/* ============================================================
   Whimbytes — base stylesheet
   Warm, editorial, cream & ink. No frameworks.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Surfaces */
  --paper:      #f5f0e5;
  --paper-warm: #efe8d9;
  --paper-card: #fbf8f1;
  --ink:        #1b1a16;

  /* Text */
  --ink-soft:   #443e34;
  --ink-mute:   #6a6252;
  --ink-faint:  #8d8372;

  /* Lines */
  --rule:        rgba(27, 26, 22, 0.13);
  --rule-strong: rgba(27, 26, 22, 0.30);

  /* Accents */
  --accent:      #b0451d;   /* terracotta */
  --accent-ink:  #8f3514;
  --green:       #2f4739;   /* deep pine */

  /* Type */
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --read:  "Newsreader", "Iowan Old Style", Georgia, Cambria, serif;
  --sans:  "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Layout */
  --wrap: 1120px;
  --measure: 62ch;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 4px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--read);
  font-size: clamp(1.0625rem, 0.6vw + 0.95rem, 1.1875rem);
  line-height: 1.68;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Subtle paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}

body > * { position: relative; z-index: 1; }

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

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: var(--paper-card); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
  font-variation-settings: "SOFT" 0, "WONK" 1, "opsz" 100;
}

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; color: var(--ink); }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.eyebrow::before {
  content: "";
  width: 2.6rem;
  height: 1px;
  background: var(--rule-strong);
  flex: none;
}

.display {
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 400;
}
.display em {
  font-style: italic;
  font-variation-settings: "SOFT" 60, "WONK" 1, "opsz" 144;
  color: var(--accent-ink);
}

.h2 {
  font-size: clamp(1.85rem, 3.6vw, 2.85rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
}

.h3 {
  font-size: clamp(1.25rem, 1.6vw, 1.5rem);
  line-height: 1.2;
}

.lede {
  font-size: clamp(1.2rem, 1.5vw, 1.45rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: var(--measure);
}

.muted { color: var(--ink-mute); }

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(3.5rem, 8vw, 7rem); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }

.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--rule);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--serif);
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 40;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  background: var(--ink);
  color: var(--paper-card);
  border-radius: 3px;
  font-size: 1rem;
  font-weight: 600;
  font-style: italic;
  font-variation-settings: "SOFT" 30, "opsz" 20;
  padding-bottom: 0.08em;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1.1rem, 2.5vw, 2.2rem);
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 500;
}
.nav a { color: var(--ink-soft); transition: color 0.2s var(--ease); }
.nav a:hover, .nav a:focus-visible { color: var(--ink); }
.nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent);
}

.nav-cta {
  font-family: var(--sans);
  font-weight: 600;
  color: var(--ink) !important;
  border: 1px solid color-mix(in srgb, var(--ink) 42%, transparent);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.nav-cta:hover, .nav-cta:focus-visible {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper-card) !important;
}

.nav-toggle {
  display: none;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  background: none;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--ink);
  padding: 0.45rem 0.95rem;
  cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn--solid { background: var(--ink); color: var(--paper-card); }
.btn--solid:hover, .btn--solid:focus-visible { background: var(--accent-ink); }

.btn--ghost { border-color: var(--rule-strong); color: var(--ink); }
.btn--ghost:hover, .btn--ghost:focus-visible { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }

.btn .arrow { transition: transform 0.25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: center; }
@media (max-width: 540px) {
  .btn-row .btn { flex: 1 1 100%; justify-content: center; }
}

.text-link {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent-ink);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  padding-bottom: 1px;
  transition: border-color 0.2s var(--ease);
}
.text-link:hover { border-bottom-color: var(--accent); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3.5rem, 9vw, 7.5rem) clamp(3rem, 6vw, 5rem); }
.hero .display { max-width: 16ch; }
.hero .lede { margin-top: 1.9rem; }
.hero .btn-row { margin-top: 2.4rem; }

.hero-meta {
  margin-top: 2.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--ink-mute);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.6rem;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 0.5rem; }
.hero-meta .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* ---------- Statement block ---------- */
.statement { max-width: 30ch; }
.statement .h2 { font-weight: 400; }
.statement .h2 em { font-style: italic; color: var(--green); }

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
}
@media (min-width: 860px) {
  .split { grid-template-columns: 0.85fr 1.15fr; align-items: start; }
}

.prose { max-width: var(--measure); color: var(--ink-soft); }
.prose p { margin-bottom: 1.2em; }
.prose .dropcap::first-letter {
  font-family: var(--serif);
  font-size: 3.6em;
  line-height: 0.72;
  float: left;
  padding: 0.08em 0.12em 0 0;
  color: var(--accent-ink);
  font-variation-settings: "SOFT" 40, "WONK" 1, "opsz" 144;
}

/* ---------- Cards / principles ---------- */
.grid-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--rule);
}
@media (min-width: 720px) {
  .grid-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1020px) {
  .grid-cards { grid-template-columns: repeat(4, 1fr); }
}

.card {
  padding: clamp(1.6rem, 2.5vw, 2.2rem) clamp(1.2rem, 2vw, 1.8rem) clamp(1.8rem, 3vw, 2.6rem);
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  position: relative;
  transition: background 0.3s var(--ease);
}
@media (min-width: 720px) and (max-width: 1019px) {
  .card:nth-child(2n) { border-right: 0; }
}
@media (min-width: 1020px) {
  .card:last-child { border-right: 0; }
  .card { border-bottom: 0; }
}
.card:hover { background: color-mix(in srgb, var(--paper-card) 70%, transparent); }

