/* The cover circuit's styles, loaded after style.css, which supplies the palette, --mono and the font faces, --grid --z --p, the logo layers
   (.lb .lc), and the site's .btn classes. Their list and the rest of the interface: README.md. */

:root {
  --draw-dur: 2.2s;        /* one trace's draw-in */
  --draw-step: 0.15s;      /* stagger between traces (up to 3 steps) */
  --draw-end: calc(var(--draw-dur) + 3 * var(--draw-step));   /* when the last trace finishes */
  --show-gap: 0.5s;        /* how long after that the buttons (or, without JavaScript, the line in their place) appear */
}

/* the chip and its logo */
.logo { position: absolute; inset: 0; }
.logo-cursor { animation: blink 1.1s steps(1, end) infinite; }
.chip { position: relative; width: calc(76px * var(--z)); aspect-ratio: 1; margin-bottom: calc(var(--p) + 16px / var(--z)); flex: none; }   /* room for the controls row (on the first dot row under the chip) to clear the name */
@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }

.traces { position: absolute; width: 620.8%; height: 256.25%; left: -260.4%; top: -78.1%; overflow: visible; pointer-events: none; }
/* The draw-in, defined once (the card's board reuses it): each trace routes out from its pin, then the pads appear. --pad-delay moves the pads' start:
   the page leaves it at 1.6 s, the card sets it negative so its pads are there before the traces route to them. */
.tr path { fill: none; stroke: var(--trace); stroke-width: 18; stroke-linejoin: round; stroke-linecap: round; opacity: 0.8; stroke-dasharray: 1 2; stroke-dashoffset: 0; animation: draw var(--draw-dur) cubic-bezier(.5, 0, .2, 1) backwards; }
.tr path:nth-child(2n) { animation-delay: var(--draw-step); }
.tr path:nth-child(3n) { animation-delay: calc(2 * var(--draw-step)); }
.tr path:nth-child(4n) { animation-delay: calc(3 * var(--draw-step)); }
.pads circle { fill: var(--bg); stroke: var(--trace); stroke-width: 18; opacity: 0.85; animation: pop 0.5s ease-out var(--pad-delay, 1.6s) backwards; }
/* Solid copper: the traces' and pads' see-through blue, mixed instead with what lies under them (--under), so a grid dot
   under a bend no longer shows through as a dot (his 11:57). Browsers without color-mix keep the see-through version. */
@supports (color: color-mix(in srgb, red, blue)) {
  .tr path { stroke: color-mix(in srgb, var(--trace) 80%, var(--under, var(--bg))); opacity: 1; }
  .pads circle { stroke: color-mix(in srgb, var(--trace) 85%, var(--under, var(--bg))); opacity: 1; }
}
/* The trace is one dash the length of the path (pathLength is 1) and the draw slides it in from before the start. It starts at 1.01, not 1: at exactly 1
   WebKit rounds the next dash's start to a zero-length dash with round caps and draws a dot at the end of some traces (a lit pad before any trace starts). */
@keyframes draw { from { stroke-dashoffset: 1.01; } to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; } to { opacity: 0.85; } }

@media (prefers-reduced-motion: reduce) { .logo-cursor { opacity: 1; } }

/* ---------- circuit controls (made by the script: replay, and the card) ---------- */
/* Under the chip, out of the flow, so appearing moves nothing. Two rounded squares (32 px, the site buttons' 4 px radius, 44 px hit box on touch) on the page's
   dot grid, the row set by the script. Replay is a ring; the card button is filled. Invisible until their fade-in, a hover, or focus. */
