/* ============================================================
   THE MEASURE OF TIME — exhibition stylesheet
   Gallery white · ink · patina green · brass
   ============================================================ */

:root {
  --paper:    #faf8f4;
  --paper-2:  #f3efe7;
  --ink:      #211f1a;
  --ink-soft: #55514a;
  --ink-faint:#8a857b;
  --patina:   #3d6b5c;
  --patina-deep: #2c5245;
  --brass:    #b08d3f;
  --brass-soft: #c8ab6e;
  --hairline: rgba(33, 31, 26, 0.16);
  --hairline-soft: rgba(33, 31, 26, 0.09);
  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  --rail-w: 12rem;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--brass); color: var(--paper); }

.mono {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}

a { color: inherit; }

/* ---------------- chapter rail ---------------- */
.rail {
  position: fixed;
  left: 0; top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  padding-left: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.rail.is-on { opacity: 1; pointer-events: auto; }
.rail ol { list-style: none; }
.rail li + li { margin-top: 1.1rem; }
.rail a {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color 0.35s ease;
}
.rail .rail-num {
  display: inline-block;
  width: 1.6rem;
  text-align: right;
  font-size: 0.62rem;
}
.rail .rail-name { position: relative; padding-bottom: 2px; }
.rail .rail-name::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.rail a.is-active { color: var(--ink); }
.rail a.is-active .rail-num { color: var(--brass); }
.rail a.is-active .rail-name::after { transform: scaleX(1); }
.rail a:hover { color: var(--patina); }

/* mobile chapter chip */
.mobile-chapter {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: none;
  justify-content: center;
  padding: 0.55rem 0;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--hairline-soft);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--patina);
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.mobile-chapter.is-on { opacity: 1; transform: translateY(0); }

