/* re-vision — dark, quiet, Apple-adjacent.
   One accent colour, hairline borders, generous space, no ornament. */

:root {
  /* Palette lifted from thenoughtyfox.com: primary #ff5c00 with the site's
     neutral ramp, rendered dark. */
  --bg:            #0a0a0a;
  --surface:       #121212;
  --surface-2:     #1a1a1a;
  --surface-3:     #232323;
  --hairline:      rgba(255, 255, 255, 0.10);
  --hairline-soft: rgba(255, 255, 255, 0.06);

  --text:          #f6f6f6;
  --text-2:        rgba(246, 246, 246, 0.64);
  --text-3:        rgba(246, 246, 246, 0.40);

  --accent:        #ff5c00;   /* --primary / orange-600 */
  --accent-hi:     #ff760a;   /* orange-500 */
  --accent-lo:     #cc4102;   /* orange-700 */
  --accent-tint:   #ffbd6d;   /* orange-300 */
  --accent-soft:   rgba(255, 92, 0, 0.15);

  --green:         #30d158;
  --orange:        #ff9532;   /* orange-400, for medium severity */
  --red:           #ff5449;
  --purple:        #ffbd6d;
  --pin:           #ff5c00;   /* annotation tags use the brand orange */

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --font: "Clash Display", "Fivo Sans", Roboto, -apple-system,
          BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-body: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;

  --nav-h: 52px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; }

::selection { background: var(--accent-soft); }

/* ---------------------------------------------------------------- nav --- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 28px;
  padding: 0 28px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline-soft);
}

.brand {
  font-family: var(--font);
  font-size: 16px; font-weight: 600; letter-spacing: -0.015em;
  display: flex; align-items: center; gap: 9px;
}
.brand { cursor: pointer; }
.brand-sub { font-weight: 500; opacity: 0.66; }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(255, 92, 0, 0.75);
}

.nav-links { display: flex; gap: 4px; margin-left: 6px; }
.nav-link {
  font-size: 13px; font-weight: 450; color: var(--text-2);
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
  border: none; background: none; font-family: inherit;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--text); background: var(--surface-3); }

.nav-status {
  margin-left: auto; display: flex; align-items: center; gap: 14px;
  font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--surface);
}
.status-pill .led {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-3);
}
.status-pill.cuda .led { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-pill.cpu  .led { background: var(--orange); }

/* Whole-page drop target: drag a photo over the app at any point, including
   over one already being analysed. */
body.dropping::after {
  content: "Drop to analyse";
  position: fixed; inset: 10px; z-index: 200;
  display: grid; place-items: center;
  font-family: var(--font);
  font-size: 17px; font-weight: 500; letter-spacing: -0.01em;
  color: var(--accent);
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(6px);
  border: 2px dashed var(--accent);
  border-radius: var(--r-lg);
  pointer-events: none;
}

.canvas { cursor: pointer; }

/* --------------------------------------------------------------- shell --- */
.view { display: none; }
.view.active { display: block; animation: fade 0.35s var(--ease); }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px 96px; }

/* ---------------------------------------------------------------- hero --- */
.hero { padding: 88px 0 40px; text-align: center; }
.hero h1 {
  font-family: var(--font);
  font-size: clamp(34px, 5vw, 52px); font-weight: 600;
  letter-spacing: -0.033em; margin: 0 0 14px; line-height: 1.06;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent), var(--accent-tint));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p {
  font-size: 17px; color: var(--text-2); margin: 0 auto; max-width: 540px;
  line-height: 1.5; letter-spacing: -0.01em;
}

/* ---------------------------------------------------------------- drop --- */
.drop {
  margin: 40px auto 0; max-width: 640px;
  border: 1px dashed var(--hairline); border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface), rgba(13, 13, 15, 0.4));
  padding: 52px 32px; text-align: center; cursor: pointer;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease),
              transform 0.25s var(--ease);
}
.drop:hover { border-color: rgba(255, 255, 255, 0.2); transform: translateY(-2px); }
.drop.over {
  border-color: var(--accent); background: var(--accent-soft);
  transform: scale(1.012);
}
.drop-icon {
  width: 46px; height: 46px; margin: 0 auto 18px;
  border-radius: 14px; background: var(--surface-3);
  display: grid; place-items: center; color: var(--accent);
}
.drop h3 { margin: 0 0 6px; font-size: 17px; font-weight: 550; letter-spacing: -0.015em; }
.drop p  { margin: 0; font-size: 13px; color: var(--text-3); }

