/* ============ VERSO Type Co. ============ */
:root {
  --paper: #EFEBE2;
  --ink: #16140F;
  --accent: #002FA7;
  --accent-dark: #6478FF;
  --hairline: color-mix(in srgb, var(--ink) 22%, transparent);
  --pad: clamp(1.25rem, 4vw, 4rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Fraunces', serif;
  font-variation-settings: 'wght' 400, 'opsz' 14;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--paper); }

.f-meridian { font-family: 'Fraunces', serif; }
.f-circuit  { font-family: 'Recursive', monospace; font-variation-settings: 'MONO' 1, 'wght' 420; }
.f-elastic  { font-family: 'Anybody', sans-serif; }

.mono-tag {
  font-family: 'Recursive', monospace;
  font-variation-settings: 'MONO' 1, 'wght' 430;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- grid overlay ---------- */
.grid-overlay {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: 0; padding: 0 var(--pad);
  opacity: 0; transition: opacity 0.3s;
}
.grid-overlay.is-on { opacity: 1; }
.grid-overlay div { border-left: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.grid-overlay div:last-child { border-right: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---------- header ---------- */
.site-head {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 1.1rem var(--pad);
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.wordmark {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'wght' 700, 'opsz' 60;
  font-size: 1.15rem; text-decoration: none; color: var(--ink);
  letter-spacing: 0.02em;
}
.wordmark-co { font-variation-settings: 'wght' 380, 'opsz' 30; font-style: italic; }
.site-nav { display: flex; gap: 1.75rem; }
.site-nav a {
  font-family: 'Recursive', monospace;
  font-variation-settings: 'MONO' 1, 'wght' 430;
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  position: relative;
}
.site-nav a::after {
  content: ''; position: absolute; left: 0; bottom: -3px;
  width: 100%; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: right; transition: transform 0.35s cubic-bezier(0.7,0,0.2,1);
}
.site-nav a:hover::after, .site-nav a.is-current::after { transform: scaleX(1); transform-origin: left; }

.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%;
  background: var(--accent); transform-origin: left; transform: scaleX(0);
  z-index: 101; pointer-events: none;
}
.head-meta { display: flex; gap: 1.25rem; align-items: baseline; }
.grid-btn {
  background: none; border: 1px solid var(--hairline); color: var(--ink);
  padding: 0.2rem 0.55rem; cursor: pointer; border-radius: 999px;
  transition: all 0.25s;
}
.grid-btn:hover, .grid-btn.is-on { background: var(--accent); color: var(--paper); border-color: var(--accent); }

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 7rem var(--pad) 3rem;
  position: relative;
}
.hero-eyebrow { color: var(--accent); margin-bottom: 2vh; }
.hero-title {
  font-size: clamp(3.6rem, 24vw, 23rem);
  line-height: 0.82;
  letter-spacing: -0.02em;
  user-select: none;
  cursor: crosshair;
  display: flex;
  contain: layout style;
}
.hero-title span {
  display: inline-block;
  font-variation-settings: 'wght' 400, 'opsz' 144;
  will-change: font-variation-settings;
}
.hero-foot {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-top: 5vh; gap: 2rem; flex-wrap: wrap;
}
.hero-sub {
  font-size: clamp(1.05rem, 1.7vw, 1.45rem);
  font-variation-settings: 'wght' 430, 'opsz' 20;
  line-height: 1.45; max-width: 34ch;
}
.hero-hint { color: color-mix(in srgb, var(--ink) 55%, transparent); }
.side-label {
  position: absolute; top: 50%;
  writing-mode: vertical-rl;
  color: color-mix(in srgb, var(--ink) 45%, transparent);
}
.side-label--left { left: 0.9rem; transform: translateY(-50%) rotate(180deg); }
.side-label--right { right: 0.9rem; transform: translateY(-50%); }

/* ---------- marquee ---------- */
.marquee {
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  overflow: hidden; padding: 0.9rem 0; white-space: nowrap;
}
.marquee-track { display: inline-flex; animation: marquee 28s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'wght' 500, 'opsz' 60;
  font-size: 1.6rem;
}
@keyframes marquee { to { transform: translateX(-33.333%); } }

/* ---------- family sections ---------- */
.family { padding: clamp(5rem, 12vh, 9rem) var(--pad); border-bottom: 1px solid var(--hairline); }
.family--dark {
  background: var(--ink); color: var(--paper);
  --hairline: color-mix(in srgb, var(--paper) 25%, transparent);
}
.family--dark ::selection { background: var(--accent-dark); color: var(--ink); }

.family-head {
  display: grid;
  grid-template-columns: minmax(3rem, 1fr) minmax(0, 7fr) minmax(0, 3fr);
  gap: 2rem; align-items: start;
  margin-bottom: clamp(2.5rem, 6vh, 4.5rem);
}
.index { color: var(--accent); font-size: 0.85rem; }
.family--dark .index { color: var(--accent-dark); }
.family-name {
  font-size: clamp(3.4rem, 9vw, 8.5rem);
  line-height: 0.95; font-weight: normal;
  margin-bottom: 1.2rem;
}
#meridian .family-name { font-variation-settings: 'wght' 620, 'opsz' 144, 'SOFT' 0, 'WONK' 1; }
#circuit .family-name  { font-variation-settings: 'MONO' 1, 'CASL' 0.6, 'wght' 800; }
#elastic .family-name  { font-variation-settings: 'wdth' 120, 'wght' 700; text-transform: uppercase; }
.family-desc {
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  font-variation-settings: 'wght' 420, 'opsz' 18;
  font-family: 'Fraunces', serif;
  line-height: 1.5; max-width: 44ch;
}
.family--dark .family-desc { font-variation-settings: 'wght' 360, 'opsz' 18; }
.family-facts { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-end; text-align: right; }
.family-facts span { border-bottom: 1px solid var(--hairline); padding-bottom: 0.45rem; width: max-content; }

/* ---------- playground ---------- */
.playground { border: 1px solid var(--ink); }
.family--dark .playground { border-color: var(--paper); }
.playground-stage {
  padding: clamp(2rem, 6vh, 4.5rem) clamp(1.25rem, 3vw, 3rem);
  font-size: clamp(2.6rem, 8vw, 7.5rem);
  line-height: 1.05;
  outline: none; overflow-wrap: break-word;
}
#meridianStage { font-variation-settings: 'wght' 560, 'opsz' 144, 'SOFT' 0, 'WONK' 0; }
#circuitStage  { font-variation-settings: 'MONO' 1, 'wght' 420, 'CASL' 0, 'slnt' 0; font-size: clamp(1.8rem, 5.5vw, 5rem); }
.playground-stage:focus { background: color-mix(in srgb, var(--accent) 4%, transparent); }

.controls {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border-top: 1px solid var(--ink);
}
.family--dark .controls { border-color: var(--paper); }
.ctrl {
  display: flex; flex-direction: column; gap: 0.8rem;
  padding: 1.1rem 1.25rem;
  border-right: 1px solid var(--hairline);
}
.ctrl:last-child { border-right: none; }
.ctrl span { display: flex; justify-content: space-between; }
.ctrl output { color: var(--accent); font-family: inherit; }
.family--dark .ctrl output { color: var(--accent-dark); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 1px; background: var(--ink); outline: none; cursor: ew-resize;
}
.family--dark input[type="range"] { background: var(--paper); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: none;
  transition: transform 0.15s;
}
.family--dark input[type="range"]::-webkit-slider-thumb { background: var(--accent-dark); }
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.4); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: none; cursor: ew-resize;
}

