/* PatchAlert website. The same "Mission control" tokens as app/lib/theme.dart.
   Fonts are bundled (fonts/); nothing is fetched from another site. Motion is
   off when the visitor asks for reduced motion. */

@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  --background: #080b0f;
  --surface: #0e1318;
  --surface-raised: #141b22;
  --line: #1e2731;
  --line-strong: #2e3b47;
  --text: #e8eef3;
  --text-muted: #a3afba;
  --text-faint: #8593a0;
  --accent: #00e5ff;
  --on-accent: #00161a;
  --danger: #ff5468;
  --warning: #ffb020;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --gutter: 20px;
  --max: 1120px;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  background: var(--background);
  color: var(--text);
  font-family: var(--sans);
  font-size: 100%;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

img {
  max-width: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}
a:hover {
  color: var(--text);
}

/* Visible focus for keyboard users everywhere. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--gutter);
  top: 12px;
  z-index: 20;
  background: var(--surface-raised);
  color: var(--text);
  padding: 12px 16px;
  border: 1px solid var(--accent);
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Header ---------- */

header.site {
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 15, 0.86);
}
/* Sticky only where the header fits on one line. */
@media (min-width: 760px) {
  header.site {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
  }
}
header.site .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 24px;
  min-height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  min-height: 48px;
}
.brand svg {
  flex: none;
}
nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
header.site nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
}
header.site nav a:hover {
  color: var(--text);
}
header.site nav a[aria-current="page"] {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ---------- Type ---------- */

main {
  display: block;
}
h1,
h2,
h3 {
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
}
h1 {
  font-size: clamp(2.1rem, 1.3rem + 3.2vw, 3.5rem);
  margin: 0 0 20px;
  max-width: 18ch;
}
h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem);
  margin: 0 0 16px;
}
h3 {
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  margin: 0 0 12px;
}
p,
li {
  max-width: 70ch;
}
.lead {
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
  color: var(--text-muted);
  max-width: 52ch;
}
.eyebrow,
.label {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 16px;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 2px;
  margin-right: 10px;
  vertical-align: middle;
  background: var(--accent);
}
.mono {
  font-family: var(--mono);
}
.note {
  color: var(--text-faint);
  font-size: 0.9rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}
.button:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--on-accent);
}
.button.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}
.button.ghost:hover {
  border-color: var(--text);
  color: var(--text);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 28px;
}

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

.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 64px;
  border-bottom: 1px solid var(--line);
}

/* Hero background slot: a faint grid and an accent glow behind the ring,
   drawn here. No background image is used (decided against; the candidate is
   in docs/design/hero-candidates/, and README.md, Website, says how to add
   one). */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 50% 60% at 78% 45%, rgba(0, 229, 255, 0.1), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
  background-position: center, -1px -1px, -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 85% 90% at 60% 40%, #000 30%, transparent 85%);
  mask-image: radial-gradient(ellipse 85% 90% at 60% 40%, #000 30%, transparent 85%);
  opacity: 0.7;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 48px;
  align-items: center;
}
.hero-brand {
  margin: 0 0 28px;
}
.hero-brand img {
  display: block;
  height: 44px;
  width: auto;
}
@media (max-width: 600px) {
  .hero-brand img {
    height: 34px;
  }
}
.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 12px;
}

/* ---------- Status ring (SVG) ---------- */

