/* ============================================================
   GARROW & VOSS ROPEWALK - Hemp & Tar identity
   Palette (OKLCH): flax cream, tar brown, hemp ochre, sea slate, rust
   Type: Young Serif (display) / Manrope variable (body)
   Motion: twisted-strand rotation + laid-rope scroll progress
   ============================================================ */

/* ---------- 1. TOKENS ---------- */
:root {
  --flax-0: oklch(96.8% 0.017 86);
  --flax-1: oklch(93.5% 0.024 84);
  --flax-2: oklch(89.2% 0.033 82);
  --tar-0: oklch(22.4% 0.021 55);
  --tar-1: oklch(29.6% 0.026 56);
  --tar-2: oklch(38.5% 0.032 58);
  --ochre: oklch(64.5% 0.115 71);
  --ochre-deep: oklch(52.0% 0.102 64);
  --slate: oklch(51.5% 0.028 224);
  --slate-deep: oklch(38.2% 0.031 232);
  --rust: oklch(53.5% 0.148 34);
  --rust-deep: oklch(44.0% 0.128 33);
  --paper: var(--flax-0);
  --ink: var(--tar-0);
  --line: oklch(84% 0.028 82);
  --line-soft: oklch(90% 0.022 84);

  --font-display: 'Young Serif', Georgia, serif;
  --font-body: 'Manrope', 'Helvetica Neue', Arial, sans-serif;
  --fs-hero: clamp(2.6rem, 6.4vw, 4.6rem);
  --fs-h1: clamp(2.0rem, 4.4vw, 3.2rem);
  --fs-h2: clamp(1.45rem, 2.6vw, 2.1rem);
  --fs-h3: clamp(1.12rem, 1.7vw, 1.4rem);
  --fs-body: 1.02rem;
  --fs-small: 0.88rem;
  --fs-tiny: 0.78rem;

  --space-1: 0.35rem; --space-2: 0.7rem; --space-3: 1.1rem;
  --space-4: 1.7rem; --space-5: 2.6rem; --space-6: 4rem;
  --space-7: 6rem;

  --w-page: 72rem;
  --w-narrow: 46rem;
  --radius: 4px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --snappy: cubic-bezier(.55,.06,.68,.19);
}

[data-theme='nightwatch'] {
  --paper: oklch(19.5% 0.017 60);
  --ink: oklch(91.5% 0.02 82);
  --line: oklch(33% 0.02 60);
  --line-soft: oklch(27% 0.017 60);
  --flax-1: oklch(24% 0.02 60);
  --flax-2: oklch(28% 0.024 62);
  --ochre: oklch(71% 0.12 74);
  --slate: oklch(70% 0.035 220);
  --rust: oklch(62% 0.15 35);
}

/* ---------- 2. RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.68;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--ochre-deep); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--rust-deep); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.12; letter-spacing: .01em; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p + p { margin-top: var(--space-3); }
::selection { background: var(--ochre); color: var(--tar-0); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--tar-0); color: var(--flax-0); padding: .6rem 1rem;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--rust); outline-offset: 2px; }

.wrap { width: min(var(--w-page), calc(100% - 2.4rem)); margin-inline: auto; }
.narrow { width: min(var(--w-narrow), calc(100% - 2.4rem)); margin-inline: auto; }

/* ---------- 3. HEADER / NAV ---------- */
.masthead {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in oklab, var(--paper) 92%, transparent);
  backdrop-filter: blur(9px);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  width: min(var(--w-page), calc(100% - 2.4rem));
  margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); padding: .85rem 0;
}
.brand { display: flex; align-items: baseline; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand .mark {
  font-family: var(--font-display); font-size: 1.18rem; letter-spacing: .02em;
}
.brand .est { font-size: var(--fs-tiny); color: var(--slate); letter-spacing: .14em; text-transform: uppercase; }
.nav { display: flex; gap: 1.15rem; align-items: center; }
.nav a {
  color: var(--ink); text-decoration: none; font-size: var(--fs-small);
  font-weight: 550; position: relative; padding: .2rem 0;
}
.nav a::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--ochre); transform: scaleX(0); transform-origin: left;
  transition: transform .28s var(--ease);
}
.nav a:hover::after, .nav a[aria-current='page']::after { transform: scaleX(1); }
.nav a[aria-current='page'] { color: var(--ochre-deep); }
.theme-btn {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  font: inherit; font-size: var(--fs-small); padding: .35rem .7rem;
  border-radius: var(--radius); cursor: pointer;
}
.theme-btn:hover { border-color: var(--ochre); color: var(--ochre-deep); }
.menu-btn { display: none; }

