/* unda brand guidelines. Tokens come straight from the logo kit. */
:root {
  --coral: #FF4B4B;
  --coral-deep: #E83A3F;
  --peach: #FFAA7A;
  --ink: #141518;
  --graphite: #1F2024;
  --slate: #5F646D;          /* Slate, one step darker for body text contrast on white */
  --slate-brand: #6E737C;
  --stone: #D9D5CE;
  --mist: #F2F1EE;           /* Stone at 35% on white: the stage surface */
  --paper: #FFFFFF;
  --line: #E4E1DB;
  --radius-stage: 24px;
  --radius-ctl: 999px;
  --ease: cubic-bezier(.22, .8, .2, 1);
  --pad: clamp(20px, 4vw, 56px);
  font-family: "Inter", system-ui, sans-serif;
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; font-size: 17px; line-height: 1.55; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* ---------- buttons and controls ---------- */
.btn {
  font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px; border-radius: var(--radius-ctl);
  border: 1.5px solid transparent; transition: background-color .2s, color .2s, border-color .2s;
}
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { background: var(--ink); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: rgba(20, 21, 24, .45); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-quiet { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--ink); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--radius-ctl); background: rgba(20, 21, 24, .06); }
.seg button {
  font: inherit; font-size: 14px; font-weight: 500; color: inherit; cursor: pointer; min-height: 36px; padding: 0 14px;
  border: 0; border-radius: var(--radius-ctl); background: transparent; display: inline-flex; align-items: center; gap: 8px;
}
.seg button[aria-checked="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20, 21, 24, .12); }
.seg .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(20, 21, 24, .2); }

