/* Plakt: the app's own interface carried onto a black stage. Hairlines, ink for what is chosen,
   mono small caps for the names of things, and the poster as the only colour on the page. */

:root {
  --stage: #0b0b0b;
  --panel: #161616;
  --well: #202020;
  --rule: #383838;
  --ink: #f3f3f0;
  --quiet: #a6a6a1;
  --mono: ui-monospace, "SF Mono", "Menlo", "Cascadia Mono", "Consolas", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --out: cubic-bezier(0.23, 1, 0.32, 1);
  --in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --bar: 52px;
}

* { box-sizing: border-box; }
html { background: var(--stage); color-scheme: dark; scroll-behavior: smooth; scrollbar-color: var(--rule) var(--stage); }
body { margin: 0; font: 15px/1.5 var(--sans); color: var(--ink); background: var(--stage); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--ink); color: var(--stage); }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
b { font-weight: 600; }

/* Names of things: the app's mono small caps. */
.label, .mark { font: 600 11px/1 var(--mono); letter-spacing: 0.15em; text-transform: uppercase; }
.label { display: block; color: var(--quiet); margin-bottom: 10px; }

/* ---- the window bar */
.bar { position: sticky; top: 0; z-index: 10; height: var(--bar); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--rule); }
.mark { color: var(--ink); text-decoration: none; padding: 10px 0; }
.tools { display: flex; align-items: center; gap: 4px; }
.tool { padding: 8px 10px; font-size: 13px; font-weight: 500; color: var(--ink); text-decoration: none; transition: background-color 140ms var(--out); }
.tools .button { margin-left: 8px; }

/* The rule under the bar sweeps while an engine loads. */
.working { position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; overflow: hidden; opacity: 0; transition: opacity 200ms var(--out); }
.working::after { content: ""; position: absolute; top: 0; bottom: 0; width: 28%; background: var(--ink); transform: translateX(-100%); }
.working.on { opacity: 1; }
.working.on::after { animation: sweep 1.1s linear infinite; }
@keyframes sweep { to { transform: translateX(460%); } }

/* ---- buttons: sentence case, a hairline, ink when they are the way forward */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 30px; padding: 0 12px; font: 500 13px/1 var(--sans); color: var(--ink); background: var(--well); border: 1px solid var(--rule); border-radius: 0; text-decoration: none; cursor: pointer; transition: transform 160ms var(--out), background-color 140ms var(--out), border-color 140ms var(--out); -webkit-tap-highlight-color: transparent; }
.button:active { transform: scale(0.97); }
.button.prominent { background: var(--ink); color: var(--stage); border-color: var(--ink); font-weight: 600; }
.button.big { height: 44px; width: 100%; justify-content: space-between; padding: 0 16px; font-size: 14.5px; }
.button.big svg { transition: transform 200ms var(--out); }

/* ---- the studio: controls on the left, the table on the right, as in the app */
.studio { display: grid; grid-template-columns: minmax(300px, 372px) minmax(0, 1fr); min-height: calc(100svh - var(--bar)); border-bottom: 1px solid var(--rule); }
.column { background: var(--panel); border-right: 1px solid var(--rule); padding: 28px 26px 24px; display: flex; flex-direction: column; gap: 21px; }
h1 { margin: 0; font-size: clamp(2rem, 3.1vw, 2.9rem); line-height: 1.02; font-weight: 650; letter-spacing: -0.035em; text-wrap: balance; }
.by-touch { display: none; }
@media (hover: none) { .by-mouse { display: none; } .by-touch { display: inline; } }
.lede { margin: -8px 0 0; color: var(--quiet); font-size: 14.5px; max-width: 42ch; text-wrap: pretty; }
.group { min-width: 0; }
/* The controls arrive in order, once, while the first sheet prints. */
.column > * { animation: arrive 520ms var(--out) backwards; }
.column > :nth-child(2) { animation-delay: 40ms; }
.column > :nth-child(3) { animation-delay: 80ms; }
.column > :nth-child(4) { animation-delay: 120ms; }
.column > :nth-child(5) { animation-delay: 160ms; }
.column > :nth-child(6) { animation-delay: 200ms; }
.column > :nth-child(7) { animation-delay: 240ms; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } }

