:root {
  --bg: #1a1a1a;
  --surface: #242424;
  --line: #3a3a3a;
  --text: #f2f2f2;
  --muted: #a8a8a8;
  --gold: #f0bf40;
  --gold-ink: #1a1a1a;
  /* The second camera in the tool: magenta reads on photos and on the dark page, and is far from gold. */
  --second: #ff6bd6;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--gold); }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: 880px; margin: 0 auto; padding-inline: 16px; }

.skip { position: absolute; inset-inline-start: -9999px; }
.skip:focus { inset-inline-start: 16px; top: 8px; background: var(--gold); color: var(--gold-ink); padding: 6px 10px; z-index: 2; }

.site-header { border-bottom: 1px solid var(--line); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-block: 12px; }
.brand { font-weight: 700; font-size: 1.25rem; color: var(--gold); text-decoration: none; margin-inline-end: auto; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-header nav a { color: var(--text); text-decoration: none; font-size: 0.95rem; }
.site-header nav a:hover { color: var(--gold); }
.site-header nav .nav-app { color: var(--gold); }

.lang { position: relative; font-size: 0.9rem; }
.lang summary { cursor: pointer; color: var(--muted); list-style: none; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: " \25BE"; }
.lang ul {
  position: absolute; inset-inline-end: 0; z-index: 3; margin: 6px 0 0; padding: 6px;
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  columns: 2; column-gap: 4px; width: max-content; max-width: calc(100vw - 32px);
}
.lang li a { display: block; padding: 4px 10px; color: var(--text); text-decoration: none; border-radius: 6px; }
.lang li a:hover, .lang li a[aria-current] { background: var(--line); }

main { padding-block: 24px 48px; }

h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); line-height: 1.2; margin: 0.4em 0 0.5em; letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; line-height: 1.3; margin: 2em 0 0.6em; }
h3 { font-size: 1.08rem; margin: 1.4em 0 0.3em; }
.lead { font-size: 1.15rem; color: var(--text); }
.facts { color: var(--gold); font-weight: 600; }
.muted { color: var(--muted); font-size: 0.92rem; }
.note { background: var(--surface); border-inline-start: 3px solid var(--gold); padding: 10px 14px; border-radius: 6px; }
.crumbs { margin: 0; font-size: 0.92rem; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button, button {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  padding: 10px 18px; border-radius: 999px; text-decoration: none; text-align: center;
  background: var(--gold); color: var(--gold-ink); border: 1px solid var(--gold);
}
.button.secondary, button { background: transparent; color: var(--gold); }
button:hover, .button.secondary:hover { background: rgba(240, 191, 64, 0.12); }
.button:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}

ul.checks, ol.steps { padding-inline-start: 1.3em; }
ul.checks li, ol.steps li { margin-block: 0.4em; }

figure { margin: 24px 0; }
figcaption { color: var(--muted); font-size: 0.92rem; margin-top: 8px; }