.ctl { display: grid; gap: 8px; width: min(100%, 420px); font-size: 14px; color: var(--slate); }
.ctl output { color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(var(--coral), var(--coral)) 0 / var(--fill, 50%) 100% no-repeat, rgba(20, 21, 24, .14); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(20, 21, 24, .14); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--coral); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: #fff; border: 2px solid var(--coral); box-shadow: 0 1px 3px rgba(20, 21, 24, .25); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--coral); }
.readout { font-size: 15px; color: var(--slate); font-variant-numeric: tabular-nums; min-height: 1.55em; text-align: center; }
.readout strong { color: var(--ink); font-weight: 600; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; min-height: 100svh; padding: 28px var(--pad) 32px;
  display: grid; grid-template-rows: auto 1fr auto; color: #fff;
  background: linear-gradient(170deg, var(--coral) 0%, var(--coral) 45%, #FF6E5C 80%, #FF8A68 100%);
}
.hero-ghost { position: absolute; width: 150vmax; right: -62vmax; bottom: -48vmax; fill: #fff; opacity: .07; pointer-events: none; }
.hero-bar { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.hero-wordmark { height: 30px; fill: #fff; }
.hero-body { position: relative; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 80px); align-items: end; padding-block: clamp(40px, 8vh, 96px); }
.hero-mark { width: 100%; max-width: 820px; overflow: visible; }
.hero-mark .m-fill { fill: #fff; }
.hero-mark .m-stroke { fill: none; stroke: #fff; }
.hero-text { display: grid; gap: 22px; justify-items: start; max-width: 520px; }
.hero h1 { font-size: clamp(48px, 7.4vw, 112px); font-weight: 600; line-height: .95; letter-spacing: -.04em; }
.hero-text p { font-size: clamp(18px, 1.5vw, 21px); line-height: 1.5; color: var(--ink); max-width: 44ch; }
.hero-meta { position: relative; font-size: 14px; color: var(--ink); }

/* ---------- book layout ---------- */
.book { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(24px, 5vw, 80px); max-width: 1360px; margin: 0 auto; padding: 0 var(--pad); }
.index { position: sticky; top: 0; align-self: start; padding-top: clamp(72px, 10vw, 140px); }
.index ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.index a { display: block; padding: 7px 0 7px 16px; text-decoration: none; font-size: 15px; color: var(--slate); border-left: 2px solid var(--line); transition: color .2s, border-color .2s; }
.index a:hover { color: var(--ink); }
.index a[aria-current="true"] { color: var(--ink); font-weight: 600; border-left-color: var(--coral); }

.rule { padding-block: clamp(72px, 10vw, 140px); border-top: 1px solid var(--line); }
.rule:first-child { border-top: 0; }
.copy { max-width: 640px; display: grid; gap: 16px; margin-bottom: clamp(28px, 4vw, 48px); }
.copy h2 { font-size: clamp(34px, 4.4vw, 56px); font-weight: 600; line-height: 1.02; letter-spacing: -.035em; }
.copy p { color: var(--slate); max-width: 60ch; }

.stage { border-radius: var(--radius-stage); padding: clamp(20px, 4vw, 48px); display: grid; justify-items: center; gap: 24px; min-height: 420px; align-content: center; }
.stage-paper { background: var(--mist); }
.stage-dark { background: var(--graphite); color: #fff; }
.sub { font-size: 17px; font-weight: 600; justify-self: start; }
.note { font-size: 14px; color: var(--slate); justify-self: start; max-width: 70ch; }

/* idea */
.idea-svg { width: min(100%, 620px); overflow: visible; fill: var(--ink); }
.idea-svg .stem-tag { fill: none; stroke: var(--coral); stroke-width: 1.4; opacity: 0; transition: opacity .35s var(--ease); }
.idea-svg.joined .stem-tag { opacity: 1; }
.idea-svg .stem-label { fill: var(--coral); font: 600 9px "Inter", sans-serif; opacity: 0; transition: opacity .35s var(--ease); }
.idea-svg.joined .stem-label { opacity: 1; }
.idea-read { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }

/* versions */
.versions-stage { --fg: var(--ink); color: var(--fg); background: #fff; box-shadow: inset 0 0 0 1px var(--line); transition: background-color .45s var(--ease), color .45s var(--ease); }
.versions-stage[data-bg="stone"] { background: var(--stone); box-shadow: none; }
.versions-stage[data-bg="ink"] { background: var(--graphite); --fg: #fff; box-shadow: none; }
.versions-stage[data-bg="coral"] { background: var(--coral); --fg: #fff; box-shadow: none; }
.versions-stage .seg { background: color-mix(in srgb, var(--fg) 9%, transparent); }
.v-art { height: 240px; width: 100%; display: grid; place-items: center; }
.v-art img { max-height: 100%; max-width: min(100%, 520px); transition: opacity .25s; }
.v-art img.swap { opacity: 0; }
.v-file { font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; }
.v-file span { font-variant-numeric: tabular-nums; opacity: .8; }
.v-file a { font-weight: 600; }

/* clear space */
.space-box { width: 100%; min-height: 300px; display: grid; place-items: center; overflow: hidden; }
.space-zone { position: relative; padding: var(--x, 30px); background: color-mix(in srgb, var(--coral) 12%, transparent); outline: 1.5px dashed var(--coral); outline-offset: -1px; }
.space-zone img { width: var(--w, 360px); background: #fff; user-select: none; }
.space-handle { position: absolute; right: -11px; bottom: -11px; width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; background: var(--coral); cursor: nwse-resize; box-shadow: 0 1px 4px rgba(20, 21, 24, .3); touch-action: none; padding: 0; }

/* small sizes */
.px-pair { display: flex; flex-wrap: wrap; gap: 28px; justify-content: center; align-items: flex-end; }
.px { margin: 0; display: grid; gap: 10px; justify-items: center; }
.px canvas { width: 200px; height: 200px; image-rendering: pixelated; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px var(--line); transition: box-shadow .25s; }
.px figcaption { font-size: 14px; color: var(--slate); }
.px[aria-current="true"] canvas { box-shadow: 0 0 0 3px var(--coral); }
.px[aria-current="true"] figcaption { color: var(--ink); font-weight: 600; }
.px-actual { display: grid; gap: 10px; justify-items: center; font-size: 14px; color: var(--slate); min-width: 96px; }
.px-actual img { image-rendering: auto; }

/* colour */
.colour-stage { justify-items: stretch; }
.colour-stage > .seg { justify-self: start; }
.swatches { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.swatches button {
  font: inherit; text-align: left; cursor: pointer; width: 100%; padding: 0; border: 0; background: none; color: var(--ink);
  display: grid; gap: 10px;
}
.swatches .chip { height: 132px; border-radius: 16px; box-shadow: inset 0 0 0 1px rgba(20, 21, 24, .08); transition: transform .25s var(--ease); }
.swatches button:hover .chip { transform: translateY(-3px); }
.swatches .name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.swatches .val { font-size: 13px; color: var(--slate); font-variant-numeric: tabular-nums; min-height: 2.6em; }
.pairs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pairs li { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; background: #fff; border-radius: 14px; padding: 10px; }
.pairs .aa { width: 56px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-weight: 600; font-size: 18px; }
.pairs b { display: block; font-size: 14px; font-weight: 600; }
.pairs span { font-size: 13px; color: var(--slate); }

/* construction */
.build-svg { width: min(100%, 680px); overflow: visible; }
.build-svg .mark { fill: var(--coral); }
.build-svg .layer { transition: opacity .35s var(--ease), clip-path 1.4s var(--ease); clip-path: inset(0 100% 0 0); }
.build-stage.in .layer { clip-path: inset(0 0 0 0); }
.build-stage.in .layer[data-layer="ellipses"] { transition-delay: 0s, .25s; }
.build-stage.in .layer[data-layer="weights"] { transition-delay: 0s, .5s; }
.build-svg .layer.off { opacity: 0; }
.build-svg .g-line { stroke: rgba(255, 255, 255, .5); stroke-width: .5; fill: none; }
.build-svg .g-over { stroke: var(--peach); stroke-width: .5; stroke-dasharray: 2 1.5; fill: none; }
.build-svg .g-ell { stroke: #fff; stroke-width: .45; stroke-dasharray: 1.6 1.6; fill: none; opacity: .75; }
.build-svg .g-w { stroke: #fff; stroke-width: .7; fill: none; }
.build-svg text { fill: #fff; font: 500 5.2px "Inter", sans-serif; }
.build-svg text.peach { fill: var(--peach); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.toggles button {
  font: inherit; font-size: 14px; font-weight: 500; min-height: 40px; padding: 0 16px; border-radius: var(--radius-ctl); cursor: pointer;
  color: #fff; background: transparent; border: 1.5px solid rgba(255, 255, 255, .35); transition: background-color .2s, color .2s, border-color .2s;
}
.toggles button[aria-pressed="true"] { background: #fff; color: var(--ink); border-color: #fff; }
.stage-dark :focus-visible { outline-color: var(--peach); }

/* app icon */
.icon-svg { width: min(100%, 320px); overflow: visible; }
.icon-ctl { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; justify-content: center; width: 100%; }

/* type */
.type-stage { justify-items: start; align-content: start; }
.type-sample { font-weight: 600; font-size: 88px; line-height: 1; letter-spacing: -.035em; outline: none; max-width: 100%; overflow-wrap: anywhere; border-radius: 8px; }
.type-sample:focus-visible { box-shadow: 0 0 0 3px var(--coral); }
.type-body { color: var(--slate); max-width: 56ch; }
.type-ctl { display: flex; flex-wrap: wrap; gap: 20px 40px; width: 100%; }
.type-ctl .ctl { width: min(100%, 300px); }

/* misuse */
.misuse { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.misuse li { display: grid; gap: 12px; align-content: start; }
.m-art { position: relative; height: 190px; border-radius: 18px; background: var(--mist); display: grid; place-items: center; overflow: hidden; }
.m-art > * { grid-area: 1 / 1; transition: transform .6s var(--ease), filter .6s var(--ease), opacity .45s var(--ease), fill-opacity .45s, stroke-opacity .45s, background-color .6s; }
.m-art img { width: 62%; }
.m-art .bg-photo { position: absolute; inset: 0; background: url(assets/img/street.jpg) center / cover; opacity: 0; }
.m-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.m-row p { font-size: 15px; font-weight: 600; }
.m-row .btn { min-height: 38px; padding: 0 16px; font-size: 14px; }
.m-state { font-size: 13px; color: var(--slate); }
/* mistake states */
.bad .m-stretch { transform: scaleX(1.45) scaleY(.9); }
.bad .m-rotate { transform: rotate(-14deg); }
.bad .m-recolour { filter: hue-rotate(155deg) saturate(1.2); }
.bad .m-effect { filter: drop-shadow(0 8px 5px rgba(20, 21, 24, .55)) blur(.3px); transform: translateY(-4px); }
.m-outline { width: 46%; }
.m-outline path { fill: var(--ink); stroke: var(--ink); stroke-width: 2.2; stroke-opacity: 0; transition: fill-opacity .45s, stroke-opacity .45s; }
.bad .m-outline path { fill-opacity: 0; stroke-opacity: 1; }
.m-type { font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 46px; opacity: 0; }
.bad .m-type { opacity: 1; }
.bad .m-type-real { opacity: 0; }
.bad .bg-photo { opacity: 1; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.gallery figure { margin: 0; border-radius: 18px; overflow: hidden; background: var(--mist); grid-column: span 3; aspect-ratio: 4 / 3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery .g-street { grid-column: span 4; aspect-ratio: auto; }
.gallery .g-cards { grid-column: span 2; aspect-ratio: auto; }
.gallery .g-light { grid-column: span 6; aspect-ratio: 2.22; }

/* files */
.files { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.file { display: grid; gap: 4px; padding: 22px 24px; border-radius: 18px; text-decoration: none; background: var(--mist); transition: background-color .2s, color .2s; }
.file strong { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.file span { font-size: 14px; color: var(--slate); }
.file:hover { background: var(--ink); color: #fff; }
.file:hover span { color: rgba(255, 255, 255, .7); }
.file-main { background: var(--coral); color: #fff; grid-column: span 2; }
.file-main span { color: rgba(255, 255, 255, .9); }

/* footer */
.foot { background: var(--graphite); color: #fff; padding: 64px var(--pad); display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; }
.foot-mark { width: 56px; fill: var(--coral); overflow: visible; }
.foot p { flex: 1 1 320px; color: rgba(255, 255, 255, .75); font-size: 15px; }
.foot a { font-size: 15px; font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 15px; font-weight: 500;
  transition: opacity .25s, transform .35s var(--ease); z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .misuse { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .book { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .index { padding: 0; margin: 0 calc(var(--pad) * -1); z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .index ul { display: flex; overflow-x: auto; gap: 4px; padding: 10px var(--pad); scrollbar-width: none; }
  .index a { white-space: nowrap; border-left: 0; padding: 8px 12px; border-radius: var(--radius-ctl); }
  .index a[aria-current="true"] { background: var(--ink); color: #fff; }
  .rule:first-child { border-top: 0; }
  .hero-body { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .files { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-main { grid-column: auto; }
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .gallery figure, .gallery .g-street, .gallery .g-cards { grid-column: auto; aspect-ratio: 4 / 3; }
  .gallery .g-light { grid-column: auto; aspect-ratio: 2.22; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .hero-bar .btn { padding: 0 16px; font-size: 14px; }
  .hero-wordmark { height: 24px; }
  .stage { min-height: 0; border-radius: 18px; }
  .swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .swatches .chip { height: 96px; }
  .misuse, .files { grid-template-columns: minmax(0, 1fr); }
  .file-main { grid-column: auto; }
  .px canvas { width: 132px; height: 132px; }
  .px-pair { gap: 16px; }
  .v-art { height: 180px; }
  .space-box { min-height: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; transition-delay: 0s !important; animation: none !important; }
}