/* ---------------- hero ---------------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  border-bottom: 1px solid var(--hairline-soft);
}
.hero-dial {
  position: absolute;
  inset: -20% -10%;
  width: 120%;
  height: 140%;
  opacity: 0.75;
}
.hero-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.7rem clamp(1.5rem, 4vw, 3rem);
  color: var(--ink-soft);
}
.hero-bar-tickets {
  text-decoration: none;
  color: var(--patina);
  border-bottom: 1px solid var(--brass);
  padding-bottom: 2px;
  transition: color 0.3s ease;
}
.hero-bar-tickets:hover { color: var(--patina-deep); }
.hero-inner { position: relative; z-index: 2; padding: 0 1.5rem; }
.hero-kicker { color: var(--patina); margin-bottom: 2.2rem; }
.hero-title {
  font-size: clamp(3.4rem, 11vw, 8.5rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: 0.01em;
  font-variant-ligatures: common-ligatures;
}
.hero-sub {
  margin-top: 2rem;
  font-style: italic;
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  color: var(--ink-soft);
}
.hero-meta {
  margin-top: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  color: var(--ink-soft);
  flex-wrap: wrap;
}
.hero-sep { width: 2.4rem; height: 1px; background: var(--brass); display: inline-block; }
.hero-scroll {
  position: absolute;
  bottom: 2rem; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink-faint);
  font-size: 0.58rem;
  letter-spacing: 0.22em;
}
.scroll-line {
  width: 1px; height: 3.4rem;
  background: linear-gradient(var(--brass), transparent);
  display: block;
  animation: scrollPulse 2.4s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { transform: scaleY(1); opacity: 1; transform-origin: top; }
  50% { transform: scaleY(0.55); opacity: 0.5; transform-origin: top; }
}

/* ---------------- prologue ---------------- */
.prologue { padding: 10rem 1.5rem 9rem; }
.prologue-inner { max-width: 44rem; margin: 0 auto; }
.section-eyebrow { color: var(--brass); margin-bottom: 2.4rem; }
.prologue .section-eyebrow { text-align: center; display: block; }
.prologue-lede {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.42;
  font-weight: 500;
}
.dropcap {
  float: left;
  font-size: 4.1em;
  line-height: 0.78;
  padding: 0.06em 0.12em 0 0;
  color: var(--patina);
  font-weight: 600;
}
.prologue-body {
  margin-top: 2.2rem;
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 38rem;
}
.prologue-rule {
  margin-top: 5rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.prologue-rule span { flex: 1; height: 1px; background: var(--hairline); }
.prologue-rule i { font-style: normal; color: var(--brass); font-size: 0.6rem; }

/* ---------------- chapters ---------------- */
.chapter {
  position: relative;
  border-top: 1px solid var(--hairline-soft);
}
.ch-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chapter { height: 420vh; }

.ch-head {
  position: absolute;
  top: clamp(1.6rem, 5vh, 3.5rem);
  left: 0; right: 0;
  text-align: center;
  z-index: 3;
  pointer-events: none;
}
.ch-eyebrow {
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  color: var(--ink-soft);
}
.ch-eyebrow .ch-no { color: var(--brass); }
.ch-eyebrow .ch-range::before {
  content: "";
  display: inline-block;
  width: 1.6rem; height: 1px;
  background: var(--hairline);
  vertical-align: middle;
  margin-right: 1.4rem;
}
.ch-title {
  margin-top: 0.9rem;
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  font-weight: 500;
  line-height: 1;
}
.ch-sub {
  margin-top: 0.5rem;
  font-style: italic;
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  color: var(--ink-soft);
}

.ch-fig {
  width: min(60vw, 78vh, 720px);
  margin-top: clamp(4rem, 12vh, 8rem);
}
.ch-fig svg { width: 100%; height: auto; display: block; overflow: visible; }

/* chapter progress hairline */
.ch-progress {
  position: absolute;
  right: clamp(1.2rem, 4vw, 3rem);
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 34vh;
  background: var(--hairline-soft);
}
.ch-progress-fill {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: var(--brass);
  transform: scaleY(0);
  transform-origin: top;
}

/* steps (museum labels) */
.steps {
  position: absolute;
  top: 100vh;
  bottom: 0;
  left: 0; right: 0;
  z-index: 5;
  pointer-events: none;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  padding: 0 clamp(1.2rem, 5vw, 5rem);
}
@media (min-width: 1101px) {
  .steps { padding-left: 13rem; }
}
.step {
  pointer-events: auto;
  align-self: center;
  justify-self: end;
  width: min(24rem, 86vw);
  opacity: 0;
  transform: translateY(2rem);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.step.is-visible { opacity: 1; transform: translateY(0); }
.step.is-visible.is-leaving { opacity: 0; transform: translateY(-1.6rem); pointer-events: none; }
.step:nth-child(even) { justify-self: start; }

.label-card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-top: 2px solid var(--patina);
  padding: 1.5rem 1.7rem 1.6rem;
  box-shadow: 0 24px 60px -32px rgba(33,31,26,0.28);
  transition: opacity 0.7s ease, transform 0.7s ease, border-top-color 0.45s ease, box-shadow 0.45s ease, translate 0.45s ease;
}
.label-card:hover {
  border-top-color: var(--brass);
  box-shadow: 0 30px 70px -30px rgba(33,31,26,0.34);
  translate: 0 -3px;
}
.label-cat { color: var(--brass); margin-bottom: 0.9rem; font-size: 0.6rem; }
.label-title { font-size: 1.45rem; font-weight: 600; line-height: 1.15; }
.label-meta {
  margin: 0.7rem 0 0.9rem;
  color: var(--ink-faint);
  font-size: 0.6rem;
  line-height: 1.7;
  text-transform: none;
  letter-spacing: 0.08em;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--hairline-soft);
}
.label-body { font-size: 1rem; line-height: 1.6; color: var(--ink-soft); }
.label-body em { color: var(--ink); }

.fact-card {
  background: var(--patina);
  color: var(--paper);
  padding: 1.8rem 1.9rem 1.9rem;
  box-shadow: 0 30px 70px -30px rgba(44, 82, 69, 0.55);
}
.fact-eyebrow { color: var(--brass-soft); margin-bottom: 1rem; }
.fact-big {
  font-family: var(--mono);
  font-size: clamp(2rem, 4vw, 2.9rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.fact-big--long { font-size: clamp(1.35rem, 3vw, 1.9rem); }
.fact-unit {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--brass-soft);
}
.fact-body { margin-top: 1.1rem; font-size: 0.98rem; line-height: 1.6; color: rgba(250, 248, 244, 0.85); }
.fact-body em { color: var(--paper); }

/* ---------------- coda ---------------- */
.coda {
  border-top: 1px solid var(--hairline-soft);
  background: var(--paper-2);
  padding: 9rem 1.5rem;
}
.coda-inner { max-width: 46rem; margin: 0 auto; }
.coda .section-eyebrow { display: block; }
.coda-title { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 500; line-height: 1.05; }
.coda-lede { margin-top: 1.6rem; font-size: 1.2rem; color: var(--ink-soft); max-width: 38rem; }

.drift { margin-top: 4.5rem; }
.drift-row + .drift-row { margin-top: 2rem; }
.drift-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.55rem;
}
.drift-name { font-size: 1.25rem; font-weight: 600; }
.drift-val { color: var(--patina); font-size: 0.62rem; }
.drift-track {
  height: 3px;
  background: var(--hairline-soft);
  position: relative;
  overflow: hidden;
}
.drift-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--patina), var(--brass));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.drift.is-visible .drift-bar { transform: scaleX(var(--w, 1)); }
.drift-note { margin-top: 2.4rem; color: var(--ink-faint); font-size: 0.6rem; text-transform: none; letter-spacing: 0.08em; }
.coda-close { margin-top: 4.5rem; font-size: 1.2rem; font-style: italic; color: var(--ink-soft); border-left: 2px solid var(--brass); padding-left: 1.6rem; }

