/* =========================================================
   DESIGN TOKENS
   Custom properties (CSS variables) hold every colour. appearance.css
   redefines them for the light theme, so the rules below never mention
   a literal colour twice. Change a token here and both themes follow.
   ========================================================= */
:root {
  color-scheme: dark;
  --bg: #101112;
  --panel: #17191b;
  --text: #f1f1ef;
  --muted: #91959a;
  --line: #303235;
  --blue: #649bff;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button,
input {
  font: inherit;
}
button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
a:focus-visible,
label:focus-within {
  outline: 2px solid var(--blue);
  outline-offset: 5px;
}
[hidden] {
  display: none !important;
}
.masthead {
  height: 100px;
  margin: 0 5.2%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--text);
  font-size: 17px;
  letter-spacing: 2.3px;
  text-decoration: none;
  font-weight: 700;
}
/* The approved mark: a contained circular brand mark with its own dark surface, so it
   reads the same on both themes. Served as a 64 px derivative, shown at 32 px. */
.brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  margin-right: 2px;
}
.brand-caption {
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 1.4px;
  width: 76px;
  line-height: 1.6;
  padding-left: 15px;
  border-left: 1px solid var(--line);
}
.tool-name {
  font-size: 10px;
  letter-spacing: 1.8px;
  color: var(--secondary);
}
.tool-name span {
  margin: 0 18px;
  color: var(--muted);
}
main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 5.2%;
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 32px 0 28px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 500;
}
.intro .eyebrow {
  color: var(--blue);
  margin: 0 0 16px;
}
h1 {
  font-size: clamp(28px, 3.1vw, 45px);
  font-weight: 400;
  letter-spacing: -1.9px;
  margin: 0;
}
.intro-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(290px, 1fr);
  border: 1px solid var(--line);
  min-height: 570px;
}
.viewer {
  min-width: 0;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.viewer-top,
.viewer-bottom {
  height: 53px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 23px;
  font-size: 9px;
  letter-spacing: 1.4px;
  color: var(--secondary);
}
.viewer-top > span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}
#status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #777;
}
#status-dot.active {
  background: var(--blue);
}
.viewer-top {
  border-bottom: 1px solid var(--line);
}
.viewer-bottom {
  border-top: 1px solid var(--line);
}
#state-label {
  color: var(--blue);
}
#capture-label {
  color: var(--muted);
}
.stage {
  position: relative;
  min-height: 440px;
  flex: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--stage);
}
.stage video,
.stage canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.stage video {
  object-fit: cover;
}
.stage #edges {
  mix-blend-mode: screen;
  opacity: 0.5;
  clip-path: inset(0 0 60% 0);
  animation: edge-sweep 2s linear infinite;
}
.target {
  position: absolute;
  width: 66%;
  height: 78%;
  pointer-events: none;
}
.target span {
  position: absolute;
  width: 19px;
  height: 19px;
  border-color: var(--frame);
  border-style: solid;
  border-width: 0;
}
.target span:nth-child(1) {
  top: 0;
  left: 0;
  border-width: 1px 0 0 1px;
}
.target span:nth-child(2) {
  top: 0;
  right: 0;
  border-width: 1px 1px 0 0;
}
.target span:nth-child(3) {
  bottom: 0;
  left: 0;
  border-width: 0 0 1px 1px;
}
.target span:nth-child(4) {
  bottom: 0;
  right: 0;
  border-width: 0 1px 1px 0;
}
.stage.locking .target span {
  border-color: var(--blue);
}
.empty-state {
  text-align: center;
  z-index: 1;
}
.object-icon {
  width: 72px;
  height: 86px;
  margin: 0 auto 24px;
}
.object-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
}
.object-icon .icon-accent {
  stroke: var(--blue);
}
.empty-state h2 {
  font-size: 23px;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.6px;
  margin: 0 0 14px;
}
.empty-state p {
  color: var(--muted);
  font-size: 11px;
}
.frame-coordinate {
  position: absolute;
  bottom: 15px;
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 1.3px;
}
.coord-left {
  left: 20px;
}
.coord-right {
  right: 20px;
}
.countdown {
  z-index: 3;
  font-size: 104px;
  line-height: 1;
  color: white;
  text-shadow: 0 2px 20px #0008;
}
.scan-line {
  display: none;
  position: absolute;
  height: 1px;
  width: 100%;
  background: #8bb6ff;
  box-shadow: 0 -12px 28px 6px #5b8bd422;
  top: 0;
  animation: scan 2s linear infinite;
}
.scanning .scan-line {
  display: block;
}
.report {
  padding: 25px 34px 27px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.report-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.small-cross {
  font-size: 20px;
  color: var(--blue);
  font-weight: 300;
}
.section-number {
  font-size: 9px;
  letter-spacing: 1.7px;
  color: var(--blue);
  margin: 37px 0 18px;
}
#report-title {
  font-size: clamp(25px, 2.7vw, 39px);
  font-weight: 400;
  line-height: 1.13;
  letter-spacing: -1.2px;
  margin: 0 0 20px;
}
.report-copy {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  max-width: 300px;
}
.steps {
  list-style: none;
  padding: 14px 0 20px;
  margin: 0;
  font-size: 11px;
  color: var(--secondary);
}
.steps li {
  padding: 9px 0;
}
.steps span {
  font-size: 9px;
  color: var(--muted);
  margin-right: 15px;
}
.actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 20px;
}
.primary {
  background: var(--button);
  border: 0;
  color: var(--button-text);
  height: 48px;
  width: 100%;
  padding: 0 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.primary:hover {
  background: var(--button-hover);
}
.primary:disabled {
  opacity: 0.6;
  cursor: wait;
}
.primary span {
  font-size: 20px;
  font-weight: 400;
}
.text-button {
  border: 0;
  background: none;
  color: var(--secondary);
  cursor: pointer;
  font-size: 11px;
  padding: 5px;
}
.upload-label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--frame);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
}
.upload-label:hover {
  background: var(--panel);
}
.upload-label input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.hint {
  font-size: 9px;
  line-height: 1.7;
  color: var(--muted);
  margin: 18px 0 0;
  max-width: 340px;
}
footer {
  padding: 25px 0 35px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}
