:root {
  color-scheme: light;
  --bg: var(--pg-bg, #f4efe5);
  --paper: var(--pg-paper, #fffdf7);
  --paper-warm: var(--pg-paper-warm, #fbf5ea);
  --text: var(--pg-text, #1f1d19);
  --muted: var(--pg-muted, #70695f);
  --border: var(--pg-border, #2a2823);
  --soft-border: var(--pg-soft-border, #cfc5b5);
  --accent: #c84943;
  --shadow: var(--pg-shadow-hard, 4px 4px 0 #2a2823);
  font-family: var(--pg-font-ui, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(42, 40, 35, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 40, 35, .035) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid #8c6b35; outline-offset: 3px; }

.shell {
  width: min(1160px, calc(100% - 20px));
  margin: 0 auto;
  padding: 8px 0 max(42px, env(safe-area-inset-bottom));
}

.hero {
  display: grid;
  gap: 8px;
  padding: 5px 4px 13px;
}

.hero .eyebrow,
.hero .dek { display: none; }

.eyebrow,
.model-index,
.stage-hint,
.reference-popover figcaption,
footer,
.facts,
.model-tab b {
  font-family: var(--pg-font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
}

.eyebrow,
.model-index {
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.65rem, 12vw, 3.2rem);
  font-weight: 790;
  letter-spacing: -.065em;
  line-height: .92;
}

h1 br { display: none; }

.dek {
  max-width: 35rem;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: .93rem;
  line-height: 1.4;
}

.model-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 14px;
}

.model-tab {
  display: grid;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  border: 2px solid var(--border);
  border-radius: 2px;
  background: var(--paper);
  box-shadow: 2px 2px 0 var(--border);
}

.model-tab img {
  width: 100%;
  height: 58px;
  display: block;
  object-fit: cover;
  border-bottom: 2px solid var(--border);
  filter: saturate(.78) contrast(.98);
}

.model-tab span {
  display: grid;
  gap: 3px;
  min-height: 48px;
  padding: 7px;
  font-size: .7rem;
  font-weight: 760;
  line-height: 1.1;
}

.model-tab b { color: var(--muted); font-size: .62rem; }
.model-tab.is-active { transform: translate(-1px, -1px); background: #fff8eb; box-shadow: 4px 4px 0 var(--border); }
.model-tab.is-active img { filter: none; }

.viewer-window { overflow: hidden; }
.viewer-layout { display: grid; }

.stage-wrap {
  position: relative;
  height: 430px;
  overflow: hidden;
  border-bottom: 2px solid var(--border);
  background: #e9e3d9;
  isolation: isolate;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.stage-fallback {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #e9e3d9;
}

.interactive-toggle {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 6;
  display: none;
  min-height: 38px;
  padding: 7px 10px;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 2px;
  background: rgba(255,253,247,.94);
  font-size: .72rem;
  font-weight: 800;
}

.ios-static-preview .stage-fallback,
.static-preview .stage-fallback { display: block; }
.ios-static-preview .interactive-toggle,
.static-preview .interactive-toggle,
.ios-interactive-preview .interactive-toggle { display: block; }
.ios-static-preview .stage-hint,
.static-preview .stage-hint { display: none; }

.stage-status {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #e9e3d9;
  font-family: var(--pg-font-mono);
  font-size: .75rem;
  transition: opacity .25s ease;
}
.stage-status.is-ready { pointer-events: none; opacity: 0; }
.stage-status.is-error { color: #8f302d; opacity: 1; }

.stage-hint {
  position: absolute;
  z-index: 2;
  left: 10px;
  bottom: 10px;
  padding: 6px 8px;
  color: #5f5a52;
  background: rgba(255,253,247,.84);
  border: 1px solid rgba(42,40,35,.35);
  font-size: .66rem;
  backdrop-filter: blur(8px);
}

.reference-toggle {
  position: absolute;
  z-index: 5;
  top: 10px;
  right: 10px;
  min-height: 36px;
  padding: 7px 10px;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 2px;
  background: rgba(255,253,247,.9);
  font-size: .76rem;
  font-weight: 800;
}
.reference-toggle[aria-pressed="true"] { color: white; background: var(--border); }

.reference-popover {
  position: absolute;
  z-index: 4;
  inset: 56px 10px auto auto;
  width: min(48%, 230px);
  margin: 0;
  padding: 5px;
  border: 2px solid var(--border);
  background: var(--paper);
  box-shadow: 4px 4px 0 rgba(42,40,35,.8);
}
.reference-popover img { display: block; width: 100%; max-height: 230px; object-fit: contain; background: #ddd5ca; }
.reference-popover figcaption { padding: 6px 3px 2px; color: var(--muted); font-size: .62rem; }

.model-notes {
  display: grid;
  gap: 22px;
  align-content: start;
  padding: 20px;
  background: var(--paper);
}

h2 {
  margin: 5px 0 9px;
  font-size: clamp(2rem, 10vw, 3.6rem);
  letter-spacing: -.055em;
  line-height: .92;
}

.model-summary,
.limitation {
  margin: 0;
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.5;
}

.facts { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--soft-border); }
.facts div { display: grid; grid-template-columns: 86px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--soft-border); font-size: .7rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; }
.limitation { padding-left: 11px; border-left: 3px solid var(--accent); font-size: .8rem; }

.viewer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.viewer-actions button {
  min-height: 44px;
  padding: 8px;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 2px;
  background: #fffaf0;
  font-size: .78rem;
  font-weight: 800;
}
.viewer-actions button:active { transform: translate(1px, 1px); }

footer { padding: 22px 4px 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }
footer p { margin: 0; }
footer a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

@media (min-width: 700px) {
  .shell { width: min(1160px, calc(100% - 36px)); padding-top: 18px; }
  .hero { grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); align-items: end; padding: 34px 4px 32px; }
  .hero .eyebrow, .hero .dek { display: block; }
  .hero .eyebrow { grid-column: 1 / -1; }
  .hero .dek { justify-self: end; margin-bottom: 6px; }
  h1 { font-size: clamp(6rem, 13vw, 9.5rem); }
  h1 br { display: block; }
  .model-picker { gap: 12px; margin-bottom: 20px; }
  .model-tab { grid-template-columns: 92px 1fr; }
  .model-tab img { width: 92px; height: 76px; border-right: 2px solid var(--border); border-bottom: 0; }
  .model-tab span { align-content: center; min-height: 76px; padding: 10px 12px; font-size: .86rem; }
}

@media (min-width: 900px) {
  .viewer-layout { grid-template-columns: minmax(0, 1fr) 318px; min-height: 650px; }
  .stage-wrap { height: 650px; border-right: 2px solid var(--border); border-bottom: 0; }
  .model-notes { padding: 28px 24px; }
  h2 { font-size: 3.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