/* ---------------- visit ---------------- */
.visit { padding: 9rem 1.5rem 8rem; border-top: 1px solid var(--hairline-soft); }
.visit-inner { max-width: 62rem; margin: 0 auto; }
.visit .section-eyebrow { display: block; }
.visit-title { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 500; }
.visit-grid {
  margin-top: 4rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
}
.visit-h {
  color: var(--brass);
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 1.2rem;
}
.visit-list { list-style: none; }
.visit-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: none;
  color: var(--ink-soft);
  padding: 0.45rem 0;
  border-bottom: 1px dotted var(--hairline-soft);
}
.visit-note { margin-top: 1.2rem; font-size: 0.95rem; font-style: italic; color: var(--ink-faint); line-height: 1.55; }

.visit-cta-row {
  margin-top: 4.5rem;
  display: flex;
  align-items: center;
  gap: 2.4rem;
  flex-wrap: wrap;
}
.cta {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  background: var(--patina);
  color: var(--paper);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 1.25rem 2.4rem;
  border: 1px solid var(--patina-deep);
  transition: background 0.3s ease, gap 0.3s ease;
}
.cta:hover { background: var(--patina-deep); gap: 1.5rem; }
.cta-arrow { color: var(--brass-soft); }
.visit-cta-note { color: var(--ink-faint); font-size: 0.62rem; transition: color 0.5s ease; max-width: 34rem; line-height: 1.9; }
.visit-cta-note .counter { color: var(--patina); }
.visit-cta-note.is-answered { color: var(--brass); }
.cta:active { transform: translateY(1px); }

/* keyboard focus — brass, unmistakable, on-theme */
a:focus-visible, .cta:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

/* ---------------- footer ---------------- */
.footer {
  border-top: 1px solid var(--hairline);
  background: var(--paper);
  padding: 3.4rem 1.5rem;
}
.footer-inner {
  max-width: 62rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: wrap;
}
.footer-title { font-size: 1.6rem; font-weight: 600; }
.footer-sub { margin-top: 0.4rem; color: var(--ink-faint); font-size: 0.6rem; }
.footer-meta { text-align: right; color: var(--ink-soft); font-size: 0.62rem; line-height: 2; text-transform: none; letter-spacing: 0.1em; }
.footer-meta a { color: var(--patina); text-decoration: none; border-bottom: 1px solid var(--brass); padding-bottom: 1px; }
.footer-meta a:hover { color: var(--patina-deep); }

/* ---------------- SVG shared ---------------- */
.svg-hairline { stroke: var(--hairline); fill: none; }
.svg-label {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  fill: var(--ink-soft);
}
.svg-label--brass { fill: var(--brass); }
.svg-label--faint { fill: var(--ink-faint); }

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) {
  .rail { display: none; }
  .mobile-chapter { display: flex; }
}

@media (max-width: 760px) {
  body { font-size: 18px; }
  /* the diagrams render ~2.6× smaller on phones — museum labels must stay readable */
  .svg-label { font-size: 17px; letter-spacing: 1.4px; }
  .chapter { height: 560vh; }
  .ch-fig { width: min(88vw, 52vh); margin-top: clamp(4rem, 10vh, 7rem); }
  .ch-progress { display: none; }
  .steps { padding: 0 1rem; }
  .step, .step:nth-child(even) { justify-self: center; align-self: end; margin-bottom: 3.5vh; }
  .label-card { padding: 1.2rem 1.35rem 1.35rem; }
  .label-title { font-size: 1.28rem; }
  .label-body { font-size: 0.92rem; }
  .fact-card { padding: 1.4rem 1.5rem 1.5rem; }
  .fact-body { font-size: 0.92rem; }
  .visit-grid { grid-template-columns: 1fr; gap: 2.4rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-meta { text-align: left; }
  .hero-title { line-height: 1.02; }
  .prologue { padding: 7rem 1.5rem 6rem; }
}

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-line { animation: none; }
  .step { opacity: 1; transform: none; transition: none; }
  .step.is-visible.is-leaving { opacity: 1; transform: none; pointer-events: auto; }
  .label-card, .label-card:hover { translate: none; transition: none; }
  .drift-bar { transition: none; transform: scaleX(var(--w, 1)); }
}
