/*
  Nikali: site styles.
  Built phone first. Animation only runs when <html data-motion="on">, which the page sets
  after checking the visitor's reduced-motion setting, so the still version is the default.
*/

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--head-h) + 1rem);
  background: var(--forest-deep);
}
html[data-motion="on"] { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--text);
  font: 400 var(--t-body)/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  --focus: var(--forest);
}

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

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--brass); color: var(--forest-deep); }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }

.on-dark { color: var(--on-dark); --focus: var(--brass-light); }
.grain { background-image: url("../img/grain-light.png"); }
.paper { background-image: url("../img/grain-dark.png"); }

.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: fixed; top: 0.5rem; left: 0.5rem; z-index: 200;
  padding: 0.75rem 1rem; background: var(--ivory); color: var(--forest-deep);
  font-weight: 600; transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Small uppercase labels: volume numbers, dates, section names. */
.meta {
  font: 600 var(--t-meta)/1.3 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.on-dark .meta { color: var(--on-dark-soft); }
.meta--brass, .on-dark .meta--brass { color: var(--brass-ink); }
.on-dark .meta--brass { color: var(--brass-light); }

.lede { font: 500 var(--t-lede)/1.32 var(--serif); }
.soft { color: var(--text-soft); }
.on-dark .soft { color: var(--on-dark-soft); }

.h2 { font-size: var(--t-h2); }
.h3 { font-size: var(--t-h3); }

.arr { flex: none; transition: transform 0.4s var(--ease); }

/* ---------- Buttons and links ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.75em;
  min-height: 3.25rem; padding: 0.9em 1.7em;
  font: 600 0.78rem/1.2 var(--sans); letter-spacing: 0.15em; text-transform: uppercase;
  text-decoration: none; text-align: center;
  border: 1px solid transparent; border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s, transform 0.3s var(--ease);
}
.btn--brass { background: var(--brass); color: #12201b; }
.btn--brass:hover { background: var(--brass-light); }
.btn--line { border-color: rgba(243, 237, 225, 0.42); color: var(--ivory); }
.btn--line:hover { border-color: var(--brass-light); color: var(--brass-light); }
.btn--forest { background: var(--forest); color: var(--ivory); }
.btn--forest:hover { background: var(--forest-deep); }
.btn--ink { border-color: rgba(32, 33, 30, 0.5); color: var(--charcoal); }
.btn--ink:hover { border-color: var(--forest); background: var(--forest); color: var(--ivory); }
.btn--sm { min-height: 2.75rem; padding: 0.7em 1.25em; font-size: 0.7rem; }
.btn:hover .arr { transform: translateX(5px); }

.actions { display: flex; flex-wrap: wrap; gap: 0.875rem; }

.link {
  display: inline-flex; align-items: center; gap: 0.75em;
  padding: 0.5rem 0; min-height: 2.75rem;
  font: 600 0.78rem/1.2 var(--sans); letter-spacing: 0.15em; text-transform: uppercase;
  text-decoration: none; color: var(--forest);
  border-bottom: 1px solid currentColor;
}
.on-dark .link { color: var(--brass-light); }
.link:hover .arr { transform: translateX(6px); }

/* ---------- Header and navigation ---------- */

.site-head {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  color: var(--on-dark); --focus: var(--brass-light);
}
.site-head::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: rgba(12, 29, 25, 0.94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(180, 154, 99, 0.22);
  opacity: 0; transition: opacity 0.4s;
}
.site-head.is-solid::before, .nav-open .site-head::before { opacity: 1; }

.site-head__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: var(--head-h); padding-inline: var(--gutter);
}

.brand { display: block; flex: none; padding: 0.5rem 0; }
.brand img { width: 8.25rem; }

/*
  The wordmark is written by hand: a pen traces each letter in turn, then the gold settles
  into the strokes. It writes five times on arrival and then rests. Without animation the
  finished gold wordmark simply shows.
*/
.brand { position: relative; }
.brand__ink { display: none; }
[data-motion="on"] .brand[data-write] .brand__ink {
  display: block; position: absolute; inset: 0.5rem 0 auto 0; width: 100%; height: auto; aspect-ratio: 1063 / 220;
  overflow: visible; pointer-events: none;
  filter: drop-shadow(0 0 2px rgba(255, 236, 190, 0.55));
}
[data-motion="on"] .brand[data-write] .brand__ink path {
  fill: none; stroke: var(--brass-light); stroke-width: 1.6; vector-effect: non-scaling-stroke;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
[data-motion="on"] .brand[data-write] img { opacity: 0; }
[data-motion="on"] .brand[data-write].is-writing .brand__ink path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.85s cubic-bezier(0.55, 0.1, 0.35, 1);
  transition-delay: calc(var(--i, 0) * 0.32s);
}
[data-motion="on"] .brand[data-write].is-written img { opacity: 1; transition: opacity 0.9s ease; }
[data-motion="on"] .brand[data-write].is-written .brand__ink { opacity: 0.25; transition: opacity 1.2s ease; }
[data-motion="on"] .brand[data-write].is-fading img,
[data-motion="on"] .brand[data-write].is-fading .brand__ink { opacity: 0; transition: opacity 0.5s ease; }
[data-motion="on"] .brand[data-write].is-done .brand__ink { display: none; }

.menu-btn {
  display: inline-flex; align-items: center; gap: 0.75rem;
  min-height: 2.75rem; padding: 0 0 0 0.75rem; margin-right: -0.125rem;
  background: none; border: 0; cursor: pointer;
  font: 600 var(--t-meta)/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase;
}
.menu-btn__icon { position: relative; width: 1.75rem; height: 0.75rem; }
.menu-btn__icon i {
  position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor;
  transition: transform 0.4s var(--ease);
}
.menu-btn__icon i:first-child { top: 0; }
.menu-btn__icon i:last-child { bottom: 0; }
.nav-open .menu-btn__icon i:first-child { transform: translateY(5.25px) rotate(45deg); }
.nav-open .menu-btn__icon i:last-child { transform: translateY(-5.25px) rotate(-45deg); }

.site-nav__list { list-style: none; margin: 0; padding: 0; }
.site-nav a { text-decoration: none; }

.progress { position: absolute; inset: auto 0 0 0; height: 2px; pointer-events: none; }
.progress span {
  display: block; height: 100%; background: var(--brass-light);
  transform-origin: 0 50%; transform: scaleX(var(--p, 0));
}

