/* AUV project site — components.
   Buttons, cards, quick facts, About layout, depth diagram, how-it-works
   flow, sensing / recognition cards, the AUV inspection sheet, video and
   project-material panels, full-size viewer. */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.mt-card { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.comm { display: flex; gap: var(--space-4); align-items: flex-start; }
.comm .icon { flex: none; margin: 0; }
.comm h3 { margin-bottom: var(--space-1); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 var(--space-5);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--ink); }
.btn--primary { background: var(--deep); border-color: var(--deep); color: #fff; }
.btn--primary:hover { background: var(--sea); border-color: var(--sea); }
.btn--small { min-height: 38px; padding: 0 var(--space-4); font-size: var(--text-small); }

/* ---------- Cards ---------- */

.card {
  padding: var(--space-5);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.card h3 { margin-bottom: var(--space-2); }
.card p { color: var(--ink-soft); }

.icon {
  width: 40px;
  height: 40px;
  padding: 8px;
  margin-bottom: var(--space-4);
  border-radius: 10px;
  background: var(--sea-soft);
  color: var(--sea);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Quick facts (under the hero) ---------- */

.facts-strip { background: var(--paper); border-block: 1px solid var(--line); }
.facts-strip dl { display: grid; }
@media (min-width: 720px) { .facts-strip dl { grid-template-columns: repeat(3, 1fr); } }
.facts-strip dl > div { padding: var(--space-5) var(--space-5) var(--space-5) 0; }
@media (min-width: 720px) {
  .facts-strip dl > div + div { padding-left: var(--space-5); border-left: 1px solid var(--line); }
}
.facts-strip dt { font-size: var(--text-small); color: var(--ink-soft); margin-bottom: 2px; }
.facts-strip dd { font-weight: 650; font-size: 1.05rem; line-height: 1.35; }

/* ---------- About ---------- */

.about-grid { display: grid; gap: var(--space-7); align-items: start; }
@media (min-width: 960px) { .about-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.about-grid h3 { margin-bottom: var(--space-3); }
.about-grid .prose + h3 { margin-top: var(--space-6); }

.figure img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--sheet);
}
.figure figcaption { margin-top: var(--space-2); font-size: var(--text-small); color: var(--ink-soft); }

.depth svg { width: 100%; max-width: 760px; height: auto; display: block; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--sheet); }
.depth text { font-family: var(--font-ui); fill: var(--ink); }
.depth .depth__muted { fill: var(--ink-soft); }

/* ---------- How it works: the flow ---------- */

.flow { display: grid; gap: var(--space-4); counter-reset: step; }
@media (min-width: 640px) { .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); } }

.flow li {
  position: relative;
  padding: var(--space-5);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.flow li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: var(--space-3);
  border-radius: 50%;
  background: var(--deep);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}
.flow h3 { font-size: 1.1rem; margin-bottom: var(--space-1); }
.flow p { color: var(--ink-soft); font-size: 0.95rem; }

/* connector chevron between cards (desktop, 3 columns) */
@media (min-width: 960px) {
  .flow li:not(:nth-child(3n))::after {
    content: "";
    position: absolute;
    top: 50%;
    right: calc(-1 * var(--space-5) / 2 - 5px);
    width: 9px;
    height: 9px;
    border-top: 2px solid var(--line-strong);
    border-right: 2px solid var(--line-strong);
    transform: translateY(-50%) rotate(45deg);
    background: transparent;
  }
}

.flow--end li:last-child { border-color: var(--hull); background: var(--hull-soft); }
.flow--end li:last-child::before { background: var(--hull-ink); }

