/* Layout: a dark studio tool. Card on a dot-grid canvas with a floating toolbar and a timeline strip;
   a tabbed inspector on the right with collapsible uppercase sections and fill-bar sliders. */
:root {
  --bg: #0b0b0c;          /* canvas */
  --grid: #26262a;        /* canvas dots */
  --panel: #111113;       /* inspector + bars */
  --field: #1c1c1e;       /* slider tracks, inputs, value boxes */
  --fill: #2c2c2f;        /* slider fill, selected pill */
  --hover: #333337;
  --line: #222225;
  --ink: #f2f2f2;
  --ink-2: #a1a1a6;
  --ink-3: #6b6b70;
  --accent: #f2f2f2;      /* focus and selection: monochrome, white */
  --accent-ink: #0b0b0c;
  --ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
  --r: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--ui); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: 100%; }

/* ---------- stage ---------- */
.stage { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.bar { display: flex; align-items: center; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { font-weight: 600; font-size: 15px; letter-spacing: .01em; margin-right: auto; }
.bar-right { display: flex; gap: 8px; align-items: center; }

.viewport { flex: 1; min-height: 0; display: grid; place-items: start; padding: 32px 32px 96px; overflow: auto;
  background-color: var(--bg);
  background-image: radial-gradient(var(--grid) 1px, transparent 1.3px);
  background-size: 18px 18px; background-attachment: local; }
.card { position: relative; margin: auto; flex: none; }
.viewport.zoomed { cursor: grab; }
.viewport.zoomed.panning { cursor: grabbing; user-select: none; }
.card canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: 2px; }
#gl { z-index: 2; }
#overlay { z-index: 3; pointer-events: none; }
.sh { position: absolute; inset: 0; border-radius: 3px; z-index: 1; pointer-events: none; will-change: transform; }
.sh.soft { box-shadow: 0 40px 80px -10px rgba(0,0,0,.75), 0 16px 36px -6px rgba(0,0,0,.5); }
.sh.contact { box-shadow: 0 3px 5px rgba(0,0,0,.6), 0 1px 1px rgba(0,0,0,.7); }

/* floating toolbar */
.toolbar { position: absolute; right: 20px; bottom: 68px; z-index: 5; display: flex; align-items: center; gap: 4px;
  padding: 6px; background: rgba(17,17,19,.92); border: 1px solid var(--line); border-radius: 14px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.tdiv { width: 1px; height: 26px; background: var(--line); margin: 0 6px; }
.ibtn { all: unset; box-sizing: border-box; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.ibtn:hover { background: var(--field); color: var(--ink); }
.ibtn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ibtn svg { width: 20px; height: 20px; }
.ibtn .dot { fill: currentColor; stroke: none; }
.zread { min-width: 54px; text-align: center; font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink); }

/* timeline strip */
.timeline { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 52px; padding: 0 20px; border-top: 1px solid var(--line); background: var(--panel); }
.tlbar { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--ink); opacity: .9; }
.status { margin: 0; color: var(--ink-3); font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.err { color: #ff8a7a; }
.tlread { font-family: var(--mono); font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

.drop { position: absolute; inset: 14px; border: 2px dashed var(--ink-2); border-radius: 16px; display: grid; place-items: center;
  font-size: 16px; color: var(--ink); background: rgba(11,11,12,.8); z-index: 10; }

/* ---------- buttons, fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; border: 0;
  background: var(--field); color: var(--ink); border-radius: 9px; padding: 9px 14px; font: 500 14px var(--ui); }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--ink); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #ffffff; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.mini { padding: 7px 11px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

select { appearance: none; -webkit-appearance: none; background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23a1a1a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  color: var(--ink); border: 0; border-radius: 9px; height: 40px; padding: 0 38px 0 14px; font: 14px var(--ui); cursor: pointer; }
select:hover { background-color: var(--hover); }

input[type=color] { -webkit-appearance: none; appearance: none; width: 40px; height: 40px; padding: 4px; border: 0; border-radius: 9px; background: var(--field); cursor: pointer; flex: none; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 6px; }
input[type=color]::-moz-color-swatch { border: 0; border-radius: 6px; }

/* segmented pills */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--field); border-radius: 11px; }
.seg button { all: unset; box-sizing: border-box; cursor: pointer; padding: 7px 14px; border-radius: 8px; font-size: 14px; color: var(--ink-2); text-align: center; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--fill); color: var(--ink); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.toolbar .seg { background: transparent; padding: 0; }
.toolbar .seg button { padding: 9px 15px; font-size: 15px; }

/* switch */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; color: var(--ink); font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .knob { position: relative; width: 46px; height: 26px; border-radius: 13px; background: #3a3a3d; transition: background .18s; flex: none; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #8e8e93; transition: transform .18s, background .18s; }
.switch input:checked + .knob { background: var(--ink); }
.switch input:checked + .knob::after { transform: translateX(20px); background: #0b0b0c; }
.switch input:focus-visible + .knob { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- inspector ---------- */
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
.tabs { display: flex; gap: 1px; padding: 10px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { all: unset; cursor: pointer; padding: 7px 9px; border-radius: 9px; font-size: 14.5px; color: var(--ink-2); white-space: nowrap; flex: none; }
.tab:hover { color: var(--ink); }
.tab.on { background: var(--fill); color: var(--ink); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.panes { flex: 1; overflow-y: auto; padding-bottom: 40px; }
.pane { display: none; }
.pane.on { display: block; }

.sec { border-bottom: 1px solid var(--line); padding: 4px 20px 20px; }
.sech { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  padding: 18px 0 14px; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #d1d1d6; }
.sech::after { content: ""; width: 9px; height: 9px; border-left: 1.6px solid var(--ink-2); border-top: 1.6px solid var(--ink-2); transform: rotate(45deg) translate(2px, 2px); transition: transform .18s; }
.sech[aria-expanded="false"]::after { transform: rotate(225deg) translate(2px, 2px); }
.sech:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sec.closed { padding-bottom: 4px; }
.sec.closed .secb { display: none; }
.group { display: grid; gap: 8px; }
.hint { color: var(--ink-3); font-size: 12.5px; margin: 12px 0 0; }
.hint.top { margin: 0 0 12px; }
.hint b { color: var(--ink-2); font-weight: 600; }
.inline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.frow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.frow select { flex: 1; max-width: 220px; }
.flabel { color: var(--ink-2); font-size: 14px; }
.colorfield { display: flex; align-items: center; gap: 10px; color: var(--ink-2); cursor: pointer; }
.exports { display: grid; }

/* fill-bar slider: label inside the track, fill shows the value, value in its own box */
.slider { display: grid; grid-template-columns: minmax(0, 1fr) 72px; gap: 8px; }
.track { position: relative; height: 40px; border-radius: 9px; background: var(--field); overflow: hidden; }
.track .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--fill); }
.track .fill::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 2px; background: #4a4a4f; opacity: 0; transition: opacity .15s; }
.track .lbl { position: absolute; left: 14px; top: 0; bottom: 0; display: flex; align-items: center; font-size: 14px; color: var(--ink-2);
  pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; right: 10px; transition: color .15s; }
.track input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.slider:hover .lbl, .slider:focus-within .lbl { color: var(--ink); }
.slider:hover .fill::after, .slider:focus-within .fill::after { opacity: 1; background: var(--ink); }
.slider:focus-within .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.val { display: flex; align-items: center; justify-content: center; height: 40px; border-radius: 9px; background: var(--field);
  font-family: var(--mono); font-size: 13.5px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* colour rows: layer → finish → colour */
.row { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px; margin-bottom: 10px;
  background: #151517; border: 1px solid transparent; border-radius: 12px; }
.row.hover { border-color: #3a3a3d; }
.sw { width: 30px; height: 30px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.rmain { display: grid; gap: 10px; min-width: 0; }
.rhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pct { font-family: var(--mono); font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.seg.layer { display: flex; width: 100%; }
.seg.layer button { flex: 1; padding: 7px 6px; }
.rstep { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.rstep select { flex: 1; min-width: 0; }
.slabel { width: 82px; flex: none; font-size: 13px; color: var(--ink-3); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; padding-left: 92px; }
.chip { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); cursor: pointer; padding: 0; }
.chip.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.rnote { font-size: 12px; color: var(--ink-3); }
.stocktag { font-size: 13px; color: var(--ink-3); }

/* paper stock */
.pnow { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 14px; color: var(--ink-2); }
.pnow b { color: var(--ink); font-weight: 600; }
.pgroup { margin-bottom: 14px; }
.plabel { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.pgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.pswatch { aspect-ratio: 1; border-radius: 9px; border: 1px solid rgba(255,255,255,.1); cursor: pointer; padding: 0; position: relative;
  box-shadow: inset 0 -8px 12px rgba(0,0,0,.14); }
.pswatch.fleck { background-image: radial-gradient(rgba(60,40,20,.55) 0.6px, transparent 1px) !important; background-size: 5px 6px !important; }
.pswatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; height: auto; }
  .stage { min-height: 82vh; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .panes { overflow: visible; }
  .toolbar { right: 12px; left: 12px; justify-content: center; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .sech::after, .switch .knob, .switch .knob::after { transition: none; } }

/* artboard */
.board { position: relative; margin: auto; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
#view { position: absolute; display: block; }
.board.oncard { cursor: grab; }
.viewport.moving, .viewport.moving .board { cursor: grabbing; user-select: none; }
.seg.wide3 { display: flex; width: 100%; }
.seg.wide3 button { flex: 1; }
.bggrid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.btn:disabled { opacity: .5; cursor: default; }

/* textured stock swatches */
.pswatch.tex-linen, .pswatch.tex-coarse { background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgba(255,255,255,.1) 0 1px, transparent 1px 3px) !important; }
.pswatch.tex-coarse { background-size: 5px 5px, 5px 5px !important; }
.pswatch.tex-ribbed { background-image: repeating-linear-gradient(90deg, rgba(0,0,0,.22) 0 1px, transparent 1px 4px) !important; }
.pswatch.tex-pulp { background-image: radial-gradient(circle at 30% 40%, rgba(255,255,255,.18) 0 1px, transparent 1.5px), radial-gradient(circle at 70% 65%, rgba(0,0,0,.2) 0 1px, transparent 1.5px) !important; background-size: 6px 7px, 5px 6px !important; }
/* six quick angles: a 3 × 2 grid instead of one overflowing row */
#angles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
#angles button { padding: 8px 4px; white-space: nowrap; }

/* transparent artboard: a checkerboard behind it shows what's see-through */
.board.transparent { background: repeating-conic-gradient(#2a2a2d 0 25%, #1f1f22 0 50%) 0 0 / 16px 16px; }

/* card shadow switched off: its sliders recede */
#gShadow.off { opacity: .4; pointer-events: none; }

/* brand, credit, artboard off */
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 28px; height: 28px; border-radius: 7px; display: block; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.timeline { gap: 16px; }
.timeline .status { flex: 1; }
.credit { margin: 0; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.credit a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.18); }
.credit a:hover { color: var(--ink); border-color: var(--ink-2); }
.panel.no-artboard .ab-only { opacity: .35; pointer-events: none; }
.board.bare { box-shadow: none; }

/* ---------- intro modal: animated artwork left, core features right ---------- */
.btn.icon { padding: 9px; }
.intro { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: rgba(6, 6, 7, .62); backdrop-filter: blur(14px) saturate(.9); -webkit-backdrop-filter: blur(14px) saturate(.9);
  opacity: 0; transition: opacity .22s ease; }
.intro.show { opacity: 1; }
.intro-card { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); width: min(1040px, 100%); max-height: calc(100vh - 48px);
  background: var(--panel); border: 1px solid #2a2a2e; border-radius: 18px; overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.03) inset;
  transform: translateY(10px) scale(.985); transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.intro.show .intro-card { transform: none; }
.intro-art { display: grid; place-items: center; padding: 44px; background: #161618;
  background-image: radial-gradient(ellipse at 50% 40%, #232326 0%, #121214 70%); min-height: 0; }
.intro-art canvas { width: 100%; height: auto; max-height: calc(100vh - 140px); object-fit: contain; display: block; border-radius: 2px;
  box-shadow: 0 2px 3px rgba(0,0,0,.35), 0 18px 40px rgba(0,0,0,.45); }
.intro-body { display: flex; flex-direction: column; padding: 36px 36px 30px; overflow: auto; min-height: 0; }
.intro-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.intro-brand img { border-radius: 7px; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.intro h1 { font-size: 26px; line-height: 1.18; letter-spacing: -.015em; font-weight: 600; margin: 26px 0 10px; text-wrap: balance; }
.intro-lede { color: var(--ink-2); margin: 0 0 22px; font-size: 14.5px; text-wrap: pretty; }
.intro-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: f; }
.intro-list li { display: grid; grid-template-columns: 26px 1fr; column-gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); counter-increment: f; }
.intro-list li::before { content: counter(f, decimal-leading-zero); grid-row: 1 / 3; font: 12px/20px var(--mono); color: var(--ink-3); }
.intro-list b { font-weight: 600; font-size: 14px; }
.intro-list span { color: var(--ink-2); font-size: 13px; line-height: 1.4; }
.intro-foot { display: flex; align-items: center; gap: 16px; margin-top: auto; padding-top: 24px; flex-wrap: wrap; }
.intro-go { padding: 12px 22px; font-size: 15px; border-radius: 10px; }
.intro-note { color: var(--ink-3); font-size: 12.5px; }
@media (max-width: 760px) {
  .intro-card { grid-template-columns: 1fr; overflow: auto; }
  .intro-art { padding: 28px; min-height: auto; }
  .intro-art canvas { width: min(100%, 300px); max-height: none; }
  .intro-body { padding: 24px; overflow: visible; }
}
@media (prefers-reduced-motion: reduce) { .intro, .intro-card { transition: none; } }
.intro-note a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.18); white-space: nowrap; }
.intro-note a:hover { color: var(--ink); }
/* video ready: make the Save button impossible to miss */
@keyframes savePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.0); } 50% { box-shadow: 0 0 0 5px rgba(255,255,255,.18); } }
#exSave.ready { animation: savePulse 1.4s ease-in-out 3; }