@media (max-width: 860px) {
  .menu-btn { display: block; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: .4rem 1.2rem 1rem;
  }
  .nav.open { display: flex; }
  .nav a { padding: .6rem 0; border-bottom: 1px solid var(--line-soft); }
}

/* ---------- 4. ROPE PROGRESS ---------- */
.rope-track {
  position: fixed; top: 0; left: 0; height: 4px; width: 100%;
  background: transparent; z-index: 90; pointer-events: none;
}
.rope-fill {
  height: 100%; width: 100%; transform-origin: left; transform: scaleX(0);
  background: repeating-linear-gradient(55deg,
    var(--ochre) 0 9px, var(--tar-2) 9px 12px, var(--rust) 12px 14px);
}

/* ---------- 5. HERO ---------- */
.hero { padding: var(--space-7) 0 var(--space-6); position: relative; overflow: hidden; }
.hero .kicker {
  font-size: var(--fs-tiny); letter-spacing: .22em; text-transform: uppercase;
  color: var(--rust); font-weight: 700; margin-bottom: var(--space-2);
}
.hero h1 { max-width: 20ch; }
.hero .lede { max-width: 56ch; margin-top: var(--space-3); font-size: 1.12rem; }
.hero-cta { margin-top: var(--space-4); display: flex; gap: var(--space-3); flex-wrap: wrap; }

.rope-wheel {
  position: absolute; right: -6rem; top: 50%; width: 30rem; height: 30rem;
  transform: translateY(-50%); opacity: .16; pointer-events: none;
  animation: strand-turn 26s linear infinite;
}
@keyframes strand-turn { to { transform: translateY(-50%) rotate(360deg); } }

/* ---------- 6. BUTTONS ---------- */
.btn {
  display: inline-block; font-family: var(--font-body); font-weight: 650;
  font-size: var(--fs-small); letter-spacing: .04em; text-transform: uppercase;
  padding: .8rem 1.5rem; border-radius: var(--radius); cursor: pointer;
  border: 1.5px solid var(--tar-0); text-decoration: none;
  transition: transform .22s var(--ease), background .22s var(--ease), color .22s var(--ease);
}
.btn-solid { background: var(--tar-0); color: var(--flax-0); }
.btn-solid:hover { background: var(--ochre-deep); border-color: var(--ochre-deep); color: var(--flax-0); transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { border-color: var(--rust); color: var(--rust-deep); transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

/* ---------- 7. CARDS / GRIDS ---------- */
.grid { display: grid; gap: var(--space-4); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 940px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space-4); background: var(--flax-1);
  transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
  display: block; color: var(--ink); text-decoration: none;
}
.card:hover { border-color: var(--ochre); transform: translateY(-3px); box-shadow: 0 10px 24px oklch(0% 0 0 / .08); }
.card h3 { margin-bottom: .4rem; }
.card .meta { font-size: var(--fs-tiny); letter-spacing: .12em; text-transform: uppercase; color: var(--rust); font-weight: 700; }
.card p { margin-top: .45rem; font-size: var(--fs-small); color: var(--tar-2); }
[data-theme='nightwatch'] .card p { color: var(--ink); opacity: .8; }

/* ---------- 8. TABLES ---------- */
table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line-soft); }
th { font-family: var(--font-display); font-size: .95rem; letter-spacing: .02em; }
tbody tr:hover { background: var(--flax-1); }
caption { caption-side: bottom; font-size: var(--fs-tiny); color: var(--slate); padding-top: .5rem; text-align: left; }

