/* ==========================================================================
   The Frantzén Compendium — shared stylesheet
   Palette: lacquer (dark rooms) / birch (daylight rooms) / urushi red / brass
   Type: Bodoni Moda (display) · Karla (body) · IBM Plex Mono (labels & data)
   ========================================================================== */

:root {
  --lacquer:       #15110F;
  --lacquer-soft:  #211B17;
  --lacquer-line:  #322A24;

  --birch:         #E2E3DB;
  --birch-soft:    #D4D6CC;
  --birch-line:    #C0C2B6;

  --urushi:        #9A3324;
  --urushi-bright: #C05442;
  --brass:         #B08A4A;
  --pine:          #2B3A33;

  --on-dark:       #DCDDD4;
  --on-dark-dim:   #979A8E;
  --on-light:      #1B1815;
  --on-light-dim:  #5C5B52;

  --display: "Bodoni Moda", "Didot", "Times New Roman", serif;
  --body:    "Karla", "Helvetica Neue", Arial, sans-serif;
  --mono:    "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 5rem);
  --spine: 5.5rem;

  --step--1: clamp(0.78rem, 0.75rem + 0.15vw, 0.86rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.09rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --step-3:  clamp(2rem, 1.6rem + 2vw, 3.1rem);
  --step-4:  clamp(2.6rem, 1.8rem + 4vw, 5.4rem);
}

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

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

body {
  margin: 0;
  background: var(--lacquer);
  color: var(--on-dark);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.68;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { text-decoration-color: var(--brass); }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--brass); color: var(--lacquer);
  padding: 0.7rem 1.1rem; font-family: var(--mono); font-size: 0.8rem;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- Type roles ---------------------------------------------------- */

h1, h2, h3, h4 { font-family: var(--display); font-weight: 500; line-height: 1.08; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { margin: 0 0 1.1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

.eyebrow {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 1.4rem;
  display: block;
  max-width: none;
}

.lede {
  font-family: var(--display);
  font-size: var(--step-2);
  line-height: 1.34;
  font-weight: 400;
  max-width: 30ch;
}

.small { font-size: var(--step--1); line-height: 1.6; color: var(--on-dark-dim); }
.mono { font-family: var(--mono); font-size: var(--step--1); letter-spacing: 0.04em; }

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

.masthead {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem var(--gutter);
  background: rgba(21, 17, 15, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--lacquer-line);
}
.masthead__mark {
  font-family: var(--display);
  font-size: 1.12rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.masthead__mark span { color: var(--brass); }

.nav { display: flex; align-items: center; gap: 1.5rem; }
.nav a {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--on-dark-dim);
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--on-dark); border-bottom-color: var(--brass); }

.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--lacquer-line); color: var(--on-dark);
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.11em; text-transform: uppercase;
  padding: 0.5rem 0.8rem; cursor: pointer;
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed; inset: 3.4rem 0 auto 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--lacquer); border-bottom: 1px solid var(--lacquer-line);
    padding: 0.5rem var(--gutter) 1.5rem;
    max-height: calc(100dvh - 3.4rem); overflow-y: auto;
  }
  .nav[hidden] { display: none; }
  .nav a { width: 100%; padding: 0.75rem 0; border-bottom: 1px solid var(--lacquer-line); }
}

/* ---------- Signature: the elevation spine -------------------------------- */

.spine {
  position: fixed; left: 1.25rem; top: 50%; transform: translateY(-50%);
  z-index: 40; display: flex; flex-direction: column; gap: 0.85rem;
  padding-left: 0.85rem; border-left: 1px solid var(--lacquer-line);
  max-width: 8.5rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease;
}
.spine.is-ready { opacity: 1; pointer-events: auto; }
.spine__stop {
  display: flex; align-items: center; gap: 0.55rem;
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--on-dark-dim); text-decoration: none; opacity: 0.55; transition: opacity 0.3s, color 0.3s;
  line-height: 1.25;
}
.spine__stop::before {
  content: ""; width: 6px; height: 6px; border: 1px solid currentColor; border-radius: 50%;
  transition: background 0.3s;
}
.spine__stop:hover { opacity: 1; }
.spine__stop.is-current { opacity: 1; color: var(--brass); }
.spine__stop.is-current::before { background: var(--brass); }
@media (max-width: 1500px) { .spine { display: none; } }

