/* ================= STYLE PROFILE — the scan experience (light) ================= */

.scan-stage {
  position: fixed; inset: 0; z-index: 1;
  display: grid; place-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse 55% 50% at 22% 38%, rgba(109,95,150,0.12), transparent 62%),
    radial-gradient(ellipse 65% 55% at 78% 108%, rgba(201,169,97,0.20), transparent 60%),
    var(--paper);
}

.scan-shell {
  position: relative;
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.05fr);
  align-items: center; gap: 6vw;
  width: min(1180px, 92vw);
}

/* ---- portrait + overlay ---- */
.scan-frame {
  position: relative; aspect-ratio: 4/5; width: min(420px, 40vw);
  justify-self: end;
  border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 70px rgba(25,21,32,0.18), 0 0 0 1px var(--line);
}
.scan-frame img { width: 100%; height: 100%; object-fit: cover; }
/* Slight deepening on the photo only — the page stays white, but the mesh
   needs something to read against. */
.scan-frame::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(rgba(25,21,32,0.10), rgba(25,21,32,0.34));
}
.scan-svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; }
.scan-svg line { stroke: rgba(255,240,205,0.9); stroke-width: 1.5; }
.scan-svg circle { fill: #fff2d2; }

.scan-beam {
  position: absolute; left: -6%; right: -6%; height: 3px; z-index: 3;
  top: 0; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, #fff3d6, transparent);
  box-shadow: 0 0 26px 7px rgba(255,229,163,0.6);
}

.scan-badge {
  position: absolute; left: 14px; bottom: 14px; z-index: 4;
  font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(251,249,246,0.9); color: var(--ink-dim);
  border: 1px solid rgba(25,21,32,0.12); backdrop-filter: blur(6px);
}

/* ---- metric chips pinned to features ---- */
.chip {
  position: absolute; z-index: 4; transform: translate(-50%,-50%);
  display: flex; align-items: center; gap: 8px;
  opacity: 0; transition: opacity 0.5s ease;
}
.chip.on { opacity: 1; }
.chip button {
  border: 1px solid var(--line); cursor: pointer;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(8px);
  color: var(--ink); font-family: var(--font-body);
  font-size: 0.72rem; letter-spacing: 0.04em; white-space: nowrap;
  padding: 8px 14px; border-radius: 999px;
  box-shadow: 0 6px 18px rgba(25,21,32,0.18);
  transition: background 0.25s, transform 0.25s, color 0.25s;
}
.chip button b { color: var(--gold); font-weight: 700; }
.chip button:hover { background: var(--ink); color: var(--paper); transform: scale(1.05); }
.chip button:hover b { color: var(--gold-soft); }
.chip::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: #fff2d2; box-shadow: 0 0 0 4px rgba(255,229,163,0.35);
  flex-shrink: 0;
}

/* ---- narration column ---- */
.scan-copy { max-width: 460px; }
.scan-copy .kicker { margin-bottom: 14px; }
.scan-phase { position: relative; min-height: 260px; }
.scan-phase > div {
  position: absolute; inset: 0;
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.22,1,0.36,1);
  pointer-events: none;
}
.scan-phase > div.on { opacity: 1; transform: none; pointer-events: auto; }
.scan-phase h2 { font-size: clamp(2rem, 4.4vw, 3.4rem); margin-bottom: 14px; }
.scan-phase p { color: var(--ink-dim); font-weight: 300; }

.palette { display: flex; gap: 10px; margin-top: 22px; }
.palette span {
  width: 46px; height: 46px; border-radius: 12px;
  transform: scale(0.4); opacity: 0;
  transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1), opacity 0.4s;
  box-shadow: 0 8px 20px rgba(25,21,32,0.16), inset 0 0 0 1px rgba(25,21,32,0.06);
}
.palette span.on { transform: none; opacity: 1; }

.readout { list-style: none; margin-top: 20px; }
.readout li {
  display: flex; justify-content: space-between; gap: 20px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  font-size: 0.92rem; opacity: 0; transform: translateX(-10px);
  transition: opacity 0.45s, transform 0.45s;
}
.readout li.on { opacity: 1; transform: none; }
.readout li span { color: var(--ink-dim); }
.readout li b { color: var(--gold); font-weight: 700; }

