/* IvoChess Clock — shared design system */

:root {
  --bg: #0a0d12;
  --bg-elev: #10141b;
  --bg-elev-2: #161b24;
  --border: #232a36;
  --text: #e8ecf2;
  --text-dim: #9aa5b4;
  --text-faint: #6b7688;
  --accent: #4fd1ff;
  --accent-2: #7c9dff;
  --accent-text: #04121a;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --maxw: 1120px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f7fa;
  --bg-elev: #ffffff;
  --bg-elev-2: #eef0f4;
  --border: #e1e4ea;
  --text: #12151b;
  --text-dim: #4b5563;
  --text-faint: #7c8697;
  --accent: #0284c7;
  --accent-2: #4f6bd8;
  --accent-text: #ffffff;
  --shadow: 0 20px 60px -25px rgba(20, 30, 50, 0.25);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7fa;
    --bg-elev: #ffffff;
    --bg-elev-2: #eef0f4;
    --border: #e1e4ea;
    --text: #12151b;
    --text-dim: #4b5563;
    --text-faint: #7c8697;
    --accent: #0284c7;
    --accent-2: #4f6bd8;
    --accent-text: #ffffff;
    --shadow: 0 20px 60px -25px rgba(20, 30, 50, 0.25);
    color-scheme: light;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse 900px 500px at 15% -10%, rgba(79, 209, 255, 0.10), transparent),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(124, 157, 255, 0.08), transparent);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
  margin: 0 0 0.5em;
}

code, pre, .mono {
  font-family: var(--mono);
}

pre {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
}

code {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.4em;
  font-size: 0.9em;
}

pre code {
  background: none;
  border: none;
  padding: 0;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- top nav ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px) saturate(1.4);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover {
  text-decoration: none;
}
.brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}
.nav-links a {
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.nav-links a:hover {
  color: var(--text);
  background: var(--bg-elev-2);
  text-decoration: none;
}
.nav-links a.current {
  color: var(--accent-text);
  background: var(--accent);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover {
  border-color: var(--accent);
}
.nav-toggle {
  display: none;
}
.nav-links-mobile-wrap {
  display: contents;
}

@media (max-width: 1200px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
    gap: 2px;
    box-shadow: var(--shadow);
    flex-wrap: nowrap;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
  }
  .nav-toggle {
    display: flex;
  }
}

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn:hover {
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-text);
  box-shadow: 0 8px 30px -8px color-mix(in srgb, var(--accent) 60%, transparent);
}
.btn-primary:hover {
  filter: brightness(1.08);
}
.btn-ghost {
  background: var(--bg-elev);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  border-color: var(--accent);
}
.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- hero ---- */
.hero {
  padding: 72px 0 28px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 56px;
  align-items: center;
}
@media (max-width: 880px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .hero {
    padding: 40px 0 32px;
  }
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  letter-spacing: -0.02em;
}
.hero h1 .accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead {
  font-size: 1.15rem;
  color: var(--text-dim);
  margin: 16px 0 30px;
}
.hero-media {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- sections ---- */
section {
  padding: 64px 0;
}
.section-head {
  margin: 0 0 40px;
}
.section-head .eyebrow {
  margin-bottom: 14px;
}
.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  letter-spacing: -0.01em;
}
.section-head p {
  color: var(--text-dim);
  font-size: 1.02rem;
}
.section-alt {
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ---- cards / grids ---- */
.grid {
  display: grid;
  gap: 20px;
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 880px) {
  .grid-3, .grid-2 {
    grid-template-columns: 1fr;
  }
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}
.card h3 {
  font-size: 1.08rem;
  margin-bottom: 10px;
}
.card p {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin: 0;
}
/* Logo centered above the name, description pinned to the card's
   bottom edge regardless of how long it is - grid rows already stretch
   every card in a row to the tallest one's height (.grid has no
   align-items override, so the default "stretch" applies), so
   margin-top:auto on the paragraph is enough to align every card's
   text to the same baseline across a row. */
.board-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.board-card h3 {
  margin-bottom: 10px;
}
.board-card p {
  margin-top: auto;
}
.board-logo {
  height: 34px;
  width: auto;
  max-width: 130px;
  object-fit: contain;
  margin-bottom: 10px;
  /* Brand logos vary from square icon marks to wide wordmarks, and some
     (e.g. Millennium's) are white-fill artwork meant for a dark
     background - a plain fixed white square broke both cases (wide
     logos got squashed to an illegible sliver, white-on-white
     disappeared). height-constrained + auto width preserves each
     logo's real aspect ratio; the white backing plate still sizes to
     content via padding, so it stays legible either way without
     needing a per-brand light/dark variant.
  */
  background: #fff;
  border-radius: 7px;
  padding: 4px 6px;
}
/* Millennium's own logo file is white-fill artwork meant for a dark
   background - invisible against the white plate every other brand's
   logo needs (and inverting the whole element just swaps it to
   black-on-black, since the plate inverts along with the logo). A
   dark plate instead of white is the simple fix, without needing a
   separate light-mode variant of their artwork. */
.board-logo--dark-plate {
  background: #14171f;
}
.card .ico {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  margin-bottom: 16px;
}
.card .ico svg {
  width: 22px;
  height: 22px;
}

.feature-shot {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

/* ---- step list (build/soldering instructions) ---- */
.steps {
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.step {
  position: relative;
  padding: 0 0 34px 46px;
  border-left: 2px solid var(--border);
  margin-left: 17px;
}
.step:last-child {
  border-left-color: transparent;
  padding-bottom: 4px;
}
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -18px;
  top: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
}
.step h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}
.step p, .step ul, .step ol {
  color: var(--text-dim);
  font-size: 0.95rem;
}
.step img {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 12px 0;
}

/* ---- tables ---- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 480px;
}
th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  background: var(--bg-elev-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}
tr:last-child td {
  border-bottom: none;
}
td.mono, th.mono {
  font-family: var(--mono);
}

/* ---- callouts ---- */
.callout {
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.callout .ico {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
}
.callout.warn {
  border-color: color-mix(in srgb, var(--warn) 40%, var(--border));
  background: color-mix(in srgb, var(--warn) 8%, var(--bg-elev));
}
.callout.warn .ico { color: var(--warn); }
.callout.info {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-elev));
}
.callout.info .ico { color: var(--accent); }
.callout.danger {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: color-mix(in srgb, var(--danger) 8%, var(--bg-elev));
}
.callout.danger .ico { color: var(--danger); }
.callout p, .callout div {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-dim);
}
.callout strong {
  color: var(--text);
}

