/* PolicySoup Blog Theme
   Design DNA: shares brand tokens with policysoup.com (Space Grotesk headings,
   Lexend body, teal accent) but is a distinct editorial/light-mode experience.
   Not a dark-app clone — warm paper background, ink-on-page feel.
*/

/* ─── Google Fonts ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Lexend:wght@300;400;500;600&display=swap');

/* ─── Design Tokens ────────────────────────────────────────────────── */
:root {
  /* Backgrounds — "Dawn" warm paper palette */
  --bg-page:          #f6efe6;
  --bg-panel:         #fffdf9;
  --bg-panel-alt:     #f4ede2;
  --bg-subtle:        #efe6db;

  /* Borders */
  --border-soft:      #e6ddd3;
  --border-medium:    #d9d0c6;
  --border-strong:    #c8beb3;

  /* Ink / Text */
  --text-primary:     #0f1e28;
  --text-secondary:   #36424a;
  --text-dim:         #6b747b;

  /* Accent — teal (from PolicySoup's dark-mode primary mapped to light) */
  --accent:           #137a6b;
  --accent-hover:     #0f5f53;
  --accent-bright:    #4dd6c3;   /* neon teal echo from dark mode */
  --accent-subtle:    color-mix(in srgb, #137a6b 12%, #f6efe6);

  /* Warm accent — terracotta (mirror of PolicySoup rose/warm) */
  --accent-warm:      #d95245;
  --accent-warm-hover:#b83a30;

  /* Header — uses the dark app shell colour so the brand anchors */
  --header-bg:        #0f1616;
  --header-text:      #e6f1ef;
  --header-accent:    #4dd6c3;

  /* Footer */
  --footer-bg:        #162425;
  --footer-text:      #b7c7c6;
  --footer-link:      #4dd6c3;

  /* Typography */
  --font-sans:        'Lexend', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-heading:     'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono:        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-serif:       'Georgia', 'Times New Roman', serif;

  /* Scale */
  --radius:           10px;
  --radius-sm:        6px;
  --radius-lg:        16px;
  --max-content:      720px;
  --max-wide:         1100px;
}

/* ─── Reset / Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text-primary);
  background-color: var(--bg-page);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, video, svg { display: block; max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover {
  color: var(--accent-hover);
  text-decoration-color: var(--accent-hover);
}

/* ─── Typography ───────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1.25rem; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }
em { font-style: italic; }

/* ─── Site Header ──────────────────────────────────────────────────── */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid rgba(77, 214, 195, 0.12);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

.site-header__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.site-header__logo-mark {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--header-accent), color-mix(in srgb, var(--header-accent) 60%, #0f1616));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  color: #0f1616;
  flex-shrink: 0;
  letter-spacing: -0.03em;
}

.site-header__site-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--header-text);
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.site-header__site-name span {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--header-accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-header__nav a {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(230, 241, 239, 0.75);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.site-header__nav a:hover {
  color: var(--header-text);
  background: rgba(255, 255, 255, 0.07);
}

.site-header__nav .nav-cta {
  color: var(--header-accent);
  border: 1px solid rgba(77, 214, 195, 0.3);
  margin-left: 0.25rem;
}

.site-header__nav .nav-cta:hover {
  background: rgba(77, 214, 195, 0.1);
  border-color: rgba(77, 214, 195, 0.5);
}

/* Mobile nav toggle */
.site-header__menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--header-text);
}

/* ─── Hero / Site Intro (homepage only) ───────────────────────────── */
.site-hero {
  background: linear-gradient(135deg, #0f1616 0%, #162425 60%, #1b2c2d 100%);
  border-bottom: 1px solid rgba(77, 214, 195, 0.1);
  padding: 3.5rem 1.5rem;
  text-align: center;
}

.site-hero__inner {
  max-width: 680px;
  margin: 0 auto;
}

.site-hero__eyebrow {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4dd6c3;
  background: rgba(77, 214, 195, 0.1);
  border: 1px solid rgba(77, 214, 195, 0.25);
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  margin-bottom: 1.25rem;
}

.site-hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  color: #e6f1ef;
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
}

.site-hero__accent {
  color: #4dd6c3;
}

.site-hero p {
  font-size: 1.05rem;
  color: #b7c7c6;
  line-height: 1.7;
  margin: 0;
}

/* ─── Main Layout ──────────────────────────────────────────────────── */
.site-main {
  flex: 1;
}

.container {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.content-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 3rem;
  padding: 3rem 0;
  align-items: start;
}

.content-layout--single {
  grid-template-columns: 1fr;
  max-width: var(--max-content);
  margin: 0 auto;
}

/* ─── Post Cards (list view) ───────────────────────────────────────── */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  display: block;
  margin-bottom: 1.25rem;
}

.post-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 20px rgba(15, 30, 40, 0.1);
  transform: translateY(-1px);
  text-decoration: none;
}

.post-card__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.post-card__date {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-heading);
  font-weight: 500;
}

.post-card__tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tag-pill {
  font-size: 0.7rem;
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: var(--accent-subtle);
  color: var(--accent);
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  transition: background 0.15s, border-color 0.15s;
}

.tag-pill:hover {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-panel));
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-decoration: none;
}

.post-card__title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.post-card:hover .post-card__title {
  color: var(--accent-hover);
}

