/* =========================================================
   AI Field Notes — design system (shared by all pages)
   Fonts, tokens, reset, primitives, topbar, footer, buttons,
   forms, hero, CTA. Per-page styles live in home.css,
   feed.css, about.css, admin.css.
   ========================================================= */

/* ---- Self-hosted fonts ---- */
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-serif-regular.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-serif-regular-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-serif-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-serif-italic-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/InterVariable.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/InterVariable-Italic.woff2') format('woff2');
}

:root {
  /* ---- Colour ---- */
  --bg:        #f7f3ea;
  --bg-2:      #efe8d7;
  --bg-inset:  #ece4d0;
  --ink:       #151412;
  --ink-2:     #3a3732;
  --ink-3:     #6b655c;
  --ink-4:     #9e978c;
  --rule:      #d8cfbe;
  --rule-2:    #e6ddc8;
  --accent:    #b04530;
  --accent-2:  #8d3724;
  --accent-wash: rgba(176, 69, 48, 0.08);

  /* ---- Type families ---- */
  --ff-serif: 'Instrument Serif', 'Times New Roman', Georgia, serif;
  --ff-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* ---- Type scale (5 steps + meta) ---- */
  --fs-display-xl: clamp(44px, 7vw, 84px);
  --fs-display-l:  clamp(34px, 4.6vw, 52px);
  --fs-display-m:  clamp(22px, 2.6vw, 30px);
  --fs-lead:       18px;
  --fs-body:       16px;
  --fs-meta:       12px;

  /* ---- Space scale ---- */
  --sp-1: 6px;
  --sp-2: 12px;
  --sp-3: 18px;
  --sp-4: 24px;
  --sp-5: 36px;
  --sp-6: 56px;
  --sp-7: 88px;
  --sp-8: 128px;

  /* ---- Structure ---- */
  --wrap: 1120px;
  --measure: 680px;
  --measure-wide: 820px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-pill: 999px;
  --t: 180ms ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
ol, ul { list-style: none; }
p { margin: 0; }

body {
  font-family: var(--ff-sans);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
  background: var(--bg);
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--ink); color: var(--bg); }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--t), text-decoration-color var(--t);
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.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;
}

/* =========================================================
   Layout primitives
   ========================================================= */
.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 32px;
}
.measure { max-width: var(--measure); }
.measure-wide { max-width: var(--measure-wide); }

/* =========================================================
   Typography primitives
   ========================================================= */
.meta {
  font-family: var(--ff-sans);
  font-size: var(--fs-meta);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: var(--measure);
}

.display-xl,
.display-l,
.display-m {
  font-family: var(--ff-serif);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.display-xl { font-size: var(--fs-display-xl); line-height: 0.98; letter-spacing: -0.025em; }
.display-l  { font-size: var(--fs-display-l);  line-height: 1.04; }
.display-m  { font-size: var(--fs-display-m);  line-height: 1.22; letter-spacing: -0.01em; }

.display-xl em,
.display-l em,
.display-m em {
  font-style: italic;
  color: var(--accent);
}

/* =========================================================
   Topbar
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 243, 234, 0.86);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 18px;
  padding-bottom: 18px;
  flex-wrap: wrap;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}
.wordmark em { font-style: italic; color: var(--accent); }
.wordmark:hover { color: var(--accent); }
.wordmark-mark {
  width: 22px;
  height: 22px;
  flex: none;
  display: block;
}
.wordmark-text {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}
.wordmark-title {
  font-family: var(--ff-serif);
  font-size: 22px;
  letter-spacing: -0.005em;
  line-height: 1;
}
.wordmark-by {
  font-family: var(--ff-sans);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  line-height: 1;
  transition: color var(--t);
}
.wordmark:hover .wordmark-by { color: var(--ink-3); }

.topnav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.topnav a:not(.btn) {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: color var(--t);
}
.topnav a:not(.btn):hover { color: var(--ink); }
.topnav a:not(.btn).is-active {
  color: var(--ink);
  position: relative;
}
.topnav a:not(.btn).is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: var(--ink);
}
.digest-count {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  margin-left: 2px;
}
.topnav a:not(.btn):hover .digest-count { color: var(--ink-2); }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background var(--t), color var(--t), border-color var(--t), transform var(--t);
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn-ghost:hover {
  border-color: var(--ink);
  color: var(--ink);
  text-decoration: none;
}
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* =========================================================
   Subscribe form
   ========================================================= */
.form-subscribe {
  display: flex;
  gap: 8px;
  max-width: 460px;
  margin-top: 0;
}
.form-subscribe input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 13px 18px;
  background: var(--bg);
  border: 1px solid var(--ink);
  border-radius: var(--radius-pill);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  transition: border-color var(--t), box-shadow var(--t);
}
.form-subscribe input[type="email"]::placeholder { color: var(--ink-4); }
.form-subscribe input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176, 69, 48, 0.15);
}
.form-subscribe button {
  padding: 13px 24px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  transition: background var(--t), border-color var(--t);
  white-space: nowrap;
}
.form-subscribe button:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.trust-line {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-3);
}
.trust-line a { color: var(--ink); }

/* =========================================================
   Hero (home + about)
   ========================================================= */
.hero { padding: 96px 0 84px; }
.hero-inner { max-width: var(--measure-wide); }
.hero .dateline { margin-bottom: 28px; }
.hero h1 { margin: 0; }
.hero .lead { margin-top: 28px; }
.hero .form-subscribe { margin-top: 36px; }
.hero .trust-line { margin-top: 16px; }

.dateline {
  font-family: var(--ff-sans);
  font-size: var(--fs-meta);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.dateline::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}

/* =========================================================
   Final CTA panel (home + about)
   ========================================================= */
.final-cta {
  margin-top: 64px;
  padding: 96px 0 112px;
  border-top: 1px solid var(--rule);
  background: var(--bg-2);
}
.final-cta-inner {
  max-width: 680px;
}
.final-cta .meta { margin-bottom: 20px; }
.final-cta h2 { margin: 0; }
.final-cta p.sub {
  margin-top: 18px;
  color: var(--ink-2);
  font-size: var(--fs-lead);
  line-height: 1.55;
  max-width: 560px;
}
.final-cta .form-subscribe { margin-top: 32px; }
.final-cta .trust-line { margin-top: 16px; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--bg);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 32px;
  flex-wrap: wrap;
  max-width: var(--wrap);
  margin: 0 auto;
}
.footer-copy {
  font-size: 13px;
  color: var(--ink-3);
}
.footer-nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.footer-nav a {
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
}
.footer-nav a:hover { color: var(--accent); }

/* =========================================================
   Responsive (shared)
   ========================================================= */
@media (max-width: 820px) {
  .wrap { padding: 0 22px; }
  .footer-inner { padding: 24px 22px; }

  .topbar-inner { padding-top: 14px; padding-bottom: 14px; gap: 16px; }
  .topnav { gap: 18px; }

  .hero { padding: 72px 0 64px; }

  .final-cta { padding: 72px 0 80px; }

  .form-subscribe { flex-direction: column; max-width: 100%; }
  .form-subscribe button { width: 100%; }
}

@media (max-width: 560px) {
  .topnav a:not(.btn) { display: none; }
  .topnav a.btn { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