.ctrl-toggle { justify-content: center; }
.toggle {
  width: 52px; height: 26px; border-radius: 999px;
  border: 1px solid var(--ink); background: transparent;
  cursor: pointer; position: relative; transition: background 0.25s;
}
.family--dark .toggle { border-color: var(--paper); }
.toggle-knob {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); transition: transform 0.25s cubic-bezier(0.7,0,0.2,1);
}
.family--dark .toggle-knob { background: var(--paper); }
.toggle.is-on { background: var(--accent); border-color: var(--accent); }
.toggle.is-on .toggle-knob { transform: translateX(26px); background: var(--paper); }
.family--dark .toggle.is-on { background: var(--accent-dark); border-color: var(--accent-dark); }
.family--dark .toggle.is-on .toggle-knob { background: var(--ink); }

/* ---------- waterfall ---------- */
.waterfall { margin-top: clamp(3rem, 8vh, 5rem); display: flex; flex-direction: column; gap: 0.6rem; }
.waterfall p {
  line-height: 1.1; border-bottom: 1px solid var(--hairline); padding-bottom: 0.6rem;
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
}
.waterfall p::after {
  content: attr(data-style);
  font-family: 'Recursive', monospace;
  font-variation-settings: 'MONO' 1, 'wght' 430;
  font-size: 0.68rem; letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--ink) 50%, transparent);
  white-space: nowrap; flex-shrink: 0;
}

