/* Spektrafilm Pack Creator. The look follows GRKit's film look picker (https://github.com/ahonn/grkit,
   web/src/styles.css), MIT License, Copyright (c) 2026 ahonn; see vendor/grkit-LICENSE.txt.
   Colours from analog film and spektrafilm's own banner and GUI: warm print-paper
   white, cyan-black ink, a light-leak orange accent, the orange film-base mask for
   selected stocks and the cyan, magenta and yellow dyes in a strip under the header.
   Square controls; IBM Plex type. */
:root {
  color-scheme: light;
  --ink: #10202a;
  --ink-2: #2b3a44;
  --muted: #56636c;
  --line: #ddd3c4;
  --paper: #f7f2ea;
  --accent: #b8381a;
  --on-accent: #ffffff;
  --selected: #f6e1cf;
  --warning: #a8331a;
  --code: #ede5d8;
  --tray: rgba(247, 242, 234, .94);
  --dye-c: #1aa6b7; --dye-m: #d6457f; --dye-y: #f2b51d;
  --r: #cf3b3b; --g: #2b9457; --b: #2f68d0;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --display: "IBM Plex Sans Condensed", "Arial Narrow", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #f1ebe3; --ink-2: #cfc6bb; --muted: #98a2a8; --line: #283238; --paper: #0d151a;
    --accent: #ff8a5c; --on-accent: #0d151a; --selected: #2b1b15; --warning: #ff9a70; --code: #1a2329;
    --tray: rgba(13, 21, 26, .94);
    --r: #ff6b6b; --g: #4cc47e; --b: #6b9cff;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 64px); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
a { color: var(--ink); text-underline-offset: .18em; }
a:hover { color: var(--accent); }
button { font: inherit; }
code { font-family: var(--mono); font-size: .86em; background: var(--code); padding: .08em .35em; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; line-height: 1.1; }
p { margin: 0; }

/* header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--paper); }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9; display: flex; align-items: center; gap: 28px; padding: 12px clamp(16px, 4vw, 56px); background: var(--paper); border-bottom: 1px solid var(--line); }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: linear-gradient(90deg, var(--dye-c) 0 33.34%, var(--dye-m) 0 66.67%, var(--dye-y) 0); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 20px var(--display); }
.brand-mark { width: 30px; height: 19px; }
.brand-mark > rect { fill: var(--accent); }
.brand-mark .holes rect { fill: var(--paper); }
.top-nav { display: flex; gap: 22px; font-size: 14px; }
.top-nav a { text-decoration: none; color: var(--muted); }
.top-nav a:hover { color: var(--ink); }
.sync { margin-left: auto; font: 500 12px var(--mono); color: var(--muted); text-decoration: none; border: 1px solid var(--line); padding: 4px 10px; white-space: nowrap; }
.sync::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2b9457; margin-right: 7px; vertical-align: 1px; }
.sync.stale::before { background: #d39b28; }
@media (max-width: 720px) { .top-nav { display: none; } }

/* buttons */
.btn, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; transition: background-color 120ms; }
.button.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-primary, .download-btn { background: var(--ink); color: var(--paper); }
.btn:hover, .button:hover { background: var(--selected); color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn[disabled] { background: var(--line); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 2px 0; font-size: 13px; color: var(--muted); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: .25em; }
.link-btn:hover { color: var(--accent); text-decoration-color: currentColor; }

/* segmented filters */
.segs { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--ink); }
.seg { padding: 6px 12px; border: 0; border-right: 1px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink-2); font-size: 13px; cursor: pointer; }
.seg:last-child { border-right: 0; }
.seg[aria-pressed="true"] { background: var(--ink); color: var(--paper); font-weight: 600; }
.segs.small .seg { padding: 4px 10px; font-size: 12.5px; }

/* page */
main { max-width: 1280px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 56px); }

