/* Halaman pratinjau. Default: kartu (layar kecil atau tanpa JS).
   html.is-previewing (diset bila PREVIEW_MQ cocok): rail kontrol + varian live di iframe. */
:root {
  color-scheme: light;
  --paper: var(--anv-paper);
  --surface: #fbfcfb;
  --ink: #241414;
  --muted: #6b6463;
  --line: #e1e4e3;
  --line-strong: #c8cdcb;
  --accent: var(--anv-maroon);
  --on-accent: #fcfaf8;
  --stage: #e7eae8;
  --radius-control: 6px;
  --radius-frame: 8px;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.page {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding: 48px 16px 72px;
}

.brand {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: var(--radius-control);
  background: var(--accent);
}

.brand img {
  width: auto;
  height: 32px;
}

h1 {
  max-width: 22ch;
  margin-top: 40px;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.lede {
  max-width: 60ch;
  margin-top: 16px;
  color: var(--muted);
  font-size: 1.0625rem;
}

.variants {
  display: grid;
  gap: 24px;
  margin-top: 56px;
}

.variant {
  display: grid;
  gap: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-frame);
  background: var(--surface);
}

.variant__shot {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  aspect-ratio: 16 / 10;
}

.variant__shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.variant__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 8px 8px;
}

.variant__name {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.variant__desc {
  max-width: 52ch;
  color: var(--muted);
}

.open {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  min-height: 46px;
  margin-top: 6px;
  padding: 0 20px;
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 200ms var(--ease-out-expo), transform 200ms var(--ease-out-expo);
}

.open:hover {
  background: var(--anv-maroon-700);
}

.open:active {
  transform: scale(0.98);
}

.notes {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

.notes p + p {
  margin-top: 8px;
}

.controls,
.compare-info,
.stage {
  display: none;
}

@media (min-width: 900px) {
  .page {
    padding: 64px 48px 96px;
  }

  .variant {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: center;
    gap: 40px;
    padding: 20px;
  }
}

/* Mode pratinjau */
html.is-previewing {
  height: 100%;
  overflow: hidden;
  scrollbar-gutter: auto;
}

html.is-previewing body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.is-previewing .page {
  --rail: clamp(280px, 23vw, 336px);
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  max-width: none;
  height: 100%;
  padding: 0;
}

.is-previewing .rail {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  padding: 20px 20px 20px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.is-previewing .brand {
  align-self: flex-start;
  padding: 8px 12px;
}

.is-previewing .brand img {
  height: 24px;
}

.is-previewing h1 {
  max-width: none;
  margin-top: 14px;
  font-size: 1.0625rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.is-previewing .lede {
  margin-top: 6px;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.is-previewing .controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.choice {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice__legend {
  margin-bottom: 6px;
  padding: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.choice__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.choice--device .choice__options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice__opt {
  position: relative;
  display: block;
}

/* Radio asli menutupi seluruh label (transparan) supaya klik, keyboard, dan screen reader tetap native. */
.choice__opt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice__opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.choice__opt input:hover + span {
  border-color: var(--line-strong);
}

.choice__opt input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.choice__opt input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Mode Bandingkan selalu ponsel: pilihan ukuran yang tersimpan tidak ditampilkan sebagai aktif. */
.choice:disabled span,
.choice:disabled input:checked + span {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  opacity: 0.45;
}

.choice:disabled input {
  cursor: not-allowed;
}

.readout__status {
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-wrap: balance;
}

.readout__meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.readout__open {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 12px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: transform 200ms var(--ease-out-expo);
}

.readout__open:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.readout__open:active {
  transform: scale(0.98);
}

.is-previewing .variants {
  display: block;
  margin: 0;
}

.is-previewing .variant {
  display: none;
  padding: 0;
  border: 0;
  background: none;
}

.is-previewing .page[data-mode="single"] .variant[data-active] {
  display: block;
}

.is-previewing .page[data-mode="compare"] .variants {
  display: none;
}

.is-previewing .variant__shot {
  display: none;
}

.is-previewing .variant__body,
.is-previewing .compare-info {
  gap: 8px;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
}

.is-previewing .variant__name {
  font-size: 1.125rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.is-previewing .variant__desc {
  font-size: 0.8125rem;
  line-height: 1.55;
}

.is-previewing .open {
  display: none;
}

.is-previewing .page[data-mode="compare"] .compare-info {
  display: flex;
  flex-direction: column;
}

.is-previewing .notes {
  margin-top: auto;
  padding-top: 14px;
  font-size: 0.75rem;
  line-height: 1.5;
}

.is-previewing .notes__cards {
  display: none;
}

.is-previewing .stage {
  --w: 1440;
  --h: 900;
  --s: 1;
  --gap: 24px;
  --head-h: 36px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
  min-width: 0;
  min-height: 0;
  margin: 12px 12px 12px 0;
  padding: 24px;
  overflow: clip;
  border-radius: var(--radius-frame);
  background: var(--stage);
}

.slot {
  display: flex;
  flex-direction: column;
}

/* Frame tidak aktif tetap di DOM dengan ukuran perangkat (visibility, bukan display) agar tidak dimuat ulang. */
.slot:not([data-active]) {
  position: absolute;
  top: 0;
  left: 0;
  visibility: hidden;
  pointer-events: none;
}

.slot__head {
  display: none;
}

.page[data-mode="compare"] .slot__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--head-h);
  padding: 0 2px 6px;
  font-size: 0.8125rem;
}

.slot__name {
  font-weight: 600;
}

.slot__open {
  color: var(--accent);
  font-weight: 500;
  text-underline-offset: 3px;
}

.slot__viewport {
  position: relative;
  width: calc(var(--w) * var(--s) * 1px);
  height: calc(var(--h) * var(--s) * 1px);
  overflow: clip;
  border-radius: var(--radius-frame);
  background: var(--surface);
  box-shadow: 0 0 0 1px rgb(36 20 20 / 10%), 0 24px 48px -24px rgb(36 20 20 / 5%);
}

.slot__viewport iframe {
  display: block;
  width: calc(var(--w) * 1px);
  height: calc(var(--h) * 1px);
  border: 0;
  background: #fff;
  opacity: 0;
  transform: scale(var(--s));
  transform-origin: 0 0;
  transition: opacity 400ms var(--ease-out-expo);
}

.slot__viewport iframe.is-loaded {
  opacity: 1;
}