/* ---------- glyphs ---------- */
.glyphs {
  margin-top: clamp(3rem, 8vh, 5rem);
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 2rem; align-items: start;
}
.glyph-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  border-top: 1px solid var(--hairline); border-left: 1px solid var(--hairline);
}
.glyph-cell {
  aspect-ratio: 1; display: grid; place-items: center;
  border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
  font-family: 'Fraunces', serif;
  font-variation-settings: 'wght' 500, 'opsz' 40;
  font-size: 1.5rem; cursor: pointer;
  transition: background 0.15s, color 0.15s;
  background: none; color: inherit; padding: 0;
}
.glyph-cell:hover, .glyph-cell.is-active { background: var(--accent); color: var(--paper); }
.glyph-inspector {
  position: sticky; top: 6rem;
  border: 1px solid var(--ink);
  display: flex; flex-direction: column; align-items: center;
  padding: 1.5rem; gap: 1rem;
}
.glyph-huge {
  font-size: clamp(8rem, 16vw, 15rem); line-height: 1;
  font-variation-settings: 'wght' 500, 'opsz' 144;
  transition: font-variation-settings 0.4s;
}
.glyph-huge:hover { font-variation-settings: 'wght' 900, 'opsz' 144, 'WONK' 1; }
.glyph-caption { color: color-mix(in srgb, var(--ink) 55%, transparent); text-align: center; }

/* ---------- casl demo ---------- */
.casl-demo { margin-top: clamp(3rem, 8vh, 5rem); display: flex; flex-direction: column; gap: 1rem; }
.casl-line { font-size: clamp(1.6rem, 4.5vw, 3.6rem); line-height: 1.15; }
.casl-line:nth-child(1) { font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 400; }
.casl-line:nth-child(2) { font-variation-settings: 'MONO' 0.5, 'CASL' 0.5, 'wght' 500, 'slnt' -6; }
.casl-line:nth-child(3) { font-variation-settings: 'MONO' 0, 'CASL' 1, 'wght' 650, 'slnt' -14, 'CRSV' 1; color: var(--accent-dark); }

/* ---------- elastic stretch ---------- */
.stretch { text-align: center; padding: clamp(2rem, 5vh, 4rem) 0 0; cursor: ew-resize; overflow: clip; }
.stretch-line {
  font-size: clamp(3.5rem, 13.5vw, 12.5rem);
  line-height: 1;
  font-variation-settings: 'wdth' 100, 'wght' 700;
  will-change: font-variation-settings;
  user-select: none;
}
.stretch-hint { margin-top: 1rem; color: color-mix(in srgb, var(--ink) 50%, transparent); }
.width-stack { margin-top: clamp(3rem, 8vh, 5rem); }
.width-stack p {
  font-size: clamp(2rem, 6vw, 5.5rem); line-height: 1.08;
  border-bottom: 1px solid var(--hairline); padding: 0.4rem 0;
}

/* ---------- tester ---------- */
.tester {
  background: var(--ink); color: var(--paper);
  padding: clamp(5rem, 12vh, 9rem) var(--pad);
  --hairline: color-mix(in srgb, var(--paper) 25%, transparent);
}
.tester-head { display: flex; align-items: baseline; gap: 2rem; flex-wrap: wrap; margin-bottom: 3rem; }
.tester-head .index { color: var(--accent-dark); }
.tester-title {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'wght' 600, 'opsz' 144;
  font-size: clamp(2rem, 5vw, 4rem); font-weight: normal;
  margin-right: auto;
}
.tester-tabs { display: flex; border: 1px solid var(--paper); border-radius: 999px; overflow: hidden; }
.tab {
  background: none; border: none; color: var(--paper);
  font-family: 'Recursive', monospace;
  font-variation-settings: 'MONO' 1, 'wght' 430;
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.6rem 1.3rem; cursor: pointer; transition: all 0.25s;
}
.tab.is-active { background: var(--paper); color: var(--ink); }
.tester-stage {
  font-size: clamp(3rem, 9vw, 9rem);
  line-height: 1.05; outline: none;
  min-height: 20vh;
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
  padding: clamp(2rem, 5vh, 3.5rem) 0;
  overflow-wrap: break-word;
  font-variation-settings: 'wght' 500, 'opsz' 144;
}
.controls--tester { border-top: none; max-width: 560px; margin-top: 1.5rem; }
.controls--tester .ctrl { border-right-color: var(--hairline); padding-left: 0; }
.tester input[type="range"] { background: var(--paper); }
.tester input[type="range"]::-webkit-slider-thumb { background: var(--accent-dark); }
.tester .ctrl output { color: var(--accent-dark); }