.scan-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--line); z-index: 6;
}
.scan-progress__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--lilac), var(--gold-bright)); }
.scan-hint {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 6;
  font-size: 0.66rem; letter-spacing: 0.32em; text-transform: uppercase; color: var(--ink-dim);
  transition: opacity 0.5s;
}
.scan-hint::after {
  content: ''; display: block; width: 1px; height: 34px; margin: 10px auto 0;
  background: linear-gradient(var(--gold), transparent);
  animation: drip 1.9s ease-in-out infinite;
}
@keyframes drip {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

.scan-track { position: relative; z-index: 0; pointer-events: none; }
.page { position: relative; z-index: 3; background: var(--paper); }

/* ---- popup ---- */
.scan-overlay {
  position: fixed; inset: 0; z-index: 120; padding: 4vw;
  background: rgba(25,21,32,0.42); backdrop-filter: blur(10px);
  display: grid; place-items: center; opacity: 0; pointer-events: none;
  transition: opacity 0.4s;
}
.scan-overlay.open { opacity: 1; pointer-events: auto; }
.scan-modal {
  position: relative; width: min(560px, 94vw); max-height: 84vh; overflow-y: auto;
  background: var(--paper-3); border: 1px solid var(--line);
  border-radius: 22px; padding: 40px 40px 36px;
  box-shadow: 0 40px 100px rgba(25,21,32,0.3);
  transform: translateY(30px) scale(0.96); opacity: 0;
  transition: transform 0.5s cubic-bezier(0.22,1,0.36,1), opacity 0.4s;
}
.scan-overlay.open .scan-modal { transform: none; opacity: 1; }
.scan-modal h3 { font-size: 1.7rem; margin-bottom: 12px; }
.scan-modal p { color: var(--ink-dim); font-weight: 300; margin-bottom: 14px; }
.scan-modal .tag {
  display: block; font-size: 0.66rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: 10px;
}
.scan-modal__close {
  position: absolute; top: 14px; right: 14px;
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--paper-2); color: var(--ink); font-size: 0.95rem;
  transition: background 0.25s, transform 0.25s, color 0.25s;
}
.scan-modal__close:hover { background: var(--ink); color: var(--paper); transform: rotate(90deg); }

@media (max-width: 900px) {
  .scan-shell { grid-template-columns: 1fr; gap: 26px; justify-items: center; text-align: center; }
  .scan-frame { width: min(300px, 64vw); justify-self: center; }
  .scan-copy { max-width: 92vw; }
  .scan-phase { min-height: 220px; }
  .palette { justify-content: center; }
  .palette span { width: 38px; height: 38px; }
  .chip button { font-size: 0.64rem; padding: 6px 11px; }
  .scan-modal { padding: 30px 24px 28px; }
}

/* ================= futuristic layer =================
   Light HUD language: hairline grid, corner brackets, a live readout strip
   and scanline sweep. Everything is drawn, so it costs no assets.
==================================================================== */

/* faint engineering grid behind the whole stage */
.scan-stage::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(25,21,32,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25,21,32,0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 25%, transparent 78%);
}
.scan-shell { z-index: 1; }

/* corner brackets around the portrait — the "target acquired" read */
.scan-frame__brackets { position: absolute; inset: -14px; z-index: 5; pointer-events: none; }
.scan-frame__brackets i {
  position: absolute; width: 26px; height: 26px;
  border: 2px solid var(--gold); opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.22,1,0.36,1);
}
.scan-frame__brackets i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; transform: translate(10px,10px); }
.scan-frame__brackets i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; transform: translate(-10px,10px); }
.scan-frame__brackets i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; transform: translate(10px,-10px); }
.scan-frame__brackets i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; transform: translate(-10px,-10px); }
.scan-frame__brackets.on i { opacity: 1; transform: none; }

/* scanline texture that rides with the beam */
.scan-lines {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,245,215,0.16) 0px, rgba(255,245,215,0.16) 1px,
    transparent 1px, transparent 4px);
  transition: opacity 0.6s;
}
.scan-lines.on { opacity: 1; }

/* live telemetry strip under the portrait */
.telemetry {
  display: flex; gap: 0; margin-top: 18px; width: min(420px, 40vw);
  justify-self: end; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: rgba(255,255,255,0.6); backdrop-filter: blur(6px);
}
.telemetry div {
  flex: 1; padding: 10px 8px; text-align: center;
  border-right: 1px solid var(--line);
}
.telemetry div:last-child { border-right: 0; }
.telemetry b {
  display: block; font-family: var(--font-body); font-size: 0.86rem;
  font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums;
}
.telemetry span {
  display: block; font-size: 0.54rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-dim); margin-top: 2px;
}

/* status line above the narration */
.scan-status {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 0.6rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 16px;
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,0.7); font-variant-numeric: tabular-nums;
}
.scan-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold-bright); box-shadow: 0 0 0 3px rgba(201,169,97,0.25);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

@media (max-width: 900px) {
  .telemetry { width: min(300px, 64vw); justify-self: center; }
  .scan-stage::before { background-size: 34px 34px; }
}

/* keep the telemetry strip tucked under the portrait in the left column */
.scan-frame { grid-column: 1; grid-row: 1; }
.telemetry  { grid-column: 1; grid-row: 2; margin-top: 16px; }
.scan-copy  { grid-column: 2; grid-row: 1 / span 2; }
@media (max-width: 900px) {
  .scan-frame, .telemetry, .scan-copy { grid-column: 1; grid-row: auto; }
}