.photo-frame { position: relative; line-height: 0; border-radius: var(--radius); overflow: hidden; background: #000; }
.photo-frame img { width: 100%; height: auto; display: block; }
.photo-frame svg.frames { position: absolute; inset: 0; width: 100%; height: 100%; }
svg.frames, svg.nested { direction: ltr; }
svg.frames rect { fill: none; stroke: var(--gold); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
svg.frames rect.active { stroke: #fff; stroke-width: 3.5; }
svg.frames text { fill: var(--gold); font-size: 22px; font-weight: 700; paint-order: stroke; stroke: rgba(0, 0, 0, 0.75); stroke-width: 4px; }
svg.frames rect.b2 { stroke: var(--second); stroke-dasharray: 10 6; }
svg.frames rect.b2.active { stroke: #fff; }
svg.frames text.b2 { fill: var(--second); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 10px 0 0; font-size: 0.92rem; }
.legend > span { display: inline-flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; width: 18px; height: 0; border-top: 3px solid var(--gold); vertical-align: middle; margin-inline-end: 8px; }
.legend .swatch { margin: 0; }
.swatch.b2 { border-top: 3px dashed var(--second); }

.nested-figure svg { width: 100%; height: auto; max-width: 640px; display: block; background: var(--surface); border-radius: var(--radius); }
svg.nested rect { fill: none; stroke: var(--gold); stroke-width: 2; }
svg.nested text { fill: var(--text); font-weight: 600; }

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
tbody th { font-weight: 600; white-space: nowrap; }
table.angles tbody tr { cursor: default; }
table.angles tbody tr.clickable { cursor: pointer; }
table.angles tbody tr.clickable:hover, table.angles tbody tr.selected { background: var(--surface); }
table.compare td, table.compare th { min-width: 120px; }
table.price { width: auto; }
table.angles tr.group th { color: var(--text); background: transparent; padding-top: 14px; }
table.angles tbody + tbody tr.group th { border-top: 1px solid var(--line); }
.zoom-tag { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
table.angles td, table.distances td { white-space: nowrap; }

.faq h3 { color: var(--text); }

.cta-box {
  margin-top: 40px; padding: 20px 22px; border: 1px solid var(--gold); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(240, 191, 64, 0.08), rgba(240, 191, 64, 0));
}
.cta-box h2 { margin-top: 0; }

fieldset { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 14px; margin: 0; }
legend { padding-inline: 6px; color: var(--muted); font-size: 0.92rem; }
select, input[type="number"] {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px;
}
select { width: 100%; margin-top: 6px; }
input[type="number"] { width: 6.5em; }
input[type="file"] { color: var(--muted); margin-block: 6px; max-width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; font-weight: 600; font-size: 0.95rem; border-radius: 999px; min-width: 3.2em; }
.chip[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); }
.inline-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.range { display: inline-flex; align-items: center; gap: 6px; }
.range input[type="number"] { width: 5em; }
.field { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin-top: 4px; }
.with-unit { display: inline-flex; align-items: center; gap: 6px; }
.segmented { display: inline-flex; flex-wrap: wrap; margin: 8px 0 12px; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.segmented label { display: inline-flex; align-items: center; margin: 0; padding: 4px 12px; border-radius: 999px; cursor: pointer; font-size: 0.95rem; }
.segmented input { margin: 0 6px 0 0; }
@supports selector(:has(*)) {
  .segmented { position: relative; }
  .segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
  .segmented label:has(input:checked) { background: var(--gold); color: var(--gold-ink); font-weight: 600; }
  .segmented label:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
}

/* The lens tool: the photo first and always in view, the controls in one
   panel beside it (wide screens) or under it (phones), the table below. */
.tool { margin-block: 16px 8px; }
.workspace { display: grid; gap: 16px; }
.workspace > * { min-width: 0; }
.viewer { z-index: 2; background: var(--bg); }
#stage { cursor: pointer; }
#stage.lens svg.frames path.dim { fill: rgba(0, 0, 0, 0.62); stroke: none; }
.lens-back {
  position: absolute; top: 10px; inset-inline-end: 10px; line-height: 1.4; font-size: 0.9rem; padding: 6px 14px;
  color: var(--text); background: rgba(26, 26, 26, 0.78); border-color: rgba(255, 255, 255, 0.28);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.lens-back::before { content: "\00d7\00a0"; }
.viewer-hint, .notes { color: var(--muted); font-size: 0.88rem; line-height: 1.45; margin: 8px 0 0; }
.notes:empty { display: none; }
.viewer .legend { margin: 8px 0 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.group { padding: 14px 16px; border-top: 1px solid var(--line); min-width: 0; }
.group:first-child { border-top: 0; }
.group-label { display: block; margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.group .chips + .group-label, .group .inline-row + .group-label { margin-top: 14px; }
.panel select, .panel input[type="number"] { background: var(--bg); }
.panel select { margin-top: 0; }
.link-button {
  display: inline-block; margin-top: 8px; padding: 6px 0; border: 0; border-radius: 0; background: none;
  color: var(--gold); font-size: 0.92rem;
}
.link-button:hover { background: none; text-decoration: underline; }
#body2-box { margin-top: 12px; }
.chip.more { min-width: 2.6em; font-size: 1.05rem; padding-block: 4px; }
.inline-row { margin-top: 10px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 4px; cursor: pointer; font-size: 0.8rem; line-height: 1.25; color: var(--muted); text-align: center; }
.tile img, .tile-plus { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 8px; border: 2px solid transparent; }
.tile-plus { display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--gold); background: var(--bg); border: 2px dashed var(--line); }
@supports selector(:has(*)) {
  .tile input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
  .tile:has(input:checked) { color: var(--text); font-weight: 600; }
  .tile:has(input:checked) img, .tile:has(input:checked) .tile-plus { border-color: var(--gold); border-style: solid; }
  .tile:has(input:focus-visible) img, .tile:has(input:focus-visible) .tile-plus { outline: 2px solid var(--gold); outline-offset: 2px; }
}
#own { margin-top: 10px; }
#own .field { font-size: 0.92rem; }

details.distance > summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; cursor: pointer; list-style: none; }
details.distance > summary::-webkit-details-marker { display: none; }
details.distance > summary .group-label { margin: 0; }
.summary-value { font-size: 0.92rem; }
.summary-value::after { content: " \25BE"; color: var(--muted); }
details.distance[open] .summary-value::after { content: " \25B4"; }
details.distance[open] > summary { margin-bottom: 6px; }
details.distance .segmented { margin: 8px 8px 4px 0; }

.results { margin-top: 20px; }
.switch { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 0.92rem; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--gold); width: 18px; height: 18px; margin: 0; }
.results:not(.with-angles) .angle { display: none; }
.inline-cta { margin-top: 18px; }
.inline-cta a {
  display: inline-flex; flex-wrap: wrap; gap: 4px 10px; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text); text-decoration: none; font-size: 0.95rem;
}
.inline-cta a span { color: var(--gold); font-weight: 600; }
.inline-cta a:hover { border-color: var(--gold); }

/* Phones and tablets: the photo stays pinned above the controls while they scroll. */
@media (max-width: 959px) and (min-height: 600px) {
  .viewer { position: sticky; top: 0; padding-top: 8px; margin-top: -8px; padding-bottom: 8px; box-shadow: 0 12px 14px -12px rgba(0, 0, 0, 0.9); }
}
@media (max-width: 959px) {
  .scroller {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 28px), transparent);
  }
  .scroller::-webkit-scrollbar { display: none; }
  .scroller > * { flex: none; }
}

/* Wide screens: the page widens, the photo sits beside the controls and stays in view. */
@media (min-width: 960px) {
  body:has(#tool) .wrap { max-width: 1212px; }
  body:has(#tool) main > :not(.tool):not(script) { max-width: 848px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: 24px; }
  .viewer { position: sticky; top: 16px; }
}

@media (prefers-reduced-motion: no-preference) {
  #stage img { transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
  svg.frames.settle { animation: frames-in 0.25s ease 0.3s both; }
}
@keyframes frames-in { from { opacity: 0; } }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; padding-block: 20px 32px; }
.site-footer a { color: var(--muted); }
.credit { font-size: 0.82rem; }

@media (max-width: 600px) {
  svg.frames text { font-size: 40px; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, button, .chip { transition: background-color 0.15s, color 0.15s; }
}
