/*!
 * Tinta Color Studio — styles.css
 * Layout: a printer's proof sheet. Inputs down the left margin, swatch scales
 * as the proof strips, checker and exports below. Registration-mark details.
 * MIT © 2026 Efraim Ray
 */
:root {
  /* Color */
  --paper: #f3f4f1;      /* proof paper, faint green-grey */
  --sheet: #ffffff;
  --ink: #161b26;        /* press ink, blue-black */
  --muted: #5b6270;
  --line: #d9dcd6;
  --accent: #3243c9;     /* process blue */
  --accent-ink: #ffffff;
  --accent-soft: rgba(50, 67, 201, 0.09);
  --pass: #127a45;
  --pass-soft: rgba(18, 122, 69, 0.1);
  --fail: #b3261e;
  --fail-soft: rgba(179, 38, 30, 0.09);
  --warn: #9a5b00;
  --cyan: #00a3d9; --magenta: #d6177a; --yellow: #f2c200;
  --shadow: 0 1px 2px rgba(22, 27, 38, 0.05), 0 6px 20px rgba(22, 27, 38, 0.05);
  /* Type */
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11141b; --sheet: #191d27; --ink: #e8eaef; --muted: #9aa1ae; --line: #2a303d;
    --accent: #8d9bff; --accent-ink: #0d1230; --accent-soft: rgba(141, 155, 255, 0.12);
    --pass: #4fd18b; --pass-soft: rgba(79, 209, 139, 0.12); --fail: #ff8a80; --fail-soft: rgba(255, 138, 128, 0.12); --warn: #f2b84b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11141b; --sheet: #191d27; --ink: #e8eaef; --muted: #9aa1ae; --line: #2a303d;
  --accent: #8d9bff; --accent-ink: #0d1230; --accent-soft: rgba(141, 155, 255, 0.12);
  --pass: #4fd18b; --pass-soft: rgba(79, 209, 139, 0.12); --fail: #ff8a80; --fail-soft: rgba(255, 138, 128, 0.12); --warn: #f2b84b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-family: var(--f-display); font-weight: 800; font-size: clamp(1.8rem, 4.2vw, 2.9rem); letter-spacing: -0.02em; }
h2 { font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; font-weight: 700; margin-top: 1.1rem; }
p { margin: 0; }
a { color: var(--accent); }
code, .mono { font-family: var(--f-mono); }
code { font-size: 0.86em; padding: 0.1em 0.35em; border-radius: 4px; background: var(--accent-soft); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.app { max-width: 1240px; margin: 0 auto; padding-inline: 16px; padding-block: 14px 48px; display: grid; gap: 22px; }

/* ---------- Header ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; position: relative; flex: none; }
.brand-mark span { position: absolute; width: 20px; height: 20px; border-radius: 50%; mix-blend-mode: multiply; }
.brand-mark span:nth-child(1) { background: var(--cyan); left: 0; top: 0; }
.brand-mark span:nth-child(2) { background: var(--magenta); right: 0; top: 0; }
.brand-mark span:nth-child(3) { background: var(--yellow); left: 7px; bottom: 0; }
.brand-text { line-height: 1.1; }
.brand-text strong { font-family: var(--f-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; display: block; }
.brand-text small { font-family: var(--f-mono); font-size: 0.7rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.top-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 32px; align-items: end; padding-bottom: 18px; border-bottom: 1px solid var(--line); position: relative; }
.hero p.lede { color: var(--muted); max-width: 60ch; margin-top: 10px; font-size: 1.02rem; }
.reg-bar { display: flex; height: 14px; width: 210px; border: 1px solid var(--ink); }
.reg-bar i { flex: 1; }
.reg-bar i:nth-child(1) { background: var(--cyan); } .reg-bar i:nth-child(2) { background: var(--magenta); }
.reg-bar i:nth-child(3) { background: var(--yellow); } .reg-bar i:nth-child(4) { background: #161b26; }
.reg-bar i:nth-child(5) { background: #8a8f99; } .reg-bar i:nth-child(6) { background: #ffffff; }
.reg-meta { font-family: var(--f-mono); font-size: 0.68rem; color: var(--muted); margin-top: 6px; letter-spacing: 0.06em; }

/* ---------- Buttons & inputs ---------- */
.btn { font: inherit; font-size: 0.88rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); cursor: pointer; transition: border-color 0.15s ease, transform 0.12s ease, background-color 0.15s ease; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-small { padding: 5px 10px; font-size: 0.8rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
input[type="text"], select { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; width: 100%; min-width: 0; }
input.hex { font-family: var(--f-mono); font-size: 0.9rem; text-transform: lowercase; }
input.hex[aria-invalid="true"] { border-color: var(--fail); background: var(--fail-soft); }
input[type="color"] { -webkit-appearance: none; appearance: none; width: 40px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: none; cursor: pointer; flex: none; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 4px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 4px; }
label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 9px; background: var(--sheet); border: 1px solid var(--line); }
.seg button { font: inherit; font-size: 0.8rem; font-weight: 600; padding: 5px 11px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- Workspace ---------- */
.workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }

.inputs { display: grid; gap: 14px; position: sticky; top: calc(12px + env(safe-area-inset-top, 0px)); }
.pal-list { display: grid; gap: 10px; }
.pal-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.pal-row .pal-name { grid-column: 1 / -1; font-weight: 600; background: var(--sheet); }
.pal-del { color: var(--muted); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset { font: inherit; font-size: 0.78rem; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px 4px 5px; border-radius: 99px; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); cursor: pointer; }
.preset:hover { border-color: var(--accent); }
.preset i { display: inline-flex; }
.preset i b { width: 12px; height: 12px; border-radius: 50%; display: block; margin-right: -3px; border: 1.5px solid var(--sheet); }
.pick-mode { display: grid; gap: 6px; }
.hint { font-size: 0.8rem; color: var(--muted); }

/* ---------- Scales ---------- */
.scales { display: grid; gap: 18px; }
.scale-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; margin-bottom: 8px; }
.scale-head h2 { font-size: 1.05rem; }
.scale-head .mono { font-size: 0.75rem; color: var(--muted); }
.strip { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.sw { font: inherit; border: 0; margin: 0; cursor: pointer; padding: 10px 6px 8px; min-height: 104px; display: grid; align-content: space-between; text-align: left; position: relative; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.sw:hover { transform: translateY(-3px); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18); z-index: 1; }
.sw:focus-visible { outline-offset: -3px; z-index: 2; }
.sw-step { font-family: var(--f-mono); font-size: 0.72rem; font-weight: 600; }
.sw-hex { font-family: var(--f-mono); font-size: 0.66rem; opacity: 0.85; word-break: break-all; }
.sw-aa { font-family: var(--f-mono); font-size: 0.62rem; font-weight: 600; display: flex; align-items: center; gap: 3px; }
.sw-pin { position: absolute; top: 7px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sw.is-fg, .sw.is-bg { box-shadow: inset 0 0 0 3px currentColor; }
.sw-tag { position: absolute; bottom: 30px; right: 4px; font-family: var(--f-mono); font-size: 0.56rem; font-weight: 700; letter-spacing: 0.04em; padding: 1px 4px; border-radius: 3px; border: 1px solid currentColor; }

/* ---------- Checker ---------- */
.lower { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: end; }
.pair-field { display: grid; gap: 5px; min-width: 0; }
.pair-field .inline { display: flex; gap: 6px; }
.ratio-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 16px 0 10px; }
.ratio { font-family: var(--f-display); font-weight: 800; font-size: clamp(2.6rem, 6vw, 3.6rem); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.ratio-label { font-weight: 700; font-size: 0.9rem; padding: 3px 10px; border-radius: 99px; }
.ratio-label.ok { color: var(--pass); background: var(--pass-soft); }
.ratio-label.bad { color: var(--fail); background: var(--fail-soft); }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; }
.chip { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px; font-size: 0.8rem; border: 1px solid var(--line); }
.chip b { font-family: var(--f-mono); font-size: 0.72rem; }
.chip.ok b { color: var(--pass); } .chip.bad b { color: var(--fail); }
.chip small { color: var(--muted); font-family: var(--f-mono); font-size: 0.68rem; }
.fix { margin-top: 14px; padding: 12px; border-radius: 8px; border: 1px dashed var(--line); display: grid; gap: 10px; }
.fix-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fix-sw { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--line); flex: none; }
.fix-text { font-size: 0.86rem; min-width: 0; flex: 1 1 160px; }

.preview { border-radius: 10px; padding: 20px; display: grid; gap: 10px; border: 1px solid var(--line); transition: background-color 0.2s ease, color 0.2s ease; }
.preview .pv-eyebrow { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.8; }
.preview .pv-title { font-family: var(--f-display); font-weight: 800; font-size: 1.6rem; line-height: 1.1; letter-spacing: -0.02em; }
.preview .pv-body { font-size: 0.95rem; max-width: 52ch; }
.preview .pv-small { font-size: 0.78rem; }
.preview .pv-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.preview .pv-btn { font: inherit; font-weight: 700; font-size: 0.88rem; padding: 9px 16px; border-radius: 7px; border: 2px solid currentColor; background: transparent; color: inherit; }
.preview .pv-btn.solid { border-color: transparent; }
.preview .pv-link { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Pair grid ---------- */
.grid-wrap { overflow-x: auto; }
.pairs { border-collapse: separate; border-spacing: 2px; font-family: var(--f-mono); font-size: 0.68rem; font-variant-numeric: tabular-nums; min-width: 640px; width: 100%; }
.pairs th { font-weight: 600; color: var(--muted); padding: 3px; }
.pairs th[scope="row"] { text-align: right; padding-right: 6px; }
.pairs td { padding: 0; }
.pairs td button { font: inherit; width: 100%; padding: 7px 2px; border: 0; border-radius: 3px; cursor: pointer; font-weight: 600; }
.pairs td button.dim { opacity: 0.32; }
.pairs td button:hover { opacity: 1; outline: 2px solid var(--ink); outline-offset: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 0.78rem; color: var(--muted); align-items: center; }

/* ---------- Export ---------- */
.export pre { margin: 0; padding: 14px 16px; border-radius: 8px; background: #11151e; color: #d9e0ee; font-family: var(--f-mono); font-size: 0.8rem; line-height: 1.6; overflow: auto; max-height: 340px; white-space: pre; }
.export .panel-head { margin-bottom: 10px; }

/* ---------- About ---------- */
.about { border-top: 1px solid var(--line); padding-top: 24px; }
.about h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); max-width: 30ch; margin-top: 4px; }
.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 40px; }
.about-grid p, .about-grid li { max-width: 64ch; }
.about-grid ul { padding-left: 1.1rem; margin: 0.4rem 0 0; display: grid; gap: 4px; }
.about-links { margin-top: 14px; font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.fine { font-size: 0.78rem; color: var(--muted); margin-top: 20px; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 9px 15px; border-radius: 8px; font-size: 0.86rem; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); z-index: 50; max-width: calc(100% - 32px); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; }
  .inputs { position: static; }
  .lower { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .hero { grid-template-columns: 1fr; }
  .sw { min-height: 74px; padding: 8px 3px 6px; }
  .sw-hex { display: none; }
  .sw-step { font-size: 0.62rem; }
  .sw-aa { font-size: 0.56rem; }
  .sw-tag { bottom: 24px; right: 2px; font-size: 0.5rem; padding: 0 2px; }
  .about-grid { grid-template-columns: 1fr; }
  .pair { grid-template-columns: 1fr; }
  .pair .swap { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