/* ---- pill / badge ---- */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* ---- page header (non-landing pages) ---- */
.page-header {
  padding: 48px 0 8px;
}
.page-header .eyebrow {
  margin-bottom: 14px;
}
.page-header h1 {
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  letter-spacing: -0.02em;
}
.page-header p {
  color: var(--text-dim);
  font-size: 1.02rem;
}

/* ---- toc ---- */
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 8px;
}
.toc a {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.toc a:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* ---- footer ---- */
footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 32px;
}
@media (max-width: 780px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.footer-grid h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 14px;
}
.footer-grid a {
  display: block;
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.footer-grid a:hover {
  color: var(--accent);
}
.footer-bottom {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-faint);
  font-size: 0.85rem;
}

/* ---- misc ---- */
.center {
  text-align: center;
}
.text-dim {
  color: var(--text-dim);
}
.kbd {
  font-family: var(--mono);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 0.85em;
}
ul.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.checklist li {
  padding-left: 28px;
  position: relative;
  margin-bottom: 10px;
  color: var(--text-dim);
  font-size: 0.95rem;
}
ul.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  border: 1px solid var(--ok);
}
ul.checklist li::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 9px;
  width: 6px;
  height: 3px;
  border-left: 2px solid var(--ok);
  border-bottom: 2px solid var(--ok);
  transform: rotate(-45deg);
}

/* ---- scroll parallax banners (opt-in via .hero-media.parallax) ----
   Fixed-aspect crop so the oversized image has room to drift vertically
   inside overflow:hidden without exposing empty edges - main.js drives
   the actual translateY() on scroll, off a rAF-throttled listener, and
   skips entirely under prefers-reduced-motion. */
.hero-media.parallax {
  aspect-ratio: 21 / 9;
}
.hero-media.parallax img {
  position: absolute;
  inset: -18% 0;
  width: 100%;
  height: 136%;
  object-fit: cover;
  will-change: transform;
}
@media (max-width: 880px) {
  .hero-media.parallax {
    aspect-ratio: 4 / 3;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero-media.parallax img {
    transform: none !important;
  }
}

/* ---- part card (printing.html - one per printable STL piece) ---- */
.part-card {
  display: flex;
  flex-direction: column;
}
.part-card .part-media {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 14px;
  color: var(--text-faint);
}
.part-card .part-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.part-card .part-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.part-card .part-head h3 {
  margin-bottom: 0;
}
.part-card p {
  margin-bottom: 14px;
}
.part-card .btn {
  align-self: flex-start;
  margin-top: auto;
}
.part-card .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.badge.badge-soon {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  flex: none;
}
