/* Nav, hero, and the animated recreation of the Studio window.

   The animation runs on a 12s loop. The base (un-animated) styles below are
   the FINAL frame — every value replaced, save check passed — so anyone with
   reduced motion turned on, and any browser that drops the animation, sees the
   finished result rather than a half-redacted document. */

/* ---- Nav ---- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand:hover {
  color: var(--text);
}

.emblem {
  color: var(--text);
}

.nav nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.95rem;
}

.nav nav a:not(.btn) {
  color: var(--text-2);
  text-decoration: none;
}

.nav nav a:not(.btn):hover {
  color: var(--text);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
}

@media (max-width: 34rem) {
  .nav nav a:not(.btn) {
    display: none;
  }
}

/* ---- Hero ---- */

.hero {
  padding: 4.5rem 0 5rem;
  background:
    radial-gradient(60rem 30rem at 85% 10%, var(--accent-soft), transparent 70%),
    var(--bg);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 3.5rem;
  align-items: center;
}

@media (max-width: 60rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 3rem;
  }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0 1rem;
}

.btn-lg {
  padding: 0.95rem 1.5rem;
  font-size: 1.05rem;
}

/* Only one primary download shows. Without JS there is no data-os, so the
   generic button (which leads to the full list) is the one. */
.hero-dl[data-hero='mac'],
.hero-dl[data-hero='linux'] {
  display: none;
}

body[data-os='mac'] .hero-dl[data-hero='mac'],
body[data-os='linux'] .hero-dl[data-hero='linux'] {
  display: inline-flex;
}

body[data-os='mac'] .hero-dl[data-hero='any'],
body[data-os='linux'] .hero-dl[data-hero='any'] {
  display: none;
}

.hero-note {
  font-size: 0.92rem;
  color: var(--text-2);
}

/* ---- The app window ---- */

.app {
  --cycle: 12s;
  /* Start a second in, so the first thing a visitor sees is findings lit up
     rather than an empty sidebar. */
  --start: -1.2s;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.5;
}

.app-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 38px;
  padding: 0 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}

.lights {
  display: flex;
  gap: 6px;
}

.lights i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--border-strong);
}

.app-title {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-save {
  white-space: nowrap;
  font-size: 11.5px;
}

.app-body {
  display: grid;
  grid-template-columns: 31% minmax(0, 1fr) 22%;
  min-height: 320px;
}

/* Sidebar: findings list */

.app-side {
  border-right: 1px solid var(--border);
  padding: 10px 8px;
  min-width: 0;
}

.side-head {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  padding: 0 6px 6px;
}

.side-head span,
.side-row b {
  font-weight: 400;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.side-group {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  padding: 8px 6px 3px;
}

.side-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-row b {
  margin-left: auto;
  padding-left: 6px;
}

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--redacted);
}

/* Canvas: the document */

.app-canvas {
  background: var(--canvas);
  padding: 18px;
  min-width: 0;
}

.page {
  position: relative;
  overflow: hidden;
  background: #fff;
  color: #2a2a2e;
  border-radius: 3px;
  box-shadow: var(--shadow-page);
  padding: 20px 22px;
  height: 100%;
  font-size: 12px;
  line-height: 1.85;
}

.page p {
  margin: 0 0 10px;
}

.page-title {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.01em;
}

.line {
  display: block;
  height: 7px;
  margin: 11px 0;
  border-radius: 4px;
  background: #ececea;
}

.line.short {
  width: 60%;
}

.scan {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, rgba(52, 81, 209, 0.14), transparent);
  opacity: 0;
  pointer-events: none;
}

/* A finding: the original collapses as its replacement grows, so the line
   reflows the way it does in the redacted copy. */
.f {
  border-radius: 3px;
}

.f .o,
.f .t {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
}

.f .o {
  max-width: 0;
}

.f .t {
  max-width: 14em;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.6;
  padding: 0 5px;
  margin: 2px 0;
  border-radius: 3px;
  background: #1b1b1f;
  color: #fff;
}

/* Inspector */

.app-insp {
  border-left: 1px solid var(--border);
  padding: 10px 10px;
  min-width: 0;
  color: var(--text-2);
}

.insp-label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.progress {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
  margin-bottom: 14px;
}

.progress i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--redacted);
}

.insp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
}