.ctl { --btn: 32px; position: absolute; z-index: 5; left: 50%; top: 100%; transform: translateX(-50%); display: flex; gap: calc(3 * var(--p) - var(--btn)); opacity: 0; transition: opacity 0.9s ease; -webkit-tap-highlight-color: transparent; }
.ctl[hidden] { display: none; }
.ctl.on, .ctl.peek { opacity: 1; }
.ctl.peek { transition-duration: 0.12s; }
/* in place and usable from load, just unseen: hover or focus shows them at once (a first tap does, on touch) */
.ctl:focus-within { opacity: 1; transition-duration: 0.12s; }
@media (hover: hover) { .ctl:hover { opacity: 1; transition-duration: 0.12s; } }
.ctl button { position: relative; width: var(--btn); height: var(--btn); padding: 0; display: grid; place-items: center; border: 0; background: none; color: var(--accent); cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.ctl button::after { content: ""; position: absolute; inset: calc((var(--btn) - 32px) / 2); border-radius: 4px; border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent); transition: background 0.2s, border-color 0.2s; }
.ctl button svg { position: relative; z-index: 1; }
.ctl .c-save { color: var(--bg); }
.ctl .c-save::after { background: var(--accent); border-color: var(--accent); }
.ctl button:focus { outline: none; }
.ctl button:active::after, .ctl button.down::after, .ctl button:focus-visible::after { border-color: var(--accent); }
.ctl .c-save:active::after, .ctl .c-save.down::after, .ctl .c-save:focus-visible::after { background: color-mix(in srgb, var(--accent) 80%, var(--ink)); border-color: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
@media (hover: hover) {   /* not on touch, where :hover sticks after a tap */
  .ctl button:hover::after { border-color: var(--accent); }
  .ctl .c-save:hover::after { background: color-mix(in srgb, var(--accent) 80%, var(--ink)); border-color: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
}
.ctl button:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 3px; }
.c-say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* the keepsake card: the board alone on a scrim, its notes and buttons beneath */
/* the scrim is opaque by itself (the dark page colour at 0.985, in both schemes: the sheet is light text on dark), so the page behind reads as a faint shape and never as text; the blur is only an extra */
.c-card { position: fixed; z-index: 20; inset: 0; width: 100%; height: 100vh; height: 100dvh; background: rgb(10 14 22 / 0.985); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); opacity: 0; transition: opacity 0.18s ease; }
.c-scroll { position: absolute; inset: 0; display: grid; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: calc(max(8px, env(safe-area-inset-top)) + 52px) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.c-card[hidden] { display: none; }
.c-card.in { opacity: 1; }
.c-sheet { margin: auto; width: min(100%, 28rem, calc(100svh - 340px)); min-width: min(100%, 17rem); transform: translateY(14px) scale(0.97); transition: transform 0.32s cubic-bezier(.2, .8, .2, 1); }
.c-card.in .c-sheet { transform: none; }
.c-frame { aspect-ratio: 1; filter: drop-shadow(0 12px 34px rgb(0 0 0 / 0.55)); }
.c-note { margin: 16px 2px; text-align: left; text-wrap: pretty; color: #d6deec; font-size: 0.92rem; line-height: 1.5; }
/* Replay: a small symbol at the note's top right, beside the board it replays, not one of the actions (his 11:45) */
.c-rp { float: right; width: 36px; height: 36px; margin: 0 0 4px 12px; padding: 0; display: grid; place-items: center; cursor: pointer; background: rgb(255 255 255 / 0.07); border: 1px solid rgb(255 255 255 / 0.3); border-radius: 4px; color: #eef2fa; }
.c-rp:hover { background: rgb(255 255 255 / 0.15); border-color: #fff; }
.c-note .c-sn { font-family: var(--mono); font-size: 0.9em; white-space: nowrap; color: #eef2fa; }
/* the actions: one row of three equal buttons (Download is the primary), the site's 4 px radius; Close is not one of them */
/* the optional name: above the actions, in the same dark-on-light-tint look as the secondary buttons */
.c-name { display: block; margin: 0 2px 12px; }
.c-nrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; color: #d6deec; font-size: 0.82rem; }
.c-poss { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }   /* "Add 's", on by default (his 11:54) */
.c-poss input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.c-name input[type="text"] { width: 100%; min-height: 44px; padding: 0 12px; box-sizing: border-box; border-radius: 4px; border: 1px solid rgb(255 255 255 / 0.3); background: rgb(255 255 255 / 0.07); color: #eef2fa; font: 400 1rem var(--mono); }
.c-name input::placeholder { color: #9fb0c9; }
.c-acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.c-acts .btn { gap: 8px; min-height: 48px; padding: 0 6px; cursor: pointer; font-size: 0.88rem; white-space: nowrap; min-width: 0; }
.c-acts .btn svg { flex: none; }
.c-acts .btn-secondary { background: rgb(255 255 255 / 0.07); border-color: rgb(255 255 255 / 0.3); color: #eef2fa; }
.c-acts .btn-secondary:hover { background: rgb(255 255 255 / 0.15); border-color: #fff; }
.c-acts .btn[aria-disabled="true"] { opacity: 0.55; cursor: default; }
/* when the sheet is narrow (a phone, or a short window that shrinks it): icon over label in the same boxes, never a second row */
.c-side { container-type: inline-size; }
@container (max-width: 400px) { .c-acts .btn { flex-direction: column; gap: 3px; min-height: 58px; font-size: 0.78rem; } }
@media (max-width: 440px) { .c-acts .btn { flex-direction: column; gap: 3px; min-height: 58px; font-size: 0.78rem; } }   /* browsers without container queries */
.c-card :focus-visible { outline: 2px solid #fff; outline-offset: 2px; }   /* the scrim is dark in both themes */
.c-lab { display: inline-grid; place-items: center; }   /* Share's two labels share a cell, so "Copied" replaces it without a change of width */
.c-lab > span { grid-area: 1 / 1; }
.c-lab .c-s2, .c-shr.copied .c-s1 { visibility: hidden; }
.c-shr.copied .c-s2 { visibility: visible; }
/* a wide, short screen (a phone on its side): the card on the left at the height there is, the note, name and actions on its right, no scrolling */
@media (orientation: landscape) and (max-height: 560px) {
  .c-scroll { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .c-sheet { --cs: min(28rem, calc(100dvh - max(10px, env(safe-area-inset-top)) - max(10px, env(safe-area-inset-bottom)))); width: auto; min-width: 0; max-width: 100%;
    display: grid; grid-template-columns: var(--cs) minmax(0, 21rem); gap: 20px; align-items: center; }
  .c-side { padding-top: 40px; }
  .c-note { margin: 0 2px 10px; font-size: 0.8rem; line-height: 1.4; }
  .c-name { margin-bottom: 10px; }
  .c-nrow { margin-bottom: 4px; font-size: 0.78rem; }
  .c-name input[type="text"] { min-height: 40px; }
  .c-acts .btn { min-height: 52px; }
}
/* Close: top right of the overlay, outside the card */
.c-x { position: absolute; z-index: 1; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); width: 44px; height: 44px; padding: 0; display: grid; place-items: center; cursor: pointer; background: rgb(255 255 255 / 0.07); border: 1px solid rgb(255 255 255 / 0.3); border-radius: 4px; color: #eef2fa; }
.c-x:hover { background: rgb(255 255 255 / 0.15); border-color: #fff; }
@media (prefers-reduced-motion: reduce) { .c-card, .c-sheet { transition: none; transform: none; } }
/* a reload with the card open goes straight to the card (his 11:28): until it is up, the page is the scrim's colour and nothing on it shows, and the card does not fade in */
.c-back body { background: rgb(10 14 22); }
.c-back body > :not(.c-card) { visibility: hidden; }
.c-back .c-card, .c-back .c-sheet { transition: none; transform: none; }
/* the board: card-only look (colours from the page's theme); its traces and pads take the shared rules above */
.c-board { display: block; width: 100%; height: 100%; --under: var(--panel-2); }
.c-board .board { fill: var(--panel-2); stroke: var(--line); stroke-width: 4; }
.c-board .dot { fill: var(--muted); opacity: 0.55; }
.c-board .mask { fill: var(--panel-2); stroke: var(--line); stroke-width: 2; }
.c-board .cu { fill: var(--trace); }
.c-board .pads circle { fill: var(--panel-2); }   /* colour only: the sizes and strokes are the page's */
.c-board .silk text { font-family: var(--mono); fill: var(--ink); letter-spacing: 0.1em; }
.c-board .dc { font-size: 26px; font-weight: 400; fill: var(--muted); }
/* the label block: title, then dim labels with values in their own column; the domain is the brightest value */
.c-board .silk .ti, .c-board .silk .ln, .c-board .silk text.v { letter-spacing: 0.04em; }   /* sizes are set by the script, from the room the longest line has */
.c-board .silk .ti { font-weight: 600; }
.c-board .silk .k { fill: var(--muted); fill-opacity: 0.7; }
.c-board .silk .v { fill-opacity: 0.85; }
.c-board .silk .vd { font-weight: 600; fill-opacity: 1; }
.c-board .qr { fill: var(--muted); }
.c-board .qm { fill: var(--panel-2); }
.c-board.hold .tr path, .c-board.hold .pads circle { animation-play-state: paused; }
.c-board.done .tr path, .c-board.done .pads circle { animation: none; }   /* reopened after a reload: already drawn */
.c-freeze { position: fixed; left: -4000px; top: 0; width: 1080px; height: 1080px; visibility: hidden; }
.c-freeze * { animation: none !important; transition: none !important; }
html.c-open { overflow: hidden; }
/* no JavaScript: a line in the buttons' place, on the buttons' schedule (--draw-end + --show-gap; the script reads --show-gap too) */
.nojs { max-width: 28rem; margin: -6px auto 14px; text-align: center; color: var(--muted); font: 400 0.78rem/1.4 var(--mono); opacity: 0; animation: nojs-in 0.9s ease calc(var(--draw-end) + var(--show-gap)) forwards; }
@keyframes nojs-in { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .nojs { opacity: 1; } }
/* the redraw: switches the traces' draw-in off for one frame so it can run again */
.replay .tr path, .replay .pads circle { animation: none; }
/* a finger needs 44 px, even though the symbols stay small */
@media (pointer: coarse), (max-width: 760px) { .ctl { --btn: 44px; } }
@media (prefers-reduced-motion: reduce) { .ctl, .ctl.on, .ctl:focus-within, .ctl:hover { transition: none; } }
