@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 300; font-display: swap; src: url(fonts/dm-sans-latin-300-normal.woff2) format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/dm-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/dm-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/playfair-display-latin-700-normal.woff2) format('woff2'); }

:root {
  --orange: #FF7F32;
  --ink: #111110;
  --paper: #F8F7F4;
  --navy: #000060;
  --ease: cubic-bezier(.76, 0, .24, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --morph: 760ms;
}
:root, :root[data-theme="light"] {
  --bg: var(--paper);
  --fg: var(--ink);
  --text-2: rgba(17, 17, 16, .62);
  --text-3: rgba(17, 17, 16, .42);
  --text-4: rgba(17, 17, 16, .30);
  --line: rgba(17, 17, 16, .12);
  --glow: rgba(255, 127, 50, .26);
  --glow-edge: rgba(255, 127, 50, 0);
  --glow-time: 7s;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: var(--ink);
  --fg: var(--paper);
  --text-2: rgba(248, 247, 244, .60);
  --text-3: rgba(248, 247, 244, .35);
  --text-4: rgba(248, 247, 244, .20);
  --line: rgba(248, 247, 244, .08);
  --glow: rgba(0, 0, 96, .6);
  --glow-edge: rgba(0, 0, 96, 0);
  --glow-time: 10s;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px; line-height: 1.55; font-weight: 400;
}
::selection { background: var(--orange); color: var(--paper); }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 50; background: var(--fg); color: var(--bg); padding: 10px 16px; text-decoration: none; font-weight: 500; }
.skip:focus { top: 16px; }

/* Corner glow */
.glow {
  position: fixed; right: -26vmax; bottom: -26vmax; width: 80vmax; height: 80vmax;
  background: radial-gradient(closest-side, var(--glow), var(--glow-edge));
  pointer-events: none; z-index: -1;
  animation: drift var(--glow-time) ease-in-out infinite alternate;
}
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(-5vmax, -4vmax) scale(1.08); } }

/* Layout */
.app { position: relative; display: grid; grid-template-columns: 288px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 32px 28px 28px;
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 36px; background: var(--bg);
}
.brand { display: inline-flex; align-items: center; min-height: 32px; text-decoration: none; padding: 4px 0; }
.brand img { height: 28px; width: auto; display: none; }
:root[data-theme="dark"] .brand .logo-paper, :root[data-theme="light"] .brand .logo-ink { display: block; }
.brand img[data-broken] { display: none !important; }
.brand .brand-text { display: none; font-weight: 500; font-size: 18px; }
.brand.no-logo .brand-text { display: inline; }

.nav, .nav ul { list-style: none; margin: 0; padding: 0; }
.nav > li + li { margin-top: 22px; }
.nav .nav-h { display: block; font-weight: 500; font-size: 15px; color: var(--fg); margin-bottom: 6px; text-decoration: none; border: 0; padding: 0; }
.nav .nav-h:hover { text-decoration: underline; text-underline-offset: 4px; }
.nav .nav-item {
  display: block; position: relative; padding: 5px 0 5px 14px; font-size: 15px; line-height: 1.35;
  color: var(--text-2); text-decoration: none; border-left: 1px solid var(--line); transition: color .2s, border-color .2s;
}
.nav .nav-item:hover { color: var(--fg); }
.nav a[aria-current="page"] { color: var(--fg); font-weight: 500; }
.nav .nav-item[aria-current="page"] { border-left: 2px solid var(--fg); padding-left: 13px; }
.nav .k { color: var(--text-3); font-weight: 400; }
.nav-sub { display: block; margin: 0; padding: 12px 0 4px 14px; font-size: 13px; font-weight: 500; color: var(--text-2); border-left: 1px solid var(--line); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; font-size: 14px; color: var(--text-2); }
.side-foot p { margin: 0; }
.side-foot .about-link { color: var(--fg); font-weight: 500; font-size: 15px; text-decoration: none; }
.side-foot .about-link:hover, .side-foot .about-link[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }
.theme-btn {
  align-self: flex-start; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--fg); display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
}
.theme-btn:hover { border-color: var(--text-3); }
.theme-btn svg { width: 16px; height: 16px; }
.topbar { display: none; }
.scrim { display: none; }
.main { min-width: 0; position: relative; outline: none; }
.view[hidden] { display: none !important; }