/* ---------- Layout blocks ------------------------------------------------- */

.band { padding: clamp(3.5rem, 8vw, 7.5rem) var(--gutter); position: relative; }
.band--light { background: var(--birch); color: var(--on-light); }
.band--light .eyebrow { color: var(--urushi); }
.band--light .small { color: var(--on-light-dim); }
.band--light a:hover { text-decoration-color: var(--urushi); }
.band--soft { background: var(--lacquer-soft); }
.band--tight { padding-top: clamp(2rem, 4vw, 3rem); }

.wrap { max-width: 74rem; margin: 0 auto; }
.wrap--narrow { max-width: 46rem; }

.split {
  display: grid; gap: clamp(1.75rem, 4vw, 4rem);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 860px) {
  .split { grid-template-columns: 14rem minmax(0, 1fr); align-items: start; }
  .split__aside { position: sticky; top: 5.5rem; }
}

.stack > * + * { margin-top: 1.1em; }
.stack-lg > * + * { margin-top: clamp(2rem, 4vw, 3.25rem); }

.rule { height: 1px; background: var(--lacquer-line); border: 0; margin: 0; }
.band--light .rule { background: var(--birch-line); }

/* ---------- Hero ---------------------------------------------------------- */

.hero {
  min-height: clamp(30rem, 88vh, 52rem);
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(4rem, 10vh, 8rem) var(--gutter) clamp(3rem, 6vh, 5rem);
  position: relative; overflow: hidden;
  background:
    radial-gradient(70% 90% at 78% 12%, rgba(176, 138, 74, 0.14), transparent 62%),
    radial-gradient(55% 70% at 12% 88%, rgba(154, 51, 36, 0.13), transparent 60%),
    var(--lacquer);
}
.hero__inner { max-width: 74rem; margin: 0 auto; width: 100%; }
.hero__title {
  font-size: var(--step-4);
  line-height: 0.92;
  letter-spacing: -0.025em;
  margin: 0 0 1.5rem;
}
.hero__title em { font-style: italic; color: var(--brass); }
.hero__meta {
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem;
  font-family: var(--mono); font-size: var(--step--1);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-dark-dim);
  padding-top: 1.6rem; margin-top: 2.4rem; border-top: 1px solid var(--lacquer-line);
}
.hero__meta b { color: var(--brass); font-weight: 400; }

/* the doorbell — the entry ritual, used once */
.bell {
  margin-top: 2.6rem;
  display: inline-flex; align-items: center; gap: 0.9rem;
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--on-dark); font-family: var(--mono);
  font-size: var(--step--1); letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none;
}
.bell__button {
  position: relative; width: 2.6rem; height: 2.6rem; flex: none;
  border: 1px solid var(--brass); border-radius: 50%;
  display: grid; place-items: center;
}
.bell__button::after {
  content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--brass);
}
.bell__button::before {
  content: ""; position: absolute; inset: -1px; border: 1px solid var(--brass); border-radius: 50%;
  animation: ring 3.4s ease-out infinite; opacity: 0;
}
@keyframes ring {
  0%   { transform: scale(1); opacity: 0.75; }
  70%  { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}
.bell:hover .bell__button { background: rgba(176, 138, 74, 0.12); }

/* ---------- Cards & indexes ----------------------------------------------- */

.grid { display: grid; gap: 1px; background: var(--lacquer-line); border: 1px solid var(--lacquer-line); }
.band--light .grid { background: var(--birch-line); border-color: var(--birch-line); }
@media (min-width: 700px) { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid--3 { grid-template-columns: repeat(3, 1fr); } }

.cell {
  background: var(--lacquer); padding: clamp(1.4rem, 3vw, 2.2rem);
  display: flex; flex-direction: column; gap: 0.7rem;
  text-decoration: none; transition: background 0.25s;
}
.band--light .cell { background: var(--birch); }
.band--soft .cell { background: var(--lacquer-soft); }
a.cell:hover { background: var(--lacquer-soft); }
.band--light a.cell:hover { background: var(--birch-soft); }
.cell__index {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--brass);
}
.band--light .cell__index { color: var(--urushi); }
.cell h3 { font-size: var(--step-1); }
.cell p { font-size: 0.94rem; color: var(--on-dark-dim); margin: 0; }
.band--light .cell p { color: var(--on-light-dim); }
.cell__more {
  margin-top: auto; padding-top: 0.9rem;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
}

