/* The Patch Gap: page-specific components. Loads after styles.css.
   One signal color on this page: red marks leaks and exploitation, blue marks defense, green marks a release or a zero. */
:root { --neon-cyan: #5FD3F3; --neon-magenta: #E25BD0; --amber: #A86400; --red: #BE3640; --red-50: #FBEDEE; --green: #0B7F73; --green-50: #E8F5F3; }

/* hero */
.hero h1 .pg-red { color: var(--red); }

/* shared bits copied from parity.css so this page doesn't depend on it */
.pull { font-weight: 800; color: var(--navy); font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.2rem); letter-spacing: -0.03em; line-height: 1.15; margin: 2.6rem 0 1rem; max-width: 40rem; }
.pull-sm { font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem); }
.closing { padding-block: clamp(3.5rem, 8vw, 6rem); }
.closing-line { margin: 0; color: #fff; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; font-size: clamp(1.7rem, 1.2rem + 2.2vw, 3rem); max-width: 52rem; }
.closing-line span { color: var(--neon-cyan); }
.closing-line .pg-soft-red { color: #F5A7AD; }
.caveat-list { margin: 0; padding-left: 1.2rem; max-width: 46rem; }
.caveat-list li { margin-bottom: 0.5rem; }

/* section kicker above a section head */
.pg-kicker { font: 500 0.75rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.16em; color: var(--blue); margin: 0 0 1rem; display: flex; align-items: center; gap: 0.6rem; }
.pg-kicker::before { content: ""; width: 8px; height: 8px; background: var(--blue); }
.pg-kicker.is-red { color: var(--red); } .pg-kicker.is-red::before { background: var(--red); }

/* failure mode line */
.pg-failure { border-left: 3px solid var(--red); padding: 0.35rem 0 0.35rem 1rem; margin: 1.6rem 0 0; color: var(--navy); font-weight: 600; max-width: 44rem; }
.pg-failure b { font: 500 0.72rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--red); margin-right: 0.6rem; }

/* figure card */
.pg-fig { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; display: grid; gap: 1rem; min-width: 0; }
.pg-fig h3 { margin: 0; }
.pg-src { margin: 0; font: 500 0.68rem/1.5 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.pg-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
@media (max-width: 860px) { .pg-split { grid-template-columns: 1fr; } }
.pg-stack { display: grid; gap: 1.2rem; align-content: start; min-width: 0; }
.card.is-hot { border-color: var(--red); } .card.is-hot .card-num { color: var(--red); }

/* embargo fuse: 23-hour axis, drawn to scale */
.pg-fuse-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pg-fuse { position: relative; height: 150px; margin: 0.4rem 2.4rem; min-width: 560px; }
.pg-fuse .wire, .pg-fuse .burn { position: absolute; left: 0; top: 72px; height: 2px; }
.pg-fuse .wire { right: 0; background: var(--line); }
.pg-fuse .burn { width: 100%; background: linear-gradient(90deg, var(--amber), var(--red)); }
.pg-fuse .spark { position: absolute; top: 66px; left: 100%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 5px rgba(190,54,64,0.16), 0 0 16px 3px rgba(226,91,208,0.5); }
.pg-fuse.is-live .burn { animation: pg-burn 8s linear infinite; }
.pg-fuse.is-live .spark { animation: pg-spark 8s linear infinite; }
@keyframes pg-burn { 0% { width: 0; } 88%, 100% { width: 100%; } }
@keyframes pg-spark { 0% { left: 0; } 88%, 100% { left: 100%; } }
.pg-fuse .pt { position: absolute; top: 67px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--red); }
.pg-fuse .pt.b { background: var(--blue); } .pg-fuse .pt.g { background: var(--green); }
.pg-fuse .lbl { position: absolute; width: 96px; margin-left: -48px; text-align: center; font: 500 0.68rem/1.35 var(--mono); color: var(--muted); }
.pg-fuse .lbl b { display: block; color: var(--navy); font-size: 0.75rem; }
.pg-fuse .up { top: 4px; } .pg-fuse .dn { top: 92px; }
.pg-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0; padding: 0; list-style: none; font: 500 0.68rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.pg-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 0.4rem; vertical-align: -1px; }

