/* Metro UI Colors — Colorlib
   No framework: the page it replaced pulled Bootstrap 3.4 and jQuery 1.12 from a
   CDN to render a colour table. */

:root {
  --bg: #ffffff;
  --fg: #16181d;
  --muted: #5b6170;
  --line: #e6e8ee;
  --panel: #fbfcfe;
  --accent: #2d89ef;          /* Metro Blue, fittingly */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014; --fg: #e9ecf2; --muted: #98a0b3;
    --line: #232733; --panel: #151922;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
/* No global smooth scroll: it also animates the initial hash jump, so someone
   arriving from a search result on #m-magenta watches the page glide 6,000px
   before settling. In-page clicks get smooth behaviour from the script. */
html { scroll-padding-top: 1.5rem; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 900px) { .wrap { padding: 0 32px; } }

a { color: var(--accent); }
code { font-family: var(--mono); font-size: .92em; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; }
.muted { color: var(--muted); }

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--fg); color: var(--bg);
  padding: 10px 16px; z-index: 10; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- hero --- */
.hero { padding: 56px 0 40px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 8px; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.hero h1 { margin: 0 0 12px; font-size: clamp(2rem, 5vw, 3.2rem); }
.lead { margin: 0 0 16px; font-size: clamp(1rem, 2vw, 1.18rem); color: var(--muted); max-width: 62ch; }
.hero-links { margin: 0; font-size: .95rem; }

/* ------------------------------------------------------------- palette --- */
.palette-block { padding: 40px 0 8px; }
.palette-block h2 { margin: 0 0 6px; font-size: 1.4rem; }
.palette {
  display: grid; gap: 10px; margin-top: 20px;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
}
.chip {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  text-decoration: none; color: inherit; transition: transform .12s ease, box-shadow .12s ease;
}
.chip:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.chip-c { width: 34px; height: 34px; border-radius: 9px; background: var(--c); border: 1px solid rgba(0,0,0,.12); flex: none; }
.chip-t { font-size: .88rem; font-weight: 600; display: flex; flex-direction: column; }
.chip-t code { font-weight: 400; color: var(--muted); font-size: .78rem; }

/* --------------------------------------------------------------- color --- */
.color { padding: 48px 0; border-top: 1px solid var(--line); }
.color-head { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.color-chip {
  width: 132px; height: 132px; border-radius: var(--radius); background: var(--c);
  border: 1px solid rgba(0,0,0,.12); flex: none;
  display: flex; align-items: flex-end; padding: 10px;
}
.color-chip span { font-family: var(--mono); font-size: .8rem; color: var(--on-c); opacity: .9; }
.color-title { flex: 1 1 320px; min-width: 0; }
.color-title h2 { margin: 0 0 4px; font-size: clamp(1.5rem, 3vw, 2rem); }
.color-sub { margin: 0 0 14px; color: var(--muted); }

.copy-row { display: flex; flex-wrap: wrap; gap: 8px; }
.snippet {
  display: inline-flex; flex-direction: column; gap: 2px; text-align: left;
  border: 1px solid var(--line); background: var(--panel); color: inherit;
  border-radius: 10px; padding: 7px 11px; cursor: pointer; font: inherit;
}
.snippet:hover { border-color: var(--accent); }
.snippet-label { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.snippet code { font-size: .82rem; }

.color-grid { display: grid; gap: 18px; margin-top: 28px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .color-grid { grid-template-columns: repeat(3, 1fr); } }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 18px; }
.panel h3 { margin: 0 0 10px; font-size: 1rem; }
.panel h3 + .muted { margin-top: -6px; font-size: .85rem; }
.panel > h3:not(:first-child) { margin-top: 22px; }

.codes { margin: 0; display: grid; gap: 2px; }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.code-row:last-child { border-bottom: 0; }
.codes dt { font-size: .82rem; color: var(--muted); }
.codes dd { margin: 0; display: flex; align-items: center; gap: 8px; }
.copy {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 7px; padding: 2px 8px; font: inherit; font-size: .72rem; cursor: pointer;
}
.copy:hover { color: var(--accent); border-color: var(--accent); }

.contrast { display: grid; gap: 8px; }
.contrast-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: .88rem; }
.badge { font-family: var(--mono); font-size: .76rem; opacity: .95; white-space: nowrap; }

.ramp { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ramp-step { border: 0; background: transparent; padding: 0; cursor: pointer; font: inherit; color: inherit; text-align: center; }
.ramp-chip { display: block; height: 46px; border-radius: 9px; background: var(--c); border: 1px solid rgba(0,0,0,.12); }
.ramp-meta { display: block; font-size: .64rem; color: var(--muted); margin-top: 5px; line-height: 1.3; }
.ramp-meta code { font-size: .62rem; }

.demo { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.demo-btn { background: var(--c); color: var(--on-c); border: 1px solid transparent; border-radius: 9px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.demo-btn.ghost { background: transparent; color: var(--c); border-color: var(--c); }
.demo-badge { background: var(--c); color: var(--on-c); border-radius: 999px; padding: 3px 11px; font-size: .78rem; font-weight: 600; }
.demo-card { width: 100%; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--bg); }
.demo-card-bar { height: 6px; background: var(--c); }
.demo-card-body { padding: 12px 14px; }
.demo-card-body p { margin: 4px 0 0; font-size: .85rem; color: var(--muted); }
.demo-field { width: 100%; display: grid; gap: 5px; font-size: .78rem; color: var(--muted); }
.demo-field input { width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font: inherit; }
.demo-field input:focus { outline: 2px solid var(--c); outline-offset: 1px; border-color: var(--c); }

/* ------------------------------------------------------------ templates --- */
.tpl-block { margin-top: 30px; }
.tpl-block h3 { margin: 0 0 4px; font-size: 1.05rem; }
.tpl-block .muted { margin: 0 0 16px; font-size: .88rem; }
.tpl-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tpl { display: block; position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); text-decoration: none; color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
.tpl:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tpl img { display: block; width: 100%; height: auto; aspect-ratio: 338 / 270; object-fit: cover; background: var(--line); }
.tpl-name { display: block; padding: 9px 11px; font-size: .85rem; font-weight: 600; }
.tpl-swatch { position: absolute; top: 9px; right: 9px; width: 17px; height: 17px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }

.notes { margin-top: 26px; border: 1px solid var(--line); border-radius: 11px; padding: 12px 16px; background: var(--panel); }
.notes summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.notes p { margin: 10px 0 0; color: var(--muted); font-size: .9rem; }
.back { margin: 22px 0 0; font-size: .85rem; }

.footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 28px 0 44px; color: var(--muted); font-size: .9rem; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: .88rem; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
