/* Blipscope page styles. Shared tokens and components come from /assets/site.css. */

:root {
  --flag-mil-bg: #fff0e0;
  --flag-mil-text: #8f4400;
  --flag-heli-bg: #f1e8fd;
  --flag-heli-text: #6626ad;
  --flag-spc-bg: #e6f0fd;
  --flag-spc-text: #1a56a8;
  --flag-sos-bg: #fde8e7;
  --flag-sos-text: #a8201a;
  --flag-new-bg: #fbf0cf;
  --flag-new-text: #7a5600;
  --flag-look-bg: #dff6fa;
  --flag-look-text: #0b6478;
  --photo-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --flag-mil-bg: #3a2210;
    --flag-mil-text: #ffb877;
    --flag-heli-bg: #2a1a40;
    --flag-heli-text: #d4adff;
    --flag-spc-bg: #142a45;
    --flag-spc-text: #9ccaff;
    --flag-sos-bg: #3d1412;
    --flag-sos-text: #ff9a90;
    --flag-new-bg: #3a2e08;
    --flag-new-text: #f5d06a;
    --flag-look-bg: #0d3038;
    --flag-look-text: #7fe9f7;
    --photo-bg: #f4f4f2;
  }
}

/* Hero */
.bs-hero {
  display: grid;
  gap: 28px;
  align-items: center;
  padding: 40px 0 48px;
}

@media (min-width: 860px) {
  .bs-hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 48px;
    padding: 56px 0 64px;
  }
}

.bs-hero__note {
  margin-top: 16px;
  color: var(--muted);
}

/* Photos sit on white, as shot, in both themes */
.photo {
  margin: 0;
  background: var(--photo-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
}

.photo figcaption {
  padding: 10px 14px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

/* Text + photo rows */
.split {
  display: grid;
  gap: 28px;
  align-items: center;
}

@media (min-width: 860px) {
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 48px;
  }

  .split--flip > :first-child {
    order: 2;
  }
}

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

/* Device flags, coloured like the screen labels */
.flags {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.flags li {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.flag {
  flex: none;
  display: inline-block;
  min-width: 3.6em;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}

.flag--mil { background: var(--flag-mil-bg); color: var(--flag-mil-text); }
.flag--heli { background: var(--flag-heli-bg); color: var(--flag-heli-text); }
.flag--spc { background: var(--flag-spc-bg); color: var(--flag-spc-text); }
.flag--sos { background: var(--flag-sos-bg); color: var(--flag-sos-text); }
.flag--new { background: var(--flag-new-bg); color: var(--flag-new-text); }
.flag--look { background: var(--flag-look-bg); color: var(--flag-look-text); }

/* Feature cards */
.features {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.features .card h3 {
  margin-top: 0;
}

.features .card p:last-child {
  margin-bottom: 0;
}

.feature-photo {
  max-width: 520px;
  margin: 24px auto 0;
}

/* Editions */
.editions .card ul {
  margin: 0 0 8px;
  padding-left: 1.2em;
}

.editions .card li {
  margin-bottom: 4px;
}

/* Set-up and data notes */
.prose h2 + p {
  margin-top: 0;
}

.prose p + h2 {
  margin-top: 1.8em;
}

/* Specs */
.specs {
  margin: 0;
  padding-left: 1.2em;
  max-width: 42em;
}

.specs li {
  margin-bottom: 6px;
}

/* Questions */
.faq {
  max-width: 46em;
}

.faq details {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
}

.faq details p {
  margin: 10px 0 0;
}

.credit {
  padding-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------- The virtual Blipscope (hero) */

.vs {
  min-width: 0;
}

.vs-intro {
  color: var(--muted);
}

.vs-scope {
  margin: 0;
}

/* The device's round panel in its dark instrument ring. The canvas draws at the screen's real
   resolution (render.js), so it is never scaled up. The canvas carries the 1:1 ratio; the bezel only
   wraps it (WebKit applies an aspect-ratio on a padded box to its content). */
.vs-bezel {
  width: min(100%, 512px);
  margin: 0 auto;
  padding: 16px;
  border-radius: 50%;
  background: #1b1f1e;
  box-shadow: inset 0 0 0 2px #2c3331, var(--shadow);
}

.vs-screen {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: #000;
  /* Touch-and-hold zooms the scope: no scrolling, selection, callout or tap flash on the canvas.
     The rest of the page scrolls as usual. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.vs-screen:focus-visible {
  outline-offset: 6px;
}

/* The watch limit's overlay (WebAssembly page only): it covers the round panel
   once the limit is reached. The padding keeps its contents inside the circle. */
.vs-bezel {
  position: relative;
}

.vs-limit {
  position: absolute;
  inset: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12%;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--text);
  text-align: center;
}

.vs-limit[hidden] {
  display: none;
}

.vs-limit__title {
  margin: 0;
  font-size: clamp(1.05rem, 4.2vw, 1.4rem);
  font-weight: 700;
  line-height: 1.25;
}

.vs-limit__buttons {
  justify-content: center;
  margin-top: 16px;
}

.vs-limit .btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.vs-scope figcaption {
  max-width: 512px;
  margin: 12px auto 0;
  text-align: center;
}

.vs-label {
  margin: 0;
  font-weight: 600;
}

.vs-credit,
.vs-status {
  margin: 2px 0 0;
}

.vs-status {
  min-height: 1.6em;
}

.vs-hint {
  max-width: 512px;
  margin: 8px auto 12px;
  text-align: center;
}

.vs-panel {
  max-width: 512px;
  margin: 8px auto 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.vs-panel > summary {
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

.vs-settings {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.vs-settings fieldset {
  margin: 0;
  padding: 8px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.vs-settings legend {
  padding: 0 6px;
  font-weight: 600;
}

.vs-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.vs-seg label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.9rem;
  cursor: pointer;
}

.vs-seg input,
.vs-check input {
  margin: 0;
  accent-color: var(--accent);
}

.vs-seg--indent {
  margin: 2px 0 8px 28px;
}

.vs-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 0;
}

.vs-row input {
  width: 6em;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.vs-check {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 6px 0;
}

.vs-check input {
  width: 18px;
  height: 18px;
}

.vs-list {
  margin: 0;
  padding: 0 16px 14px 40px;
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* The hero with the live scope: on a phone, title, then the scope, then the text (plan section 8).
   On wider screens, title and text on the left, the scope on the right. */
@media (min-width: 860px) {
  .bs-hero--live {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-areas: "title scope" "text scope";
    align-items: start;
    row-gap: 0;
  }

  .bs-hero--live .bs-hero__title {
    grid-area: title;
    align-self: end;
  }

  .bs-hero--live .bs-hero__text {
    grid-area: text;
  }

  .bs-hero--live .vs {
    grid-area: scope;
  }
}