/* Phone and tablet: the menu is a full-screen page of its own. */
@media (max-width: 75.99em) {
  .site-nav {
    position: fixed; inset: 0; z-index: -1;
    display: flex; flex-direction: column;
    padding: calc(var(--head-h) + clamp(1.25rem, 5vh, 3rem)) var(--gutter) max(1.75rem, env(safe-area-inset-bottom));
    background-color: var(--forest-deep);
    background-image: url("../img/grain-light.png"), radial-gradient(90% 55% at 100% 0%, #1c453b, rgba(14, 34, 29, 0) 70%);
    overflow-y: auto; overscroll-behavior: contain;
    visibility: hidden; opacity: 0;
    transition: opacity 0.35s, visibility 0s 0.35s;
  }
  .nav-open .site-nav { visibility: visible; opacity: 1; transition: opacity 0.35s; }
  .nav-open { overflow: hidden; }

  .site-nav__list { display: grid; }
  .site-nav__list a, .site-nav__signin {
    display: block; padding: 0.3em 0;
    font: 500 clamp(2.125rem, 10vw, 3.5rem)/1.05 var(--serif);
    letter-spacing: 0.05em; text-transform: uppercase; color: var(--ivory);
  }
  .site-nav a[aria-current="page"] { color: var(--brass-light); }
  .site-nav__account { display: grid; justify-items: start; gap: 1.5rem; }
  .site-nav__account .btn { margin-top: 0.25rem; }
  .site-nav__tagline {
    margin-top: auto; padding-top: 2.25rem;
    font: italic 500 1.375rem/1.2 var(--serif); color: var(--brass-light);
  }

  [data-motion="on"] .site-nav__list li,
  [data-motion="on"] .site-nav__account > *,
  [data-motion="on"] .site-nav__tagline {
    opacity: 0; transform: translateY(1.25rem);
    transition: opacity 0.3s, transform 0.3s;
  }
  [data-motion="on"].nav-open .site-nav__list li,
  [data-motion="on"].nav-open .site-nav__account > *,
  [data-motion="on"].nav-open .site-nav__tagline {
    opacity: 1; transform: none;
    transition: opacity 0.6s var(--ease), transform 0.7s var(--ease);
    transition-delay: calc(var(--i, 0) * 55ms + 120ms);
  }
  .site-nav__list li:nth-child(2) { --i: 1; }
  .site-nav__list li:nth-child(3) { --i: 2; }
  .site-nav__list li:nth-child(4) { --i: 3; }
  .site-nav__list li:nth-child(5) { --i: 4; }
  .site-nav__account > :nth-child(1) { --i: 5; }
  .site-nav__account > :nth-child(2) { --i: 6; }
  .site-nav__tagline { --i: 8; }

  /* Without JavaScript the menu simply sits open under the logo. */
  .no-js .site-head { position: relative; background: var(--forest-deep); }
  .no-js .site-head__bar { height: auto; flex-wrap: wrap; padding-block: 0.75rem; }
  .no-js .menu-btn { display: none; }
  .no-js .site-nav { position: static; visibility: visible; opacity: 1; padding: 0.5rem 0 0; width: 100%; background: none; }
  .no-js .site-nav__list { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
  .no-js .site-nav__list a, .no-js .site-nav__signin { font-size: 1.25rem; padding: 0.5rem 0; }
  .no-js .site-nav__account { display: flex; align-items: center; gap: 1.25rem; }
  .no-js .site-nav__tagline { display: none; }
  .no-js .hall, .no-js .page-head { padding-top: 2rem; }
}

@media (min-width: 76em) {
  .brand img { width: 9.5rem; }
  .menu-btn { display: none; }
  .site-nav { display: flex; align-items: center; gap: clamp(1.5rem, 2.6vw, 3rem); }
  .site-nav__list { display: flex; gap: clamp(1.25rem, 2.2vw, 2.5rem); }
  .site-nav__account { display: flex; align-items: center; gap: clamp(1.25rem, 2vw, 2rem); }
  .site-nav__list a, .site-nav__signin {
    position: relative; display: block; padding: 0.9rem 0;
    font: 600 var(--t-meta)/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase;
  }
  .site-nav__list a::after, .site-nav__signin::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0.45rem; height: 1px;
    background: var(--brass-light); transform: scaleX(0); transform-origin: 0 50%;
    transition: transform 0.45s var(--ease);
  }
  .site-nav__list a:hover::after, .site-nav__signin:hover::after,
  .site-nav a[aria-current="page"]::after { transform: scaleX(1); }
  .site-nav a[aria-current="page"] { color: var(--brass-light); }
  .site-nav__tagline { display: none; }
}

/* ---------- Home: the entrance hall ---------- */

.hall {
  --arch-w: min(54rem, 100vw - 1.5rem);
  --emblem: clamp(8.75rem, min(34vw, 26vh), 18.5rem);
  --intro: 1;
  position: relative; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center;
  padding: calc(var(--head-h) + 1rem) var(--gutter) 6.25rem;
  text-align: center; color: var(--on-dark); --focus: var(--brass-light);
  background-color: var(--forest-deep);
  background-image:
    url("../img/grain-light.png"),
    radial-gradient(70% 46% at 50% 16%, rgba(47, 102, 88, 0.55), rgba(14, 34, 29, 0) 72%),
    radial-gradient(55% 30% at 50% 100%, rgba(180, 154, 99, 0.16), rgba(14, 34, 29, 0) 75%);
}
html[data-intro="seen"] .hall { --intro: 0.12; }

/* The great arch that frames the hall: two mouldings and a star at the keystone. */
.hall__arch {
  position: absolute; left: 50%; top: calc(var(--head-h) + 0.25rem); bottom: 0;
  width: var(--arch-w); transform: translateX(-50%);
  border: 1px solid rgba(180, 154, 99, 0.5); border-bottom: 0;
  border-radius: calc(var(--arch-w) / 2) calc(var(--arch-w) / 2) 0 0;
  pointer-events: none;
}
.hall__arch::before {
  content: ""; position: absolute; inset: clamp(7px, 1.3vw, 15px); bottom: 0;
  border: 1px solid rgba(180, 154, 99, 0.24); border-bottom: 0;
  border-radius: calc(var(--arch-w) / 2) calc(var(--arch-w) / 2) 0 0;
}
.hall__keystone {
  position: absolute; left: 50%; top: 0; width: 2.25rem; height: 2.25rem;
  transform: translate(-50%, -50%); color: var(--brass-light);
  background: radial-gradient(circle, var(--forest-deep) 55%, rgba(14, 34, 29, 0) 72%);
  display: grid; place-items: center;
}
.hall__keystone .star { width: 1.125rem; height: 1.125rem; }

/*
  Light along the arch. Two points of light climb the brass mouldings from either side,
  meet at the keystone, and the star flares as they arrive. Drawn with a conic gradient
  that shows only where the lines are.
*/
@property --nk-a { syntax: "<angle>"; inherits: false; initial-value: 180deg; }
.hall__arch::after, .vault__arch::after {
  content: ""; position: absolute; inset: -1.5px -1.5px 0; pointer-events: none;
  border: 2px solid transparent; border-bottom: 0; border-radius: inherit;
}
.hall__arch::after, .hall__arch::before, .vault__arch::after, .vault__arch::before {
  --nk-light: rgba(255, 238, 200, 0.95);
  background: conic-gradient(from 0deg at 50% calc(var(--arch-w) / 2),
    rgba(255, 238, 200, 0) calc(var(--nk-a) - 6deg), var(--nk-light) var(--nk-a), rgba(255, 238, 200, 0) calc(var(--nk-a) + 6deg),
    rgba(255, 238, 200, 0) calc(360deg - var(--nk-a) - 6deg), var(--nk-light) calc(360deg - var(--nk-a)), rgba(255, 238, 200, 0) calc(360deg - var(--nk-a) + 6deg)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0) border-box;
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0) border-box;
  opacity: 0;
}
.hall__arch::before, .vault__arch::before { opacity: 1; --nk-light: rgba(255, 238, 200, 0); }
@keyframes nk-climb {
  0% { --nk-a: 178deg; opacity: 0; }
  10% { opacity: 1; }
  50% { opacity: 1; }
  58%, 100% { --nk-a: 0deg; opacity: 0; }
}
@keyframes nk-climb-inner {
  0% { --nk-a: 178deg; --nk-light: rgba(255, 238, 200, 0); }
  10%, 50% { --nk-light: rgba(255, 238, 200, 0.7); }
  58%, 100% { --nk-a: 0deg; --nk-light: rgba(255, 238, 200, 0); }
}
@keyframes nk-gleam {
  0%, 52%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 0 rgba(255, 240, 205, 0)); }
  60% { transform: scale(1.35) rotate(45deg); filter: drop-shadow(0 0 5px rgba(255, 240, 205, 0.95)) drop-shadow(0 0 16px rgba(220, 198, 149, 0.65)); }
  72% { transform: scale(1) rotate(90deg); filter: drop-shadow(0 0 2px rgba(255, 240, 205, 0.35)); }
}
@property --nk-light { syntax: "<color>"; inherits: false; initial-value: rgba(255, 238, 200, 0); }
[data-motion="on"] .hall__arch::after, [data-motion="on"] .vault__arch::after { animation: nk-climb 7s cubic-bezier(0.45, 0, 0.3, 1) 2s infinite; }
[data-motion="on"] .hall__arch::before, [data-motion="on"] .vault__arch::before { animation: nk-climb-inner 7s cubic-bezier(0.45, 0, 0.3, 1) 2.15s infinite; }
[data-motion="on"] .hall__keystone .star, [data-motion="on"] .vault .hall__keystone .star { animation: nk-gleam 7s var(--ease-inout) 2s infinite; }

