/* ==========================================================================
   theme.css — Get Closer (getcloseronline)
   Paint layer only. Colors, fonts, accent flourishes.
   Layout structure comes from layout.css (loaded after this file).
   Palette (DS-2): #FAF7F4, #1C1917, #D4622A, #7C9E8F
   Scheme: light (DS-1)
   ========================================================================== */

/* --- Google Fonts -------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=Source+Sans+3:wght@300;400;500&display=swap');

/* --- Color + font variable contract -------------------------------------- */
:root {
  /* Palette */
  --color-bg:      #FAF7F4;  /* Parchment — page background */
  --color-text:    #1C1917;  /* Espresso — body text, headings */
  --color-accent:  #D4622A;  /* Terracotta — links, CTAs, active nav, pull quotes */
  --color-surface: #FAF7F4;  /* Parchment — card fills (same surface, slight separation via border) */
  --color-border:  #7C9E8F;  /* Sage — hairlines, card edges, dividers */

  /* Font roles */
  --font-sans:  'Source Sans 3', sans-serif;
  --font-serif: 'Lora', Georgia, serif;
}

/* --- Base document paint ------------------------------------------------- */
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
}

/* Page wrapper — light scheme */
.page {
  background: var(--color-bg);
  color: var(--color-text);
}

/* --- Typography paint ---------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--color-text);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover,
a:focus-visible {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.2em;
}

/* --- Site header + nav --------------------------------------------------- */
.site-header {
  background: var(--color-bg);
  border-bottom: var(--border-width) solid var(--color-border);
  padding-block: var(--space-sm);
  padding-inline: var(--space-md);
}

@media (min-width: 768px) {
  .site-header {
    padding-inline: var(--space-xl);
  }
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  max-width: var(--container);
  margin-inline: auto;
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.nav-brand:hover,
.nav-brand:focus-visible {
  color: var(--color-accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

/* Pin nav typography identically on every page. layout.css (journal lib) loads
   after this file and re-styles `.nav-links`/`.nav-brand` as italic serif, but
   it is absent on the-framework.html — which made the header chrome render
   differently page-to-page. These higher-specificity rules win everywhere. */
.site-nav .nav-brand {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
}
.site-nav .nav-links,
.site-nav .nav-links a {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-style: normal;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--color-accent);
  text-decoration: none;
}

.nav-links a[aria-current="page"] {
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 2px;
}

/* --- Hero paint ---------------------------------------------------------- */
.hero {
  padding-block: var(--space-xl) var(--space-2xl);
  padding-inline: var(--space-md);
  border-bottom: var(--border-width) solid var(--color-border);
  background: var(--color-bg);
}

@media (min-width: 768px) {
  .hero {
    padding-inline: var(--space-xl);
  }
}

.hero__title {
  font-family: var(--font-serif);
  font-size: var(--text-4xl);
  line-height: var(--leading-tight);
  color: var(--color-text);
  max-width: 18ch;
}

.hero__lead {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  color: var(--color-text);
  max-width: 52ch;
  margin-top: var(--space-sm);
  line-height: var(--leading-normal);
  opacity: 0.8;
}

/* Terracotta accent rule under hero heading */
.hero__title::after {
  content: '';
  display: block;
  width: 3rem;
  height: 3px;
  background: var(--color-accent);
  margin-top: var(--space-sm);
}

/* --- Section titles ------------------------------------------------------ */
.section-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  color: var(--color-text);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--color-accent);
  display: inline-block;
  margin-bottom: var(--space-lg);
}

.articles-section {
  padding-block: var(--space-xl);
  padding-inline: var(--space-md);
}

@media (min-width: 768px) {
  .articles-section {
    padding-inline: var(--space-xl);
  }
}

/* --- Article cards ------------------------------------------------------- */
.article-card {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: border-color 0.2s ease, transform 0.2s ease;
  position: relative;
}

.article-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--color-border);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  transition: background 0.2s ease;
}

.article-card:hover {
  border-color: var(--color-accent);
}

.article-card:hover::before {
  background: var(--color-accent);
}

.article-card:hover {
  transform: translateY(-2px);
}

.article-card__title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: var(--leading-snug);
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.article-card__link {
  color: var(--color-text);
  text-decoration: none;
}

.article-card__link:hover,
.article-card__link:focus-visible {
  color: var(--color-accent);
  text-decoration: none;
}

.article-card__meta {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-border);
  margin-bottom: var(--space-xs);
}

.article-card__excerpt {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: var(--leading-normal);
  opacity: 0.75;
}

/* --- Article list (articles.html) --------------------------------------- */
.page-hero {
  padding-block: var(--space-xl);
  padding-inline: var(--space-md);
  border-bottom: var(--border-width) solid var(--color-border);
}

@media (min-width: 768px) {
  .page-hero {
    padding-inline: var(--space-xl);
  }
}

.page-title {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  color: var(--color-text);
}

/* Left-aligned editorial intent. layout.css (journal lib) centers the hero +
   page title, but theme.css is designed flush-left (left accent rules, inline
   section titles) and the-framework.html — which has no layout.css — is already
   left. These higher-specificity rules pin every page to the same flush-left
   treatment so headings align with the content/lists beneath them. */
.page .hero,
.page .page-hero { text-align: left; }
.page .hero__title,
.page .hero__lead { margin-inline: 0; }
.page .page-title,
.page .section-title { text-align: left; }

.articles-index {
  padding-block: var(--space-xl);
  padding-inline: var(--space-md);
  max-width: var(--container);
  margin-inline: auto;
}

@media (min-width: 768px) {
  .articles-index {
    padding-inline: var(--space-xl);
  }
}