.well { width: 100%; height: 46px; padding: 0 12px; font: 650 22px/1 var(--sans); letter-spacing: -0.01em; color: var(--ink); background: var(--well); border: 1px solid var(--rule); border-radius: 0; caret-color: var(--ink); transition: border-color 140ms var(--out); }
.well:focus { outline: none; border-color: var(--ink); }

/* Option tiles: one sheet of tiles with hairlines between, the chosen one in ink. */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.tile { height: 34px; padding: 0 10px; text-align: left; font: 500 12.5px/1 var(--sans); color: var(--ink); background: var(--well); border: 0; border-radius: 0; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background-color 140ms var(--out); -webkit-tap-highlight-color: transparent; }
.tile[aria-checked="true"] { background: var(--ink); color: var(--stage); font-weight: 600; }
.tile:active:not([aria-checked="true"]) { background: #303030; }
.tile:focus-visible { outline-offset: -3px; }
.tile:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* Images: twelve small sheets, grey like the rest of the panel until one is on the stage. */
.thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.thumb { aspect-ratio: 2 / 3; padding: 0; border: 0; border-radius: 0; background: var(--well) url(images/thumbs.webp) 0 0 / 600% 200% no-repeat; filter: grayscale(1) brightness(0.72); cursor: pointer; transition: filter 180ms var(--out); -webkit-tap-highlight-color: transparent; }
.thumb[aria-pressed="true"] { filter: none; box-shadow: inset 0 0 0 2px var(--ink); }
.thumb:focus-visible { outline-offset: -3px; }

.shuffle { width: 100%; justify-content: flex-start; height: 36px; }
.shuffle .look-name { margin-left: auto; color: var(--quiet); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.shuffle.rolled .dice { animation: roll 420ms var(--out); }
@keyframes roll { from { transform: rotate(-90deg) scale(0.9); } to { transform: none; } }

.sliders { display: grid; gap: 14px; }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; margin-bottom: 2px; }
.slider-head label { font-weight: 500; }
.slider-head output { color: var(--quiet); font-variant-numeric: tabular-nums; }
/* The app's slider: a hairline and a square to hold. */
.ink-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
.ink-slider::-webkit-slider-runnable-track { height: 1px; background: var(--rule); }
.ink-slider::-moz-range-track { height: 1px; background: var(--rule); }
.ink-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; margin-top: -5px; background: var(--ink); border: 0; border-radius: 0; transition: transform 140ms var(--out); }
.ink-slider::-moz-range-thumb { width: 11px; height: 11px; background: var(--ink); border: 0; border-radius: 0; }
.ink-slider:active::-webkit-slider-thumb { transform: scale(1.25); }

.get { margin-top: auto; padding-top: 6px; }
.fine { margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--quiet); max-width: 46ch; text-wrap: pretty; }