/* ---------- 9. PAGE SECTIONS ---------- */
.section { padding: var(--space-6) 0; }
.section.tint { background: var(--flax-1); border-block: 1px solid var(--line-soft); }
.section-head { margin-bottom: var(--space-4); }
.section-head .kicker {
  font-size: var(--fs-tiny); letter-spacing: .2em; text-transform: uppercase;
  color: var(--rust); font-weight: 700;
}
.section-head h2 { margin-top: .3rem; }
.prose { max-width: 62ch; }
.prose p + p { margin-top: 1rem; }
.prose ul { margin: 1rem 0 0 1.2rem; display: grid; gap: .4rem; }
figure { margin: var(--space-4) 0; }
figcaption { font-size: var(--fs-tiny); color: var(--slate); margin-top: .4rem; }

/* ---------- 10. STRAND DIVIDER ---------- */
.strand { height: 22px; margin: var(--space-5) auto; width: min(56rem, 92%); opacity: .8; }

/* ---------- 11. FORMS ---------- */
form { display: grid; gap: var(--space-3); max-width: 34rem; }
label { font-weight: 650; font-size: var(--fs-small); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: .65rem .8rem; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--ochre); outline: 2px solid var(--ochre); outline-offset: 0; }
fieldset { border: 1px solid var(--line); padding: var(--space-3); border-radius: var(--radius); }
legend { font-weight: 700; font-size: var(--fs-small); padding: 0 .4rem; }
.form-note { font-size: var(--fs-tiny); color: var(--slate); }

/* ---------- 12. FOOTER ---------- */
.foot {
  margin-top: var(--space-6); border-top: 1px solid var(--line);
  padding: var(--space-5) 0 var(--space-6); background: var(--flax-1);
}
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--space-4); }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.foot h3 { font-size: .95rem; margin-bottom: .5rem; }
.foot ul { list-style: none; display: grid; gap: .35rem; }
.foot a { color: var(--ink); text-decoration: none; font-size: var(--fs-small); }
.foot a:hover { color: var(--rust-deep); text-decoration: underline; }
.foot .legal { margin-top: var(--space-4); font-size: var(--fs-tiny); color: var(--slate); }

/* ---------- 13. REVEAL ANIMATION ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .07s; } .reveal.d2 { transition-delay: .14s; }
.reveal.d3 { transition-delay: .21s; } .reveal.d4 { transition-delay: .28s; }

/* ---------- 14. MOTION SAFETY ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- 15. BREADCRUMB / PAGETOP ---------- */
.crumb { font-size: var(--fs-tiny); letter-spacing: .08em; text-transform: uppercase; color: var(--slate); margin: var(--space-4) 0; }
.crumb a { color: inherit; }
.pagetop { padding: var(--space-5) 0 var(--space-3); }
.pagetop h1 { margin-top: .35rem; }
.pagetop .kicker { font-size: var(--fs-tiny); letter-spacing: .2em; text-transform: uppercase; color: var(--rust); font-weight: 700; }

/* ---------- 16. DEFINITIONS / TIMELINE ---------- */
dl.fact { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; font-size: var(--fs-small); }
dl.fact dt { font-weight: 700; color: var(--slate-deep); }
[data-theme='nightwatch'] dl.fact dt { color: var(--ochre); }
.timeline { display: grid; gap: var(--space-3); border-left: 3px solid var(--ochre); padding-left: var(--space-4); }
.timeline .yr { font-family: var(--font-display); color: var(--rust-deep); }