footer > span:first-child {
  letter-spacing: 1.5px;
}
.footer-dot {
  margin: 0 9px;
}
#results {
  padding-top: 32px;
}
#results .result-state {
  font-size: 10px;
  letter-spacing: 1.8px;
  color: var(--blue);
  margin: 0 0 17px;
}
#results h2 {
  font-weight: 400;
  font-size: 29px;
  letter-spacing: -0.9px;
  line-height: 1.2;
  margin: 0 0 22px;
  overflow-wrap: anywhere;
}
#results dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 0 0 20px;
}
#results dt {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  margin-bottom: 8px;
}
#results dd {
  font-size: 12px;
  margin: 0;
  line-height: 1.5;
}
#results .description {
  font-size: 12px;
  color: var(--secondary);
  line-height: 1.8;
  min-height: 2em;
}
.reveal {
  animation: reveal 0.3s ease both;
}
.error-title {
  color: var(--error) !important;
}
@keyframes scan {
  from {
    top: 0;
  }
  to {
    top: 100%;
  }
}
@keyframes edge-sweep {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (min-width: 1500px) {
  .stage {
    min-height: 520px;
  }
  .report {
    padding: 30px 45px;
  }
}
@media (max-width: 800px) {
  .masthead {
    height: 78px;
  }
  .brand-caption {
    display: none;
  }
  .tool-name {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .tool-name span {
    margin: 0 8px;
  }
  .intro {
    margin: 30px 0 25px;
  }
  .intro-note {
    display: none;
  }
  h1 {
    letter-spacing: -1px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .viewer {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .stage {
    min-height: 380px;
  }
  .report {
    padding: 25px;
  }
  .report-top {
    margin-bottom: 0;
  }
  .section-number {
    margin-top: 25px;
  }
  #report-title br {
    display: none;
  }
  #report-title {
    font-size: 29px;
    max-width: 320px;
  }
  .report-copy {
    max-width: none;
  }
  .steps {
    padding-bottom: 0;
  }
  .actions {
    padding-top: 24px;
  }
  .hint {
    max-width: none;
  }
  footer {
    flex-direction: column;
    gap: 8px;
  }
  .viewer-top,
  .viewer-bottom {
    padding: 0 16px;
  }
  .brand {
    font-size: 14px;
  }
  .intro .eyebrow {
    font-size: 8px;
  }
  .stage .target {
    width: 72%;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .stage #edges {
    clip-path: none;
  }
  .scan-line {
    top: 50%;
  }
}
.stage video {
  object-fit: contain;
}
.observations {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}
.observations li {
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

/* Editorial result presentation. Capture geometry and scan behavior are unchanged. */
.stage {
  background: var(--stage);
}
.empty-state .object-icon {
  display: none;
}
.empty-state h2 {
  margin-bottom: 24px;
}
.hero-primary {
  display: block;
  font-size: clamp(26px, 2.5vw, 36px);
  line-height: 1.15;
  letter-spacing: -1.2px;
  color: var(--text);
}
.hero-secondary {
  display: block;
  margin-top: 10px;
  font-size: 25px;
  line-height: 1.3;
  letter-spacing: -0.5px;
  color: var(--secondary);
}
.empty-state p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--secondary);
}
/* Result composition: a bounded photograph and a readable, prioritized report. */
.has-result {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: start;
}
.has-result .viewer {
  height: clamp(560px, 44vw, 620px);
  border-bottom: 1px solid var(--line);
}
.has-result .stage {
  min-height: 0;
}
.has-result .stage canvas {
  object-fit: contain;
}
.has-result .viewer-top,
.has-result .viewer-bottom {
  height: 42px;
}
.has-result .report {
  padding: 26px 30px 18px;
}
.has-result .report-top {
  display: none;
}
/* Keep the live region intact while placing the action before secondary analysis. */
.has-result #results {
  display: contents;
}
.has-result #results .result-state {
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 1.4px;
  color: var(--blue);
  margin: 0 0 12px;
}
.has-result #results h2 {
  font-size: clamp(28px, 2.45vw, 36px);
  line-height: 1.12;
  letter-spacing: -1px;
  margin: 0 0 18px;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.has-result #results dl {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  margin: 0 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.has-result #results dt {
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 3px;
}
.has-result #results dd {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  overflow-wrap: anywhere;
}
.identity-role {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}
.identity-basis {
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.identity-evidence {
  font-size: 14px;
  line-height: 1.6;
  color: var(--secondary);
  overflow-wrap: anywhere;
}
.identity-explanation {
  font-size: 17px;
  line-height: 1.5;
  color: var(--secondary);
  margin: 0 0 20px;
  max-width: 52ch;
}
.analysis-heading {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--secondary);
  margin: 0 0 6px;
}
.has-result .observations {
  counter-reset: observation;
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
}
.has-result .observations li {
  counter-increment: observation;
  position: relative;
  padding: 10px 0 10px 30px;
  border-top: 1px solid var(--line);
}
.has-result .observations li::before {
  content: counter(observation, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 13px;
  font:
    12px/1.5 ui-monospace,
    Consolas,
    monospace;
  color: var(--blue);
}
.next-view {
  border-left: 2px solid var(--blue);
  padding-left: 16px;
  margin: 20px 0 0;
}
.next-view h3 {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 6px;
}
.next-view p {
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}
.identification-notes {
  order: 2;
  margin-top: 12px;
  color: var(--secondary);
  font-size: 16px;
  line-height: 1.55;
}
.identification-notes summary {
  cursor: pointer;
  padding: 10px 0;
  font-size: 14px;
}
.identification-notes summary:hover {
  color: var(--text);
}
.identification-notes summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}
.identification-notes p {
  margin: 14px 0 0;
}
.identification-notes h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 14px 0 8px;
}
.full-observations {
  padding-left: 24px;
  margin: 0;
}
.full-observations li {
  margin: 10px 0;
  padding-left: 4px;
}
.has-result .actions {
  order: 1;
  margin-top: 20px;
  padding-top: 0;
}
.has-result .hint:empty {
  display: none;
}
.has-result .identity-name {
  animation: reveal 0.18s ease-out;
}
@media (min-width: 801px) and (max-width: 1100px) {
  .has-result {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  }
  .has-result .report {
    padding: 24px;
  }
}
@media (max-width: 900px) {
  .has-result {
    grid-template-columns: 1fr;
  }
  .has-result .viewer {
    height: 310px;
    border-right: 0;
  }
  .has-result .report {
    padding: 24px;
  }
  .has-result .viewer-top,
  .has-result .viewer-bottom {
    height: 36px;
  }
  .has-result .target {
    height: 82%;
    width: 70%;
  }
  .has-result #results h2 {
    font-size: clamp(28px, 4.6vw, 34px);
    text-wrap: pretty;
  }
  .has-result .observations li:nth-child(n + 4) {
    display: none;
  }
  .has-result .observations {
    font-size: 17px;
  }
  .has-result .identity-explanation {
    font-size: 16px;
  }
}
@media (max-width: 480px) {
  .has-result .viewer {
    height: 270px;
  }
  .has-result .report {
    padding: 22px 20px 14px;
  }
  .has-result #results dl {
    gap: 12px;
  }
  .hero-primary {
    font-size: 27px;
  }
  .hero-secondary {
    font-size: 23px;
  }
}