/* ---- the stage: one poster on black, leaning toward the pointer like a held sheet */
.stage { position: relative; display: grid; justify-items: center; align-items: start; padding: clamp(18px, 3.4vw, 46px); min-width: 0; perspective: 1400px; }
/* The poster stays in view while a tall column of controls scrolls past it. */
.sheet-wrap { position: sticky; isolation: isolate; top: calc(var(--bar) + clamp(18px, 3.4vw, 46px)); height: min(calc(100svh - var(--bar) - 2 * clamp(18px, 3.4vw, 46px)), 1180px); max-width: 100%; aspect-ratio: var(--aspect, 0.6667); transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); will-change: transform; cursor: crosshair; touch-action: pan-y; }
/* A hairline keeps a dark poster apart from the dark stage. */
.sheet { width: 100%; height: 100%; background: #111; overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09); }
.sheet svg { display: block; width: 100%; height: 100%; }
/* Until the first sheet is drawn a still of it stands on the stage, without its event lines. */
.sheet:empty, .sheet:empty + .info, .waiting .info { visibility: hidden; }
.sheet .still { display: block; width: 100%; height: 100%; object-fit: cover; }
/* The event on the poster: four lines of information, set in one of five layouts. Each line sits on a
   plate of the poster's own ground so it reads over the lettering. */
.sheet-wrap { container-type: inline-size; }
.info { position: absolute; inset: 0; padding: 4.6cqw; display: grid; pointer-events: none; color: var(--info-ink, #111); font-size: clamp(7.5px, 2.05cqw, 15px); line-height: 1.28; font-weight: 500; letter-spacing: -0.005em; }
.info span { justify-self: start; align-self: start; max-width: 62cqw; padding: 0.35em 0.6em 0.4em; background: var(--info-ground, #eee); text-wrap: balance; }
.info .kind { font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
/* corners: venue and kind above, programme and dates below */
.info[data-layout="corners"] { grid-template: "venue kind" 1fr "sub dates" auto / 1fr auto; gap: 1.2cqw; }
.info[data-layout="corners"] .venue { grid-area: venue; }
.info[data-layout="corners"] .kind { grid-area: kind; justify-self: end; }
.info[data-layout="corners"] .sub { grid-area: sub; align-self: end; max-width: 44cqw; }
.info[data-layout="corners"] .dates { grid-area: dates; align-self: end; justify-self: end; text-align: right; max-width: var(--dates-max, 62cqw); }
/* foot: everything in one block at the bottom left */
.info[data-layout="foot"] { align-content: end; gap: 0; }
.info[data-layout="foot"] span { padding-top: 0.2em; padding-bottom: 0.2em; }
.info[data-layout="foot"] .kind { padding-top: 0.5em; }
.info[data-layout="foot"] .dates { padding-bottom: 0.5em; }
/* head: one block at the top right, ranged right */
.info[data-layout="head"] { align-content: start; justify-items: end; gap: 0; text-align: right; }
.info[data-layout="head"] span { justify-self: end; padding-top: 0.2em; padding-bottom: 0.2em; }
.info[data-layout="head"] .kind { padding-top: 0.5em; }
.info[data-layout="head"] .dates { padding-bottom: 0.5em; }
/* band: a strip across the bottom, in three columns */
.info[data-layout="band"] { padding: 0; align-content: end; grid-template: "kind sub dates" auto "venue sub dates" auto / 1fr 1.3fr 1fr; background: none; }
.info[data-layout="band"] span { max-width: none; justify-self: stretch; align-self: stretch; padding: 0.5em 4.6cqw 0.2em; }
.info[data-layout="band"] .kind { grid-area: kind; padding-top: 1em; }
.info[data-layout="band"] .venue { grid-area: venue; padding-bottom: 1em; }
.info[data-layout="band"] .sub { grid-area: sub; padding: 1em 2cqw; }
.info[data-layout="band"] .dates { grid-area: dates; padding: 1em 4.6cqw 1em 2cqw; text-align: right; }
/* spine: the lines stand in the bottom right corner, reading upward */
.info[data-layout="spine"] { writing-mode: vertical-rl; transform: rotate(180deg); align-content: end; justify-content: start; gap: 0; }
.info[data-layout="spine"] span { max-width: none; max-height: 78cqw; padding: 0.6em 0.3em; }
.info[data-layout="spine"] .kind { padding-top: 0.9em; }

/* A new look prints in from the top, like a sheet leaving the press. */
.sheet.printing, .sheet.printing + .info { animation: print var(--print-time, 460ms) var(--out); }
@keyframes print { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.stage-note { position: absolute; left: 0; right: 0; bottom: 14px; margin: 0; text-align: center; font-size: 12.5px; color: var(--quiet); min-height: 1.5em; pointer-events: none; }

/* ---- the wall: the same word on twelve images, each sheet live */
.wall-section { padding: clamp(56px, 8vw, 112px) clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--rule); }
.wall-head > p { margin: 0 0 clamp(24px, 3.2vw, 40px); color: var(--quiet); max-width: 58ch; text-wrap: pretty; }
.wall { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 2.6vw, 36px) clamp(10px, 1.6vw, 22px); }
.card { display: grid; gap: 10px; min-width: 0; padding: 0; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; border-radius: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.poster { position: relative; display: block; aspect-ratio: 2 / 3; container-type: inline-size; isolation: isolate; cursor: crosshair; touch-action: pan-y; }
.poster .sheet { display: block; }
.card .info { font-size: max(5px, 2.3cqw); }
.card-name { display: flex; gap: 0.8em; min-width: 0; font: 600 10.5px/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.card-name span { color: var(--quiet); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1180px) { .wall { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---- opening it the first time */
.open { scroll-margin-top: var(--bar); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "head scene" "steps scene"; column-gap: clamp(28px, 5vw, 72px); padding: clamp(56px, 8vw, 112px) clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--rule); align-items: start; }
.open > * { min-width: 0; }
.open-head { grid-area: head; }
.open-steps { grid-area: steps; }
h2 { margin: 0 0 14px; font-size: clamp(1.6rem, 2.4vw, 2.2rem); line-height: 1.08; font-weight: 650; letter-spacing: -0.03em; text-wrap: balance; }
.open-head > p { margin: 0 0 26px; color: var(--quiet); max-width: 58ch; text-wrap: pretty; }
.open-steps > .fine { margin: 14px 0 0; }
.steps { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.step { width: 100%; display: grid; grid-template-columns: 26px 1fr; gap: 6px; align-items: baseline; padding: 12px 14px; text-align: left; font: 400 14px/1.45 var(--sans); color: var(--ink); background: var(--panel); border: 0; border-radius: 0; cursor: pointer; transition: background-color 160ms var(--out); -webkit-tap-highlight-color: transparent; }
.step .n { font: 600 12px/1 var(--mono); color: var(--quiet); }
.step[aria-current="step"] { background: var(--ink); color: var(--stage); }
.step[aria-current="step"] .n { color: var(--stage); }
.step:focus-visible { outline-offset: -3px; }

.terminal { margin-top: 30px; }
.terminal-line { display: flex; align-items: stretch; border: 1px solid var(--rule); background: var(--well); }
.terminal-line code { flex: 1; min-width: 0; padding: 11px 12px; font: 12.5px/1.4 var(--mono); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.terminal-line .button { height: auto; border: 0; border-left: 1px solid var(--rule); min-width: 76px; }
/* A label that changes its word does it through a short blur, so it reads as one thing changing. */
.swap { display: inline-block; transition: opacity 160ms var(--out), filter 160ms var(--out); }
.swap.swapping { opacity: 0; filter: blur(2px); }

/* The scenes are drawings in the page's own lines, not screenshots. */
.scene-wrap { grid-area: scene; position: sticky; top: calc(var(--bar) + 28px); }
.scene { position: relative; aspect-ratio: 4 / 3; background: var(--panel); border: 1px solid var(--rule); overflow: hidden; }
.shot { position: absolute; inset: 0; display: grid; place-items: center; padding: 8%; opacity: 0; transform: translateY(6px) scale(0.985); transition: opacity 240ms var(--out), transform 320ms var(--out); pointer-events: none; }
.scene[data-scene="drag"] .shot-drag,
.scene[data-scene="warn"] .shot-dialog, .scene[data-scene="confirm"] .shot-dialog,
.scene[data-scene="settings"] .shot-settings, .scene[data-scene="privacy"] .shot-settings, .scene[data-scene="anyway"] .shot-settings { opacity: 1; transform: none; }

.shot-drag { grid-template-columns: auto auto auto; gap: 5%; justify-content: center; align-content: center; }
.app-tile, .folder { width: clamp(116px, 13vw, 136px); aspect-ratio: 1; display: grid; place-items: end center; padding: 12px 12px 14px; font: 600 11px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid var(--rule); background: var(--well); }
.app-tile { background: var(--ink); color: var(--stage); border-color: var(--ink); }
.scene[data-scene="drag"] .app-tile { animation: nudge 1.8s var(--in-out) infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 55% { transform: translateX(22%); } }
.arrow { width: clamp(28px, 5vw, 56px); height: 1px; background: var(--quiet); position: relative; align-self: center; }
.arrow::after { content: ""; position: absolute; right: 0; top: -4px; width: 8px; height: 8px; border-top: 1px solid var(--quiet); border-right: 1px solid var(--quiet); transform: rotate(45deg); }

.dialog { width: min(78%, 330px); padding: 22px 20px 18px; background: var(--well); border: 1px solid var(--rule); text-align: center; }
.dialog-title { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.dialog-body { margin: 8px 0 18px; font-size: 12.5px; color: var(--quiet); line-height: 1.45; }
.dialog-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dialog-button { display: grid; place-items: center; height: 30px; padding: 0 10px; font-size: 12.5px; font-weight: 500; border: 1px solid var(--rule); background: var(--panel); white-space: nowrap; }
.dialog-button.hot, .scene[data-scene="anyway"] .anyway { background: var(--ink); color: var(--stage); border-color: var(--ink); font-weight: 600; animation: press 1.9s var(--out) infinite; }
@keyframes press { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(0.95); } }

.settings { width: 100%; height: 100%; display: grid; grid-template-columns: 38% 1fr; border: 1px solid var(--rule); background: var(--well); font-size: 12px; }
.settings-side { display: grid; align-content: start; gap: 2px; padding: 12px 8px; border-right: 1px solid var(--rule); background: var(--panel); }
.row { padding: 7px 9px; color: var(--quiet); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background-color 200ms var(--out), color 200ms var(--out); }
.scene[data-scene="privacy"] .privacy, .scene[data-scene="anyway"] .privacy { background: var(--ink); color: var(--stage); font-weight: 600; }
.settings-main { padding: 14px; display: grid; align-content: end; gap: 10px; opacity: 0.25; transition: opacity 240ms var(--out); }
.scene[data-scene="anyway"] .settings-main { opacity: 1; }
.settings-head { font-weight: 650; font-size: 13px; }
.blocked { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--rule); background: var(--panel); line-height: 1.4; }
.blocked .dialog-button { justify-self: end; }

.scene-progress { height: 1px; background: var(--rule); margin-top: -1px; position: relative; }
.scene-progress span { position: absolute; inset: 0; background: var(--ink); transform-origin: left; transform: scaleX(0); }
.scene-progress span.running { transition: transform var(--step-time, 3600ms) linear; transform: scaleX(1); }

/* ---- Instagram */
.follow { padding: clamp(56px, 8vw, 112px) clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--rule); }
.follow h2 { margin: 0 0 14px; font-size: clamp(2rem, 6.4vw, 5.6rem); line-height: 1; letter-spacing: -0.04em; }
.follow p { margin: 0; color: var(--quiet); }
.handle { display: inline-flex; align-items: center; gap: 0.35em; text-decoration: none; }
.handle svg { width: 0.62em; height: 0.62em; transition: transform 220ms var(--out); }

/* ---- foot */
.foot { display: flex; flex-wrap: wrap; gap: 14px 28px; justify-content: space-between; padding: 26px clamp(20px, 5vw, 72px) 40px; font-size: 12.5px; color: var(--quiet); }
.foot p { margin: 0; max-width: 62ch; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot a { color: var(--ink); }

/* Hover belongs to pointers that can hover. */
@media (hover: hover) and (pointer: fine) {
  .tool:hover { background: var(--well); }
  .button:hover { border-color: var(--quiet); }
  .button.prominent:hover { background: #fff; border-color: #fff; }
  .tile:not([aria-checked="true"]):hover { background: #2a2a2a; }
  .thumb:hover { filter: none; }
  .step:not([aria-current="step"]):hover { background: var(--well); }
  .handle:hover svg { transform: translateX(0.14em); }
  .button.big:hover svg { transform: translateY(2px); }
  .ink-slider:hover::-webkit-slider-thumb { transform: scale(1.15); }
}

/* ---- narrow: the poster first, the controls under it */
@media (max-width: 860px) {
  .studio { grid-template-columns: 1fr; min-height: 0; }
  .stage { order: -1; padding: 18px 18px 30px; border-bottom: 1px solid var(--rule); }
  .sheet-wrap { position: static; height: auto; width: min(100%, 62svh * var(--aspect, 0.6667)); }
  .column { border-right: 0; padding: 26px 20px 28px; }
  .lede { max-width: none; }
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .open { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "scene" "steps"; }
  /* The drawing stays under the bar while the steps scroll, so a tapped step is seen at once. */
  .scene-wrap { position: sticky; top: var(--bar); z-index: 2; margin: 0 calc(-1 * clamp(20px, 5vw, 72px)) 18px; }
  .scene { aspect-ratio: 16 / 9; border-left: 0; border-right: 0; }
  .shot { padding: 5%; }
  .dialog { padding: 14px 16px 12px; }
  .dialog-body { margin: 6px 0 12px; }
  .wide-only { display: none; }
  .stage-note { bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sheet-wrap { transform: none !important; }
  .column > *, .sheet.printing, .sheet.printing + .info, .shuffle.rolled .dice, .scene .app-tile, .dialog-button.hot, .scene .anyway, .working.on::after { animation: none !important; }
  .shot { transform: none; transition: opacity 200ms linear; }
  .scene-progress span.running { transition: none; }
}