/* ---------- in use posters ---------- */
.inuse { padding: clamp(5rem, 12vh, 9rem) var(--pad); border-bottom: 1px solid var(--hairline); }
.inuse-head { display: flex; align-items: baseline; gap: 2rem; margin-bottom: 3rem; }
.inuse-title {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'wght' 600, 'opsz' 144;
  font-size: clamp(2rem, 5vw, 4rem); font-weight: normal;
}
.posters { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }
.poster {
  aspect-ratio: 3/4.2;
  padding: 1.5rem;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.poster:hover { transform: translateY(-8px) rotate(-0.5deg); box-shadow: 0 24px 48px -16px color-mix(in srgb, var(--ink) 35%, transparent); }
.poster--meridian { background: var(--accent); color: var(--paper); }
.poster--meridian .poster-big { font-variation-settings: 'wght' 560, 'opsz' 144, 'WONK' 1; font-size: clamp(2.6rem, 5.2vw, 4.6rem); line-height: 0.95; }
.poster--meridian em { font-style: italic; font-variation-settings: 'wght' 700, 'opsz' 144, 'SOFT' 100; }
.poster--circuit { background: #0D0C0A; color: #B8FF5C; border: 1px solid #B8FF5C; }
.poster--circuit .poster-big { font-variation-settings: 'MONO' 1, 'wght' 700; font-size: clamp(2.4rem, 4.6vw, 4rem); line-height: 1.1; }
.poster--elastic { background: #E8571C; color: #16140F; }
.poster--elastic .poster-big { font-size: clamp(2.2rem, 4.4vw, 3.8rem); line-height: 1; text-transform: uppercase; }
.poster-kicker, .poster-foot { opacity: 0.75; }

/* ---------- about ---------- */
.about {
  padding: clamp(6rem, 15vh, 11rem) var(--pad);
  display: grid; grid-template-columns: minmax(3rem, 1fr) minmax(0, 9fr);
  gap: 2rem;
}
.about-text {
  font-size: clamp(1.5rem, 3.4vw, 2.9rem);
  font-variation-settings: 'wght' 420, 'opsz' 40;
  line-height: 1.35; max-width: 30ch;
}
.about-sign { margin-top: 2rem; color: var(--accent); grid-column: 2; }

/* ---------- footer ---------- */
.site-foot {
  background: var(--ink); color: var(--paper);
  padding: 3rem var(--pad) 0;
  overflow: hidden;
}
.foot-links { display: flex; gap: 2.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.foot-links span { border-bottom: 1px solid color-mix(in srgb, var(--paper) 30%, transparent); padding-bottom: 0.4rem; }
.foot-wordmark {
  font-size: clamp(4.2rem, 27vw, 26rem);
  line-height: 0.72;
  text-align: center;
  transform: translateY(0.14em);
  display: flex; justify-content: center;
  user-select: none; cursor: crosshair;
  contain: layout style;
}
.foot-wordmark span { font-variation-settings: 'wght' 600, 'opsz' 144; will-change: font-variation-settings; }
.colophon {
  text-align: center; padding: 1.2rem 0; opacity: 0.55; position: relative;
  border-top: 1px solid color-mix(in srgb, var(--paper) 18%, transparent);
}

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .family-head { grid-template-columns: 1fr; gap: 1rem; }
  .family-facts { flex-direction: row; align-items: baseline; gap: 1.25rem; }
  .glyphs { grid-template-columns: 1fr; }
  .glyph-inspector { position: static; }
  .site-nav { display: none; }
  .side-label { display: none; }
}

@media (max-width: 600px) {
  .head-meta span { display: none; }
  .waterfall p::after { display: none; }
  .about { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee-track { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