/* attempts, log scale */
.pg-att { display: grid; gap: 0.6rem; }
.pg-att-row, .pg-att-axis { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 0.8rem; align-items: center; }
.pg-att-row .t { font: 500 0.75rem/1 var(--mono); color: var(--muted); }
.pg-bar { height: 22px; background: var(--tint); border-radius: 3px; position: relative; overflow: hidden; }
.pg-bar i { position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--red); transform-origin: left; }
.pg-bar em { position: absolute; left: 0.5rem; top: 0; font: 600 0.75rem/22px var(--sans); font-style: normal; color: #fff; }
.pg-att-axis div { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 0.25rem; font: 500 0.68rem/1 var(--mono); color: var(--muted); }
.pg-zero { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; display: flex; align-items: center; gap: 1.2rem; }
.pg-zero strong { font: 800 3.4rem/1 var(--sans); color: var(--green); letter-spacing: -0.04em; }
.pg-zero span { color: var(--navy); font-weight: 600; font-size: 0.95rem; line-height: 1.4; }

/* the number 4 */
.pg-key { background: var(--navy); color: #CFE3F7; border-radius: var(--radius); padding: 1.2rem; font: 500 0.88rem/1.6 var(--mono); word-break: break-all; min-height: 8.5rem; margin: 0; }
.pg-key .k { color: var(--neon-cyan); }
.pg-key .hit { color: #fff; background: var(--red); padding: 0 3px; border-radius: 2px; }
.pg-chain { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
@media (max-width: 640px) { .pg-chain { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pg-chain li { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 0.8rem; display: grid; gap: 0.2rem; font-size: 0.85rem; line-height: 1.35; color: var(--muted); }
.pg-chain b { font: 800 1.5rem/1.1 var(--sans); color: var(--navy); letter-spacing: -0.03em; }
.pg-chain .pg-src { font-size: 0.6rem; }
.pg-race { display: grid; gap: 0.5rem; }
.pg-race-row { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) 7rem; gap: 0.7rem; align-items: center; font-size: 0.9rem; color: var(--navy); }
.pg-race-row .tr { height: 8px; background: var(--tint); border-radius: 4px; position: relative; overflow: hidden; }
.pg-race-row .tr i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); border-radius: 4px; background: var(--blue); transform-origin: left; }
.pg-race-row .tr i.rng { background: repeating-linear-gradient(90deg, var(--blue) 0 5px, transparent 5px 9px); }
.pg-race-row .v { font: 500 0.72rem/1 var(--mono); color: var(--muted); }

/* how long each flaw sat in shipped code */
.pg-lat { display: grid; gap: 0.75rem; }
.pg-lat-row, .pg-lat-axis { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 0.8rem; align-items: center; }
.pg-lat-row > span { font-weight: 700; color: var(--navy); font-size: 0.9rem; }
.pg-lat-row > span.is-red { color: var(--red); }
.pg-lat-track { position: relative; height: 16px; }
.pg-lat-track i { position: absolute; top: 4px; height: 8px; border-radius: 4px; background: var(--amber); left: var(--a); width: var(--w); transform-origin: left; }
.pg-lat-track i::after { content: ""; position: absolute; right: -5px; top: -3px; width: 14px; height: 14px; border-radius: 50%; background: var(--red); }
.pg-lat-track.now i { background: var(--red); width: 5px; }
.pg-lat-track b { position: absolute; top: 1px; left: var(--m); width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; border: 2px solid var(--amber); background: #fff; z-index: 1; }
.pg-lat-axis div { position: relative; height: 1.2rem; border-top: 1px solid var(--line); }
.pg-lat-axis em { position: absolute; top: 0.25rem; transform: translateX(-50%); font: 500 0.68rem/1 var(--mono); font-style: normal; color: var(--muted); }
@media (max-width: 560px) { .pg-lat-row, .pg-lat-axis { grid-template-columns: 6.8rem minmax(0, 1fr); } .pg-lat-row > span { font-size: 0.78rem; } }

/* bars draw once when they scroll into view; at rest they are complete */
.is-armed .pg-bar i, .is-armed .pg-race-row .tr i, .is-armed .pg-lat-track i { transform: scaleX(0); }
.is-played .pg-bar i, .is-played .pg-race-row .tr i, .is-played .pg-lat-track i { transform: scaleX(1); transition: transform 1.1s cubic-bezier(.2,.7,.2,1); }
.is-played .pg-att-row:nth-child(2) i, .is-played .pg-race-row:nth-child(3) i, .is-played .pg-lat-row:nth-child(2) i { transition-delay: 150ms; }
.is-played .pg-att-row:nth-child(3) i, .is-played .pg-race-row:nth-child(4) i, .is-played .pg-lat-row:nth-child(3) i { transition-delay: 300ms; }
.is-played .pg-att-row:nth-child(4) i, .is-played .pg-race-row:nth-child(5) i, .is-played .pg-lat-row:nth-child(4) i { transition-delay: 450ms; }
.is-played .pg-race-row:nth-child(6) i, .is-played .pg-lat-row:nth-child(5) i { transition-delay: 600ms; }

/* Brotli exposure paths */
.pg-paths svg { width: 100%; height: auto; display: block; }
.pg-paths text { font: 500 12px var(--sans); fill: var(--navy); }
.pg-paths .m { font: 500 9.5px var(--mono); fill: var(--muted); letter-spacing: 0.06em; }

/* report flood: one square per report */
.pg-flood { display: grid; grid-template-columns: repeat(23, minmax(0, 1fr)); gap: 4px; }
.pg-flood i { aspect-ratio: 1; max-width: 100%; border-radius: 2px; background: var(--line); }
.pg-flood i.v { background: var(--red); }
.pg-flood.is-playing i { animation: pg-pop 400ms ease both; animation-delay: calc(var(--n) * 22ms); }
@keyframes pg-pop { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: none; } }
@media (max-width: 520px) { .pg-flood { grid-template-columns: repeat(15, minmax(0, 1fr)); } }

/* agents */
.pg-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; position: relative; align-items: center; }
.pg-flow .node { position: relative; z-index: 1; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 0.8rem; text-align: center; font-size: 0.85rem; line-height: 1.35; color: var(--muted); display: grid; gap: 0.15rem; }
.pg-flow .node b { color: var(--navy); font-size: 1rem; }
.pg-flow .lane { position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; background: var(--line); }
.pg-flow .tok { position: absolute; top: calc(50% - 6px); left: 86%; width: 12px; height: 12px; border-radius: 3px; background: var(--amber); }
.pg-flow.is-live .tok { animation: pg-tok 5s ease-in-out infinite; }
@keyframes pg-tok { 0% { left: 12%; } 45% { left: 48%; } 90%, 100% { left: 86%; } }
.pg-bankview { margin: 0; border: 1px dashed var(--red); border-radius: var(--radius); background: var(--red-50); padding: 0.7rem 0.9rem; font: 500 0.75rem/1.5 var(--mono); color: var(--red); }

/* AI on every side */
.pg-triad .card { transition: border-color 300ms ease, box-shadow 300ms ease; }
.pg-triad.is-live .card { animation: pg-hl 7.5s infinite; animation-delay: var(--d); }
@keyframes pg-hl { 0%, 30% { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-50); } 34%, 100% { border-color: var(--line); box-shadow: none; } }

/* alarm vs calm */
.pg-vs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 760px) { .pg-vs { grid-template-columns: 1fr; } }
.pg-vs > div { border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.pg-vs .is-alarm { background: var(--red-50); border: 1px solid #EFC9CC; }
.pg-vs .is-calm { background: var(--green-50); border: 1px solid #BFE3DE; }
.pg-vs h3 { margin-bottom: 0.7rem; }
.pg-vs ul { margin: 0; padding-left: 1.1rem; }
.pg-vs li { margin-bottom: 0.45rem; font-size: 0.97rem; }

/* exposure check (same mechanics as the parity check) */
.pg-check-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.9fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .pg-check-grid { grid-template-columns: 1fr; } }
.pg-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.8rem 1rem; align-items: center; padding: 0.85rem 0; border-bottom: 1px solid var(--line-soft); }
.pg-row:last-child { border-bottom: 0; }
.pg-area { font-weight: 700; color: var(--navy); font-size: 0.95rem; }
.pg-area small { display: block; font-weight: 400; color: var(--muted); font-size: 0.84rem; line-height: 1.45; margin-top: 0.2rem; }
.pg-opts { display: flex; gap: 0.35rem; }
.pg-opt { display: block; cursor: pointer; }
.pg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pg-opt span { display: block; min-width: 4.4rem; text-align: center; padding: 0.5rem 0.55rem; border: 1px solid var(--line); border-radius: 4px; font: 600 0.8rem/1.2 var(--sans); color: var(--muted); transition: all 160ms ease; }
.pg-opt input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.pg-opt.yes input:checked + span { background: #E7F5F2; border-color: #8CCFC3; color: var(--green); }
.pg-opt.no input:checked + span, .pg-opt.unsure input:checked + span { background: #FDF1F1; border-color: #E9A5AA; color: var(--red); }
@media (max-width: 560px) { .pg-row { grid-template-columns: 1fr; } .pg-opts { width: 100%; } .pg-opt { flex: 1; } .pg-opt span { min-width: 0; } }
.pg-result { position: sticky; top: calc(var(--header-h) + 1rem); }
.card > p.pg-figure { font: 800 3rem/1 var(--sans); color: var(--navy); letter-spacing: -0.04em; margin: 0 0 0.8rem; }
.card > p.pg-figure small { font-size: 1rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.pg-meter { height: 10px; border-radius: 5px; background: var(--line-soft); overflow: hidden; margin-bottom: 1rem; }
.pg-meter i { display: block; height: 100%; width: 0; background: var(--red); border-radius: 5px; transition: width 500ms ease; }
.pg-verdict { font-weight: 700; color: var(--navy) !important; }
#pg-gaps ul { margin: 0.4rem 0 0; padding-left: 1.1rem; color: var(--text); font-size: 0.95rem; }
#pg-gaps li { margin-bottom: 0.3rem; }

/* sources grouped by case */
.pg-src-group { font: 500 0.75rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--blue); margin: 2.2rem 0 0.9rem; }
.pg-src-group:first-of-type { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  .pg-fuse.is-live .burn, .pg-fuse.is-live .spark, .pg-flow.is-live .tok, .pg-triad.is-live .card, .pg-flood.is-playing i { animation: none; }
  .is-armed .pg-bar i, .is-armed .pg-race-row .tr i, .is-armed .pg-lat-track i { transform: none; }
  .is-played .pg-bar i, .is-played .pg-race-row .tr i, .is-played .pg-lat-track i, .pg-meter i { transition: none; }
}