@font-face {
  font-family: 'Young Serif';
  src: url('/assets/fonts/youngserif-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2010-2027, U+2C60-2C7F;
}
@font-face {
  font-family: 'Manrope';
  src: url('/assets/fonts/manrope-var.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2010-2027, U+2C60-2C7F;
}


/* ---------- 17. COMPARE / SPEC BLOCKS ---------- */
.spec { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.4rem; font-size: var(--fs-small); }
.spec dt { font-weight: 700; color: var(--slate-deep); }
[data-theme='nightwatch'] .spec dt { color: var(--ochre); }

/* ---------- 18. QUOTE / PULL ---------- */
.pull {
  border-left: 4px solid var(--ochre); padding: var(--space-2) 0 var(--space-2) var(--space-4);
  font-family: var(--font-display); font-size: 1.25rem; line-height: 1.4; margin: var(--space-4) 0;
}
.pull cite { display: block; font-family: var(--font-body); font-size: var(--fs-tiny); color: var(--slate); margin-top: .5rem; font-style: normal; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- 19. NUMBERED STEPS ---------- */
.steps { counter-reset: step; display: grid; gap: var(--space-3); }
.steps li {
  counter-increment: step; list-style: none; position: relative; padding-left: 3rem;
}
.steps li::before {
  content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: .1rem;
  font-family: var(--font-display); color: var(--rust); font-size: 1.3rem;
}

/* ---------- 20. HERO VARIANT (page top) ---------- */
.pagetop .lede { max-width: 58ch; margin-top: var(--space-2); font-size: 1.08rem; }

/* ---------- 21. JOURNAL / ARTICLE ---------- */
article.post { max-width: 44rem; margin-inline: auto; }
article.post h2 { margin-top: var(--space-4); }
.post-meta { font-size: var(--fs-tiny); letter-spacing: .12em; text-transform: uppercase; color: var(--slate); margin-top: .6rem; }
.byline { font-size: var(--fs-small); color: var(--tar-2); border-top: 1px solid var(--line-soft); margin-top: var(--space-4); padding-top: var(--space-3); }
[data-theme='nightwatch'] .byline { color: var(--ink); opacity: .75; }

/* ---------- 22. NOTICE / CALLOUT ---------- */
.notice {
  border: 1px solid var(--ochre); border-left-width: 5px; background: var(--flax-1);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius); margin: var(--space-4) 0;
}
.notice strong { color: var(--ochre-deep); }

/* ---------- 23. TWIST HOVER (signature) ---------- */
.twist { display: inline-block; transition: transform .35s var(--ease); }
.card:hover .twist, .btn:hover .twist { transform: rotate(-3deg); }

/* ---------- 24. STRAND SEPARATOR SPIN ---------- */
.strand-spin path { transition: stroke .3s var(--ease); }
.strand-spin { animation: strand-shift 12s linear infinite alternate; }
@keyframes strand-shift { from { transform: translateX(-8px); } to { transform: translateX(8px); } }

/* ---------- 25. MARK / HIGHLIGHT ---------- */
mark { background: var(--ochre); color: var(--tar-0); padding: 0 .2em; border-radius: 2px; }
[data-theme='nightwatch'] mark { color: var(--tar-0); }

/* ---------- 26. PRINT ---------- */
@media print {
  .masthead, .foot, .rope-track, .rope-wheel, .menu-btn, .theme-btn { display: none !important; }
  body { background: white; color: black; }
}

/* ---------- 27. UTILITY ---------- */
.mt-2 { margin-top: var(--space-2); } .mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); } .mt-5 { margin-top: var(--space-5); }
.center { text-align: center; }
.small { font-size: var(--fs-small); }
.tiny { font-size: var(--fs-tiny); }
.muted { color: var(--slate); }
[data-theme='nightwatch'] .muted { color: var(--ink); opacity: .7; }
.uppercase { text-transform: uppercase; letter-spacing: .12em; }


/* ---------- 28. STEPS REFINEMENT ---------- */
.steps { margin-top: var(--space-3); }
.steps li + li { border-top: 1px dashed var(--line-soft); padding-top: var(--space-3); }
.steps strong { font-family: var(--font-display); font-weight: 400; font-size: 1.08rem; }

/* ---------- 29. LEDGER TABLE STATE ---------- */
tr.passed td:last-child { color: var(--ochre-deep); font-weight: 700; }
tr.failed td:last-child { color: var(--rust-deep); font-weight: 700; }

