/* ============================================================
   Weaver Studio — main.css
   Tokens and rules per design/SYSTEM.md v1.0
   ============================================================ */

/* ---------- Fonts (self-hosted) ---------- */
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* color */
  --paper: #FAF7F2;
  --paper-deep: #F1EBE0;
  --ink: #1C1917;
  --ink-soft: #4A443D;
  --gold: #C08A1E;
  --gold-deep: #8A6210;
  --reed: #44543A;
  --clay-red: #A8402F;

  /* type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-text: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --fs-xs: 0.75rem;
  --fs-s: 0.889rem;
  --fs-base: 1.125rem;
  --fs-m: clamp(1.25rem, 1.1rem + 0.6vw, 1.406rem);
  --fs-l: clamp(1.45rem, 1.2rem + 1vw, 1.758rem);
  --fs-xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.197rem);
  --fs-2xl: clamp(2.1rem, 1.6rem + 2.4vw, 2.747rem);
  --fs-3xl: clamp(2.4rem, 1.8rem + 3.2vw, 3.433rem);
  --fs-4xl: clamp(2.75rem, 1.9rem + 4.6vw, 4.5rem);

  /* spacing (4px base) */
  --sp-1: 4px;  --sp-2: 8px;   --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px;  --sp-7: 48px; --sp-8: 64px;
  --sp-9: 96px; --sp-10: 128px;

  /* misc */
  --radius: 2px;
  --container: 1200px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-text);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; display: block; }

/* ---------- Typography ---------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-l); letter-spacing: -0.01em; }

p { max-width: 65ch; }

.lead {
  font-size: var(--fs-m);
  line-height: 1.5;
  color: var(--ink-soft);
}

.eyebrow {
  font-size: var(--fs-s);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
  display: block;
  margin-bottom: var(--sp-4);
}

a { color: var(--gold-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color 180ms var(--ease); }
a:hover { color: var(--ink); }

::selection { background: var(--gold); color: var(--ink); }

/* ---------- Layout ---------- */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
@media (min-width: 768px) { .container { padding-inline: var(--sp-7); } }

.section { padding-block: 56px; }
@media (min-width: 768px)  { .section { padding-block: var(--sp-9); } }
@media (min-width: 1100px) { .section { padding-block: var(--sp-10); } }

.section-head { margin-bottom: var(--sp-7); }
.section-head p { margin-top: var(--sp-4); }

/* ---------- Utilities ---------- */
.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;
}

/* ---------- Skip link & focus ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: var(--sp-3) var(--sp-5); z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 3px; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--paper-deep);
}
.nav-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: var(--sp-4);
}
.brand {
  display: flex; align-items: center; gap: var(--sp-3);
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.25rem; color: var(--ink); text-decoration: none; min-height: 44px;
}
.brand svg { width: 28px; height: 28px; }

.nav-links { display: flex; gap: var(--sp-6); list-style: none; align-items: center; }
.nav-links a {
  font-size: var(--fs-s); font-weight: 500; color: var(--ink);
  text-decoration: none; padding-block: var(--sp-2);
  border-bottom: 2px solid transparent;
  transition: border-color 180ms var(--ease);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { border-bottom-color: var(--gold); }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--ink);
  border-radius: var(--radius); padding: var(--sp-2) var(--sp-3);
  font: inherit; font-size: var(--fs-s); font-weight: 500; color: var(--ink);
  cursor: pointer; min-height: 44px; min-width: 64px;
}

@media (max-width: 767px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--paper);
    border-bottom: 1px solid var(--paper-deep); padding: var(--sp-4) var(--sp-5) var(--sp-6);
  }
  .nav-links.open { display: flex; align-items: flex-start; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding-block: var(--sp-3); font-size: var(--fs-base); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font-weight: 600; font-size: var(--fs-s);
  padding: var(--sp-4) var(--sp-6); border-radius: var(--radius);
  text-decoration: none; border: 1px solid transparent;
  transition: transform 180ms var(--ease), background 180ms var(--ease), color 180ms var(--ease);
}
.btn:hover { transform: translateY(-2px); }

.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: var(--gold-deep); color: var(--paper); }

.btn-ghost { border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

.btn-row { display: flex; gap: var(--sp-4); flex-wrap: wrap; margin-top: var(--sp-6); }

/* ---------- Hero ---------- */
.hero { padding-block: var(--sp-8) 56px; }
@media (min-width: 768px)  { .hero { padding-block: var(--sp-9); } }
@media (min-width: 1100px) { .hero { padding-block: 152px var(--sp-10); } }