.hall__inner {
  position: relative;
  width: min(100%, var(--arch-w) - 2.75rem);
  display: grid; justify-items: center;
  padding-top: clamp(1.75rem, 6vh, 4.5rem);
}

/* The monogram: a dim casting, the lit metal over it, and a beam that crosses once. */
.emblem {
  position: relative; width: var(--emblem); aspect-ratio: 856 / 684;
  -webkit-tap-highlight-color: transparent;
}
.emblem img, .emblem__beam { position: absolute; inset: 0; width: 100%; height: 100%; }
.emblem__dim { filter: brightness(0.3) saturate(0.45); }
.emblem__beam {
  display: none;
  -webkit-mask: url("../img/mask-monogram.png") center / 100% 100% no-repeat;
  mask: url("../img/mask-monogram.png") center / 100% 100% no-repeat;
  background: linear-gradient(105deg, rgba(255, 246, 220, 0) 44%, rgba(255, 246, 220, 0.95) 50%, rgba(255, 246, 220, 0) 56%) 100% 0 / 300% 100% no-repeat;
  mix-blend-mode: screen;
}

.hall__wordmark { width: calc(var(--emblem) * 1.12); margin-top: clamp(0.75rem, 2vh, 1.5rem); }

.hall__title {
  margin-top: clamp(1.25rem, 3.4vh, 2.25rem);
  font-size: clamp(2.375rem, 1.6rem + 3.4vw, 4.25rem);
  line-height: 1;
}
.hall__sub {
  margin-top: clamp(0.75rem, 2vh, 1.125rem); max-width: 30ch;
  font: italic 500 clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem)/1.25 var(--serif);
  color: var(--brass-light);
}
.hall__copy {
  margin-top: clamp(0.75rem, 2vh, 1.125rem); max-width: 58ch;
  font-size: var(--t-small); line-height: 1.55; color: var(--on-dark-soft);
}
.hall .actions { justify-content: center; margin-top: clamp(1.25rem, 3vh, 2rem); }

.hall__cue {
  position: absolute; left: 50%; bottom: 1.125rem; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 0.5rem;
  padding: 0.5rem 1rem; text-decoration: none; color: var(--brass-light);
  font: 600 0.6875rem/1 var(--sans); letter-spacing: 0.2em; text-transform: uppercase;
}
.hall__cue i { display: block; width: 1px; height: 1.75rem; background: linear-gradient(var(--brass-light), rgba(220, 198, 149, 0)); transform-origin: 50% 0; }

@media (max-width: 39.99em) {
  .hall .actions { flex-direction: column; align-self: stretch; width: 100%; max-width: 21rem; }
  .hall .actions .btn { width: 100%; }
}
@media (min-width: 40em) {
  .hall__copy { font-size: var(--t-body); }
}
/* Short screens: the first button always stays in view. */
@media (max-width: 39.99em) and (max-height: 43.75em) {
  .hall { --emblem: 7.25rem; }
  .hall__inner { padding-top: 1rem; }
  .hall__copy { order: 5; margin-top: 1.5rem; }
}
@media (min-width: 60em) and (max-height: 52em) {
  .hall { --emblem: min(18.5rem, 23vh); }
  .hall__inner { padding-top: 1.5vh; }
  .hall__title { font-size: clamp(2.75rem, 4.4vw, 3.5rem); white-space: nowrap; }
}