.project-footer {
  font-size: 12px;
  line-height: 1.7;
}
.project-footer strong {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0;
}
.project-footer p {
  margin: 5px 0 0;
  letter-spacing: 0;
}
.project-footer nav {
  display: flex;
  gap: 22px;
}
.project-footer a {
  color: var(--secondary);
  text-decoration: none;
}
.project-footer a:hover {
  color: var(--blue);
}
.intro-secondary {
  color: var(--secondary);
  font-size: 22px;
  line-height: 1.4;
  margin: 10px 0 0;
  letter-spacing: -0.3px;
}

/* Shared action rhythm: crisp edges, clear labels, purposeful supporting copy. */
.primary,
.upload-label {
  min-height: 72px;
  height: auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  border-radius: 2px;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}
.action-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.primary .action-copy,
.upload-label .action-copy {
  font-size: 15px;
}
.action-copy strong {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 600;
}
.action-copy small {
  font-size: 12px;
  line-height: 1.4;
  font-weight: 400;
}
.upload-label .action-copy small {
  color: var(--secondary);
}
.primary .action-arrow,
.upload-label .action-arrow {
  font-size: 21px;
  font-weight: 400;
  flex-shrink: 0;
  width: 32px;
  text-align: right;
  border-left: 1px solid currentColor;
}
.primary:active:not(:disabled),
.upload-label:active {
  transform: translateY(1px);
}
.upload-label:hover {
  border-color: var(--blue);
}
.has-result .primary {
  min-height: 64px;
  padding: 11px 16px;
}
@media (min-width: 1440px) {
  .masthead {
    max-width: 1290px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Viewport guidance (phones): the scroll destinations keep clear of any sticky header.
   lib/viewport-guide.js measures the header and sets --guide-offset; the margin itself
   lives here so no pixel offsets are scattered through JavaScript. */
.viewer,
#results {
  scroll-margin-top: calc(var(--guide-offset, 0px) + 12px);
}