.card-num {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 2.4rem;
}
.card .h3 { margin-bottom: 0.7rem; }
.card p { color: var(--ink-soft); font-size: 0.98rem; line-height: 1.62; }

/* ---------- Themes / what we're working on ---------- */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--rule);
}
@media (min-width: 900px) {
  .theme-grid { grid-template-columns: repeat(3, 1fr); }
}
.theme {
  padding: clamp(1.8rem, 3vw, 2.6rem) clamp(1.2rem, 2vw, 2rem) clamp(2rem, 3.5vw, 3rem);
  border-bottom: 1px solid var(--rule);
  position: relative;
  transition: background 0.3s var(--ease);
}
@media (min-width: 900px) {
  .theme { border-bottom: 0; border-right: 1px solid var(--rule); }
  .theme:last-child { border-right: 0; }
}
.theme:hover { background: color-mix(in srgb, var(--paper-card) 70%, transparent); }
.theme-num {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 1.6rem;
}
.theme-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 0.9rem;
}
.theme .h3 { margin-bottom: 0.9rem; }
.theme p { color: var(--ink-soft); font-size: 0.98rem; line-height: 1.62; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.7rem;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Feature / note block ---------- */
.note {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper-card) 60%, transparent);
  padding: clamp(1.6rem, 4vw, 3rem);
  display: grid;
  gap: 1.2rem;
}
@media (min-width: 800px) {
  .note { grid-template-columns: 1fr auto; align-items: end; gap: 2.5rem; }
}

/* ---------- CTA band ---------- */
.cta-band {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-warm);
}

/* ---------- Page hero (subpages) ---------- */
.page-hero { padding-block: clamp(3rem, 7vw, 5.5rem) clamp(2rem, 4vw, 3rem); }
.page-hero .display { font-size: clamp(2.2rem, 5.5vw, 4rem); max-width: 20ch; }
.page-hero .lede { margin-top: 1.6rem; }

/* ---------- Belief / list ---------- */
.ruled-list { border-top: 1px solid var(--rule); }
.ruled-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  padding-block: clamp(1.5rem, 3vw, 2.2rem);
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 820px) {
  .ruled-item { grid-template-columns: 0.9fr 1.4fr; gap: 2.5rem; align-items: baseline; }
}
.ruled-item .h3 { font-weight: 500; }
.ruled-item p { color: var(--ink-soft); margin: 0; max-width: 60ch; }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  gap: clamp(2rem, 5vw, 4.5rem);
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .contact-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

.field { margin-bottom: 1.4rem; }
.field label {
  display: block;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.55rem;
}
.field input,
.field textarea {
  width: 100%;
  font-family: var(--read);
  font-size: 1.05rem;
  color: var(--ink);
  background: color-mix(in srgb, var(--paper-card) 70%, transparent);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0.8rem 0.95rem;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.field textarea { min-height: 9rem; resize: vertical; }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--paper-card);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--ink-mute); opacity: 1; }

.form-note { font-size: 0.85rem; color: var(--ink-mute); margin-top: 1rem; }

.contact-aside dl { margin: 0; }
.contact-aside dt {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 1.6rem;
}
.contact-aside dd { margin: 0.35rem 0 0; font-family: var(--serif); font-size: 1.15rem; }
.contact-aside a { border-bottom: 1px solid var(--rule-strong); }
.contact-aside a:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: clamp(3rem, 7vw, 6rem);
  padding-top: clamp(2.5rem, 5vw, 4rem);
  background: var(--paper-warm);
}
.footer-grid {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: 1fr;
  padding-bottom: clamp(2rem, 4vw, 3rem);
}
@media (min-width: 780px) {
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr; }
}
.footer-brand .brand { margin-bottom: 1rem; }
.footer-brand p { color: var(--ink-mute); max-width: 34ch; font-size: 0.98rem; }
.footer-col h4 {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 1rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.footer-col a { color: var(--ink-soft); font-family: var(--sans); font-size: 0.95rem; }
.footer-col a:hover { color: var(--ink); }

.footer-fine {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem;
  padding-block: 1.4rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-faint);
}

/* ---------- Entrance (CSS-only — content is never hidden from no-JS/crawlers) ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal { animation: fadeUp 0.75s var(--ease) both; }
.d1 { animation-delay: 0.07s; }
.d2 { animation-delay: 0.14s; }
.d3 { animation-delay: 0.21s; }
.d4 { animation-delay: 0.28s; }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; } }

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

/* ---------- Utility ---------- */
.stack > * + * { margin-top: 1.6rem; }
.center { text-align: center; }
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper-card);
  padding: 0.7rem 1.1rem;
  border-radius: 0 0 var(--radius) 0;
  z-index: 100;
  font-family: var(--sans);
  font-size: 0.9rem;
}
.skip-link:focus { left: 0; }

/* ---------- Mobile nav ---------- */
@media (max-width: 720px) {
  .nav-toggle { display: inline-block; }
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: 0.5rem var(--gutter) 1.25rem;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
  .nav-cta { border: 0; border-radius: 0; padding: 0.9rem 0; }
}
@media (min-width: 721px) { .nav { display: flex !important; } }
