/* ───────────────────────────────────────────────────────────
   Wrenfield — navy ink on laid paper, sampled off the film.
   Three inks and nothing else, as the engraving itself.
   ─────────────────────────────────────────────────────────── */

:root {
  --paper:  #edeae0;
  --paper2: #e4e0d3;
  --card:   #f6f4ec;
  --ink:    #26355f;
  --ink-d:  #141b33;
  --ink-70: rgba(20,27,51,.72);
  --ink-45: rgba(20,27,51,.48);
  --line:   rgba(38,53,95,.20);
  --brass:  #a8823c;

  --serif: "Cormorant Garamond", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --gut:  clamp(20px, 4.6vw, 96px);
  --ease: cubic-bezier(.22,1,.36,1);
  --max:  1240px;
  --scroll-length: 1150vh;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink-d); font-family: var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg, video, canvas { display: block; max-width: 100%; }
button { font: inherit; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: fixed; top: -100px; left: 12px; z-index: 200; background: var(--ink); color: var(--paper); padding: 10px 16px; text-decoration: none; font-size: 13px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

/* ── loader ─────────────────────────────────────────────── */
.loader { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; gap: 20px; justify-items: center; background: var(--paper); transition: opacity .7s var(--ease), visibility .7s; }
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__mark { font-family: var(--serif); font-size: 30px; color: var(--ink); letter-spacing: .01em; }
.loader__bar { width: 180px; height: 1px; background: var(--line); overflow: hidden; }
.loader__bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .25s linear; }

/* ── film ───────────────────────────────────────────────── */
.film { position: fixed; inset: 0; z-index: 0; background: var(--paper); }
.film canvas, .film__fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.film__fallback { display: none; }
.film__grade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(237,234,224,.34) 0%, rgba(237,234,224,0) 16%,
                                          rgba(237,234,224,0) 84%, rgba(237,234,224,.32) 100%); }

/* ── chrome ─────────────────────────────────────────────── */
.chrome { position: fixed; top: 0; left: 0; right: 0; z-index: 40; display: flex; align-items: center; gap: 30px; padding: 20px var(--gut); }
.chrome::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(237,234,224,.94), rgba(237,234,224,0)); }
.mark { font-family: var(--serif); font-size: 23px; font-weight: 500; letter-spacing: .01em; color: var(--ink); text-decoration: none; }
.mark--lg { font-size: 27px; }
.chrome__nav { margin-left: auto; display: flex; gap: 26px; }
.chrome__nav a { font-size: 12.5px; letter-spacing: .02em; color: var(--ink-70); text-decoration: none; position: relative; padding-bottom: 3px; }
.chrome__nav a::after { content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 1px; background: var(--brass); transition: width .35s var(--ease); }
.chrome__nav a:hover { color: var(--ink); }
.chrome__nav a:hover::after { width: 100%; }

.burger { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.burger span { display: block; width: 22px; height: 1.5px; background: var(--ink); transition: transform .35s var(--ease); }
.burger span + span { margin-top: 6px; }
.burger[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
.burger[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

.navPanel { position: fixed; inset: 0; z-index: 39; background: var(--paper); display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 0 var(--gut); opacity: 0; visibility: hidden; transition: opacity .4s var(--ease), visibility .4s; }
.navPanel.is-open { opacity: 1; visibility: visible; }
.navPanel a { font-family: var(--serif); font-size: clamp(34px,9vw,54px); color: var(--ink); text-decoration: none; padding: 6px 0; }

.rail { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 45; background: rgba(38,53,95,.12); }
.rail i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: 0 50%; }

/* ── buttons ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; padding: 12px 20px; border: 1px solid var(--ink); border-radius: 2px; transform: var(--mag, translate(0,0)); transition: background .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease); }
.btn--ink { background: var(--ink); color: var(--paper); }
.btn--ink:hover { background: var(--brass); border-color: var(--brass); color: var(--ink-d); }
.btn--line { background: transparent; color: var(--ink); }
.btn--line:hover { background: var(--ink); color: var(--paper); }
.btn--lg { padding: 14px 26px; font-size: 13.5px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ── film stage ─────────────────────────────────────────── */
.stage { position: relative; z-index: 10; }
.stage__spacer { height: var(--scroll-length); }
.overlays { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.beat { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 var(--gut); opacity: 0; will-change: opacity, transform; }
.beat > * { pointer-events: auto; }
.beat--l { align-items: flex-start; text-align: left; }
.beat--r { align-items: flex-end; text-align: right; }
.beat--c, .beat--end { align-items: center; text-align: center; }

/* ── type ───────────────────────────────────────────────── */
.display { font-family: var(--serif); font-size: clamp(42px, 7vw, 104px); font-weight: 400; line-height: .98; letter-spacing: -.012em; margin: 0 0 18px; color: var(--ink); }
.h1 { font-family: var(--serif); font-size: clamp(32px, 4.8vw, 68px); font-weight: 400; line-height: 1.02; letter-spacing: -.01em; margin: 0 0 14px; color: var(--ink); }
.h2 { font-family: var(--serif); font-size: clamp(32px, 5.2vw, 76px); font-weight: 400; line-height: .99; letter-spacing: -.012em; margin: 0 0 16px; color: var(--ink); }

.eyebrow { display: inline-flex; align-items: center; gap: 11px; font-size: 10.5px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-45); margin-bottom: 18px; }
.eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--brass); }
.beat--r .eyebrow { flex-direction: row-reverse; }