.cards-3 { display: grid; gap: var(--space-5); }
@media (min-width: 800px) { .cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.cards-2 { display: grid; gap: var(--space-5); }
@media (min-width: 800px) { .cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.note-line { margin-top: var(--space-5); max-width: 70ch; font-family: var(--font-prose); font-size: 1.05rem; line-height: 1.65; color: var(--ink-soft); }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.chip {
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--sheet);
  font-weight: 600;
  font-size: 0.9rem;
}

.photo-row { display: grid; gap: var(--space-5); margin-top: var(--space-6); }
@media (min-width: 720px) { .photo-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- AUV design: inspection sheet ---------- */

.design-grid { display: grid; gap: var(--space-6); align-items: start; }
@media (min-width: 960px) { .design-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } }

.sheet {
  position: relative;
  margin: 0;
  padding: 10px;
  background: var(--sheet);
  border: 1.5px solid var(--ink);
  transition: box-shadow 0.15s ease;
}
.sheet__frame { position: relative; border: 1px solid var(--ink); border-bottom: 0; }
.sheet.is-inspecting { box-shadow: 0 0 0 4px var(--hull); }

.sheet__view { position: relative; overflow: hidden; background: #fff; line-height: 0; }
.sheet__view img { width: 100%; }
.sheet--live .sheet__view { cursor: crosshair; }
.sheet--coarse .sheet__view { cursor: zoom-in; }
.sheet__view:focus-visible { outline: 3px solid var(--sea); outline-offset: -3px; }

.sheet__strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  border: 1px solid var(--ink);
  font-size: var(--text-small);
  line-height: 1.4;
}
.sheet__strip > span { padding: var(--space-2) var(--space-3); }
.sheet__strip > span:first-child { border-right: 1px solid var(--ink); font-weight: 700; }

.sheet__info {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: min(230px, 62%);
  padding: var(--space-3) var(--space-4);
  background: rgb(255 255 255 / 0.96);
  border: 1px solid var(--ink);
  font-size: var(--text-small);
  line-height: 1.4;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.sheet.is-inspecting .sheet__info { opacity: 1; transform: none; }
.sheet--panel-bl .sheet__info { top: auto; right: auto; bottom: 12px; left: 12px; }
.sheet__info-title { font-weight: 800; font-size: 1.15rem; line-height: 1.1; }
.sheet__info-sub { color: var(--ink-soft); margin-bottom: var(--space-2); }
.sheet__info dl { display: grid; gap: 2px; }
.sheet__info dl > div { display: flex; justify-content: space-between; gap: var(--space-3); }
.sheet__info dt { color: var(--ink-soft); }
.sheet__info dd { font-weight: 650; text-align: right; }

.loupe {
  position: absolute;
  z-index: 4;
  width: 176px;
  height: 176px;
  left: 0;
  top: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 6px 18px rgb(10 37 54 / 0.3), inset 0 0 0 3px #fff;
  background-repeat: no-repeat;
  background-color: #fff;
  pointer-events: none;
  opacity: 0;
}
.sheet.is-magnifying .loupe { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet__info { transition: none; }
}

.design-side { display: grid; gap: var(--space-5); }

.spec { border-top: 1px solid var(--line); }
.spec > div { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.spec dt { font-size: var(--text-small); color: var(--ink-soft); }
.spec dd { font-weight: 600; }

.inspect-tools {
  padding: var(--space-5);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: grid;
  gap: var(--space-4);
}
.inspect-tools h3 { margin: 0; font-size: 1.05rem; }
.inspect-tools p { font-size: var(--text-small); color: var(--ink-soft); }
.inspect-tools fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.inspect-tools legend { padding: 0; font-size: var(--text-small); font-weight: 650; margin-bottom: var(--space-2); }
html:not(.js) .inspect-tools { display: none; }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--sheet);
}
.segmented label { position: relative; text-align: center; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: block; padding: 8px 0; font-weight: 600; }
.segmented label + label span { border-left: 1px solid var(--line-strong); }
.segmented input:checked + span { background: var(--deep); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--sea); outline-offset: -3px; }

.pointer-only-touch { display: none; }
.design-grid--coarse .zoom-only { display: none; }
.design-grid--coarse .pointer-only-touch { display: block; }
.design-grid--coarse .pointer-only-fine { display: none; }

/* ---------- Video + project materials ---------- */

.media-slot {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-6);
  text-align: center;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}
