/*
 * Sherlock Ai — "optic scanner" web system.
 * Extends the app's design language (app/lib/core/theme/app_theme.dart):
 * near-black indigo canvas, condensed-uppercase display over mono body,
 * and instrument cyan spent only on the beam and the primary action.
 */

/* ---------- fonts (self-hosted; no third-party CDN, see PRIVACY §6) ---------- */
@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/BarlowCondensed-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/BarlowCondensed-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/BarlowCondensed-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("../fonts/SpaceMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("../fonts/SpaceMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --void: #07080d;
  --canvas: #0a0b12;
  --panel: #10121d;
  --panel-hi: #171a28;
  --line: #2a2f45;
  --line-soft: #1b1f30;

  --beam: #00d8ff;
  --beam-ink: #04161a;
  --beam-dim: rgba(0, 216, 255, 0.14);

  --text: #e9ecf6;
  --muted: #99a2be;
  --faint: #6a7290;

  /* score tiers — mirrors AppTheme.tierColor */
  --tier-certain: #ff5d5d;
  --tier-strong: #5c8dff;
  --tier-possible: #ffc94d;

  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(1.25rem, 5vw, 4rem);
  --measure: 68ch;
  --radius: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Coordinate grid + grain: atmosphere, never noise you can read through. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(
    ellipse 120% 80% at 50% 0%,
    #000 0%,
    transparent 72%
  );
  opacity: 0.5;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

main,
header,
footer {
  position: relative;
  z-index: 2;
}

/* ---------- type ---------- */
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 0.95;
  letter-spacing: 0.01em;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.9rem, 9vw, 5.6rem);
}
h2 {
  font-size: clamp(1.9rem, 4.6vw, 2.9rem);
}
h3 {
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  font-weight: 600;
  letter-spacing: 0.03em;
}

p {
  margin: 0 0 1.15em;
  max-width: var(--measure);
}

a {
  color: var(--beam);
  text-decoration-color: rgba(0, 216, 255, 0.35);
  text-underline-offset: 3px;
  transition:
    text-decoration-color 0.2s ease,
    color 0.2s ease;
}
a:hover {
  text-decoration-color: var(--beam);
}

strong {
  color: #fff;
  font-weight: 700;
}

/* Instrument readout label — the recurring voice of the system. */
.kicker {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.1rem;
}
.kicker::after {
  content: "";
  height: 1px;
  flex: 1;
  max-width: 120px;
  background: linear-gradient(90deg, var(--line), transparent);
}
.kicker--beam {
  color: var(--beam);
}

.shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ---------- skip link ---------- */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--beam);
  color: var(--beam-ink);
  padding: 0.75rem 1.25rem;
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  z-index: 100;
}
.skip:focus {
  left: 0;
}

:focus-visible {
  outline: 2px solid var(--beam);
  outline-offset: 3px;
}

/* ---------- header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(10, 11, 18, 0.82);
  border-bottom: 1px solid var(--line-soft);
}
.site-head__in {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 66px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}
.brand svg {
  width: 26px;
  height: 26px;
  flex: none;
}

.nav {
  display: flex;
  gap: 1.4rem;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--beam);
}
@media (max-width: 640px) {
  .nav {
    gap: 0.95rem;
    font-size: 10px;
    letter-spacing: 0.1em;
  }
  .brand span {
    display: none;
  }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 56px;
  padding: 0 1.9rem;
  border-radius: var(--radius);
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}
.btn--beam {
  background: var(--beam);
  color: var(--beam-ink);
  box-shadow: 0 0 0 0 rgba(0, 216, 255, 0.4);
}
.btn--beam:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 34px -12px rgba(0, 216, 255, 0.7);
}
.btn--ghost {
  border-color: var(--line);
  color: var(--text);
  background: transparent;
}
.btn--ghost:hover {
  border-color: var(--beam);
  color: var(--beam);
}

/* ---------- hero ---------- */
.hero {
  padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem);
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
@media (max-width: 900px) {
  .hero__grid {
    grid-template-columns: 1fr;
  }
}

.hero h1 {
  margin-bottom: 1.4rem;
}
.hero h1 em {
  font-style: normal;
  color: var(--beam);
}
.hero__lede {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 46ch;
  margin-bottom: 2rem;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-bottom: 1.6rem;
}
.hero__note {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--faint);
  max-width: 42ch;
}

/* The reticle: a single hero artefact, animated once. */
.reticle {
  position: relative;
  aspect-ratio: 1;
  max-width: 380px;
  margin-inline: auto;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: radial-gradient(circle at 50% 45%, #151a2b 0%, var(--void) 78%);
  overflow: hidden;
}
.reticle svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.reticle__beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--beam), transparent);
  box-shadow: 0 0 22px 3px rgba(0, 216, 255, 0.55);
  animation: sweep 4.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
.reticle__glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 45%,
    var(--beam-dim) 50%,
    transparent 55%
  );
  animation: sweep 4.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
@keyframes sweep {
  0%,
  100% {
    top: 8%;
  }
  50% {
    top: 88%;
  }
}
.reticle__hud {
  position: absolute;
  bottom: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--faint);
  text-transform: uppercase;
}