/* The opening sequence. Runs in full once per visit, then stays out of the way. */
@keyframes nk-rise { from { opacity: 0; transform: translateY(1.25rem); } to { opacity: 1; transform: none; } }
@keyframes nk-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nk-arch { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(-3rem 0 0 0); } }
@keyframes nk-light {
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  to { -webkit-mask-position: 0% 0; mask-position: 0% 0; }
}
@keyframes nk-beam { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes nk-cue { 0% { transform: scaleY(0); } 55%, 100% { transform: scaleY(1); } }

[data-motion="on"] .hall__arch { animation: nk-arch 1.7s var(--ease-inout) calc(var(--intro) * 0.15s) both; }
[data-motion="on"] .hall__keystone { animation: nk-fade 0.8s ease calc(var(--intro) * 1.6s) both; }
[data-motion="on"] .emblem__lit {
  -webkit-mask: linear-gradient(105deg, #000 45%, rgba(0, 0, 0, 0) 55%) 100% 0 / 300% 100% no-repeat;
  mask: linear-gradient(105deg, #000 45%, rgba(0, 0, 0, 0) 55%) 100% 0 / 300% 100% no-repeat;
  animation: nk-light 1.5s var(--ease-inout) calc(var(--intro) * 0.55s) both;
}
[data-motion="on"] .emblem__beam { display: block; animation: nk-beam 1.5s var(--ease-inout) calc(var(--intro) * 0.55s) both; }
[data-motion="on"] .emblem.is-glinting .emblem__beam { animation: nk-beam 1.3s var(--ease-inout) both; }
[data-motion="on"] .hall__wordmark { animation: nk-fade 1.1s ease calc(var(--intro) * 1.6s) both; }
[data-motion="on"] .hall__title { animation: nk-rise 1s var(--ease) calc(var(--intro) * 1.95s) both; }
[data-motion="on"] .hall__sub { animation: nk-rise 1s var(--ease) calc(var(--intro) * 2.15s) both; }
[data-motion="on"] .hall__copy { animation: nk-rise 1s var(--ease) calc(var(--intro) * 2.3s) both; }
[data-motion="on"] .hall .actions { animation: nk-rise 1s var(--ease) calc(var(--intro) * 2.45s) both; }
[data-motion="on"] .hall__cue { animation: nk-fade 1s ease calc(var(--intro) * 3s) both; }
[data-motion="on"] .hall__cue i { animation: nk-cue 2.6s var(--ease-inout) 3.2s infinite; }

/* ---------- Home: the threshold (a doorway opens from the hall into the library) ---------- */

.threshold { position: relative; background-color: var(--forest-deep); background-image: url("../img/grain-light.png"); }
.threshold__door {
  padding: clamp(6rem, 15vw, 11rem) var(--gutter) var(--section);
  background-color: var(--ivory); background-image: url("../img/grain-dark.png");
  color: var(--text); text-align: center;
  border-radius: 50% 50% 0 0 / clamp(4.5rem, 13vw, 11rem) clamp(4.5rem, 13vw, 11rem) 0 0;
}
.threshold__a { font-size: clamp(2.25rem, 1.2rem + 4.6vw, 5.5rem); max-width: 16ch; margin-inline: auto; }
.threshold__b { max-width: 31ch; margin: clamp(1.25rem, 3vw, 2rem) auto 0; font: 500 var(--t-lede)/1.3 var(--serif); color: var(--text-soft); }

.js[data-motion="on"] .threshold { height: 240vh; height: 240svh; }
.js[data-motion="on"] .threshold__stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  background: radial-gradient(60% 50% at 50% 100%, rgba(220, 198, 149, 0.2), rgba(14, 34, 29, 0) 70%);
}
.js[data-motion="on"] .threshold__door {
  position: absolute; inset: 0; border-radius: 0;
  display: grid; place-content: center; padding: var(--head-h) var(--gutter) 0;
  clip-path: inset(36% 32% 0 32% round 999px 999px 0 0);
  will-change: clip-path;
}
.js[data-motion="on"] .threshold__a { opacity: var(--a, 0); transform: translateY(calc((1 - var(--a, 0)) * 1.75rem)); }
.js[data-motion="on"] .threshold__b { opacity: var(--b, 0); transform: translateY(calc((1 - var(--b, 0)) * 1.75rem)); }

/* ---------- Shared section furniture ---------- */

.band { padding-block: var(--section); }
.band--tight { padding-block: clamp(3.5rem, 2.5rem + 5vw, 7rem); }
.band--ivory { background-color: var(--ivory); }
.band--shade { background-color: var(--ivory-shade); }
.band--forest { background-color: var(--forest); }
.band--deep { background-color: var(--forest-deep); }
.band--charcoal { background-color: var(--charcoal); }

.split { display: grid; gap: clamp(2rem, 5vw, 3.5rem); }
@media (min-width: 60em) {
  .split { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(3rem, 7vw, 7.5rem); }
  .split--wide-left { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .split--narrow-left { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); }
  .split__stick { position: sticky; top: calc(var(--head-h) + 3rem); align-self: start; }
}

.stack > * + * { margin-top: 1.25rem; }
.stack--lg > * + * { margin-top: 2rem; }

/* Headings uncover line by line, and brass rules draw in, as a section arrives. */
[data-motion="on"] [data-reveal] { opacity: 0; transform: translateY(1.5rem); transition: opacity 0.9s var(--ease), transform 1.1s var(--ease); transition-delay: var(--d, 0s); }
[data-motion="on"] [data-reveal].is-in { opacity: 1; transform: none; }

.rule { height: 1px; border: 0; margin: 0; background: var(--brass); transform-origin: 0 50%; }
[data-motion="on"] .rule[data-reveal] { opacity: 1; transform: scaleX(0); transition: transform 1.4s var(--ease-inout); }
[data-motion="on"] .rule[data-reveal].is-in { transform: scaleX(1); }

/* ---------- Home: why Nikali ---------- */

.why { padding-top: var(--section); background-color: var(--ivory); }

.litany {
  list-style: none; padding: 0; display: grid; gap: clamp(0.875rem, 2vw, 1.375rem);
  font: 500 var(--t-h3)/1.14 var(--serif); letter-spacing: -0.005em;
}
.litany li { padding-left: clamp(1rem, 2.4vw, 1.75rem); border-left: 1px solid var(--brass); }
[data-motion="on"] .litany li { color: rgba(32, 33, 30, 0.26); border-left-color: var(--rule); transition: color 0.8s ease, border-color 0.8s ease; }
[data-motion="on"] .litany li.is-read { color: var(--text); border-left-color: var(--brass); }
.why__close { margin-top: clamp(2rem, 4vw, 3rem); font: italic 500 var(--t-h3)/1.14 var(--serif); color: var(--forest); max-width: 20ch; }

/* Learn, preserve, share, pass it on: a real sequence, so it reads as one line of travel. */
.pass { list-style: none; padding: 0; margin-top: var(--section); display: grid; }
.pass li { position: relative; display: flex; align-items: center; padding: 0 0 2.25rem 2.5rem; }
.pass li:last-child { padding-bottom: 0; }
.pass li::before {
  content: ""; position: absolute; left: 0; top: 0.42em; width: 0.6875rem; height: 0.6875rem;
  border: 1px solid var(--brass-ink); border-radius: 50%; background: var(--ivory);
  font-size: clamp(2rem, 8.6vw, 3.5rem);
}
.pass li:not(:last-child)::after {
  content: ""; position: absolute; left: 0.3125rem; top: 1.6rem; bottom: -0.5rem; width: 1px; background: var(--brass);
  transform-origin: 50% 0;
}
.pass li:last-child::before { background: var(--brass); border-color: var(--brass); }
.pass__word {
  font: 500 clamp(2rem, 8.6vw, 3.5rem)/1 var(--serif); letter-spacing: 0.08em; text-transform: uppercase; color: var(--forest);
}
@media (min-width: 60em) {
  .pass { display: flex; align-items: center; gap: 1.5rem; }
  .pass li { padding: 0; gap: 1.5rem; flex: 1 1 auto; }
  .pass li:last-child { flex: 0 0 auto; }
  .pass li::before { display: none; }
  .pass li:not(:last-child)::after {
    position: static; flex: 1 1 2rem; width: auto; height: 1px; transform-origin: 0 50%;
    background: linear-gradient(90deg, var(--brass), var(--brass)) no-repeat;
  }
  .pass__word { font-size: clamp(1.75rem, 3.3vw, 3.25rem); white-space: nowrap; }
}
[data-motion="on"] .pass li .pass__word { opacity: 0.2; transition: opacity 0.8s ease; transition-delay: calc(var(--i, 0) * 0.42s); }
[data-motion="on"] .pass li::after { transform: scale(0); transition: transform 0.7s var(--ease-inout); transition-delay: calc(var(--i, 0) * 0.42s + 0.25s); }
[data-motion="on"] .pass.is-in li .pass__word { opacity: 1; }
[data-motion="on"] .pass.is-in li::after { transform: none; }
.pass li:nth-child(2) { --i: 1; } .pass li:nth-child(3) { --i: 2; } .pass li:nth-child(4) { --i: 3; }

/* The arcade: four arches that carry the sentence into the Repository. */
.arcade-lead { margin-top: var(--section); padding-inline: var(--gutter); text-align: center; font: italic 500 var(--t-lede)/1.3 var(--serif); color: var(--text-soft); }
.arcade { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: clamp(1.5rem, 3vw, 2.5rem); overflow: hidden; }
.arcade__bay {
  position: relative; aspect-ratio: 1 / 1.3;
  display: grid; place-items: end center; padding-bottom: 26%;
  background-color: var(--forest); background-image: url("../img/grain-light.png");
  border-radius: 999px 999px 0 0;
  font: 500 clamp(1rem, 4.3vw, 2.875rem)/1 var(--serif); color: var(--brass-light);
}
@media (min-width: 48em) { .arcade__bay { aspect-ratio: 1 / 0.9; padding-bottom: 17%; font-size: clamp(1.75rem, 3.4vw, 2.875rem); } }
.arcade__bay::before {
  content: ""; position: absolute; inset: clamp(5px, 1.2vw, 16px); bottom: 0;
  border: 1px solid rgba(180, 154, 99, 0.55); border-bottom: 0; border-radius: 999px 999px 0 0;
}
[data-motion="on"] .arcade__bay { transform: translateY(101%); transition: transform 1.1s var(--ease); transition-delay: calc(var(--i, 0) * 0.13s); }
[data-motion="on"] .arcade.is-in .arcade__bay { transform: none; }
.arcade__bay:nth-child(2) { --i: 1; } .arcade__bay:nth-child(3) { --i: 2; } .arcade__bay:nth-child(4) { --i: 3; }

/* ---------- Home: the Repository and its shelves ---------- */

.repo { padding: clamp(3rem, 7vw, 6.5rem) 0 var(--section); background-color: var(--forest); }
.repo__title { font-size: var(--t-h2); max-width: 13ch; }

.shelf { margin-top: clamp(4rem, 9vw, 7.5rem); }
.shelf__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 2rem; margin-bottom: 1.25rem; }
.shelf__hint { font-size: var(--t-small); color: var(--on-dark-soft); }
.shelf__grid { display: grid; gap: 2.25rem; }

.shelf__case {
  display: flex; align-items: flex-end; gap: 5px;
  height: clamp(18rem, 78vw, 23.5rem);
  margin-inline: calc(var(--gutter) * -1); padding: 1.5rem var(--gutter) 0;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.shelf__case::-webkit-scrollbar { display: none; }
.shelf__board {
  height: 0.6875rem; margin-inline: calc(var(--gutter) * -1);
  background: linear-gradient(#c7ad74, #8d7746 45%, #5f4f2a);
  box-shadow: 0 14px 22px -8px rgba(0, 0, 0, 0.55);
}

.spine {
  --spine: #24584c; --foil: var(--brass-light);
  position: relative; flex: 1 0 3.75rem; max-width: 5.5rem; height: var(--h, 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 1.125rem 0 1.25rem; margin: 0;
  border: 0; border-radius: 3px 3px 0 0; cursor: pointer;
  background: var(--spine); color: var(--foil);
  box-shadow: inset 7px 0 9px -7px rgba(255, 255, 255, 0.2), inset -9px 0 12px -8px rgba(0, 0, 0, 0.55);
  scroll-snap-align: center;
  transition: transform 0.5s var(--ease), box-shadow 0.5s;
  -webkit-tap-highlight-color: transparent;
}
.spine::before, .spine::after {
  content: ""; position: absolute; left: 0; right: 0; height: 1px; background: currentColor; opacity: 0.6;
  box-shadow: 0 4px 0 currentColor;
}
.spine::before { top: 3.25rem; }
.spine::after { bottom: 3rem; }
.spine__num { font: 600 0.9375rem/1 var(--serif); letter-spacing: 0.1em; min-height: 1rem; }
.spine__title { writing-mode: vertical-rl; font: 600 clamp(1.0625rem, 1.5vw, 1.3125rem)/1 var(--serif); letter-spacing: 0.05em; white-space: nowrap; }
.spine .star { width: 0.75rem; height: 0.75rem; }
.spine--ink { --spine: #20211e; }
.spine--deep { --spine: #0d1f1b; }
.spine--paper { --spine: #e6dcc8; --foil: #173a32; }
.spine--brass { --spine: #9b8450; --foil: #14201b; }
.spine--sage { --spine: #7c8f82; --foil: #10201b; }
.spine:hover { transform: translateY(-0.5rem); }
.spine[aria-selected="true"] { transform: translateY(-1.125rem); box-shadow: inset 7px 0 9px -7px rgba(255, 255, 255, 0.2), inset -9px 0 12px -8px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--brass-light); }
.spine:focus-visible { outline-offset: 4px; }

.volume { padding-top: 1.5rem; border-top: 1px solid rgba(180, 154, 99, 0.6); }
.volume + .volume { margin-top: 2.5rem; }
.volume__title { margin-top: 0.75rem; font-size: var(--t-h3); }
.volume__line { margin-top: 0.75rem; font: italic 500 var(--t-lede)/1.25 var(--serif); color: var(--brass-light); }
.volume__topics { margin-top: 0.75rem; color: var(--on-dark-soft); }
.volume .link { margin-top: 1.25rem; }
@keyframes nk-open { from { opacity: 0; transform: translateY(0.75rem); } to { opacity: 1; transform: none; } }
[data-motion="on"] .volume.is-open { animation: nk-open 0.6s var(--ease) both; }

@media (min-width: 64em) {
  .shelf__grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(3rem, 5vw, 5rem); align-items: end; }
  .shelf__case { margin-inline: 0; padding-inline: 0.75rem; overflow: visible; height: 24rem; gap: 6px; }
  .shelf__board { margin-inline: 0; }
  .shelf__panels { padding-bottom: 0.6875rem; min-height: 17rem; }
}

/* ---------- Home: the collection (recent additions) ---------- */

.entries { list-style: none; padding: 0; border-top: 1px solid var(--charcoal); }
.entry { border-bottom: 1px solid var(--rule); }
.entry a { position: relative; display: grid; gap: 0.625rem; padding: clamp(1.5rem, 3vw, 2.25rem) 0; text-decoration: none; }
.entry a::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--brass-ink); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.6s var(--ease); }
.entry a:hover::before, .entry a:focus-visible::before { transform: scaleX(1); }
.entry__title { font: 500 var(--t-h3)/1.06 var(--serif); letter-spacing: -0.01em; transition: color 0.3s; }
.entry a:hover .entry__title { color: var(--forest); }
.entry__text { max-width: 48ch; color: var(--text-soft); }
.entry__read { display: inline-flex; align-items: center; gap: 0.75em; margin-top: 0.25rem; font: 600 var(--t-meta)/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--forest); }
.entry a:hover .arr { transform: translateX(6px); }
@media (min-width: 48em) {
  .entry a { grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 2rem; }
  .entry__meta, .entry__title, .entry__text { grid-column: 1; }
  .entry__read { grid-column: 2; grid-row: 1 / span 3; align-self: center; margin: 0; }
}
.note { font-size: var(--t-small); color: var(--text-soft); font-style: italic; }
.on-dark .note { color: var(--on-dark-soft); }

/* ---------- Home: one life, many lessons ---------- */

.story { background-color: var(--charcoal); }
.niche {
  position: relative; width: min(100%, 27rem); margin-inline: auto;
  padding: clamp(5.5rem, 22vw, 9rem) clamp(1.75rem, 6vw, 3rem) clamp(2.25rem, 6vw, 3.25rem);
  background-color: var(--ivory); background-image: url("../img/grain-dark.png"); color: var(--charcoal);
  border-radius: 999px 999px 0 0; text-align: center;
}
.niche::before { content: ""; position: absolute; inset: 0.625rem; bottom: 0; border: 1px solid var(--brass); border-bottom: 0; border-radius: 999px 999px 0 0; pointer-events: none; }
.niche .star { margin: 0 auto 1.5rem; width: 1.25rem; height: 1.25rem; color: var(--brass-ink); }
.niche__quote { font: italic 500 clamp(1.5rem, 1.2rem + 1.5vw, 2.125rem)/1.2 var(--serif); }
.niche--photo { padding: 0; overflow: hidden; aspect-ratio: 4 / 5; }
.niche--photo img { width: 100%; height: 100%; object-fit: cover; }
.story__name { font: 500 var(--t-h3)/1.1 var(--serif); color: var(--brass-light); }
.story blockquote.lede { font-style: italic; }

/* ---------- Home: curiosity ---------- */

.curious { position: relative; overflow: hidden; text-align: center; background-color: var(--ivory-shade); }
.curious .wrap { position: relative; }
.dome {
  position: absolute; left: 50%; top: 50%; width: min(150vw, 64rem); height: auto;
  transform: translate(-50%, -50%) rotate(var(--turn, 0deg)); color: rgba(109, 90, 45, 0.26); pointer-events: none;
}
.search {
  display: flex; align-items: stretch; width: min(100%, 40rem); margin: clamp(1.75rem, 4vw, 2.75rem) auto 0;
  background: var(--ivory); border: 1px solid var(--charcoal); border-radius: 2px;
}
.search:focus-within { outline: 2px solid var(--forest); outline-offset: 3px; }
.search input {
  flex: 1; min-width: 0; padding: 1rem 0 1rem 1.25rem; border: 0; background: transparent; outline: 0;
  font: 500 clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem)/1.2 var(--serif);
}
.search input::placeholder { color: #5c6058; opacity: 1; }
.search button {
  flex: none; display: inline-flex; align-items: center; gap: 0.6em; padding: 0 1.25rem; border: 0; cursor: pointer;
  background: var(--forest); color: var(--ivory);
  font: 600 var(--t-meta)/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase;
}
.search button:hover { background: var(--forest-deep); }
@media (max-width: 39.99em) { .search button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .search button { padding: 0 1.125rem; } }
.topics { list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.625rem; width: min(100%, 50rem); margin: clamp(1.75rem, 4vw, 2.5rem) auto 0; }
.topics a {
  display: inline-flex; align-items: center; min-height: 2.875rem; padding: 0.4rem 1.2rem;
  border: 1px solid rgba(32, 33, 30, 0.34); border-radius: 999px; background: rgba(243, 237, 225, 0.82);
  font: 500 1.25rem/1.1 var(--serif); text-decoration: none;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.topics a:hover { background: var(--forest); border-color: var(--forest); color: var(--ivory); }

/* ---------- Home: the listening room ---------- */

.listen { background-color: var(--forest-deep); }
.formats { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(1.25rem, 3vw, 2.5rem); border-top: 1px solid var(--rule-dark); }
.formats li { padding: clamp(0.875rem, 2vw, 1.25rem) 0; border-bottom: 1px solid var(--rule-dark); font: 500 clamp(1.25rem, 1.05rem + 1vw, 1.875rem)/1.1 var(--serif); }

/* ---------- Home: pass it on ---------- */

.teach { text-align: center; background-color: var(--ivory); }
.teach__lines { display: grid; gap: 0.5rem; margin-top: clamp(1.75rem, 4vw, 2.75rem); font: 500 var(--t-lede)/1.3 var(--serif); color: var(--text-soft); }
.teach__ask { margin: clamp(1.75rem, 4vw, 2.75rem) auto 0; max-width: 22ch; font: 600 var(--t-h3)/1.1 var(--serif); color: var(--forest); }
.teach .btn { margin-top: clamp(1.75rem, 4vw, 2.5rem); }
.creed { margin-top: var(--section); padding-top: clamp(2rem, 4vw, 3rem); border-top: 1px solid var(--brass); font: italic 500 var(--t-h3)/1.15 var(--serif); }

/* ---------- Wayfinding rail (wide screens, home only) ---------- */

.rail { display: none; }
@media (min-width: 80em) and (min-height: 40em) {
  .rail { display: block; position: fixed; right: 1.125rem; top: 50%; z-index: 40; transform: translateY(-50%); }
  .rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.125rem; }
  .rail a { position: relative; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; text-decoration: none; --focus: var(--brass); }
  .rail a::before { content: ""; width: 0.4375rem; height: 0.4375rem; border-radius: 50%; border: 1px solid var(--brass); background: rgba(14, 34, 29, 0.35); transition: transform 0.3s, background-color 0.3s; }
  .rail a[aria-current="true"]::before { background: var(--brass); transform: scale(1.6); }
  .rail span {
    position: absolute; right: 2rem; top: 50%; transform: translate(0.5rem, -50%); white-space: nowrap;
    padding: 0.5rem 0.75rem; background: var(--forest-deep); color: var(--ivory); border: 1px solid rgba(180, 154, 99, 0.5);
    font: 600 0.6875rem/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase;
    opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
  }
  .rail a:hover span, .rail a:focus-visible span { opacity: 1; transform: translate(0, -50%); }
}

/* ---------- Inner pages ---------- */

.page-head {
  padding: calc(var(--head-h) + clamp(2.75rem, 8vw, 6rem)) 0 clamp(2.75rem, 7vw, 5.5rem);
  color: var(--on-dark); --focus: var(--brass-light);
  background-color: var(--forest-deep);
  background-image: url("../img/grain-light.png"), radial-gradient(80% 90% at 85% 0%, rgba(47, 102, 88, 0.5), rgba(14, 34, 29, 0) 70%);
  border-bottom: 1px solid var(--brass);
}
.page-head .meta { margin-bottom: 1rem; color: var(--brass-light); }
.page-head__title { font-size: clamp(2.625rem, 1.5rem + 5vw, 5.5rem); max-width: 16ch; }
.page-head__lede { margin-top: clamp(1rem, 2.5vw, 1.75rem); max-width: 34ch; font: 500 var(--t-lede)/1.3 var(--serif); color: var(--on-dark-soft); }
[data-motion="on"] .page-head__title { animation: nk-rise 1s var(--ease) 0.1s both; }
[data-motion="on"] .page-head__lede { animation: nk-rise 1s var(--ease) 0.25s both; }

.crumbs { margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; font: 600 var(--t-meta)/1.4 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--on-dark-soft); }
.crumbs li + li::before { content: "/"; margin-right: 0.75rem; color: var(--brass); }
.crumbs a { text-decoration: none; padding: 0.5rem 0; }
.crumbs a:hover { color: var(--brass-light); }
.crumbs [aria-current] { color: var(--brass-light); }

.prose { max-width: 40rem; }
.prose > * + * { margin-top: 1.25rem; }
.prose h2 { font-size: var(--t-h3); margin-top: 3rem; }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.25rem; }
.prose li + li { margin-top: 0.5rem; }
.prose a { color: var(--forest); }
.prose .lede { color: var(--charcoal); }

/* Three statements set like engraved plaques. */
.plaques { display: grid; gap: clamp(2rem, 4vw, 3rem); }
.plaque { padding-top: 1.5rem; border-top: 1px solid var(--brass); }
.plaque p:last-child { margin-top: 1rem; font: 500 var(--t-h3)/1.14 var(--serif); }
@media (min-width: 56em) { .plaques { grid-template-columns: 1.4fr 1fr 1.2fr; } }

/* Numbered steps: used only where the order is the point. */
.steps { list-style: none; padding: 0; display: grid; gap: clamp(2rem, 4vw, 3rem); counter-reset: step; }
.steps li { counter-increment: step; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.steps li::before { content: "0" counter(step); display: block; font: 500 clamp(3rem, 2rem + 4vw, 5rem)/0.9 var(--serif); color: var(--brass-ink); }
.steps h3 { margin-top: 1rem; font-size: var(--t-h3); letter-spacing: 0.06em; text-transform: uppercase; }
.steps p { margin-top: 0.75rem; color: var(--text-soft); max-width: 30ch; }
@media (min-width: 56em) { .steps { grid-template-columns: repeat(3, 1fr); } }

/* The building directory: every part of the site as a room. */
.directory { border-top: 1px solid var(--brass); }
.directory div { display: grid; gap: 0.25rem; padding: clamp(1rem, 2.4vw, 1.5rem) 0; border-bottom: 1px solid var(--rule-dark); }
.directory dt { font: 600 var(--t-meta)/1.4 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--on-dark-soft); }
.directory dd { font: 500 var(--t-h3)/1.1 var(--serif); }
.directory a { text-decoration: none; }
.directory a:hover { color: var(--brass-light); }
@media (min-width: 48em) { .directory div { grid-template-columns: 2fr 3fr; align-items: baseline; gap: 2rem; } }

/* Rows: subjects, ways to help, search results. */
.rows { list-style: none; padding: 0; border-top: 1px solid var(--charcoal); }
.row { display: grid; gap: 0.625rem; padding: clamp(1.5rem, 3vw, 2.25rem) 0; border-bottom: 1px solid var(--rule); scroll-margin-top: calc(var(--head-h) + 1rem); }
.row__title { font-size: var(--t-h3); }
.row__text { color: var(--text-soft); max-width: 52ch; }
.row .link { justify-self: start; margin-top: 0.25rem; }
@media (min-width: 56em) {
  .row { grid-template-columns: 9rem minmax(0, 1fr) auto; align-items: start; column-gap: 2rem; }
  .row > .meta { padding-top: 0.75rem; }
  .row .link { grid-column: 3; grid-row: 1; align-self: center; margin: 0; }
  .row__body { grid-column: 2; }
}
.row:target .row__title { color: var(--forest); }
.row:target { box-shadow: inset 3px 0 0 var(--brass); padding-left: 1.25rem; }

.contact-list { border-top: 1px solid var(--charcoal); }
.contact-list div { display: grid; gap: 0.375rem; padding: clamp(1.5rem, 3vw, 2.25rem) 0; border-bottom: 1px solid var(--rule); }
.contact-list dd a { font: 500 clamp(1.5rem, 1.1rem + 2.4vw, 3rem)/1.1 var(--serif); text-decoration: none; word-break: break-word; }
.contact-list dd a:hover { color: var(--forest); text-decoration: underline; text-decoration-color: var(--brass); }
@media (min-width: 56em) { .contact-list div { grid-template-columns: 14rem 1fr; align-items: baseline; } }

.checks { list-style: none; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.on-dark .checks { border-color: var(--rule-dark); }
.checks li { position: relative; padding: 1rem 0 1rem 2rem; border-bottom: 1px solid var(--rule); }
.on-dark .checks li { border-color: var(--rule-dark); }
.checks li::before { content: ""; position: absolute; left: 0.125rem; top: 1.5rem; width: 0.5rem; height: 0.5rem; background: var(--brass); transform: rotate(45deg); }

/* ---------- Forms ---------- */

.form { display: grid; gap: 1.5rem; max-width: 40rem; scroll-margin-top: calc(var(--head-h) + 2rem); }
.field { display: grid; gap: 0.5rem; }
.field label, .field legend { font: 600 var(--t-small)/1.3 var(--sans); padding: 0; }
.field__hint { font-size: var(--t-small); color: var(--text-soft); }
.field input[type="text"], .field input[type="email"], .field select, .field textarea {
  width: 100%; padding: 0.875rem 1rem; min-height: 3.25rem;
  background: #fbf8f1; border: 1px solid rgba(32, 33, 30, 0.45); border-radius: 2px;
  font-size: 1.0625rem; line-height: 1.5;
}
.field textarea { min-height: 13rem; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; border-color: var(--forest); }
.field [aria-invalid="true"] { border-color: #8c2f1b; box-shadow: inset 3px 0 0 #8c2f1b; }
.field__error { font-size: var(--t-small); font-weight: 600; color: #8c2f1b; }
.field--check { grid-template-columns: auto 1fr; align-items: start; column-gap: 0.875rem; }
.field--check input { width: 1.375rem; height: 1.375rem; margin: 0.15rem 0 0; accent-color: var(--forest); }
.field--check label { font-weight: 400; font-size: var(--t-small); line-height: 1.5; }
.field--check .field__error { grid-column: 2; }
.hp { position: absolute; left: -200vw; width: 1px; height: 1px; overflow: hidden; }

.notice { padding: 1.5rem 1.5rem 1.5rem 1.75rem; border-left: 3px solid var(--brass); background: #fbf8f1; max-width: 40rem; scroll-margin-top: calc(var(--head-h) + 2rem); }
.notice h2 { font-size: var(--t-h3); }
.notice p { margin-top: 0.75rem; }
.notice--error { border-left-color: #8c2f1b; }

/* ---------- Repository preview ---------- */

.record { padding-block: clamp(2.5rem, 6vw, 4.5rem); border-bottom: 1px solid var(--rule); }
.record__title { margin-top: 1rem; font-size: var(--t-h2); max-width: 18ch; }
.record__dek { margin-top: 1.25rem; font: italic 500 var(--t-lede)/1.3 var(--serif); color: var(--text-soft); max-width: 30ch; }
.index-list { list-style: none; padding: 0; border-top: 1px solid var(--charcoal); }
.index-list li { border-bottom: 1px solid var(--rule); }
.index-list a, .index-list span.index-list__item { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1.125rem 0; text-decoration: none; font: 500 clamp(1.25rem, 1.1rem + 0.8vw, 1.625rem)/1.2 var(--serif); }
.index-list a:hover { color: var(--forest); }
.index-list small { flex: none; font: 600 var(--t-meta)/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-soft); }

/* ---------- Footer ---------- */

.site-foot { padding: clamp(4rem, 9vw, 7rem) 0 2rem; color: var(--on-dark); --focus: var(--brass-light); background-color: var(--forest-deep); border-top: 1px solid var(--brass); }
.site-foot__top { display: grid; gap: 2rem; justify-items: start; padding-bottom: clamp(2.5rem, 6vw, 4.5rem); border-bottom: 1px solid var(--rule-dark); }
.site-foot__brand img { width: 11.875rem; }
.site-foot__tagline { font: 500 var(--t-h3)/1.1 var(--serif); }
.site-foot__line { margin-top: 0.75rem; font: italic 500 var(--t-lede)/1.3 var(--serif); color: var(--brass-light); }
.site-foot__creed .btn { margin-top: 1.75rem; }
.site-foot__nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem 1.5rem; padding-block: clamp(2.5rem, 6vw, 4rem); }
.site-foot__col ul { list-style: none; padding: 0; margin-top: 1rem; }
.site-foot__col a { display: inline-block; padding: 0.4375rem 0; text-decoration: none; color: var(--on-dark); }
.site-foot__col a:hover, .site-foot__legal a:hover { color: var(--brass-light); text-decoration: underline; }
.site-foot__base { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 2rem; padding-top: 1.75rem; border-top: 1px solid var(--rule-dark); font-size: var(--t-small); color: var(--on-dark-soft); }
.site-foot__legal { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.site-foot__legal a { display: inline-block; padding: 0.375rem 0; text-decoration: none; }
.motion-toggle { display: inline-flex; align-items: center; gap: 0.625rem; min-height: 2.75rem; padding: 0 1rem; background: none; border: 1px solid var(--rule-dark); border-radius: 999px; cursor: pointer; font-size: var(--t-small); color: var(--on-dark-soft); }
.motion-toggle:hover { border-color: var(--brass-light); color: var(--ivory); }
.motion-toggle__dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--brass-light); }
[data-motion="off"] .motion-toggle__dot { background: transparent; box-shadow: inset 0 0 0 1px var(--on-dark-soft); }
@media (min-width: 60em) {
  .site-foot__top { grid-template-columns: auto 1fr; align-items: center; gap: clamp(3rem, 8vw, 8rem); }
  .site-foot__brand img { width: 16.25rem; }
  .site-foot__nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .motion-toggle { margin-left: auto; }
}

/* ---------- The leaf: a page turns when you open the Repository or an entry ---------- */

.leaf {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: var(--gutter);
  background-color: var(--ivory); background-image: url("../img/grain-dark.png"); color: var(--charcoal); text-align: center;
  transform: translateY(101%); visibility: hidden; pointer-events: none;
}
.leaf__title { margin-top: 1rem; font: 500 var(--t-h2)/1.04 var(--serif); letter-spacing: -0.012em; max-width: 16ch; }
.leaf.is-opening { visibility: visible; transform: none; transition: transform 0.6s var(--ease-inout); }
.leaf.is-opening .leaf__inner { animation: nk-rise 0.6s var(--ease) 0.25s both; }
@keyframes nk-leaf-away { from { transform: none; visibility: visible; } to { transform: translateY(-101%); visibility: hidden; } }
html[data-arrive][data-motion="on"] .leaf { visibility: visible; transform: none; animation: nk-leaf-away 0.75s var(--ease-inout) 0.12s both; }

/* ---------- Print ---------- */

@media print {
  .site-head, .site-foot__nav, .rail, .leaf, .hall__cue, .motion-toggle { display: none !important; }
  body { background: #fff; }
}

/* Grid children may shrink below their content, so the shelf scrolls instead of widening the page. */
.shelf__grid > *, .split > * { min-width: 0; }