.samples {
  margin-top: 26px; display: flex; gap: 8px; justify-content: center;
  flex-wrap: wrap; font-size: 12px; color: var(--text-3);
}

/* -------------------------------------------------------------- result --- */
.result { display: none; padding-top: 30px; }
.result.on { display: grid; grid-template-columns: 420px 1fr; gap: 30px; align-items: start; }

@media (max-width: 940px) {
  .result.on { grid-template-columns: 1fr; }
  .stage { position: static !important; }
}

.stage { position: sticky; top: calc(var(--nav-h) + 24px); }

.canvas {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface); border: 1px solid var(--hairline);
  line-height: 0;
}
.canvas img { width: 100%; display: block; }

.box {
  position: absolute; border: 1.5px solid var(--accent); border-radius: 4px;
  pointer-events: none; opacity: 0; transition: opacity 0.4s var(--ease);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0);
}
.box.show { opacity: 1; }
.box.high   { border-color: var(--red); background: rgba(255, 69, 58, 0.1); }
.box.medium { border-color: var(--orange); background: rgba(255, 159, 10, 0.09); }
.box.low    { border-color: rgba(255, 255, 255, 0.45); }
.box span {
  position: absolute; top: -19px; left: -1.5px; white-space: nowrap;
  font-size: 10px; font-weight: 600; letter-spacing: 0.01em;
  padding: 2px 6px; border-radius: 5px 5px 5px 0;
  background: var(--red); color: #fff;
}
.box.medium span { background: var(--orange); color: #000; }
.box.feature span { background: var(--accent); color: #fff; }
.box.region span  { background: var(--purple); color: #fff; }
.box.low span { background: rgba(255,255,255,0.85); color: #000; }

.otabs {
  display: flex; gap: 4px; margin-top: 10px;
  padding: 3px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--hairline-soft);
}
.otab {
  flex: 1; padding: 6px 10px; border: none; border-radius: 7px;
  background: none; color: var(--text-2); cursor: pointer;
  font-family: inherit; font-size: 12px; letter-spacing: -0.005em;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.otab:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.otab.active { background: var(--surface-3); color: var(--text); }
.otab:disabled { opacity: 0.3; cursor: default; }
.otab .n {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.otab.active .n { color: var(--accent); }

.stage-meta {
  margin-top: 12px; display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.stage-meta .name {
  color: var(--text-2); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 200px;
}
.btn-ghost {
  margin-left: auto; font-family: inherit; font-size: 12px;
  color: var(--accent); background: none; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: 7px;
}
.btn-ghost:hover { background: var(--accent-soft); }
.btn-ghost { text-decoration: none; }
.cached-tag {
  font-size: 11px; color: var(--accent);
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft);
}
.cached-tag:empty { display: none; }
/* only the first one pushes right; the rest sit next to it */
.stage-meta .btn-ghost ~ .btn-ghost { margin-left: 0; }

.gcard .tags {
  display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px;
}
.gcard .tags span {
  font-size: 10px; color: var(--text-3); padding: 2px 6px;
  border-radius: 5px; background: var(--surface-2);
  border: 1px solid var(--hairline-soft);
}
.gcard .cond {
  float: right; font-size: 11px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- cards --- */
.cards { display: flex; flex-direction: column; gap: 14px; }

.card {
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  background: var(--surface); overflow: hidden;
  opacity: 0; transform: translateY(10px);
  animation: rise 0.45s var(--ease) forwards;
}
@keyframes rise { to { opacity: 1; transform: none; } }

.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--hairline-soft);
}
.card-head h2 {
  margin: 0; font-size: 14px; font-weight: 550; letter-spacing: -0.008em;
}
.card-head .ms {
  margin-left: auto; font-size: 11px; color: var(--text-3);
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.card-icon {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  display: grid; place-items: center; background: var(--surface-3);
  color: var(--accent);
}
.card-body { padding: 18px; }

.pending .card-body { min-height: 68px; }
.skeleton {
  height: 12px; border-radius: 6px; margin-bottom: 10px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear;
}
.skeleton:last-child { width: 55%; margin-bottom: 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ----------------------------------------------------------- primitives --- */
.headline {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px;
}
.headline .big {
  font-size: 26px; font-weight: 600; letter-spacing: -0.025em;
}
.headline .conf {
  font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.sub { font-size: 13px; color: var(--text-2); line-height: 1.5; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--surface-2);
  font-size: 12.5px; color: var(--text); letter-spacing: -0.005em;
}
.chip .pct {
  font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.chip.alt { background: none; color: var(--text-2); }

.group-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-3);
  margin: 16px 0 8px;
}
.group-label:first-child { margin-top: 0; }

/* ---------------------------------------------------------------- pins --- */
/* Dot, leader, chip. Position of the chip and the length/angle of the leader
   are set from JS (see layoutLabels) so the line always ends on the chip edge
   and two chips never sit on top of each other - neither is expressible in
   CSS alone. */
.pin {
  position: absolute; width: 0; height: 0;
  opacity: 0; transition: opacity 0.4s var(--ease);
  --tone: var(--pin);
}
.pin.show { opacity: 1; }
.pin.sev-high   { --tone: var(--red); }
.pin.sev-medium { --tone: var(--orange); }
.pin.sev-low    { --tone: #e2e2e7; }

.pin .dot {
  position: absolute; left: 0; top: 0;
  width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: var(--tone);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.95),
              0 1px 4px rgba(0, 0, 0, 0.45);
}

.pin .arm {
  position: absolute; left: 0; top: 0;
  height: 0; width: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.9);
  transform-origin: 0 50%;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.pin .plabel {
  position: absolute;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 11.5px; font-weight: 500; letter-spacing: -0.005em;
  color: #fff;
  padding: 4px 10px 4px 8px; border-radius: 999px;
  /* Transparent enough to read the photo through, dark enough to read the
     text on top of it - the blur is what keeps it legible over busy pixels. */
  background: rgba(18, 18, 20, 0.46);
  backdrop-filter: blur(14px) saturate(170%);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.pin .plabel::before {
  content: ""; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--tone); margin-right: 6px;
  vertical-align: 0.5px;
}

.pin.pulse .dot { animation: pinPulse 0.75s var(--ease); }
@keyframes pinPulse {
  0%, 100% { transform: scale(1); }
  45%      { transform: scale(1.7); }
}

/* Evidence outline under a compliance pin - present but quiet. */
.hint {
  position: absolute; border-radius: 5px; pointer-events: none;
  border: 1.5px solid var(--tone, #fff);
  opacity: 0; transition: opacity 0.4s var(--ease);
}
.hint.show { opacity: 0.8; }
.hint.sev-high   { border-color: var(--red); }
.hint.sev-medium { border-color: var(--orange); }
.hint.sev-low    { border-color: rgba(255, 255, 255, 0.7); }

/* meters */
.meter { margin-top: 14px; }
.meter-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 7px;
  font-size: 12px; color: var(--text-2);
}
.meter-row .lbl { width: 76px; flex: none; }
.meter-track {
  flex: 1; height: 5px; border-radius: 3px; background: var(--surface-3);
  overflow: hidden;
}
.meter-fill {
  height: 100%; border-radius: 3px; background: var(--accent);
  width: 0; transition: width 0.7s var(--ease);
}
.meter-row .val {
  width: 34px; text-align: right; font-variant-numeric: tabular-nums;
  color: var(--text-3); font-size: 11px;
}

.scorebar { display: flex; gap: 4px; margin: 14px 0 10px; }
.scorebar i {
  flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3);
  transition: background 0.5s var(--ease);
}
.scorebar i.on { background: var(--accent); }

/* verdict */
.verdict {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 550;
}
.verdict.pass   { background: rgba(48, 209, 88, 0.14); color: var(--green); }
.verdict.review { background: rgba(255, 159, 10, 0.14); color: var(--orange); }
.verdict.fail   { background: rgba(255, 69, 58, 0.14); color: var(--red); }

.findings { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.finding {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--hairline-soft);
  font-size: 13px; cursor: default;
  transition: background 0.2s var(--ease);
}
.finding:hover { background: var(--surface-3); }
.finding[data-overlay] { cursor: pointer; }
.finding .sev {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--text-3);
}
.finding.high .sev   { background: var(--red); }
.finding.medium .sev { background: var(--orange); }
.finding .what { font-weight: 500; }
.finding .detail {
  color: var(--text-3); font-size: 12px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.finding .score {
  margin-left: auto; font-size: 11px; color: var(--text-3);
  font-variant-numeric: tabular-nums; font-family: var(--mono);
}

/* caption */
.caption-text {
  font-size: 15px; line-height: 1.55; letter-spacing: -0.01em;
  color: var(--text);
}
.alt-box {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--hairline-soft);
  font-family: var(--mono); font-size: 12px; color: var(--text-2);
  line-height: 1.5; position: relative; word-break: break-word;
}
.alt-box .tag {
  display: block; font-family: var(--font); font-size: 10.5px;
  font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 6px;
}
.copy {
  position: absolute; top: 10px; right: 10px;
  font-size: 11px; color: var(--accent); background: none; border: none;
  cursor: pointer; font-family: var(--font); padding: 3px 7px; border-radius: 6px;
}
.copy:hover { background: var(--accent-soft); }

/* grids of images */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 9px; }
.tile {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-sm);
  overflow: hidden; background: var(--surface-2); cursor: pointer;
  border: 1px solid var(--hairline-soft);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.tile:hover { transform: translateY(-2px); border-color: var(--hairline); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .score {
  position: absolute; left: 6px; bottom: 6px;
  padding: 2px 6px; border-radius: 6px; font-size: 10.5px; font-weight: 600;
  background: rgba(0, 0, 0, 0.66); backdrop-filter: blur(8px);
  font-variant-numeric: tabular-nums;
}
.tile.dupe { border-color: var(--red); }
.tile.dupe .score { background: rgba(255, 69, 58, 0.9); color: #fff; }

.empty {
  font-size: 13px; color: var(--text-3); line-height: 1.5;
  padding: 4px 0;
}

/* search + library views */
.searchbar {
  display: flex; gap: 10px; margin: 34px 0 26px;
}
.searchbar input {
  flex: 1; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 13px 16px; color: var(--text);
  font-family: inherit; font-size: 14.5px; outline: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.searchbar input::placeholder { color: var(--text-3); }
.searchbar input:focus { border-color: var(--accent); background: var(--surface-2); }
.btn {
  padding: 13px 22px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-family: inherit;
  font-size: 14px; font-weight: 550; letter-spacing: -0.01em;
  transition: filter 0.2s var(--ease), transform 0.1s var(--ease);
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: default; }

.section-title {
  font-family: var(--font);
  font-size: 21px; font-weight: 600; letter-spacing: -0.02em;
  margin: 34px 0 6px;
}
.section-sub { font-size: 13.5px; color: var(--text-2); margin: 0 0 20px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.gcard {
  border-radius: var(--r-md); overflow: hidden; background: var(--surface);
  border: 1px solid var(--hairline-soft); cursor: pointer;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.gcard:hover { transform: translateY(-3px); border-color: var(--hairline); }
.gcard { position: relative; }
.gcard img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }

/* Always visible rather than hover-only: a control you cannot see is a
   control that does not exist, and hover does not exist on touch at all. */
.gdel {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 26px; height: 26px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 10, 10, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff; font-size: 13px; line-height: 1; font-family: inherit;
  opacity: 0.55;
  transition: opacity 0.2s var(--ease), background 0.2s var(--ease),
              transform 0.15s var(--ease);
}
.gcard:hover .gdel { opacity: 1; }
.gdel:hover {
  background: var(--red); border-color: transparent; transform: scale(1.08);
}
.gcard .meta { padding: 11px 13px; }
.gcard .rt { font-size: 13px; font-weight: 500; letter-spacing: -0.005em; }
.gcard .cap {
  font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: var(--surface-3); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 11px 18px; font-size: 13px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  z-index: 100;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