.lede { font-size: clamp(15px, 1.25vw, 18px); line-height: 1.62; color: var(--ink-70); margin: 0; max-width: 44ch; }
.beat--c .lede, .beat--end .lede { max-width: 46ch; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.row--split { justify-content: space-between; align-items: center; }
.beat--c .row { justify-content: center; }

.figures { list-style: none; display: flex; gap: 42px; margin: 28px 0 0; padding: 0; }
.figures li { display: flex; flex-direction: column; }
.figures b { font-family: var(--serif); font-size: clamp(38px,4vw,60px); line-height: 1; color: var(--brass); }
.figures span { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-45); margin-top: 6px; }

/* ── page ───────────────────────────────────────────────── */
.page { position: relative; z-index: 30; background: var(--paper); }
.sec { padding: clamp(70px, 9.5vw, 150px) var(--gut); max-width: var(--max); margin: 0 auto; }
.sec--tint { max-width: none; background: var(--paper2); }
.sec--tint > * { max-width: var(--max); margin-inline: auto; }
.sec__head { margin-bottom: clamp(34px,5vw,62px); }
.sec__head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; flex-wrap: wrap; }

.r { opacity: 0; transform: translateY(22px); }
.r--in { opacity: 1; transform: none; transition: opacity .8s var(--ease) var(--d,0ms), transform .8s var(--ease) var(--d,0ms); }

/* ── creed ──────────────────────────────────────────────── */
.creed { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.creed li { background: var(--paper); display: grid; grid-template-columns: 74px 1fr; gap: 26px; padding: clamp(26px,3vw,40px) 0; align-items: baseline; }
.creed span { font-family: var(--serif); font-size: 24px; font-style: italic; color: var(--brass); }
.creed b { font-family: var(--serif); font-size: clamp(22px,2.4vw,32px); font-weight: 400; color: var(--ink); letter-spacing: -.01em; }
.creed p { grid-column: 2; margin: 10px 0 0; font-size: 14.5px; line-height: 1.68; color: var(--ink-70); max-width: 62ch; }

/* ── ledger table ───────────────────────────────────────── */
.tablewrap { overflow-x: auto; }
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ledger th, .ledger td { text-align: left; padding: 15px 18px 15px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; font-weight: 400; }
.ledger thead th { padding: 0 18px 12px 0; border-bottom: 1px solid var(--ink); }
.ledger thead button { background: none; border: 0; cursor: pointer; padding: 0; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-45); display: inline-flex; align-items: center; gap: 6px; }
.ledger thead button::after { content: "↕"; font-size: 10px; opacity: .45; }
.ledger thead button:hover { color: var(--ink); }
.ledger thead [aria-sort="ascending"] button::after { content: "↑"; opacity: 1; color: var(--brass); }
.ledger thead [aria-sort="descending"] button::after { content: "↓"; opacity: 1; color: var(--brass); }
.ledger tbody th { font-family: var(--serif); font-size: 19px; color: var(--ink); }
.ledger tbody tr { transition: background .25s var(--ease); }
.ledger tbody tr:hover { background: rgba(38,53,95,.05); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); margin-right: 9px; vertical-align: middle; }
.dot--x { background: var(--brass); }

/* ── terms ──────────────────────────────────────────────── */
.terms { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.terms article { background: var(--card); padding: 26px 22px; }
.terms b { display: block; font-family: var(--serif); font-size: clamp(26px,2.6vw,36px); color: var(--ink); letter-spacing: -.015em; }
.terms span { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-45); margin: 6px 0 14px; }
.terms p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-70); }