.hero h1 { max-width: 15ch; }
.hero .lead { margin-top: var(--sp-5); max-width: 46ch; }

.hero-accent { color: var(--gold-deep); font-style: italic; }

/* The living hero: two canvases (the wall, the weaver and her rain) behind the copy; the nest is built in
   the .stage cell. Lines carry data-at and are revealed by stencil-page.js as she completes each loop;
   without JavaScript they are simply visible (hidden only under html.anim-ready, like .reveal). */
.hero-live { position: relative; isolation: isolate; overflow: hidden; }
.hero-live canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#wall { z-index: 0; } #c { z-index: 1; }
.hero-grid { position: relative; z-index: 2; display: grid; gap: var(--sp-6); }
.hero-live .stage { position: relative; min-height: 40svh; order: -1; }
@media (min-width: 960px) {
  .hero-grid { grid-template-columns: 1.05fr 1fr; align-items: center; min-height: calc(100svh - 72px); }
  .hero-live .stage { min-height: 64vh; order: 0; }
}
.hero-line { display: block; }
.anim-ready .hero-line { opacity: 0; transform: translateY(24px); transition: opacity 280ms var(--ease), transform 280ms var(--ease); }
.anim-ready .hero-line.in { opacity: 1; transform: none; }
.hero-hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 2; margin: 0; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); opacity: .7; display: none; }
@media (min-width: 960px) and (hover: hover) { .hero-hint { display: block; } }
@media (prefers-reduced-motion: reduce) { .anim-ready .hero-line { opacity: 1; transform: none; transition: none; } }

/* ---------- Weave motif ---------- */
.weave-rule { margin-block: var(--sp-7) 0; color: var(--gold); }
.weave-rule svg { width: 160px; height: 12px; }

/* ---------- Prose (privacy, terms) ---------- */
.prose { max-width: 68ch; }
.prose h2 { font-size: var(--fs-l, 1.5rem); margin-top: var(--sp-7); }
.prose p { margin-top: var(--sp-3); }
.prose .meta { font-size: var(--fs-s); color: var(--ink-soft); margin-top: var(--sp-6); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: var(--sp-5); }
@media (min-width: 768px)  { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--paper); border: 1px solid var(--paper-deep);
  border-radius: var(--radius); padding: var(--sp-6);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.card h3 { margin-bottom: var(--sp-1); }
.card .meta { font-size: var(--fs-s); color: var(--ink-soft); }

/* Work cards */
.work-card {
  border: 1px solid var(--paper-deep); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease);
}
.work-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(28, 25, 23, 0.08); }
.work-card .thumb { aspect-ratio: 16/10; width: 100%; }
.work-card .thumb svg { width: 100%; height: 100%; }
.work-card .body { padding: var(--sp-5) var(--sp-5) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-2); }
.work-card .claim { font-family: var(--font-display); font-size: var(--fs-l); line-height: 1.15; }

.tags { display: flex; gap: var(--sp-2); flex-wrap: wrap; list-style: none; margin-top: var(--sp-2); }
.tags li {
  font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--paper-deep); border-radius: 999px; padding: 3px 10px; color: var(--ink-soft);
}
.tag-concept { background: var(--reed); border-color: var(--reed) !important; color: var(--paper) !important; }