/* Breadcrumbs */
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 15px; font-weight: 500; color: var(--text-2); }
.crumbs li + li::before { content: "/"; margin: 0 10px; color: var(--text-4); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 4px; }

/* Overview, platform and about pages */
.vo { padding: 64px 56px 96px; max-width: 1480px; }
.vo .crumbs { margin-bottom: 18px; }
.vo-title { margin: 0; max-width: 18ch; text-wrap: balance; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: clamp(42px, 5.6vw, 80px); line-height: 1.04; letter-spacing: -.01em; }
.lead { margin: 22px 0 0; max-width: 38ch; font-size: clamp(24px, 2.2vw, 30px); font-weight: 300; line-height: 1.35; color: var(--text-2); }
.sheet { margin-top: 64px; display: flex; flex-direction: column; gap: 56px; }
.pl h2 { margin: 0 0 20px; font-size: 20px; font-weight: 500; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.pl h2 a { text-decoration: none; }
.pl h2 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.pl h3 { margin: 32px 0 16px; font-size: 16px; font-weight: 500; color: var(--text-2); }
.tiles { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 28px 36px; }
.tiles:empty { display: none; }
.tile { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--fg); padding: 8px; margin: -8px; border-radius: 6px; }
.tile .mini { position: relative; display: block; background: var(--line); outline: 1px solid var(--text-4); transition: outline-color .2s; }
.tile:hover .mini { outline-color: var(--fg); }
.tile .mini .ov { position: absolute; inset: 0; overflow: hidden; }
.tile-t { font-size: 15px; font-weight: 500; line-height: 1.25; }
.tile-r { font-size: 14px; color: var(--text-2); line-height: 1.25; }
.made { margin-top: 88px; padding-top: 28px; border-top: 1px solid var(--line); max-width: 640px; }
.made h2 { margin: 0 0 10px; font-family: 'Playfair Display', Georgia, serif; font-size: 30px; line-height: 1.1; }
.made p { margin: 0; color: var(--text-2); }
.made a, .back a, .about-body a { color: var(--fg); font-weight: 500; text-underline-offset: 4px; }
.back { margin: 48px 0 0; }
.about-body { margin-top: 36px; max-width: 58ch; font-size: 19px; }
.about-body p { margin: 0 0 16px; }
.about-body a { font-weight: inherit; }

/* Overlay downloads */
.dl-wrap { margin-top: 12px; }
.dl { display: inline-flex; align-items: flex-start; gap: 12px; max-width: 100%; text-decoration: none; color: var(--fg); padding: 12px 16px 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); transition: border-color .2s; }
.dl:hover { border-color: var(--text-3); }
.dl svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.dl span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dl b { font-weight: 500; font-size: 15px; }
.dl small { font-size: 14px; line-height: 1.35; color: var(--text-2); }
.comp .dl { align-self: flex-start; }
.rows dd.na { color: var(--text-3); }

/* Format view */
.vf { padding: 48px 56px 40px; }
.vf-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 32px; }
.vf-title { margin: 0; text-wrap: balance; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: clamp(40px, 4.8vw, 68px); line-height: 1.04; outline: none; }
.vf-lead { margin: 10px 0 0; max-width: 54ch; text-wrap: pretty; font-size: 24px; font-weight: 300; line-height: 1.4; color: var(--text-2); }
.vf-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 56px; align-items: start; }

.stage { position: relative; height: 420px; }
.stage.animate { transition: height var(--morph) var(--ease); }
.frame { position: absolute; left: 0; top: 0; width: 100px; height: 100px; }
.frame.animate { transition: left var(--morph) var(--ease), top var(--morph) var(--ease), width var(--morph) var(--ease), height var(--morph) var(--ease); }
.frame-fill { position: absolute; inset: 0; background: linear-gradient(var(--line), var(--line)), var(--bg); outline: 1px solid var(--text-4); }
.frame-ov { position: absolute; inset: 0; transition: opacity .16s ease; }
.frame.ov-out .frame-ov, .frame.ov-out .ghosts { opacity: 0; }
.ghosts { position: absolute; inset: 0; opacity: 0; transition: opacity .3s ease; display: none; }
.frame.stack .ghosts { display: block; opacity: 1; }
.ghosts i { position: absolute; inset: 0; border: 1px solid var(--text-4); background: var(--bg); transform: translateX(calc(var(--n) * 18px)); }
.ruler { position: absolute; display: flex; align-items: center; gap: 10px; transition: opacity .2s ease; color: var(--text-2); font-size: 14px; white-space: nowrap; }
.ruler::before, .ruler::after { content: ""; flex: 1; background: var(--text-4); }
.rx { left: 0; right: 0; top: calc(-1 * var(--rx-off, 28px)); height: 14px; border-left: 1px solid var(--text-3); border-right: 1px solid var(--text-3); }
.rx::before, .rx::after { height: 1px; }
.ry { top: 0; bottom: 0; left: -28px; width: 14px; flex-direction: column; border-top: 1px solid var(--text-3); border-bottom: 1px solid var(--text-3); }
.ry::before, .ry::after { width: 1px; }
.ry .rl { writing-mode: vertical-rl; transform: rotate(180deg); }
.rl b { font-weight: 500; color: var(--fg); font-variant-numeric: tabular-nums; }
.frame.flipping .ruler, .frame.flipping .frame-ov { opacity: 0; }
.frame.short .ry .px, .frame.narrow .rx .px { display: none; }