/* ── people ─────────────────────────────────────────────── */
.people { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 20px; }
.person__p { aspect-ratio: 4/5; background: linear-gradient(160deg, var(--a), var(--b)); margin-bottom: 14px; position: relative; overflow: hidden; }
.person__p::after { content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(48deg, rgba(237,234,224,.26) 0 1px, transparent 1px 5px); }
.person { transition: transform .5s var(--ease); }
.person:hover { transform: translateY(-6px); }
.person b { display: block; font-family: var(--serif); font-size: 21px; font-weight: 400; color: var(--ink); }
.person > span { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-45); margin: 5px 0 10px; }
.person p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink-70); }

/* ── accordion ──────────────────────────────────────────── */
.acc { border-top: 1px solid var(--line); }
.acc__i { border-bottom: 1px solid var(--line); }
.acc__b { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: none; border: 0; color: var(--ink); cursor: pointer; text-align: left; padding: 22px 0; font-family: var(--serif); font-size: clamp(19px,2.1vw,26px); }
.acc__b i { position: relative; width: 13px; height: 13px; flex: none; }
.acc__b i::before, .acc__b i::after { content: ""; position: absolute; background: var(--brass); transition: transform .35s var(--ease); }
.acc__b i::before { left: 0; top: 6px; width: 13px; height: 1.5px; }
.acc__b i::after { top: 0; left: 6px; width: 1.5px; height: 13px; }
.acc__i.is-open .acc__b i::after { transform: scaleY(0); }
.acc__p { overflow: hidden; height: 0; transition: height .4s var(--ease); }
.acc__p p { margin: 0; padding-bottom: 22px; font-size: 14.5px; line-height: 1.68; color: var(--ink-70); max-width: 68ch; }