.media-slot svg { width: 44px; height: 44px; fill: none; stroke: var(--line-strong); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.video-frame { aspect-ratio: 16 / 9; max-width: 960px; }
.video-frame svg { width: 64px; height: 64px; }

.materials { display: grid; gap: var(--space-5); }
@media (min-width: 800px) { .materials { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.materials .card { display: grid; gap: var(--space-4); align-content: start; }
.materials .card h3 { margin: 0; }
.materials .media-slot { min-height: 200px; padding: var(--space-5); }
.media-slot--a0 { aspect-ratio: 841 / 1189; min-height: 0 !important; }

/* ---------- Full-size viewer (dialog) ---------- */

.viewer {
  width: min(96vw, 1240px);
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
}
.viewer::backdrop { background: rgb(10 37 54 / 0.82); }
.viewer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}
.viewer__bar h2 { margin: 0; font-size: 1.05rem; letter-spacing: 0; }
.viewer__bar form { margin: 0; }
.viewer__scroll { max-height: calc(100vh - 150px); overflow: auto; background: #fff; }
.viewer__scroll img { width: 1600px; max-width: none; border: 0; border-radius: 0; }

/* ---------- Labels: simulation / conceptual / reference ---------- */

.tag {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.6;
  vertical-align: middle;
  white-space: nowrap;
}
.tag--concept { background: var(--paper); color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--line-strong); }
.tag--sim { background: var(--sea-soft); color: var(--sea); }

/* ---------- Risk states ---------- */

.risk { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; line-height: 1.35; }
.risk--safe { background: var(--risk-safe-soft); color: var(--risk-safe-ink); }
.risk--hazard { background: var(--risk-hazard-soft); color: var(--risk-hazard-ink); box-shadow: inset 0 0 0 1.5px var(--risk-hazard); }
.risk--high { background: var(--risk-high-soft); color: var(--risk-high-ink); box-shadow: inset 0 0 0 1.5px var(--risk-high); }
.risk--unknown { background: var(--risk-unknown-soft); color: var(--risk-unknown-ink); box-shadow: inset 0 0 0 1.5px var(--risk-unknown); }
.risk--small { padding: 2px 9px; font-size: 0.82rem; white-space: nowrap; }

.risk-card { border-top-width: 4px; }
.risk-card .risk { margin-bottom: var(--space-3); }
.card .risk--safe { color: var(--risk-safe-ink); }
.card .risk--hazard { color: var(--risk-hazard-ink); }
.card .risk--unknown { color: var(--risk-unknown-ink); }
.risk-card--safe { border-top-color: var(--risk-safe); }
.risk-card--hazard { border-top-color: var(--risk-hazard); }
.risk-card--unknown { border-top-color: var(--risk-unknown); }

/* evidence pills (shared by the explanation example and the demo) */
.ev { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 650; white-space: nowrap; }
.ev--yes { background: var(--sea-soft); color: var(--sea); }
.ev--no { background: var(--paper); color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--line); }
.ev--maybe { background: var(--risk-hazard-soft); color: var(--risk-hazard-ink); }
.ev--info { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* "How a decision is explained" example */
.explain {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
@media (min-width: 860px) { .explain { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; } .explain figcaption { grid-column: 1 / -1; } }
.explain__table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.explain__table th, .explain__table td { padding: 8px 12px 8px 0; text-align: left; border-bottom: 1px solid var(--line); }
.explain__table th { font-size: var(--text-small); font-weight: 650; color: var(--ink-soft); }
.explain__result { display: grid; gap: var(--space-2); }
.explain__result > div { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-2) var(--space-3); background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); }
.explain__result dt { color: var(--ink-soft); font-size: var(--text-small); }
.explain__result dd { font-weight: 700; text-align: right; }

/* small step list inside a card */
.mini-flow { display: grid; gap: 6px; margin: var(--space-2) 0 var(--space-4); counter-reset: mini; }
.mini-flow li { counter-increment: mini; display: flex; align-items: center; gap: var(--space-2); font-weight: 600; font-size: 0.95rem; }
.mini-flow li::before {
  content: counter(mini);
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sea-soft);
  color: var(--sea);
  font-size: 0.78rem;
  font-weight: 700;
}

/* data-transfer pipeline */
.pipeline { display: grid; gap: var(--space-2); counter-reset: pipe; }
@media (min-width: 640px) { .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pipeline li {
  counter-increment: pipe;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
  line-height: 1.3;
}
.pipeline li::before {
  content: counter(pipe);
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--deep);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}
.pipeline li:last-child { border-color: var(--hull); background: var(--hull-soft); }
.pipeline li:last-child::before { background: var(--hull-ink); }

/* ---------- AUV design: layout wrapper ---------- */

.design-views { min-width: 0; }