/* Overlay drawing */
.ov { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hl { fill: var(--orange); opacity: .6; }
.z { transform-box: fill-box; }
.safe { fill: none; stroke: var(--orange); stroke-width: 2; stroke-dasharray: 8 6; }
.reg { fill: none; stroke: var(--fg); stroke-opacity: .7; stroke-width: 1.5; stroke-dasharray: 2 5; }
.ava { fill: var(--bg); stroke: var(--text-2); stroke-width: 1.5; }
.outer { fill: none; stroke: var(--text-3); stroke-width: 1; }
.bars { fill: var(--line); }
.subs-box { fill: var(--bg); stroke: var(--text-3); stroke-width: 1; }
.subs-bar { fill: var(--fg); }
.cc-box { fill: none; stroke: var(--text-2); stroke-width: 2; stroke-dasharray: 2 4; }
.cc-bar { fill: var(--text-3); }
.subs, .cc { transform-box: fill-box; transform-origin: center; }
.lbls { position: absolute; inset: 0; pointer-events: none; }
.lbl { position: absolute; font-size: 13px; line-height: 1.25; font-weight: 500; color: var(--fg); background: var(--bg); padding: 3px 7px; border-radius: 3px; white-space: nowrap; border: 1px solid var(--line); }
.lbl.tl { transform: translate(0, 0); }
.lbl.tc { transform: translate(-50%, 0); }
.lbl.tr { transform: translate(-100%, 0); }
.lbl.cc { transform: translate(-50%, -50%); }
.lbl.bl { transform: translate(0, -100%); }

/* The safe zone edge keeps moving slowly */
.frame .safe, .comp-frame .safe { animation: ants 4s linear infinite; }
@keyframes ants { from { stroke-dashoffset: 28; } to { stroke-dashoffset: 0; } }

/* Reveal sequence after a morph */
.frame.reveal .z { animation: growY 560ms var(--ease-out) both; animation-delay: calc(var(--i) * 70ms); }
.frame.reveal .z.d-top { transform-origin: 50% 0; }
.frame.reveal .z.d-bottom { transform-origin: 50% 100%; }
.frame.reveal .z.d-left { transform-origin: 0 50%; animation-name: growX; }
.frame.reveal .z.d-right { transform-origin: 100% 50%; animation-name: growX; }
.frame.reveal .z.d-fade { animation-name: fadeIn; }
.frame.reveal .safe { animation: fadeIn 300ms ease both, ants 4s linear infinite; animation-delay: 200ms, 0ms; }
.frame.reveal .reg, .frame.reveal .ava, .frame.reveal .outer, .frame.reveal .bars { animation: fadeIn 420ms ease both; animation-delay: 260ms; }
.frame.reveal .subs, .frame.reveal .cc { animation: rise 520ms var(--ease-out) both; animation-delay: 360ms; }
.frame.reveal .lbl { animation: fadeIn 360ms ease both; animation-delay: 480ms; }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(30%); } }

