/* ============================================================================
   SECURITY & PRIVACY PAGE — extends the shared landing.css component system.
   Only page-specific helpers live here; sections, type, buttons, splits,
   checklist, the lp-kv spec rows, FAQ and CTA are all reused from landing.css
   and feature-grid.css so the page stays consistent with the homepage, the
   how-it-works page and the dashboard in every theme.

   Token references only — light and dark resolve automatically. Strictly
   monochrome: hairlines and surfaces carry the depth, one ink accent marks
   state. The page-specific motion (the outbound-fetch guard drawing itself)
   keys off the `.in-view` class landing.js already sets on `[data-motion]`
   ancestors, uses transform/opacity only, is gated behind
   `@media (scripting: enabled)` so it renders finished without JS, and is
   fully disabled under `prefers-reduced-motion`.
   ========================================================================= */

/* ── Hero — the shared centered hero, with more air above the tag ───────── */
.sec-hero {
  padding-top: clamp(56px, 8vw, 104px);
}

/* ── Trust band — one bordered strip divided by hairlines, not four cards ──
   Values are set in mono with tabular figures so the row reads as data. */
.sec-band {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: clip;
}

.sec-band__item {
  padding: clamp(20px, 2.6vw, 28px);
  border-block-start: 1px solid var(--color-border-soft);
}

.sec-band__item:first-child {
  border-block-start: 0;
}

.sec-band__val {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
  font-feature-settings: "tnum";
  color: var(--color-text);
}

.sec-band__label {
  display: block;
  margin-top: var(--space-2);
  max-width: 30ch;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--color-text-soft);
}

@media (min-width: 640px) {
  .sec-band {
    grid-template-columns: repeat(2, 1fr);
  }

  .sec-band__item:nth-child(-n + 2) {
    border-block-start: 0;
  }

  .sec-band__item:nth-child(2n) {
    border-inline-start: 1px solid var(--color-border-soft);
  }
}

@media (min-width: 1040px) {
  .sec-band {
    grid-template-columns: repeat(4, 1fr);
  }

  .sec-band__item {
    border-block-start: 0;
  }

  .sec-band__item + .sec-band__item {
    border-inline-start: 1px solid var(--color-border-soft);
  }
}

/* ── Visual panel — a token-built surface that frames a mini-visual ──────── */
.sec-panel {
  padding: clamp(22px, 3vw, 30px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.sec-panel__label {
  display: block;
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.sec-panel__label + .lp-kv,
.sec-panel__label + .sec-flow {
  margin-top: 0;
}

.sec-panel > .lp-kv:first-child,
.sec-panel > .sec-defs:first-child {
  margin-top: 0;
}

.sec-panel__note {
  margin: var(--space-6) 0 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border-soft);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text-soft);
}

/* Prose link — monochrome, underlined, with an explicit focus ring. */
.sec-link {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-border-strong);
  text-underline-offset: 3px;
  border-radius: var(--radius-sm);
  transition: text-decoration-color var(--duration-fast) var(--ease-out);
}

.sec-link:hover {
  text-decoration-color: var(--color-text);
}

.sec-link:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* ── Control groups — definition lists with mono terms ────────────────────
   Deliberately not a symmetric card grid: the two longest groups span the
   full width and set their own two-track definition list, so the section
   reads as a spec sheet rather than a row of feature tiles. */
.sec-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

.sec-group {
  padding: clamp(22px, 2.8vw, 30px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.sec-group__label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-3);
}

.sec-defs {
  margin: var(--space-5) 0 0;
  display: grid;
  gap: var(--space-4);
}

.sec-defs > div {
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-soft);
}

.sec-defs > div:first-child {
  padding-top: 0;
  border-top: 0;
}

.sec-defs dt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.5;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.sec-defs dd {
  margin: var(--space-2) 0 0;
  max-width: 62ch;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text-soft);
}

/* Literal header / directive values quoted inline. Scoped to this page's
   surfaces — security.css is only loaded by templates/security.html. */
.sec-defs code,
.faq-item__content code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