.ring-figure {
  margin: 0;
  justify-self: center;
  width: min(100%, 420px);
}
.ring {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
/* The same ring as the app's Status screen (StatusRing in
   app/lib/screens/status_screen.dart): tick marks, the ring line, and one dot
   in the state color that orbits with a short fading trail (no open alerts:
   steady, 8 s; open alerts: a little faster, 6 s) or rests and pulses
   (review, 3 s). Nothing moves behind the text. */
.ring .ticks {
  fill: none;
  stroke-width: 1;
  stroke-opacity: 0.55;
}
.ring .arc {
  fill: none;
  stroke-width: 2;
}
.ring .trail path {
  fill: none;
}
.ring .dot-group {
  transform-origin: 160px 160px;
}
.ring .halo {
  fill: none;
  stroke-width: 1.5;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
.ring text {
  text-anchor: middle;
  font-family: var(--mono);
  font-weight: 600;
}
.ring .big {
  font-size: 64px;
}
.ring .small {
  font-size: 13px;
  letter-spacing: 0.14em;
  fill: var(--text-muted);
}
.ring .tiny {
  font-size: 10.5px;
  letter-spacing: 0.1em;
}
.ring .words {
  font-size: 19px;
  letter-spacing: 0.12em;
  fill: var(--accent);
}
.state-open { color: var(--danger); }
.state-review { color: var(--warning); }
.state-clear { color: var(--accent); }
.ring .state .ticks,
.ring .state .arc,
.ring .state .trail path,
.ring .state .halo {
  stroke: currentColor;
}
.ring .state .dot,
.ring .state .big,
.ring .state .tiny {
  fill: currentColor;
}
/* Still version (reduced motion, or after the animation): open alerts, with
   the dot at rest and no trail. */
.state-review,
.state-clear {
  opacity: 0;
}
.ring .trail {
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  /* Each state shows for 4 s; two cycles (24 s), then it stops on open
     alerts with the dot back at rest. */
  .ring .state {
    animation-duration: 12s;
    animation-iteration-count: 2;
    animation-timing-function: linear;
    animation-fill-mode: both;
  }
  .ring .state-open {
    animation-name: state-open;
  }
  .ring .state-review {
    animation-name: state-review;
  }
  .ring .state-clear {
    animation-name: state-clear;
  }
  .ring .trail {
    opacity: 1;
    animation: trail-off 24s step-end 1 both;
  }
  .ring .orbit-fast {
    animation: orbit 6s linear 4;
  }
  .ring .orbit {
    animation: orbit 8s linear 3;
  }
  .ring .pulse .halo {
    animation: halo 3s ease-out 8;
  }
  .ring .pulse .dot {
    animation: swell 3s ease-in-out 8;
    transform-box: fill-box;
    transform-origin: center;
  }
}
.ring-figure.paused .ring,
.ring-figure.paused .ring * {
  animation-play-state: paused;
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}
@keyframes halo {
  0% { opacity: 0.6; transform: scale(1.2); }
  100% { opacity: 0; transform: scale(2.6); }
}
@keyframes swell {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
/* The trail is only there while the dot moves. */
@keyframes trail-off {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes state-open {
  0%, 30% { opacity: 1; }
  33.4%, 96.6% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes state-review {
  0%, 30% { opacity: 0; }
  33.4%, 63.3% { opacity: 1; }
  66.7%, 100% { opacity: 0; }
}
@keyframes state-clear {
  0%, 63.3% { opacity: 0; }
  66.7%, 96.6% { opacity: 1; }
  100% { opacity: 0; }
}

.ring-figure figcaption {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}
.ring-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 10px auto 0;
}
.ring-legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
}
.ring-legend .glyph {
  font-weight: 600;
}
.ring-legend .open .glyph {
  color: var(--danger);
}
.ring-legend .review .glyph {
  color: var(--warning);
}
.ring-legend .clear .glyph {
  color: var(--accent);
}
.ring-toggle {
  margin-top: 12px;
  min-height: 44px;
  padding: 0 16px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.ring-toggle:hover {
  color: var(--text);
  border-color: var(--text);
}
.ring-toggle[hidden] {
  display: none;
}

/* ---------- Catalog numbers ---------- */

.band {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 40px 0;
}
.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.stats > div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 4px;
  padding: 20px;
  background: var(--surface);
}
.stats dd {
  margin: 0;
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem);
  line-height: 1.1;
  color: var(--text);
}
.stats dt {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.feedline {
  margin: 16px 0 0;
  max-width: none;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.pulse-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
}
@media (prefers-reduced-motion: no-preference) {
  .pulse-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: pulse 2.4s var(--ease) 4;
    opacity: 0;
  }
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(3); opacity: 0; }
}

/* ---------- Sections ---------- */

.how,
.notify,
.not-do,
.closing {
  padding-top: 80px;
}
.screens {
  padding-top: 88px;
}
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: none;
}
.steps li::before {
  content: "0" counter(step);
  display: block;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

.notify {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
}
.notif-wrap {
  margin: 0;
  padding: 40px 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse 80% 70% at 50% 0%, rgba(0, 229, 255, 0.08), transparent 70%),
    var(--surface);
}
.notif {
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 16px 20px 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.notif-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.notif-icon {
  display: block;
  border-radius: 50%;
  background: var(--background);
  padding: 2px;
}
.notif-head span:first-of-type {
  color: var(--text);
}
.notif-title {
  margin: 10px 0 2px;
  font-weight: 600;
}
.notif-body {
  margin: 0;
  color: var(--text-muted);
}
.notif-wrap figcaption {
  margin-top: 16px;
  text-align: center;
}

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: 64px;
  align-items: center;
  padding-top: 64px;
  padding-bottom: 64px;
  border-bottom: 1px solid var(--line);
}
.feature:last-child {
  border-bottom: 0;
}
.feature.flip {
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
}
.feature.flip .feature-copy {
  order: 2;
}
.feature-copy p:not(.eyebrow) {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 46ch;
}
.feature .num {
  color: var(--accent);
}
.feature .num::before {
  display: none;
}