.app kbd {
  font-size: 10px;
  white-space: nowrap;
}

/* Toast */

.app-toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: grid;
  background: var(--token-bg);
  color: var(--token-fg);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: var(--shadow-pop);
}

.app-toast > * {
  grid-area: 1 / 1;
}

.toast-wait {
  opacity: 0;
}

.toast-ok b {
  color: var(--redacted);
}

/* Narrow windows drop the side panels. Never with display: none — that
   cancels their animations, and showing them again restarts them out of step
   with the document. Taken out of flow and hidden, they keep the one clock. */
@media (max-width: 40rem) {
  .app-insp {
    position: absolute;
    visibility: hidden;
  }

  .app-body {
    grid-template-columns: 38% minmax(0, 1fr);
    min-height: 280px;
  }

  .app-canvas {
    padding: 10px;
  }

  .page {
    padding: 14px;
  }

  .app-save {
    display: none;
  }
}

@media (max-width: 26rem) {
  .app-side {
    position: absolute;
    visibility: hidden;
  }

  .app-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- The loop ----
   0–8%    scan; findings light up amber, rows appear
   24–50%  each finding flips to its replacement, its row turns green
   56–64%  "re-reading the copy"
   64–92%  save check passed
   92–100% reset */

@media (prefers-reduced-motion: no-preference) {
  .scan {
    animation: scan var(--cycle) var(--start) infinite;
  }

  .toast-wait {
    animation: toast-wait var(--cycle) var(--start) infinite;
  }

  .toast-ok {
    animation: toast-ok var(--cycle) var(--start) infinite;
  }

  .app-toast {
    animation: toast var(--cycle) var(--start) infinite;
  }

  .progress i {
    animation: progress var(--cycle) var(--start) infinite;
  }

  .f1 { animation: hl1 var(--cycle) var(--start) infinite; }
  .f2 { animation: hl2 var(--cycle) var(--start) infinite; }
  .f3 { animation: hl3 var(--cycle) var(--start) infinite; }
  .f4 { animation: hl4 var(--cycle) var(--start) infinite; }
  .f1 .o { animation: o1 var(--cycle) var(--start) infinite; }
  .f2 .o { animation: o2 var(--cycle) var(--start) infinite; }
  .f3 .o { animation: o3 var(--cycle) var(--start) infinite; }
  .f4 .o { animation: o4 var(--cycle) var(--start) infinite; }
  .f1 .t { animation: t1 var(--cycle) var(--start) infinite; }
  .f2 .t { animation: t2 var(--cycle) var(--start) infinite; }
  .f3 .t { animation: t3 var(--cycle) var(--start) infinite; }
  .f4 .t { animation: t4 var(--cycle) var(--start) infinite; }
  .r1 { animation: row1 var(--cycle) var(--start) infinite; }
  .r2 { animation: row2 var(--cycle) var(--start) infinite; }
  .r3 { animation: row3 var(--cycle) var(--start) infinite; }
  .r4 { animation: row4 var(--cycle) var(--start) infinite; }
  .r1 .dot { animation: dot1 var(--cycle) var(--start) infinite; }
  .r2 .dot { animation: dot2 var(--cycle) var(--start) infinite; }
  .r3 .dot { animation: dot3 var(--cycle) var(--start) infinite; }
  .r4 .dot { animation: dot4 var(--cycle) var(--start) infinite; }
}

@keyframes scan {
  0% { top: -40px; opacity: 1; }
  8% { top: 100%; opacity: 1; }
  9%, 100% { opacity: 0; }
}

@keyframes toast {
  0%, 54% { opacity: 0; transform: translate(-50%, 10px); }
  57%, 92% { opacity: 1; transform: translate(-50%, 0); }
  96%, 100% { opacity: 0; transform: translate(-50%, 10px); }
}

@keyframes toast-wait {
  0%, 63% { opacity: 1; }
  65%, 100% { opacity: 0; }
}

@keyframes toast-ok {
  0%, 63% { opacity: 0; }
  65%, 100% { opacity: 1; }
}

@keyframes progress {
  0%, 22% { width: 0; }
  26% { width: 25%; }
  34% { width: 50%; }
  42% { width: 75%; }
  50%, 92% { width: 100%; }
  97%, 100% { width: 0; }
}

/* Per finding: amber from 8%, flip at F (24/32/40/48%), hold, reset at 92%. */
@keyframes hl1 { 0%, 7% { box-shadow: none; } 9%, 24% { background: var(--pending-soft); box-shadow: inset 0 -2px var(--pending); } 26%, 100% { background: transparent; box-shadow: none; } }
@keyframes hl2 { 0%, 7% { box-shadow: none; } 9%, 32% { background: var(--pending-soft); box-shadow: inset 0 -2px var(--pending); } 34%, 100% { background: transparent; box-shadow: none; } }
@keyframes hl3 { 0%, 7% { box-shadow: none; } 9%, 40% { background: var(--pending-soft); box-shadow: inset 0 -2px var(--pending); } 42%, 100% { background: transparent; box-shadow: none; } }
@keyframes hl4 { 0%, 7% { box-shadow: none; } 9%, 48% { background: var(--pending-soft); box-shadow: inset 0 -2px var(--pending); } 50%, 100% { background: transparent; box-shadow: none; } }

@keyframes o1 { 0%, 24% { max-width: 20em; } 27%, 92% { max-width: 0; } 96%, 100% { max-width: 20em; } }
@keyframes o2 { 0%, 32% { max-width: 20em; } 35%, 92% { max-width: 0; } 96%, 100% { max-width: 20em; } }
@keyframes o3 { 0%, 40% { max-width: 20em; } 43%, 92% { max-width: 0; } 96%, 100% { max-width: 20em; } }
@keyframes o4 { 0%, 48% { max-width: 20em; } 51%, 92% { max-width: 0; } 96%, 100% { max-width: 20em; } }

@keyframes t1 { 0%, 24% { max-width: 0; padding: 0; opacity: 0; } 27%, 92% { max-width: 14em; padding: 0 5px; opacity: 1; } 96%, 100% { max-width: 0; padding: 0; opacity: 0; } }
@keyframes t2 { 0%, 32% { max-width: 0; padding: 0; opacity: 0; } 35%, 92% { max-width: 14em; padding: 0 5px; opacity: 1; } 96%, 100% { max-width: 0; padding: 0; opacity: 0; } }
@keyframes t3 { 0%, 40% { max-width: 0; padding: 0; opacity: 0; } 43%, 92% { max-width: 14em; padding: 0 5px; opacity: 1; } 96%, 100% { max-width: 0; padding: 0; opacity: 0; } }
@keyframes t4 { 0%, 48% { max-width: 0; padding: 0; opacity: 0; } 51%, 92% { max-width: 14em; padding: 0 5px; opacity: 1; } 96%, 100% { max-width: 0; padding: 0; opacity: 0; } }

/* Rows appear during the scan and are "selected" just before their flip. */
@keyframes row1 { 0%, 6% { opacity: 0; } 9% { opacity: 1; } 18%, 25% { opacity: 1; background: var(--accent-soft); } 27%, 92% { opacity: 1; background: transparent; } 97%, 100% { opacity: 0; } }
@keyframes row2 { 0%, 7% { opacity: 0; } 10% { opacity: 1; } 27%, 33% { opacity: 1; background: var(--accent-soft); } 35%, 92% { opacity: 1; background: transparent; } 97%, 100% { opacity: 0; } }
@keyframes row3 { 0%, 8% { opacity: 0; } 11% { opacity: 1; } 35%, 41% { opacity: 1; background: var(--accent-soft); } 43%, 92% { opacity: 1; background: transparent; } 97%, 100% { opacity: 0; } }
@keyframes row4 { 0%, 9% { opacity: 0; } 12% { opacity: 1; } 43%, 49% { opacity: 1; background: var(--accent-soft); } 51%, 92% { opacity: 1; background: transparent; } 97%, 100% { opacity: 0; } }

@keyframes dot1 { 0%, 24% { background: var(--pending); } 26%, 100% { background: var(--redacted); } }
@keyframes dot2 { 0%, 32% { background: var(--pending); } 34%, 100% { background: var(--redacted); } }
@keyframes dot3 { 0%, 40% { background: var(--pending); } 42%, 100% { background: var(--redacted); } }
@keyframes dot4 { 0%, 48% { background: var(--pending); } 50%, 100% { background: var(--redacted); } }