/* ── apply ──────────────────────────────────────────────── */
.sec--apply { max-width: none; background: var(--paper2); }
.apply { max-width: var(--max); margin-inline: auto; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px,5vw,72px); align-items: start; }
.apply__meta { list-style: none; margin: 30px 0 0; padding: 0; display: grid; gap: 12px; }
.apply__meta li { display: grid; grid-template-columns: 110px 1fr; font-size: 14px; }
.apply__meta span { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-45); padding-top: 3px; }
.apply__meta a { color: var(--brass); text-decoration: none; }
.apply__meta a:hover { text-decoration: underline; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; }
.field--wide { grid-column: 1 / -1; }
.field label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-45); }
.field input, .field select, .field textarea { font: inherit; font-size: 15px; color: var(--ink-d); background: var(--card); border: 1px solid var(--line); border-radius: 2px; padding: 12px 14px; width: 100%; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); outline: none; }
.field.is-bad input, .field.is-bad select, .field.is-bad textarea { border-color: #b23b2e; }
.formstatus { font-size: 12.5px; margin: 0; color: var(--ink-45); }
.formstatus[data-tone="bad"] { color: #b23b2e; }
.formstatus[data-tone="good"] { color: #2c6b4a; }
.form.is-sent .field { opacity: .5; pointer-events: none; }

/* ── footer ─────────────────────────────────────────────── */
.foot { background: var(--ink-d); color: var(--paper); padding: clamp(46px,6vw,72px) var(--gut) 32px; }
.foot__top, .foot__bot { max-width: var(--max); margin-inline: auto; display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.foot__top { padding-bottom: 32px; border-bottom: 1px solid rgba(237,234,224,.16); }
.foot .mark { color: var(--paper); }
.foot nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 22px; }
.foot a { font-size: 12.5px; color: rgba(237,234,224,.7); text-decoration: none; }
.foot a:hover { color: var(--brass); }
.foot__bot { padding-top: 22px; justify-content: space-between; }
.foot__bot span { font-size: 11.5px; color: rgba(237,234,224,.45); }

/* ═══ MOTION LAYER ═══════════════════════════════════════ */

.beat::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .6s var(--ease); }
.beat.is-live::before { opacity: 1; }
.beat--l::before { background: linear-gradient(100deg, rgba(237,234,224,.95) 0%, rgba(237,234,224,.74) 34%, rgba(237,234,224,0) 64%); }
.beat--r::before { background: linear-gradient(260deg, rgba(237,234,224,.95) 0%, rgba(237,234,224,.74) 34%, rgba(237,234,224,0) 64%); }
.beat--c::before, .beat--end::before { background: radial-gradient(60% 48% at 50% 50%, rgba(237,234,224,.94) 0%, rgba(237,234,224,.62) 56%, rgba(237,234,224,0) 100%); }

.is-split { display: block; }
.ln { display: block; overflow: hidden; padding-bottom: .08em; }
.ln i { display: block; font-style: inherit; transform: translateY(110%); opacity: 0;
  transition: transform 1.05s var(--ease), opacity .8s var(--ease); transition-delay: calc(var(--li) * 100ms); }
.beat.is-live .ln i, .wipe.is-live .ln i, .sec__head.is-live .ln i { transform: none; opacity: 1; }

.beat > * { opacity: 0; transform: translateY(24px); transition: opacity .85s var(--ease), transform .95s var(--ease); transition-delay: calc(var(--i) * 90ms + 140ms); }
.beat > .display, .beat > .h2 { opacity: 1; transform: none; }
.beat.is-live > * { opacity: 1; transform: translateY(0); }
.beat.is-live > .eyebrow { transform: translateY(calc(var(--t,0) * -12px)); }
.beat.is-live > .display, .beat.is-live > .h2 { transform: translateY(calc(var(--t,0) * -26px)); }
.beat.is-live > .lede { transform: translateY(calc(var(--t,0) * -46px)); }
.beat.is-live > .row, .beat.is-live > .figures { transform: translateY(calc(var(--t,0) * -70px)); }

.eyebrow::before { width: 0; transition: width .9s var(--ease) .3s; }
.beat.is-live .eyebrow::before, .is-live .eyebrow::before { width: 26px; }

.beat .figures li { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .9s var(--ease); }
.beat .figures li:nth-child(2) { transition-delay: .12s; }
.beat.is-live .figures li { opacity: 1; transform: none; }

.wipe > *:not(.ln) { opacity: 0; transform: translateY(22px); transition: opacity .85s var(--ease), transform .95s var(--ease); }
.wipe.is-live > *:not(.ln) { opacity: 1; transform: none; }
.wipe.is-live > *:nth-child(2) { transition-delay: .1s; }
.wipe.is-live > *:nth-child(3) { transition-delay: .18s; }


.has-cursor, .has-cursor * { cursor: none !important; }
.cur { position: fixed; top: 0; left: 0; z-index: 300; pointer-events: none; border-radius: 50%; }
.cur--dot { width: 5px; height: 5px; background: var(--ink); }
.cur--ring { width: 32px; height: 32px; border: 1px solid rgba(38,53,95,.45); display: grid; place-items: center;
  transition: width .32s var(--ease), height .32s var(--ease), background .32s var(--ease), border-color .32s var(--ease), opacity .3s; }
.cur--ring.is-on { width: 52px; height: 52px; background: rgba(38,53,95,.07); }
.cur--ring.is-lg { width: 88px; height: 88px; background: var(--ink); border-color: transparent; }
.cur--ring.is-down { width: 24px; height: 24px; }
.cur--ring.is-out { opacity: 0; }
.cur__l { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--paper); opacity: 0; transition: opacity .2s; }
.cur--ring.is-lg .cur__l { opacity: 1; }

/* ── responsive ─────────────────────────────────────────── */
@media (max-width: 1040px) {
  .terms, .people { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .apply, .form { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --scroll-length: 1000vh; }
  .chrome__nav, .chrome .btn { display: none; }
  .burger { display: block; margin-left: auto; }
  .beat { justify-content: flex-end; padding-bottom: 72px; }
  .beat--r, .beat--c, .beat--end { align-items: flex-start; text-align: left; }
  .beat--r .eyebrow { flex-direction: row; }
  .beat--c .row { justify-content: flex-start; }
  .beat--l::before, .beat--r::before, .beat--c::before, .beat--end::before {
    background: linear-gradient(to bottom, rgba(237,234,224,0) 14%, rgba(237,234,224,.74) 42%, rgba(237,234,224,.97) 100%);
  }
  .creed li { grid-template-columns: 1fr; gap: 4px; }
  .creed p { grid-column: 1; }
  .terms, .people { grid-template-columns: 1fr; }
  .figures { gap: 26px; }
  .apply__meta li { grid-template-columns: 1fr; gap: 2px; }
  .foot nav { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .film canvas { display: none; }
  .film__fallback { display: block; }
  .stage__spacer { height: 640vh; }
  .ln i, .beat > *, .wipe > *:not(.ln), .beat .figures li, .r {
    opacity: 1 !important; transform: none !important; transition: none !important;
  }
  .cur { display: none; }
}