.stage-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; margin-top: 24px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 24px; font-size: 14px; color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 10px; }
.sw { flex: none; width: 28px; height: 16px; display: inline-block; }
.sw-hatch { background: repeating-linear-gradient(135deg, var(--orange) 0 1.5px, transparent 1.5px 6px); opacity: .85; }
.sw-safe { height: 0; border-top: 2px dashed var(--orange); }
.sw-subs { border: 1px solid var(--text-3); background: linear-gradient(var(--fg), var(--fg)) center / 60% 3px no-repeat, var(--bg); border-radius: 2px; }
.sw-cc { border: 2px dotted var(--text-2); border-radius: 2px; }
.sw-reg { height: 0; border-top: 2px dotted var(--fg); }
.sw-ava { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--text-2); }
.sw-outer { border: 1px solid var(--text-3); }
.toggle { display: inline-flex; align-items: center; gap: 10px; background: none; border: none; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--fg); padding: 8px 0; min-height: 44px; }
.toggle .track { width: 34px; height: 20px; border-radius: 999px; background: var(--line); border: 1px solid var(--text-3); position: relative; transition: background .2s; }
.toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform .25s var(--ease-out), background .2s; }
.toggle[aria-pressed="true"] .track { background: var(--fg); border-color: var(--fg); }
.toggle[aria-pressed="true"] .track::after { transform: translateX(14px); background: var(--bg); }
.frame.guides-off .frame-ov, .frame.guides-off .ghosts, .comp-frame.guides-off .comp-ov { opacity: 0 !important; }

/* Spec column */
.spec { display: flex; flex-direction: column; gap: 28px; padding-top: 4px; }
.ratio { font-weight: 300; font-size: clamp(72px, 7.5vw, 116px); line-height: .9; letter-spacing: -.04em; }
.dims { margin-top: -12px; font-weight: 300; font-size: 26px; line-height: 1.2; }
.rows { margin: 0; display: grid; grid-template-columns: 1fr; }
.rows div { padding: 12px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 16px; }
.rows div:last-child { border-bottom: 1px solid var(--line); }
.rows dt { font-size: 14px; font-weight: 500; color: var(--text-2); padding-top: 2px; }
.rows dd { margin: 0; font-size: 16px; }
.notes p { margin: 0 0 14px; max-width: 42ch; }
.notes p:last-child { margin-bottom: 0; }
.comp { display: flex; flex-direction: column; gap: 16px; padding-top: 28px; border-top: 1px solid var(--line); }
.comp h2 { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 30px; line-height: 1.1; }
.comp-dims { font-weight: 300; font-size: 24px; line-height: 1.2; margin-top: -8px; }
.comp-stage { position: relative; height: 220px; }
.comp-frame { position: absolute; left: 0; top: 0; }
.comp-ov { position: absolute; inset: 0; transition: opacity .16s ease; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { display: flex; flex-direction: column; gap: 2px; text-decoration: none; padding: 8px 0; }
.pager .next { text-align: right; grid-column: 2; }
.pager small { font-size: 14px; color: var(--text-2); }
.pager span { font-size: 20px; font-weight: 500; }
.pager a:hover span { text-decoration: underline; text-underline-offset: 5px; }
.kbd-hint { margin: 12px 0 0; font-size: 14px; color: var(--text-3); }

/* Text transitions */
.vf.leaving [data-anim] { opacity: 0; transform: translateY(-6px); transition: opacity 180ms ease, transform 180ms ease; }
.vf.entering [data-anim] { animation: textIn 560ms var(--ease-out) both; animation-delay: calc(var(--k, 0) * 55ms + 80ms); }
@keyframes textIn { from { opacity: 0; transform: translateY(12px); } }
.vx.entering { animation: textIn 520ms var(--ease-out) both; }

/* Responsive */
@media (max-width: 1240px) {
  .vf-body { grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; }
  .rows div { grid-template-columns: 112px minmax(0, 1fr); }
}
@media (max-width: 1040px) {
  .vf-body { grid-template-columns: 1fr; }
  .spec { max-width: 640px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .menu-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; min-height: 44px; cursor: pointer; font-weight: 500; font-size: 15px; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(320px, 86vw); height: 100%; transform: translateX(-102%); transition: transform .38s var(--ease); border-right: 1px solid var(--line); }
  .side.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(17, 17, 16, .45); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .vo { padding: 36px 16px 64px; }
  .sheet { margin-top: 44px; gap: 44px; }
  .tiles { gap: 24px 24px; }
  .vf { padding: 28px 16px 32px; }
  .vf-lead { font-size: 24px; }
  .pager { margin-top: 44px; }
  .pager span { font-size: 17px; }
  .kbd-hint { display: none; }
  .side .brand { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; animation-iteration-count: 1 !important; }
  .glow { animation: none; }
}