/* ---------- sections ---------- */
.section {
  padding: clamp(3rem, 7vw, 5.5rem) 0;
  border-top: 1px solid var(--line-soft);
}
.section__head {
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.section__head p {
  color: var(--muted);
  margin-top: 1rem;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  counter-reset: step;
}
.step {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 1.75rem 1.5rem;
  position: relative;
  overflow: hidden;
}
.step::before {
  counter-increment: step;
  content: "0" counter(step);
  font-family: var(--display);
  font-size: 3.4rem;
  font-weight: 700;
  color: var(--line);
  position: absolute;
  top: -0.35rem;
  right: 0.9rem;
  line-height: 1;
}
.step h3 {
  margin-bottom: 0.7rem;
  max-width: 16ch;
}
.step p {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0;
}

/* score tiers */
.tiers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.tier {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 10px;
  background: var(--panel);
  padding: 1.1rem 1.2rem;
}
.tier b {
  font-family: var(--display);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  display: block;
  line-height: 1;
  margin-bottom: 0.4rem;
}
.tier span {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.tier--certain {
  border-left-color: var(--tier-certain);
}
.tier--certain b {
  color: var(--tier-certain);
}
.tier--strong {
  border-left-color: var(--tier-strong);
}
.tier--strong b {
  color: var(--tier-strong);
}
.tier--possible {
  border-left-color: var(--tier-possible);
}
.tier--possible b {
  color: var(--tier-possible);
}

/* privacy promises */
.promises {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.promise {
  padding: 1.4rem 0 0;
  border-top: 2px solid var(--beam);
}
.promise h3 {
  font-size: 1.05rem;
  margin-bottom: 0.55rem;
}
.promise p {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0;
}

/* lawful-use callout */
.callout {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  padding: clamp(1.5rem, 3vw, 2.25rem);
}
.callout h3 {
  color: var(--tier-possible);
  margin-bottom: 0.8rem;
}
.callout p:last-child {
  margin-bottom: 0;
}

/* ---------- legal document layout ---------- */
.doc {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(3rem, 7vw, 5rem);
}
.doc__head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 2rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.doc__head h1 {
  font-size: clamp(2.4rem, 7vw, 4rem);
  margin-bottom: 1rem;
}
.doc__meta {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.doc__body {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 880px) {
  .doc__body {
    grid-template-columns: 1fr;
  }
  .toc {
    position: static !important;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    background: var(--panel);
  }
}
.toc {
  position: sticky;
  top: 90px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
  counter-reset: toc;
}
.toc a {
  color: var(--muted);
  text-decoration: none;
  display: flex;
  gap: 0.6rem;
}
.toc a::before {
  counter-increment: toc;
  content: counter(toc, decimal-leading-zero);
  color: var(--faint);
}
.toc a:hover {
  color: var(--beam);
}

.doc section {
  margin-bottom: 2.75rem;
  scroll-margin-top: 90px;
}
.doc section h2 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line-soft);
}
.doc h3 {
  font-size: 1rem;
  margin: 1.75rem 0 0.6rem;
  color: var(--beam);
  letter-spacing: 0.08em;
}
.doc p,
.doc li {
  color: var(--muted);
}
.doc ul {
  padding-left: 1.1rem;
  margin: 0 0 1.15em;
  max-width: var(--measure);
}
.doc li {
  margin-bottom: 0.55em;
}
.doc li::marker {
  color: var(--beam);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: 13px;
}
.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.table-wrap table {
  margin: 0;
  min-width: 520px;
}
th,
td {
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
th {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  color: var(--text);
  background: var(--panel);
}
td {
  color: var(--muted);
}
tr:last-child td {
  border-bottom: none;
}

/* ---------- FAQ ---------- */
.faq {
  display: grid;
  gap: 0.75rem;
  max-width: var(--measure);
}
details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
details[open] {
  border-color: var(--beam-dim);
}
summary {
  cursor: pointer;
  padding: 1.1rem 1.3rem;
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
summary::-webkit-details-marker {
  display: none;
}
summary::after {
  content: "+";
  color: var(--beam);
  font-size: 1.5rem;
  line-height: 1;
  flex: none;
}
details[open] summary::after {
  content: "–";
}
details > div {
  padding: 0 1.3rem 1.3rem;
  color: var(--muted);
  font-size: 13.5px;
}
details > div p:last-child {
  margin-bottom: 0;
}

/* ---------- contact card ---------- */
.contact {
  border: 1px solid var(--beam-dim);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(0, 216, 255, 0.06), transparent);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  max-width: var(--measure);
}
.contact a[href^="mailto"] {
  font-family: var(--display);
  font-size: clamp(1.3rem, 3.5vw, 1.9rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  word-break: break-word;
}

pre {
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--muted);
  white-space: pre-wrap;
  max-width: var(--measure);
}

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding: clamp(2.5rem, 5vw, 3.5rem) 0 2.5rem;
  background: var(--void);
}
.site-foot__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2.5rem;
}
.site-foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}
.site-foot nav a {
  color: var(--muted);
  text-decoration: none;
}
.site-foot nav a:hover {
  color: var(--beam);
}
.site-foot__legal {
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.04em;
  max-width: 62ch;
}
.site-foot__legal p {
  margin-bottom: 0.6em;
  max-width: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reticle__beam,
  .reticle__glow {
    top: 48%;
  }
}