/* ---------- 30. LEAF NAV PILL ---------- */
.pill {
  display: inline-block; font-size: var(--fs-tiny); letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem; color: var(--slate);
  background: var(--flax-1); margin-right: .4rem;
}
[data-theme='nightwatch'] .pill { border-color: var(--line); color: var(--ink); opacity: .8; }

/* ---------- 31. HERO RULES LIST ---------- */
.hero .rules { display: grid; gap: .3rem; margin-top: var(--space-3); font-size: var(--fs-small); }
.hero .rules li { list-style: none; padding-left: 1.2rem; position: relative; }
.hero .rules li::before { content: '\2014'; position: absolute; left: 0; color: var(--rust); }

/* ---------- 32. NIGHTWATCH TRANSITION ---------- */
body, .masthead, .foot, .card, input, textarea, select {
  transition: background-color .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease);
}

/* ---------- 33. SCROLLBAR & MISC ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--flax-1); }
::-webkit-scrollbar-thumb { background: var(--tar-2); border-radius: 5px; }
abbr[title] { text-decoration: dotted underline; cursor: help; }


/* ---------- 34. FINAL PASS ---------- */
.table-wrap { overflow-x: auto; }
table { min-width: 0; }
@media (max-width: 640px) {
  table { font-size: .84rem; }
  th, td { padding: .5rem .5rem; }
}
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
@media (max-width: 940px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4 { grid-template-columns: 1fr; } }
.lede + .hero-cta { margin-top: var(--space-4); }
.section-head + .grid, .section-head + .prose { margin-top: var(--space-2); }
a.card:focus-visible { outline-offset: 4px; }
.card h3 .twist { margin-right: .3rem; }
.foot .legal code { font-size: .95em; background: var(--flax-2); padding: 0 .3em; border-radius: 2px; }
[data-theme='nightwatch'] .foot .legal code { background: var(--flax-2); }
main > section:first-of-type { padding-top: var(--space-4); }
@media (max-width: 860px) {
  .hero { padding-top: var(--space-5); }
  .rope-wheel { width: 20rem; height: 20rem; right: -8rem; opacity: .12; }
}


/* ---------- 35. QUAY CARDS FINE-TUNE ---------- */
.quay-num { font-family: var(--font-display); color: var(--rust); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; }
.grid-3 .card p.meta { margin-bottom: .3rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .35rem; }
.hero-mark { display: block; width: 5.5rem; height: 5.5rem; margin-bottom: var(--space-3); color: var(--ochre); }
[data-theme='nightwatch'] .hero-mark { color: var(--ochre); }
.skip-link:focus { z-index: 100; }
:root { color-scheme: light; }
[data-theme='nightwatch'] { color-scheme: dark; }


/* ---------- 36. FOCUS & MOTION POLISH ---------- */
*:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
.btn-solid:focus-visible, .btn-ghost:focus-visible { outline: 3px solid var(--rust); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .strand-spin, .rope-wheel, .hero-mark { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}
strong { font-weight: 700; }
em { font-style: italic; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-4) 0; }
img { max-width: 100%; height: auto; }


/* ---------- 37. WIDE TABLE SPLIT ---------- */
@media (max-width: 720px) {
  table thead th:first-child, table tbody td:first-child { position: sticky; left: 0; background: var(--flax-0); }
  [data-theme='nightwatch'] table thead th:first-child,
  [data-theme='nightwatch'] table tbody td:first-child { background: var(--flax-2); }
}
dt + dd { margin-top: 0; }
dd { margin: 0 0 .4rem 0; }
.fact { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.6rem; font-size: var(--fs-small); }
.fact dt { font-family: var(--font-display); color: var(--rust); }
[data-theme='nightwatch'] .fact dt { color: var(--ochre); }
.hero-eyebrow { display: flex; align-items: center; gap: .6rem; color: var(--ochre-deep); }
[data-theme='nightwatch'] .hero-eyebrow { color: var(--ochre); }
.hero-eyebrow::after { content: ''; flex: 0 0 3.5rem; height: 2px; background: currentColor; opacity: .6; }
