/* ============================================================
   hanash theme — screen.css
   Sections: tokens · reset · base · layout · header · hero ·
   feed/cards · article · footer · components · responsive
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --color-bg: #ffffff;
  --color-text: #0f172a;       /* slate-900 */
  --color-muted: #64748b;      /* slate-500 */
  --color-border: #e2e8f0;     /* cool hairline */
  --color-accent: #4f46e5;     /* indigo */
  --color-accent-ink: #ffffff;
  --color-surface: #f8fafc;    /* slate-50 */

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --container: 1280px;
  --reading: 720px;
  --radius: 8px;
  --gap: 1px;
  --header-h: 88px;

  --step-hero: clamp(2.25rem, 1.4rem + 3.6vw, 4rem);
  --step-title: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
  --space: clamp(1.5rem, 1rem + 2vw, 3rem);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body, h1, h2, h3, h4, p, figure, blockquote, ul, ol { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
img, picture { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- base ---------- */
body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.1; }
a:hover { color: var(--color-accent); }

/* ---------- layout helpers ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 1.25rem; }
.container--narrow { width: 100%; max-width: var(--reading); margin-inline: auto; padding-inline: 1.25rem; }
.site-main { display: block; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.site-header__inner { display: flex; align-items: center; gap: 1rem; min-height: var(--header-h); }
.site-logo { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-size: 1.25rem; }
.site-logo__img { width: 72px; height: 72px; object-fit: contain; }
.site-logo__name { font-weight: 600; }

.nav__list { display: flex; gap: 1.25rem; }
.nav__link { color: var(--color-muted); font-weight: 500; font-size: .95rem; }
.nav__item--current .nav__link, .nav__link:hover { color: var(--color-text); }

.site-nav { display: flex; align-items: center; gap: 1.5rem; margin-left: auto; }
.site-actions { display: flex; align-items: center; gap: .5rem; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; padding: .5rem; margin-left: auto; }
.nav-toggle span { width: 22px; height: 2px; background: var(--color-text); transition: transform .2s, opacity .2s; }
.nav-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-active span:nth-child(2) { opacity: 0; }
.nav-toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; padding: .5rem .9rem; border-radius: var(--radius); font-weight: 500; font-size: .9rem; border: 1px solid transparent; }
.btn--accent { background: var(--color-accent); color: var(--color-accent-ink); }
.btn--accent:hover { color: var(--color-accent-ink); filter: brightness(1.08); }
.btn--ghost { color: var(--color-text); }
.btn--ghost:hover { color: var(--color-accent); }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--radius); border: 1px solid var(--color-border); color: var(--color-text); background: var(--color-bg); }
.btn-icon:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--color-border); margin-top: var(--space); background: var(--color-surface); }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; justify-content: space-between; padding-block: 2.5rem; }
.site-footer__brand { display: flex; align-items: center; gap: .75rem; color: var(--color-muted); max-width: 28rem; }
.site-footer__brand img { object-fit: contain; }
.site-footer__nav .nav__list { gap: 1rem; }
.site-footer__copy { color: var(--color-muted); font-size: .85rem; width: 100%; }

/* ---------- hero ---------- */
.hero__inner {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding: clamp(1.5rem, 1rem + 2vw, 3rem);
  margin-block: var(--space);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background-color: var(--color-bg);
  /* "Dawn Wash" — soft tonal mesh: faint indigo pooled in corners, settling to surface */
  background-image:
    radial-gradient(120% 120% at 100% 0%, rgb(79 70 229 / 0.05) 0%, transparent 42%),
    radial-gradient(120% 120% at 0% 100%, rgb(100 116 139 / 0.05) 0%, transparent 45%),
    linear-gradient(180deg, var(--color-bg) 0%, var(--color-surface) 100%);
}
.hero__title { font-size: var(--step-hero); font-weight: 400; max-width: 14ch; }
.hero__desc { color: var(--color-muted); font-size: 1.125rem; margin-top: 1rem; max-width: 44ch; }
.hero__media img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); display: block; }
.tag-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: var(--space); }

/* ---------- feed grid (hairline gutters) ---------- */
.feed {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  background: var(--color-border);   /* shows through 1px gaps */
  border: 1px solid var(--color-border);
  margin-block: var(--space);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ---------- post card ---------- */
.post-card { position: relative; display: flex; flex-direction: column; gap: 1rem; background: var(--color-bg); padding: 1.5rem; transition: background .2s; }
.post-card:hover { background: var(--color-surface); }
.post-card__link { display: flex; flex-direction: column; gap: 1rem; }
.post-card__media { aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; background: var(--color-surface); }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; }
.post-card__title { font-size: var(--step-title); font-weight: 500; }
.post-card__excerpt { color: var(--color-muted); font-size: .95rem; }

/* ---------- tag chip ---------- */
.tag-chip {
  align-self: flex-start; display: inline-block; padding: .25rem .6rem;
  font-size: .75rem; font-weight: 500; letter-spacing: .02em; text-transform: uppercase;
  color: var(--color-muted); border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-bg);
  position: relative; z-index: 1;
}
.tag-chip:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* ---------- pagination ---------- */
.pagination { display: flex; justify-content: center; gap: 1rem; align-items: center; padding-block: 1rem var(--space); color: var(--color-muted); }
.pagination a { color: var(--color-text); font-weight: 500; }
.pagination a:hover { color: var(--color-accent); }

