/* Shared chrome for the generator (index.html) and the contact sheet
   (gallery.html): fonts, tokens, top strip, controls, About dialog. */

/* ---------- fonts: self-hosted, OFL (fonts/OFL.txt). No third-party request ---------- */
@font-face {
  font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/barlow-400.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/barlow-500.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/barlow-600.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Condensed"; font-style: normal; font-weight: 300; font-display: swap;
  src: url("fonts/barlow-condensed-300.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/barlow-condensed-600.woff2") format("woff2");
}

/* ---------- tokens ---------- */
:root {
  /* the room: true black, strictly neutral. The chrome has no hue of its own */
  --room: #000;
  --panel: #121212;
  --raise: #1e1e1e;
  --line: rgba(255, 255, 255, 0.11);
  --line-2: rgba(255, 255, 255, 0.26);
  --ink: rgba(255, 255, 255, 0.94);
  --ink-2: rgba(255, 255, 255, 0.70);
  --ink-3: rgba(255, 255, 255, 0.55);
  --on-ink: #000;
  --scrim: rgba(0, 0, 0, 0.74);
  --glass: rgba(255, 255, 255, 0.18);
  --dev-ink: #fff;
  --dev-ink-dark: rgba(0, 0, 0, 0.82);
  /* the only colour in the chrome, written at runtime from the active palette */
  --accent: #b03a67;
  --accent-ink: #fff;
  --accent-vis: #d0648c;

  --f-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --f-text: "Barlow", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --t-11: 0.6875rem;
  --t-12: 0.75rem;
  --t-13: 0.8125rem;
  --t-15: 0.9375rem;
  --t-17: 1.0625rem;
  --t-20: 1.25rem;
  --t-plate: clamp(2rem, 3.7vw, 3.6rem);
  --t-strip: clamp(2.25rem, 4vw, 3.25rem);
  --t-sheet: clamp(3.75rem, 11vw, 9.5rem);

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 80px;

  --r-ctl: 4px;
  --r-key: 3px;
  --h-ctl: 36px;
  --h-tap: 44px;
  --h-top: 48px;
  --w-panel: 440px;
  --w-page: 1680px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --d-fast: 120ms;
  --d-move: 220ms;
  --d-develop: 340ms;
}
@media (pointer: coarse), (max-width: 720px) {
  :root { --h-ctl: 44px; }
}

/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--room);
  color: var(--ink);
  font: 400 var(--t-15)/1.45 var(--f-text);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent-vis); outline-offset: 2px; }
[hidden] { display: none !important; }
.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: var(--s-2); top: -80px; z-index: 99;
  background: var(--ink); color: var(--on-ink); padding: var(--s-3) var(--s-4);
  border-radius: var(--r-ctl); font-weight: 600;
}
.skip:focus { top: var(--s-2); }

/* ---------- top strip ---------- */
.top {
  height: var(--h-top);
  display: flex; align-items: center; gap: var(--s-5);
  padding: 0 var(--s-4);
  background: var(--room);
  position: relative; z-index: 30;
}
.wordmark {
  font: 600 var(--t-15)/1 var(--f-display);
  letter-spacing: 0.24em; text-transform: uppercase;
}
.wordmark a {
  text-decoration: none; display: inline-flex; align-items: center;
  min-height: var(--h-tap);
}
.tagline { color: var(--ink-3); font-size: var(--t-13); white-space: nowrap; }
.nav { display: flex; margin-left: auto; }
.nav a, .nav button {
  font: 500 var(--t-13)/1 var(--f-text); color: var(--ink-2);
  text-decoration: none; padding: 0 var(--s-3);
  min-height: var(--h-tap); display: inline-flex; align-items: center;
  position: relative; white-space: nowrap;
  transition: color var(--d-fast) var(--ease);
}
.nav a:hover, .nav button:hover { color: var(--ink); }
.nav [aria-current] { color: var(--ink); }
.nav [aria-current]::after {
  content: ""; position: absolute; left: var(--s-3); right: var(--s-3); bottom: 9px;
  height: 2px; background: var(--accent-vis);
}
.view { display: flex; gap: var(--s-2); align-items: center; }

/* ---------- controls ---------- */
.btn {
  height: var(--h-ctl); padding: 0 var(--s-3);
  border: 1px solid var(--line-2); border-radius: var(--r-ctl);
  background: var(--panel);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  font: 500 var(--t-13)/1 var(--f-text); color: var(--ink); white-space: nowrap;
  text-decoration: none;
  transition: background var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease);
}
.btn:hover { background: var(--raise); border-color: var(--ink-3); }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
/* the fill is the palette's own front colour, which is near-black on Noir
   and Graphite; the lifted border keeps the button's edge visible there */
.btn.primary {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent-vis);
  font-weight: 600; padding: 0 var(--s-5);
}
.btn.primary:hover { filter: brightness(1.12); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn svg { flex: none; }
.seg { display: inline-flex; }
.seg .btn { border-radius: 0; margin-left: -1px; }
.seg .btn:first-child { border-radius: var(--r-ctl) 0 0 var(--r-ctl); margin-left: 0; }
.seg .btn:last-child { border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }
.seg .btn[aria-pressed="true"] { position: relative; z-index: 1; }
kbd {
  font: 500 var(--t-11)/1 var(--f-mono); color: var(--ink-3);
  border: 1px solid var(--line-2); border-radius: var(--r-key); padding: 3px 5px;
}
.btn.primary kbd, .btn[aria-pressed="true"] kbd { color: inherit; border-color: currentColor; }
select.field, input.field {
  height: var(--h-ctl); padding: 0 var(--s-3);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-ctl);
  font-size: var(--t-13);
}
input.field { font-family: var(--f-mono); }

/* ---------- about dialog ---------- */
dialog {
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-ctl);
  padding: var(--s-6);
  width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  margin: auto; overflow: auto;
}
dialog::backdrop { background: var(--scrim); }
dialog h2 { font: 300 var(--t-strip)/1 var(--f-display); margin-bottom: var(--s-4); }
dialog h3 {
  font: 600 var(--t-17)/1.2 var(--f-display); letter-spacing: 0.01em;
  margin: var(--s-5) 0 var(--s-2);
}
dialog p, dialog li { color: var(--ink-2); max-width: 62ch; }
dialog p + p { margin-top: var(--s-3); }
dialog strong { color: var(--ink); font-weight: 600; }
dialog ul { list-style: none; }
dialog li { padding: var(--s-1) 0; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: var(--s-2) var(--s-4); align-items: baseline; }
.keys dt { white-space: nowrap; }
.keys dd { color: var(--ink-2); }
.dialog-foot {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-4);
  margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--line);
}

.toast {
  position: fixed; left: 50%; bottom: var(--s-8); transform: translateX(-50%);
  background: var(--ink); color: var(--on-ink);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-ctl);
  font: 500 var(--t-13)/1.3 var(--f-text);
  opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity var(--d-fast) var(--ease);
  max-width: calc(100vw - 32px);
}
.toast.on { opacity: 1; }

@media (max-width: 1360px) {
  .tagline { display: none; }
}
@media (max-width: 1000px) {
  .view .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .view .btn { min-width: var(--h-tap); padding: 0 var(--s-2); }
}
@media (max-width: 720px) {
  .top { gap: var(--s-1); padding: 0 var(--s-3); }
  .nav a, .nav button { padding: 0 var(--s-2); }
  .nav .nav-home { display: none; }
  .nav [aria-current]::after { left: var(--s-2); right: var(--s-2); }
  dialog { padding: var(--s-5) var(--s-4); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