/* ---------- Floors (the ascent) ------------------------------------------- */

.floor { display: grid; gap: 1.2rem 3rem; padding: clamp(1.8rem, 4vw, 2.8rem) 0; border-top: 1px solid var(--lacquer-line); }
.band--light .floor { border-top-color: var(--birch-line); }
@media (min-width: 800px) { .floor { grid-template-columns: 11rem minmax(0, 1fr); } }
.floor__tag {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brass);
}
.band--light .floor__tag { color: var(--urushi); }

/* ---------- Fact list ----------------------------------------------------- */

.facts { list-style: none; margin: 0; padding: 0; }
.facts li {
  display: grid; gap: 0.15rem 1.5rem; padding: 0.85rem 0;
  border-bottom: 1px solid var(--lacquer-line);
}
.band--light .facts li { border-bottom-color: var(--birch-line); }
@media (min-width: 620px) { .facts li { grid-template-columns: 12rem minmax(0, 1fr); } }
.facts dt, .facts .k {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--on-dark-dim); padding-top: 0.25rem;
}
.band--light .facts .k { color: var(--on-light-dim); }

/* ---------- Notes / callouts ---------------------------------------------- */

.note {
  border-left: 2px solid var(--brass);
  padding: 0.2rem 0 0.2rem 1.2rem;
  font-size: 0.95rem;
  color: var(--on-dark-dim);
}
.band--light .note { border-left-color: var(--urushi); color: var(--on-light-dim); }
.note strong { color: var(--on-dark); font-weight: 600; }
.band--light .note strong { color: var(--on-light); }

/* ---------- Buttons ------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.13em; text-transform: uppercase;
  padding: 0.85rem 1.4rem; text-decoration: none; cursor: pointer;
  border: 1px solid var(--brass); color: var(--brass); background: none;
  transition: background 0.2s, color 0.2s;
}
.btn:hover { background: var(--brass); color: var(--lacquer); }
.btn--solid { background: var(--urushi); border-color: var(--urushi); color: #F4EFE9; }
.btn--solid:hover { background: var(--urushi-bright); border-color: var(--urushi-bright); color: #fff; }
.btn--ghost { border-color: var(--on-dark-dim); color: var(--on-dark); }
.btn--ghost:hover { background: var(--on-dark); color: var(--lacquer); }
.band--light .btn { border-color: var(--urushi); color: var(--urushi); }
.band--light .btn:hover { background: var(--urushi); color: #F4EFE9; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ---------- Q&A ----------------------------------------------------------- */

.qa { border-top: 1px solid var(--lacquer-line); }
.band--light .qa { border-top-color: var(--birch-line); }
.qa details { border-bottom: 1px solid var(--lacquer-line); }
.band--light .qa details { border-bottom-color: var(--birch-line); }
.qa summary {
  cursor: pointer; list-style: none; padding: 1.2rem 2.5rem 1.2rem 0; position: relative;
  font-family: var(--display); font-size: var(--step-1); line-height: 1.3;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after {
  content: "+"; position: absolute; right: 0.3rem; top: 1.1rem;
  font-family: var(--mono); color: var(--brass); font-size: 1.2rem;
}
.band--light .qa summary::after { color: var(--urushi); }
.qa details[open] summary::after { content: "–"; }
.qa .qa__body { padding: 0 0 1.5rem; }

/* ---------- Legal / document pages ---------------------------------------- */

.doc { background: var(--birch); color: var(--on-light); }
.doc h2 { font-size: var(--step-2); margin: 2.6rem 0 0.9rem; }
.doc h3 { font-size: var(--step-1); margin: 1.9rem 0 0.6rem; font-family: var(--body); font-weight: 700; letter-spacing: 0; }
.doc p, .doc li { max-width: 42rem; }
.doc ul, .doc ol { padding-left: 1.2rem; margin: 0 0 1.1em; }
.doc li { margin-bottom: 0.45em; }
.doc table { width: 100%; border-collapse: collapse; margin: 1.2rem 0 2rem; font-size: 0.9rem; }
.doc th, .doc td { text-align: left; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--birch-line); vertical-align: top; }
.doc th { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.11em; text-transform: uppercase; color: var(--on-light-dim); }
.doc .toc { background: var(--birch-soft); padding: 1.4rem 1.6rem; margin: 2rem 0; }
.doc .toc ol { margin: 0; }
.table-scroll { overflow-x: auto; }

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