/* sections: a rule, a heading column that stays in view, the body */
.section { border-top: 2px solid var(--ink); padding: 28px 0 40px; display: flex; flex-wrap: wrap; gap: 24px; }
main > .section:first-of-type { border-top: 0; padding-top: 36px; }
.section[hidden] { display: none; }
.section > h2 { position: sticky; top: 72px; z-index: 5; align-self: flex-start; flex: 0 0 200px; font-size: 26px; }
.section-body { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
@media (max-width: 900px) {
  .section > h2 { top: 52px; flex-basis: 100%; padding: 10px 0; margin: -10px 0; background: var(--paper); }
}
.note { max-width: 72ch; font-size: 13px; line-height: 1.6; color: var(--muted); }
.note-group { display: flex; flex-direction: column; gap: 4px; }

/* shelf toolbar */
.shelf-toolbar { position: sticky; top: 57px; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 8px 0; margin: -8px 0 0; background: var(--paper); }
.shelf-count { font-size: 16px; }
.shelf-count .count { font-family: var(--mono); font-weight: 500; color: var(--accent); }
.shelf-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.shelf-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--ink); padding: 0 10px; min-width: min(280px, 100%); flex: 0 1 320px; }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.6; flex: none; }
.search input { flex: 1; border: 0; background: none; font: 400 14px var(--body); padding: 8px 0; color: var(--ink); min-width: 0; }
.search input:focus { outline: none; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.shelf-links { display: inline-flex; gap: 16px; flex-wrap: wrap; }

/* shelf: ten tiles a row at full width, fewer when narrow */
.shelf { --gap-x: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(max(84px, calc((100% - 9 * var(--gap-x)) / 10)), 1fr)); gap: 10px var(--gap-x); align-items: stretch; }
.shelf .empty { grid-column: 1 / -1; color: var(--muted); padding: 32px 0; }
.shelf-label { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 0 2px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-top: 1px solid var(--line); }
.shelf-label:first-child { border-top: 0; padding-top: 0; }
.shelf-label .n { font-family: var(--mono); font-weight: 400; letter-spacing: 0; margin-left: 4px; }
.shelf-label .link-btn { font-size: 12px; letter-spacing: 0; text-transform: none; }
.shelf-tile { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; min-height: 150px; padding: 16px 4px 10px; border: 1px solid transparent; cursor: pointer; user-select: none; }
@media (hover: hover) { .shelf-tile:not([data-checked]):hover { background: color-mix(in srgb, var(--selected) 55%, var(--paper)); } }
.shelf-tile[data-checked] { background: var(--selected); }
.shelf-tile.required { border: 1px dashed var(--accent); }
.tile-check { position: absolute; top: 6px; right: 6px; z-index: 1; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.tile-body { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: center; cursor: pointer; }
.tile-body .cover { width: 64px; height: 64px; display: block; flex: none; }
.wedge { --rb: #333; display: grid; grid-template-columns: repeat(9, 1fr); gap: 1px; width: 64px; height: 7px; padding: 1px; background: var(--rb); }
.wedge i { display: block; }
.tile-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; width: 100%; min-height: 2.5em; overflow: hidden; font-weight: 600; font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.tile-meta { max-width: 100%; margin-top: 2px; overflow: hidden; font-size: 10px; line-height: 1.3; color: var(--muted); text-align: center; white-space: nowrap; text-overflow: ellipsis; }
.tile-meta.new { color: var(--accent); }
.tile-need { max-width: 100%; font-size: 10px; line-height: 1.3; color: var(--accent); text-align: center; overflow-wrap: anywhere; }
.tile-need[hidden] { display: none; }
.tile-link { margin-top: auto; padding: 4px 6px 0; border: 0; background: none; font-size: 12px; color: var(--ink-2); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.tile-link:hover { color: var(--accent); }

/* cover text in viewBox units, as on the camera icon */
.cover text { font-family: var(--display); font-weight: 700; text-anchor: middle; }
.cover-brand { font-size: 8px; }
.cover-name { font-size: 6.6px; letter-spacing: .2px; }
.cover-number { font-size: 14px; letter-spacing: -.3px; }
.cover-name-large { font-size: 12px; letter-spacing: -.2px; }

/* spectral tables, as module rows */
.modules { display: grid; border-top: 1px solid var(--line); }
.module { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 24px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.module-main { display: flex; gap: 12px; align-items: flex-start; flex: 1 1 420px; cursor: pointer; }
.module input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.module-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.module-name { font-family: var(--mono); font-weight: 500; font-size: 15px; }
.module-description { font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.module:has([data-include]:not(:checked)) .module-description { color: var(--muted); }
.module-default { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; padding-top: 2px; }
.module-default input { width: 16px; height: 16px; margin: 0; }
.module-warning { font-size: 14px; line-height: 1.6; color: var(--warning); max-width: 72ch; }
.module-warning[hidden] { display: none; }

/* install */
.os-tabs { display: inline-flex; border: 1px solid var(--ink); align-self: flex-start; }
.os-tabs button { border: 0; border-right: 1px solid var(--ink); padding: 6px 14px; background: var(--paper); color: var(--ink-2); font-size: 13px; cursor: pointer; }
.os-tabs button:last-child { border-right: 0; }
.os-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); font-weight: 600; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.steps li { counter-increment: s; display: grid; grid-template-columns: 40px 1fr; gap: 6px 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.steps li[hidden] { display: none; }
.steps li::before { content: counter(s); grid-row: span 4; font: 700 26px/1 var(--display); color: var(--accent); }
.steps h3 { font-size: 18px; }
.steps p { color: var(--ink-2); font-size: 15px; max-width: 72ch; }
.rc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.rc[hidden], .rc-none[hidden] { display: none; }
.rc code { font-size: 13px; padding: 8px 10px; background: var(--code); border: 1px solid var(--line); user-select: all; }
.rc-none { font-size: 13px; color: var(--muted) !important; }

/* faq */
.faq details { border-bottom: 1px solid var(--line); max-width: 820px; }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 400; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 0 16px; color: var(--ink-2); max-width: 70ch; font-size: 15px; }

/* sources */
.source-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 32px; }
.src { display: grid; gap: 6px; align-content: start; padding: 14px 0; border-top: 1px solid var(--line); font-size: 14px; }
.src h3 { font-size: 18px; }
.src p { color: var(--ink-2); }
.src a { overflow-wrap: anywhere; }

.foot { max-width: 1280px; margin: 0 auto; padding: 40px clamp(16px, 4vw, 56px) 150px; border-top: 2px solid var(--ink); color: var(--muted); font-size: 13px; display: grid; gap: 8px; }
.foot p { max-width: 100ch; }

/* tray */
.tray { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 0 clamp(10px, 3vw, 32px) calc(env(safe-area-inset-bottom, 0px) + 12px); pointer-events: none; transition: transform .3s cubic-bezier(.2, .8, .3, 1), opacity .2s; }
.tray-inner { pointer-events: auto; max-width: 980px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 10px 10px 10px 20px; background: var(--tray); backdrop-filter: blur(12px); border: 1px solid var(--ink); }
.tray-summary { flex: 1; min-width: 0; display: grid; gap: 2px; }
.tray-summary strong { font-size: 16px; }
.tray-summary span { font-size: 13px; color: var(--muted); }
.tray-warn { color: var(--warning) !important; }
.tray .btn-primary { min-height: 52px; padding: 0 24px; font-size: 18px; font-weight: 700; }
.tray-progress { pointer-events: none; max-width: 980px; margin: 0 auto; height: 3px; overflow: hidden; }
.tray-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
@media (max-width: 560px) { .tray-inner { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; } .tray .btn { width: 100%; } }

/* detail dialog */
dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); padding: 0; box-shadow: 0 30px 80px -30px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(8, 16, 21, .5); }
dialog[open] { animation: rise .2s cubic-bezier(.2, .8, .3, 1); }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.d-close { position: sticky; top: 10px; height: 0; display: flex; justify-content: flex-end; margin: 0 10px; z-index: 2; }
.d-close button { width: 36px; height: 36px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
#d-body { padding: 24px clamp(18px, 4vw, 32px) 28px; display: grid; gap: 20px; }
.d-title .b { color: var(--muted); font-size: 14px; }
.d-title h2 { font-size: clamp(32px, 5vw, 46px); }
.strip { --rb: #333; --ep: #eee; display: grid; grid-template-rows: 18px 96px 22px; background: var(--rb); overflow: hidden; }
.strip .sp { background: repeating-linear-gradient(90deg, transparent 0 9px, var(--paper) 9px 19px, transparent 19px 32px); background-clip: content-box; padding: 5px 0; }
.strip .frames { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; padding: 0 4px; }
.strip .frames i { display: block; }
.strip .ep { font: 700 10.5px/22px var(--display); letter-spacing: .08em; color: var(--ep); padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.strip.paper { grid-template-rows: 10px 96px 10px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.strip.paper .sp, .strip.paper .ep { background: none; font-size: 0; }
.d-strip .cap { font-size: 13px; color: var(--muted); margin-top: 8px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.chart { border: 1px solid var(--line); padding: 12px 12px 6px; }
.chart h3 { font-size: 16px; margin-bottom: 6px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .ax { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font: 10px var(--body); }
.chart .ln { fill: none; stroke-width: 1.8; stroke-linejoin: round; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin: 4px 0 6px; }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: 3px; margin-right: 5px; }
.lic { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.d-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--paper); padding: 10px 16px; font-size: 14px; max-width: min(520px, calc(100vw - 32px)); }