/* ---------- Pricing ---------- */
.price-card { border: 1px solid var(--paper-deep); border-radius: var(--radius); padding: var(--sp-6); }
.price-card.featured { border-color: var(--gold); border-width: 2px; }
.price {
  font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 600;
  margin-block: var(--sp-3);
}
.price small { font-family: var(--font-text); font-size: var(--fs-s); font-weight: 400; color: var(--ink-soft); }
.check-list { list-style: none; margin-top: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.check-list li { padding-left: var(--sp-5); position: relative; font-size: var(--fs-s); }
.check-list li::before {
  content: ''; position: absolute; left: 0; top: 0.45em;
  width: 10px; height: 6px; border-left: 2px solid var(--reed); border-bottom: 2px solid var(--reed);
  transform: rotate(-45deg);
}

/* Change-pricing table */
.table-wrap { overflow-x: auto; }
table.pricing { border-collapse: collapse; width: 100%; font-size: var(--fs-s); }
table.pricing th, table.pricing td { text-align: left; padding: var(--sp-4); border-bottom: 1px solid var(--paper-deep); }
table.pricing th { font-weight: 600; font-size: var(--fs-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
table.pricing td.amount { font-weight: 600; white-space: nowrap; }

/* ---------- Process steps ---------- */
.steps { list-style: none; counter-reset: step; display: flex; flex-direction: column; }
.steps li {
  counter-increment: step; position: relative;
  padding: var(--sp-6) 0 var(--sp-6) 72px; border-top: 1px solid var(--paper-deep);
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: var(--sp-6);
  font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 600; color: var(--gold);
  line-height: 1;
}
.steps h3 { margin-bottom: var(--sp-2); }
.steps p { color: var(--ink-soft); }

/* ---------- Ink panel (dark sections) ---------- */
.panel-ink { background: var(--ink); color: var(--paper); }
.panel-ink .eyebrow { color: var(--gold); }
.panel-ink .lead, .panel-ink p { color: #CFC9C0; }
.panel-ink a { color: var(--gold); }
.panel-ink a:hover { color: var(--paper); }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: var(--sp-5); max-width: 640px; }
label { font-size: var(--fs-s); font-weight: 600; display: block; margin-bottom: var(--sp-2); }
input, textarea, select {
  width: 100%; font: inherit; font-size: var(--fs-base);
  padding: var(--sp-3) var(--sp-4); color: var(--ink);
  background: #fff; border: 1px solid #D8D0C2; border-radius: var(--radius);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--gold-deep); outline-offset: 1px; border-color: transparent; }
.form-note { font-size: var(--fs-s); color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--paper); padding-block: var(--sp-8) var(--sp-6); }
.footer-grid { display: grid; gap: var(--sp-6); }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h2 { font-size: var(--fs-xl); max-width: 18ch; }
.site-footer nav ul { list-style: none; display: flex; flex-direction: column; gap: var(--sp-3); }
.site-footer a { color: var(--paper); text-decoration: none; }
.site-footer a:hover { color: var(--gold); }
.footer-meta {
  margin-top: var(--sp-7); padding-top: var(--sp-5);
  border-top: 1px solid #3A342E;
  display: flex; flex-wrap: wrap; gap: var(--sp-4); justify-content: space-between;
  font-size: var(--fs-s); color: #A79E92;
}
.footer-label { font-size: var(--fs-xs); letter-spacing: 0.12em; text-transform: uppercase; color: #A79E92; margin-bottom: var(--sp-3); }

/* ---------- Reveal (signature interaction) ----------
   Hidden state applies only under .anim-ready, which JS sets strictly
   when IntersectionObserver is live — content can never be stranded
   invisible. A JS failsafe also forces .in after 2s. */
.anim-ready .reveal { opacity: 0; transform: translateY(24px); }
.anim-ready .reveal.in {
  opacity: 1; transform: none;
  transition: opacity 280ms var(--ease), transform 280ms var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .anim-ready .reveal { opacity: 1; transform: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Spacing & layout utilities (declared last: they win ties) ---------- */
.pt-0 { padding-top: 0; }
.pb-0 { padding-bottom: 0; }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.max-760 { max-width: 760px; }
.container-narrow { max-width: 860px; }
.section-tinted { background: var(--paper-deep); border-block: 1px solid #E7DFD1; }
.bg-paper { background: var(--paper); }
.price-s { font-size: var(--fs-xl); }
.label-soft { font-weight: 400; color: var(--ink-soft); }
.work-card-static { pointer-events: none; max-width: 760px; }
button.btn { border: none; cursor: pointer; }
.site-footer ul { list-style: none; }
.footer-muted { margin-top: var(--sp-3); color: #A79E92; }
table.pricing caption { text-align: left; padding-bottom: var(--sp-3); }