.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-list__item {
  border-bottom: var(--border-width) solid var(--color-border);
  padding-block: var(--space-md);
}

.article-list__item:first-child {
  border-top: var(--border-width) solid var(--color-border);
}

.article-list__link {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  display: block;
  transition: color 0.2s ease;
}

.article-list__link:hover,
.article-list__link:focus-visible {
  color: var(--color-accent);
  text-decoration: none;
}

/* Sage accent numeral on list items */
.article-list__item::before {
  content: counter(article-counter, decimal-leading-zero);
  counter-increment: article-counter;
  display: block;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--color-border);
  margin-bottom: var(--space-3xs);
}

.article-list {
  counter-reset: article-counter;
}

/* --- Prose (article body) ------------------------------------------------ */
.prose {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5 {
  font-family: var(--font-serif);
  color: var(--color-text);
}

.prose h2 {
  border-left: 3px solid var(--color-accent);
  padding-left: var(--space-sm);
}

.prose h3 {
  color: var(--color-accent);
}

.prose a {
  color: var(--color-accent);
}

.prose a:hover {
  color: var(--color-text);
}

/* Pull-quote style for blockquote */
.prose blockquote {
  border-left: 4px solid var(--color-accent);
  margin-inline: 0;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--color-text);
}

/* --- Footer -------------------------------------------------------------- */
.site-footer {
  background: var(--color-text);
  color: var(--color-bg);
  padding-block: var(--space-lg);
  padding-inline: var(--space-md);
  margin-top: auto;
}

@media (min-width: 768px) {
  .site-footer {
    padding-inline: var(--space-xl);
  }
}

.site-footer .container {
  max-width: var(--container);
  margin-inline: auto;
}

.footer-copy {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-bg);
  opacity: 0.7;
}

/* --- Micro-interactions: cinematic reveal (DS-5) ------------------------- */
@keyframes fade-rise {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__title,
.hero__lead {
  animation: fade-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero__lead {
  animation-delay: 0.12s;
}

.article-card {
  animation: fade-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Stagger article cards */
.article-card:nth-child(2) { animation-delay: 0.06s; }
.article-card:nth-child(3) { animation-delay: 0.12s; }
.article-card:nth-child(4) { animation-delay: 0.18s; }
.article-card:nth-child(5) { animation-delay: 0.24s; }
.article-card:nth-child(6) { animation-delay: 0.30s; }

/* --- Reduced motion (DS-5) ---------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .hero__title,
  .hero__lead,
  .article-card {
    animation: none;
  }

  .article-card:hover {
    transform: none;
  }
}

/* --- Focus visible ring -------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* --- Sage accent: category / meta labels --------------------------------- */
.label,
.category {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-border);
}

/* --- Divider rule -------------------------------------------------------- */
.divider {
  border: none;
  border-top: var(--border-width) solid var(--color-border);
  margin-block: var(--space-lg);
}

/* ===== Mobile nav — minimal burger redesign + 320px hardening ===== */
.nav-toggle { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }

/* Burger button — 36×36 visible, -4px margin gives ~44px touch area */
.nav-burger {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  width: 2.25rem;
  height: 2.25rem;
  margin: -0.25rem;           /* expand tap target to ~44px without visual bloat */
  padding: 0.25rem;
  flex: 0 0 auto;
  color: var(--color-text);
  transition: color 160ms ease;
  cursor: pointer;
}
/* three bars — asymmetric widths give intentional rhythm */
.nav-burger span {
  display: block;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 220ms cubic-bezier(.4,0,.2,1),
              opacity   160ms ease,
              width     220ms cubic-bezier(.4,0,.2,1);
}
.nav-burger span:nth-child(1) { width: 20px; }
.nav-burger span:nth-child(2) { width: 12px; }   /* shorter middle = visual accent */
.nav-burger span:nth-child(3) { width: 20px; }

.nav-burger:hover { color: var(--color-accent); }
.nav-toggle:focus-visible ~ .nav-burger { outline: 2px solid var(--color-accent); outline-offset: 4px; border-radius: var(--radius-sm); }

@media (max-width: 767px) {
  /* tighter header on mobile */
  .site-nav { flex-wrap: wrap; gap: var(--space-xs); padding-block: var(--space-xs); }
  .nav-brand { flex: 1 1 0; min-width: 0; }
  .nav-burger { display: flex; }

  /* beat layout.css `.nav-links{display:flex}` (loads after theme.css) */
  .site-nav .nav-links { flex-basis: 100%; width: 100%; display: none; }
  .nav-toggle:checked ~ .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-block: var(--space-2xs);
    border-top: var(--border-width) solid var(--color-border, currentColor);
    margin-top: var(--space-3xs);
  }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; width: 100%; padding-block: var(--space-xs); }
  /* on mobile the block-level link makes border-bottom full-width — use color only */
  .nav-links a[aria-current="page"] { border-bottom: none; padding-bottom: var(--space-xs); }

  /* X state — bars equalise in width then cross */
  .nav-toggle:checked ~ .nav-burger span:nth-child(1) { width: 18px; transform: translateY(5.5px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; width: 18px; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) { width: 18px; transform: translateY(-5.5px) rotate(-45deg); }
}
@media (max-width:30rem) {
  :root {
    --text-4xl: clamp(1.7rem, 1.1rem + 4.5vw, 2.75rem);
    --text-3xl: clamp(1.5rem, 1rem + 3.2vw, 2.25rem);
    --text-2xl: clamp(1.3rem, 0.95rem + 2.2vw, 1.95rem);
    --text-xl:  clamp(1.2rem, 0.95rem + 1.4vw, 1.563rem);
  }
  h1, h2, h3, h4 { hyphens:auto; -webkit-hyphens:auto; }
}
