/* Moonjar prototype site. Tokens match pipeline/viewer.html. */
:root { --bg: #f4f2ef; --fg: #1d1c1a; --muted: #6d6a65; --card: #ffffff; --line: #e2ded8; --accent: #1d1c1a; --stage: #d9d6d1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #161514; --fg: #eeebe6; --muted: #a29e97; --card: #211f1d; --line: #34312d; --accent: #eeebe6; --stage: #2a2826; }
}
:root[data-theme="dark"] { --bg: #161514; --fg: #eeebe6; --muted: #a29e97; --card: #211f1d; --line: #34312d; --accent: #eeebe6; --stage: #2a2826; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 -apple-system, system-ui, "Segoe UI", sans-serif; }
a { color: inherit; }
h1, h2 { font-weight: 600; letter-spacing: -.01em; margin: 0 0 10px; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 22px; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px; }
.muted, .lead { color: var(--muted); }
.lead { max-width: 640px; margin: 0 0 18px; }
.block { padding-top: 40px; }

/* header / footer */
.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.top .wrap { display: flex; align-items: center; gap: 22px; height: 56px; }
.brand { font-weight: 700; letter-spacing: .12em; text-decoration: none; font-size: 17px; }
.top nav { display: flex; gap: 18px; flex: 1; }
.top nav a { text-decoration: none; color: var(--muted); font-size: 14px; padding: 4px 0; }
.top nav a[aria-current="page"] { color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }
.proto { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; }
footer { margin-top: 56px; border-top: 1px solid var(--line); padding: 18px 0 32px; font-size: 13px; }
footer p { margin: 4px 0; max-width: 720px; }
@media (max-width: 520px) { .proto { display: none; } .top nav { gap: 14px; } }

/* buttons, chips, swatches */
.btn { display: inline-block; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: var(--bg);
  font: inherit; font-weight: 600; padding: 11px 18px; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.wide { display: block; width: 100%; margin-top: 8px; }
.btn:focus-visible, .chip:focus-visible, .sw:focus-visible, .card:focus-visible, .thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link { border: 0; background: none; color: var(--fg); text-decoration: underline; font: inherit; font-size: 13px; cursor: pointer; padding: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--bg); outline: 2px solid transparent; cursor: pointer; padding: 0; display: block; }
.sw[aria-pressed="true"] { outline-color: var(--accent); }
.swatches.big .sw { width: 40px; height: 40px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 18px; padding: 6px 13px;
  font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; }
.chip[aria-pressed="true"], .chip[aria-current="page"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chip:disabled { opacity: .35; cursor: not-allowed; text-decoration: line-through; }
.unrendered { opacity: .55; }
.chip.unrendered { border-style: dashed; opacity: .75; }

/* home */
.hero { padding: 32px 0 8px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: center; }
.hero-text p { color: var(--muted); font-size: 17px; margin: 0 0 22px; }
.hero-text .btn { margin: 0 8px 8px 0; }
.hero-pic { aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--stage); }
.hero-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } h1 { font-size: 26px; } }

/* cards */
.cards { display: grid; gap: 14px; }
.cards.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.colours { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
@media (max-width: 1000px) { .cards.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cards.six, .cards.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards.colours { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .cards.three { grid-template-columns: minmax(0, 1fr); } }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-decoration: none; }
.card .pic { aspect-ratio: 1; background: var(--stage); display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.card .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card b { display: block; padding: 10px 12px 0; font-weight: 600; }
.card small { display: block; padding: 0 12px; color: var(--muted); font-size: 12px; }
.card small:last-child { padding-bottom: 10px; }
.card p { margin: 4px 12px 12px; color: var(--muted); font-size: 13px; }
a.card:hover { border-color: var(--muted); }

/* product page (layout from viewer.html) */
.product { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; padding-top: 20px; }
@media (max-width: 900px) { .product { grid-template-columns: minmax(0, 1fr); } }
.stage { position: relative; background: var(--stage); border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; }
.stage img, .stage model-viewer { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage .nav { position: absolute; top: 50%; transform: translateY(-50%); border: 0; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.8); color: #1d1c1a; font-size: 20px; cursor: pointer; }
.stage .prev { left: 10px; } .stage .next { right: 10px; }
.stage .bar { position: absolute; left: 10px; bottom: 10px; z-index: 2; display: flex; gap: 8px; flex-wrap: wrap; }
.stage .bar a, .stage .bar span, .stage .bar button { background: rgba(255,255,255,.85); color: #1d1c1a; font-size: 12px; padding: 4px 10px; border-radius: 14px; text-decoration: none; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumb { flex: 0 0 auto; width: 96px; border: 2px solid transparent; border-radius: 8px; padding: 0; background: var(--card); cursor: pointer; overflow: hidden; color: var(--fg); }
.thumb[aria-current="true"] { border-color: var(--accent); }
.thumb img, .thumb .tri { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--stage); }
.thumb .tri { display: grid; place-items: center; font-weight: 600; font-size: 18px; }
.thumb small { display: block; font-size: 11px; padding: 3px 4px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { display: grid; place-content: center; gap: 12px; height: 100%; padding: 24px; text-align: center; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.empty .btn { justify-self: center; background: rgba(255,255,255,.9); color: #1d1c1a; border-color: transparent; text-shadow: none; }
.panel h1 { font-size: 24px; margin: 0 0 2px; }
.panel .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.group { margin-bottom: 18px; }
.group > div:first-child { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.group > div:first-child b { color: var(--fg); text-transform: none; letter-spacing: 0; font-weight: 500; }
.hint { font-size: 12px; color: var(--muted); margin: -6px 0 8px; min-height: 1em; }
.idline { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.spec { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 14px 0 0; font-size: 13px; }
.spec dt { color: var(--muted); }
.spec dd { margin: 0; }
.downloads a { display: block; margin-top: 8px; font-size: 14px; }
.note { margin-top: 16px; font-size: 12px; color: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--fg); max-width: min(520px, calc(100vw - 32px)); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog p { color: var(--muted); font-size: 14px; }
dialog pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; white-space: pre-wrap; font-size: 13px; }
dialog .row { display: flex; gap: 8px; }
.stage .bar button { border: 0; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.stage .nav { z-index: 2; }