.post-card__excerpt {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__readmore {
  margin-top: 1rem;
  font-size: 0.82rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ─── Single Post ──────────────────────────────────────────────────── */
.post-header {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 2rem;
}

.post-header__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.post-header__date {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
}

.post-header__author {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
}

.post-header__author::before {
  content: "·";
  margin-right: 0.75rem;
  color: var(--border-medium);
}

.post-header h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
}

.post-header__description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.65;
  font-weight: 300;
}

/* ─── Article Body ─────────────────────────────────────────────────── */
.prose {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.prose h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-soft);
}

.prose h3 {
  font-size: 1.2rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.prose h4 {
  font-size: 1.05rem;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.prose p { margin-bottom: 1.4rem; }

.prose a {
  font-weight: 500;
}

.prose ul, .prose ol {
  margin: 0 0 1.4rem 1.5rem;
}

.prose li { margin-bottom: 0.4rem; }

.prose blockquote {
  margin: 1.75rem 0;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-panel));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.prose blockquote p { margin-bottom: 0; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-subtle);
  border: 1px solid var(--border-soft);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent-hover);
}

.prose pre {
  background: #0f1616;
  border: 1px solid rgba(77, 214, 195, 0.1);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  color: #e6f1ef;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 2.5rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.prose th {
  text-align: left;
  padding: 0.6rem 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.prose td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border-soft);
}

.prose tr:nth-child(even) td {
  background: var(--bg-panel-alt);
}

.prose img {
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  margin: 1.5rem auto;
}

/* ─── Post Footer / Tags ───────────────────────────────────────────── */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-soft);
}

.post-footer__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.post-footer__tags-label {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.25rem;
}

/* ─── Post Navigation ──────────────────────────────────────────────── */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2.5rem;
}

.post-nav__item {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.post-nav__item:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 12px rgba(15, 30, 40, 0.08);
  text-decoration: none;
}

.post-nav__direction {
  font-size: 0.72rem;
  font-family: var(--font-heading);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

.post-nav__title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.post-nav__item--next {
  text-align: right;
}

/* ─── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-widget {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.sidebar-widget__title {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-soft);
}

.sidebar-widget__body {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.sidebar-widget__body p { margin-bottom: 0.75rem; }
.sidebar-widget__body p:last-child { margin-bottom: 0; }

.sidebar-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.82rem;
  color: #fff;
  background: var(--accent);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s;
  margin-top: 0.5rem;
  width: 100%;
  justify-content: center;
}

.sidebar-cta:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.recent-post-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.recent-post-item:last-child { border-bottom: none; }

.recent-post-item a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  display: block;
  margin-bottom: 0.15rem;
  line-height: 1.35;
}
.recent-post-item a:hover { color: var(--accent); }

.recent-post-item__date {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-heading);
}

/* ─── Section Header ───────────────────────────────────────────────── */
.section-header {
  padding: 2rem 0 0;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.4rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.section-header__count {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-dim);
}

/* ─── Pagination ───────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 0;
  flex-wrap: wrap;
}

.pagination a,
.pagination .page-number {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  background: var(--bg-panel);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
  text-decoration: none;
}

.pagination .active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── 404 / Empty states ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-dim);
}

.empty-state h2 {
  font-size: 3rem;
  color: var(--border-medium);
  margin-bottom: 0.5rem;
}

/* ─── Tags Page ────────────────────────────────────────────────────── */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 2rem 0;
}

/* ─── Footer ───────────────────────────────────────────────────────── */
.site-footer {
  background: var(--footer-bg);
  border-top: 1px solid rgba(77, 214, 195, 0.08);
  padding: 2.5rem 1.5rem;
  margin-top: auto;
}

.site-footer__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
}

.site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.site-footer__brand-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--header-text);
  text-decoration: none;
}

.site-footer__brand-name:hover { color: var(--footer-link); }

.site-footer__tagline {
  font-size: 0.82rem;
  color: var(--footer-text);
  max-width: 340px;
  line-height: 1.5;
}

.site-footer__links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.site-footer__links a {
  font-size: 0.82rem;
  color: var(--footer-link);
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 500;
}

.site-footer__links a:hover {
  color: #fff;
  text-decoration: none;
}

.site-footer__bottom {
  max-width: var(--max-wide);
  margin: 1.5rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: rgba(183, 199, 198, 0.5);
  font-family: var(--font-heading);
}

/* ─── Divider ──────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-soft);
  border: none;
  margin: 2rem 0;
}

/* ─── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 800px) {
  html { font-size: 16px; }

  .content-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 0;
  }

  .sidebar {
    position: static;
    top: auto;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav__item--next { text-align: left; }

  .site-footer__inner {
    grid-template-columns: 1fr;
  }

  .site-footer__links { align-items: flex-start; }

  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
}

@media (max-width: 600px) {
  .site-header__inner { padding: 0 1rem; }
  .container { padding: 0 1rem; }
  .site-hero { padding: 2.5rem 1rem; }

  .site-header__nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--header-bg);
    flex-direction: column;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(77, 214, 195, 0.12);
    gap: 0.1rem;
  }

  .site-header__nav.is-open { display: flex; }
  .site-header__nav a { padding: 0.65rem 0.5rem; width: 100%; }

  .site-header__menu-toggle { display: flex; }
  .site-header { position: relative; }

  .post-card { padding: 1.25rem; }
  .post-header { padding: 1.5rem 0 1.25rem; }

  .post-card__title { font-size: 1.15rem; }
}

/* ─── Utility classes ──────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