.footer {
  background: var(--lacquer); border-top: 1px solid var(--lacquer-line);
  padding: clamp(3rem, 6vw, 5rem) var(--gutter) 2.5rem;
  color: var(--on-dark);
}
.footer__grid { display: grid; gap: 2.5rem; max-width: 74rem; margin: 0 auto; }
@media (min-width: 760px) { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer h4 {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--brass); font-weight: 400; margin-bottom: 1rem;
}
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 0.55rem; }
.footer a { color: var(--on-dark-dim); text-decoration: none; font-size: 0.92rem; }
.footer a:hover { color: var(--on-dark); text-decoration: underline; text-decoration-color: var(--brass); }
.footer__base {
  max-width: 74rem; margin: 3rem auto 0; padding-top: 1.6rem;
  border-top: 1px solid var(--lacquer-line);
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
  font-size: 0.82rem; color: var(--on-dark-dim);
}
.footer__base p { max-width: 46rem; margin: 0; }

/* ---------- Cookie consent ------------------------------------------------ */

.cc-backdrop {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(10, 8, 7, 0.62); backdrop-filter: blur(3px);
}
.cc-backdrop[hidden], .cc[hidden], .cc-panel[hidden] { display: none; }

.cc {
  position: fixed; z-index: 950; left: 0; right: 0; bottom: 0;
  background: var(--lacquer-soft); color: var(--on-dark);
  border-top: 1px solid var(--brass);
  padding: clamp(1.25rem, 3vw, 2rem) var(--gutter);
  animation: cc-in 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes cc-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
.cc__inner {
  max-width: 74rem; margin: 0 auto;
  display: grid; gap: 1.25rem 3rem; align-items: center;
}
@media (min-width: 980px) { .cc__inner { grid-template-columns: minmax(0, 1fr) auto; } }
.cc h2 { font-size: var(--step-1); margin-bottom: 0.5rem; }
.cc p { font-size: 0.9rem; color: var(--on-dark-dim); max-width: 54rem; margin: 0; }
.cc p a { color: var(--brass); }
.cc__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.cc__actions .btn { padding: 0.75rem 1.1rem; }

.cc-panel {
  position: fixed; z-index: 960; inset: auto 0 0 0;
  max-height: 88dvh; overflow-y: auto;
  background: var(--birch); color: var(--on-light);
  padding: clamp(1.5rem, 4vw, 2.5rem) var(--gutter) 2rem;
  border-top: 2px solid var(--urushi);
}
@media (min-width: 860px) {
  .cc-panel { inset: 50% auto auto 50%; transform: translate(-50%, -50%); max-width: 44rem; border: 1px solid var(--birch-line); border-top: 2px solid var(--urushi); }
}
.cc-panel h2 { font-size: var(--step-2); margin-bottom: 0.6rem; }
.cc-cat { border-top: 1px solid var(--birch-line); padding: 1.1rem 0; }
.cc-cat__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.cc-cat__head h3 { font-family: var(--body); font-weight: 700; font-size: 1rem; letter-spacing: 0; }
.cc-cat p { font-size: 0.88rem; color: var(--on-light-dim); margin: 0.4rem 0 0; }
.cc-switch { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; }
.cc-switch input { width: 1.05rem; height: 1.05rem; accent-color: var(--urushi); cursor: pointer; }
.cc-switch input:disabled { cursor: not-allowed; opacity: 0.5; }
.cc-panel__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.6rem; }

.cc-reopen {
  position: fixed; left: 1rem; bottom: 1rem; z-index: 500;
  background: var(--lacquer-soft); color: var(--on-dark-dim);
  border: 1px solid var(--lacquer-line); border-radius: 50%;
  width: 2.5rem; height: 2.5rem; cursor: pointer; font-size: 0.95rem;
  display: grid; place-items: center;
}
.cc-reopen:hover { color: var(--brass); border-color: var(--brass); }
.cc-reopen[hidden] { display: none; }

/* ---------- Utilities ----------------------------------------------------- */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.center { text-align: center; }
.center p, .center .lede { margin-left: auto; margin-right: auto; }