@media (min-width: 980px) {
  .sec-groups {
    grid-template-columns: repeat(2, 1fr);
  }

  .sec-group--wide {
    grid-column: 1 / -1;
  }

  .sec-group--wide .sec-defs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(24px, 3vw, 48px);
  }

  /* Two tracks means the first ROW is two items, not one — both lose the
     divider so the top edge of the list stays flush. */
  .sec-group--wide .sec-defs > div:nth-child(-n + 2) {
    padding-top: 0;
    border-top: 0;
  }
}

/* ── Outbound-fetch guard — an ordered chain that draws itself ────────────
   Order is meaningful (each step gates the next), so it is marked up as an
   <ol>. A static hairline spine is always present; an ink fill grows down it
   and the step markers settle in once the panel is revealed. */
.sec-flow {
  position: relative;
  margin: var(--space-6) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-5);
}

.sec-flow::before,
.sec-flow::after {
  content: "";
  position: absolute;
  inset-inline-start: 7px;
  top: var(--space-2);
  bottom: var(--space-2);
  width: 2px;
  border-radius: 999px;
}

.sec-flow::before {
  background: var(--color-border);
}

/* The fill: fully drawn by default so the diagram is complete without JS. */
.sec-flow::after {
  background: var(--color-accent);
  transform-origin: top center;
  transform: scaleY(1);
  transition: transform 0.9s var(--ease-out);
}

.sec-flow__step {
  position: relative;
  padding-inline-start: 34px;
}

.sec-flow__step::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid var(--color-border-strong);
  background: var(--color-bg);
  transition:
    transform var(--duration-slow) var(--ease-spring),
    opacity var(--duration-slow) var(--ease-out);
}

/* The final step is the only one that results in a request going out. */
.sec-flow__step:last-child::before {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.sec-flow__label {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.sec-flow__note {
  display: block;
  margin-top: var(--space-1);
  max-width: 46ch;
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--color-text-soft);
}

/* Start states — only when scripting can drive the reveal. Without JS this
   block is inert and the whole diagram renders in its finished state. */
@media (scripting: enabled) {
  .sec-flow::after {
    transform: scaleY(0);
  }

  .sec-flow__step::before {
    opacity: 0;
    transform: scale(0.6);
  }
}

/* End states — keyed off the `.in-view` class landing.js sets on the
   `[data-motion]` panel that wraps the diagram. Universal visible baseline. */
[data-motion].in-view .sec-flow::after {
  transform: scaleY(1);
}

[data-motion].in-view .sec-flow__step::before {
  opacity: 1;
  transform: scale(1);
}

[data-motion].in-view .sec-flow__step:nth-child(1)::before { transition-delay: 0.08s; }
[data-motion].in-view .sec-flow__step:nth-child(2)::before { transition-delay: 0.22s; }
[data-motion].in-view .sec-flow__step:nth-child(3)::before { transition-delay: 0.36s; }
[data-motion].in-view .sec-flow__step:nth-child(4)::before { transition-delay: 0.5s; }
[data-motion].in-view .sec-flow__step:nth-child(5)::before { transition-delay: 0.64s; }

/* ── Section composition ────────────────────────────────────────────────── */
.sec-groups + .lp-split {
  margin-top: var(--lp-block-gap);
}

/* Flip the panel to the left on the SSRF row (desktop only) so the controls
   section alternates instead of repeating the same column order. */
@media (min-width: 980px) {
  .sec-split--reverse .sec-panel {
    order: -1;
  }
}

/* ── Reduced motion ─────────────────────────────────────────────────────
   Resolve the diagram to its finished state with no transition. Mirrors the
   global guard in landing.css for the shared motion variants. */
@media (prefers-reduced-motion: reduce) {
  .sec-flow::after,
  [data-motion].in-view .sec-flow::after {
    transform: scaleY(1);
    transition: none;
  }

  .sec-flow__step::before,
  [data-motion].in-view .sec-flow__step::before {
    opacity: 1;
    transform: none;
    transition: none;
    transition-delay: 0s;
  }

  .sec-link {
    transition: none;
  }
}