/* Simple phone frame: dark bezel, rounded screen. */
.phone {
  margin: 0;
  justify-self: center;
  width: 100%;
  max-width: 320px;
  padding: 10px;
  border-radius: 40px;
  background: #000;
  border: 1px solid var(--line-strong);
  box-shadow:
    0 0 0 6px var(--surface),
    0 30px 60px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(0, 229, 255, 0.06);
}
.phone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 30px;
}

.not-do .panel {
  border-left: 3px solid var(--warning);
}
.not-do h2 {
  font-size: 1.4rem;
}

.closing {
  padding-bottom: 96px;
  text-align: center;
}
.closing h2,
.closing p {
  margin-left: auto;
  margin-right: auto;
}
.closing p:first-of-type {
  color: var(--text-muted);
}

/* Gentle reveal on scroll, only when site.js runs and motion is allowed. */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}
.js-reveal .reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- Text pages (Privacy, Terms, Accessibility, Support) ---------- */

.page-head {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  padding: 56px 0 40px;
}
.page-head::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  -webkit-mask-image: linear-gradient(90deg, transparent 20%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 20%, #000 100%);
  opacity: 0.5;
  pointer-events: none;
}
.page-head .wrap {
  position: relative;
}
.page-head h1 {
  margin-bottom: 8px;
}
.page-head .note {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.82rem;
}
.prose {
  padding-top: 40px;
  padding-bottom: 72px;
}
.prose > * {
  max-width: 72ch;
}
.prose h2 {
  font-size: 1.4rem;
  margin: 48px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.prose h3 {
  font-size: 1.1rem;
  margin: 28px 0 8px;
}
.prose li + li {
  margin-top: 6px;
}

.draft {
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text);
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
th {
  color: var(--text-muted);
  font-weight: 600;
}
caption,
caption.label {
  display: table-caption;
  caption-side: top;
  text-align: left;
  padding-bottom: 8px;
  margin: 0;
}
.prose .table-scroll {
  max-width: none;
}

/* ---------- Footer ---------- */

footer.site {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 40px 0 48px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1.4fr;
  gap: 32px;
}
footer.site p {
  margin: 8px 0;
}
footer.site nav ul {
  flex-direction: column;
  gap: 2px;
}
footer.site nav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--text-muted);
}
footer.site nav a:hover {
  color: var(--text);
}
footer.site .brand {
  font-size: 1rem;
  min-height: 40px;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  .hero-grid,
  .notify {
    grid-template-columns: minmax(0, 1fr);
  }
  .ring-figure {
    width: min(100%, 360px);
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stats > div:first-child {
    grid-column: 1 / -1;
  }
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }
  .feature,
  .feature.flip {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
  .feature.flip .feature-copy {
    order: 0;
  }
  .phone {
    max-width: 290px;
  }
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
}

@media (max-width: 600px) {
  .hero {
    padding: 44px 0 40px;
  }
  header.site nav a {
    padding: 0 6px;
  }
  .table-scroll {
    overflow-x: auto;
  }
  .how,
  .notify,
  .not-do,
  .closing {
    padding-top: 56px;
  }
  .feature {
    padding-top: 48px;
    padding-bottom: 48px;
  }
  .panel {
    padding: 20px;
  }
}