/* ---------- article ---------- */
.article { padding-top: var(--space); }
.article__header { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.article__title { font-size: var(--step-hero); font-weight: 400; }
.article__lede { color: var(--color-muted); font-size: 1.2rem; max-width: 40ch; }
.article__meta { display: flex; align-items: center; gap: .75rem; color: var(--color-muted); font-size: .9rem; flex-wrap: wrap; justify-content: center; }
.avatar { border-radius: 999px; }
.article__author { color: var(--color-text); font-weight: 500; }
.article__feature { margin-block: var(--space); }
.article__feature img { width: 100%; border-radius: var(--radius); }
.article__feature figcaption { text-align: center; color: var(--color-muted); font-size: .85rem; margin-top: .5rem; }

/* ---------- prose (post content) ---------- */
.article__body { font-size: 1.125rem; line-height: 1.75; }
.article__body > * + * { margin-top: 1.4em; }
.article__body h2 { font-size: 1.75rem; margin-top: 2em; }
.article__body h3 { font-size: 1.375rem; margin-top: 1.6em; }
.article__body a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; }
.article__body img, .article__body video { border-radius: var(--radius); }
.article__body blockquote { border-left: 3px solid var(--color-accent); padding-left: 1.25rem; color: var(--color-muted); font-style: italic; }
.article__body pre { background: var(--color-text); color: #f8fafc; padding: 1rem 1.25rem; border-radius: var(--radius); overflow-x: auto; font-size: .9rem; }
.article__body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.article__body :not(pre) > code { background: var(--color-surface); padding: .1em .35em; border-radius: 4px; }
.article__body figcaption { text-align: center; color: var(--color-muted); font-size: .85rem; }

/* ---------- Koenig card widths (wide / full breakout) ---------- */
.article__body :is(.kg-card, figure) { margin-block: 1.5rem; }
.article__body .kg-width-wide,
.article__body .kg-width-full { position: relative; left: 50%; transform: translateX(-50%); }
.article__body .kg-width-wide { width: min(1040px, 92vw); }
.article__body .kg-width-full { width: 100vw; }
.article__body .kg-width-full img { width: 100%; border-radius: 0; }

/* ---------- article footer + comments + related ---------- */
.article__footer { padding-block: var(--space); border-top: 1px solid var(--color-border); margin-top: var(--space); }
.article__tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.article__comments { padding-block: var(--space); }
.related { padding-block: var(--space); border-top: 1px solid var(--color-border); }
.related .feed { margin-block: 0; }
.related__title { font-size: 1.5rem; margin-bottom: 1.25rem; }

/* ---------- archive header ---------- */
.archive-head { border-bottom: 1px solid var(--color-border); }
.archive-head__inner { padding-block: var(--space); display: flex; flex-direction: column; gap: .5rem; }
.archive-head__kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--color-accent); font-weight: 600; }
.archive-head__title { font-size: var(--step-hero); font-weight: 400; }
.archive-head__desc { color: var(--color-muted); font-size: 1.125rem; max-width: 52ch; }
.archive-head__count { color: var(--color-muted); font-size: .9rem; }
.archive-head__avatar { margin-bottom: .5rem; }

/* ---------- error ---------- */
.error { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; text-align: center; }
.error__code { font-family: var(--font-display); font-size: clamp(4rem, 10vw, 8rem); color: var(--color-accent); line-height: 1; }
.error__title { font-size: var(--step-title); font-weight: 400; }

/* ---------- newsletter CTA ---------- */
.newsletter { border-block: 1px solid var(--color-border); background: var(--color-surface); }
.newsletter__inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .75rem; padding-block: var(--space); }
.newsletter__logo { object-fit: contain; }
.newsletter__title { font-size: var(--step-title); font-weight: 400; }
.newsletter__desc { color: var(--color-muted); max-width: 44ch; }
.newsletter__btn { margin-top: .5rem; }

/* ============================================================
   responsive — mobile-first; overrides for sm (>=640) and lg (>=1024)
   ============================================================ */

/* Phones: stack the hero (text over image) */
@media (max-width: 640px) {
  .hero__inner { grid-template-columns: 1fr; }
}

/* Mobile: nav collapses into a drawer */
@media (max-width: 1023px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    z-index: 39;   /* below the sticky header (z-40), above page content */
    flex-direction: column; align-items: flex-start; gap: 1rem;
    background: var(--color-bg); border-bottom: 1px solid var(--color-border);
    padding: 1.25rem; margin-left: 0;
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s;
  }
  .site-nav.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav__list { flex-direction: column; gap: .75rem; }
  .site-actions { width: 100%; }
  .site-footer__inner { flex-direction: column; align-items: flex-start; }
}

/* sm: 2-column feed */
@media (min-width: 640px) {
  .feed { grid-template-columns: 1fr 1fr; }
}

/* lg: 3-column feed; full inline nav */
@media (min-width: 1024px) {
  .feed { grid-template-columns: repeat(3, 1fr); }
}
