/* patchyourshit.today: hazard tape, departure boards, zero webfonts (no third-party requests). */

:root {
  color-scheme: dark;
  --bg: #0e0f0c;
  --panel: #171914;
  --panel-2: #1f221b;
  --line: #2f3329;
  --text: #ece9dc;
  --muted: #a6a391;
  --hazard: #ffd21f;
  --hazard-ink: #141307;
  --ok: #3ddc84;
  --soon: #ffc21a;
  --urgent: #ff5a3c;
  --overdue: #ff2d55;
  --link: #8ec9ff;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Impact", "Haettenschweiler", "Arial Narrow Bold", "Franklin Gothic Heavy", var(--sans);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: #c4e2ff; }

:focus-visible { outline: 3px solid var(--hazard); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--hazard); color: var(--hazard-ink); padding: .5rem 1rem; z-index: 10; font-weight: 700;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

/* ---------- header ---------- */

.hazard-tape {
  height: 10px;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 14px, var(--hazard-ink) 14px 28px);
}

.site-header { border-bottom: 1px solid var(--line); background: #0b0c09; }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding-block: .75rem;
}

.logo {
  font: 900 1.35rem/1 var(--display);
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.logo b { color: var(--hazard); font-weight: inherit; }
.logo small { color: var(--muted); font: 600 .8rem var(--mono); text-transform: none; letter-spacing: 0; }

.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; margin: 0; padding: 0; }
.site-nav a {
  display: block; padding: .4rem .7rem; border-radius: 999px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.site-nav a:hover { background: var(--panel-2); }
.site-nav a[aria-current="page"] { background: var(--hazard); color: var(--hazard-ink); }

main { flex: 1; padding-block: 2rem 3rem; }

/* ---------- type ---------- */

h1, h2, h3 { line-height: 1.15; margin: 0 0 .6rem; }
h1 { font: 900 clamp(2rem, 6vw, 3.4rem)/1.05 var(--display); text-transform: uppercase; letter-spacing: .01em; }
h2 { font-size: 1.4rem; }
.lede { color: var(--muted); font-size: 1.1rem; max-width: 60ch; margin-top: 0; }
.mono { font-family: var(--mono); }

.notice {
  background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 1rem 1.25rem; color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 800 1rem var(--sans); letter-spacing: .02em;
  padding: .7rem 1.2rem; border-radius: 999px; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  text-decoration: none;
}
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn-hazard { background: var(--hazard); color: var(--hazard-ink); border-color: var(--hazard); }
.btn-hazard:hover { background: #ffe066; color: var(--hazard-ink); }

/* ---------- home hero ---------- */

.hero { text-align: center; padding-block: 1rem 2.5rem; }
.hero h1 { margin-bottom: 1.5rem; }

.big-button {
  width: min(320px, 78vw); aspect-ratio: 1; border-radius: 50%;
  border: 0; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #ff7a63, var(--urgent) 45%, #a3160a 100%);
  color: #fff; font: 900 clamp(1.8rem, 7vw, 2.6rem)/1 var(--display); text-transform: uppercase;
  box-shadow: 0 14px 0 #6b0d04, 0 22px 40px #0009, inset 0 -8px 20px #0005;
  transition: transform .08s ease, box-shadow .08s ease;
  outline-offset: 8px;
}
.big-button:active { transform: translateY(10px); box-shadow: 0 4px 0 #6b0d04, 0 10px 20px #0009, inset 0 -8px 20px #0005; }

.answer {
  min-height: 4.5rem; margin: 2rem auto 0; max-width: 34ch;
  font: 900 clamp(1.4rem, 4.5vw, 2.1rem)/1.2 var(--display); text-transform: uppercase; color: var(--hazard);
}
.answer.pop { animation: pop .35s ease; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }

.kev-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.kev-card {
  display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; align-items: start;
  background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--ok);
  border-radius: var(--radius); padding: 1rem 1.1rem;
}
.kev-card[data-level="soon"] { border-left-color: var(--soon); }
.kev-card[data-level="urgent"] { border-left-color: var(--urgent); }
.kev-card[data-level="overdue"] { border-left-color: var(--overdue); }
.kev-card h3 { font-size: 1.05rem; margin: 0; }
.kev-card .cve { font: 700 .95rem var(--mono); }
.kev-card p { margin: .25rem 0 0; color: var(--muted); font-size: .95rem; grid-column: 1 / -1; }
.kev-card .when { text-align: right; font: 700 .95rem var(--mono); white-space: nowrap; }

.cve-links { display: inline-flex; gap: .5rem; font: 600 .8rem var(--mono); }
.cve-links a { padding: .05rem .4rem; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; }
.cve-links a:hover { border-color: var(--link); }

.tag {
  display: inline-block; font: 700 .72rem var(--mono); text-transform: uppercase; letter-spacing: .05em;
  padding: .1rem .45rem; border-radius: 4px; background: #3a0c14; color: #ff8fa3; vertical-align: middle;
}

.grid-2 { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }

/* ---------- departure board ---------- */

.board-shell {
  background: #050605; border: 2px solid #22261d; border-radius: 14px;
  box-shadow: inset 0 0 0 6px #0c0e0a, 0 20px 50px #0008;
  padding: 1rem;
}

.board-title {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  font: 800 1rem var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--hazard);
  padding: .25rem .25rem 1rem; border-bottom: 1px solid #22261d; margin-bottom: 1rem;
}
.board-clock { font-size: 1.4rem; color: #fff; letter-spacing: .08em; }

.board-controls { display: grid; gap: .75rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); margin-bottom: 1rem; }
.board-controls label { min-width: 0; }
.board-controls label { display: grid; gap: .25rem; font: 700 .72rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

input[type="search"], select {
  width: 100%; font: 500 1rem var(--mono); color: var(--text);
  background: #111310; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem;
}
input[type="search"]:focus, select:focus { border-color: var(--hazard); }

.board-summary { font: 600 .9rem var(--mono); color: var(--muted); margin: 0 0 .75rem; }
.board-summary strong { color: var(--text); }

.board { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-family: var(--mono); }
.board th {
  text-align: left; font: 700 .72rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  padding: 0 .6rem .25rem;
}
.board th button {
  all: unset; cursor: pointer; display: inline-flex; gap: .3rem; align-items: center;
}
.board th button:focus-visible { outline: 2px solid var(--hazard); }
.board th[aria-sort="ascending"] button::after { content: "▲"; color: var(--hazard); }
.board th[aria-sort="descending"] button::after { content: "▼"; color: var(--hazard); }

.board td { background: #0f110d; padding: .55rem .6rem; vertical-align: top; border-block: 1px solid #1b1e17; }
.board td:first-child { border-left: 1px solid #1b1e17; border-radius: 6px 0 0 6px; }
.board td:last-child { border-right: 1px solid #1b1e17; border-radius: 0 6px 6px 0; }

.flap {
  display: inline-block; padding: .1rem .35rem; border-radius: 3px;
  background: linear-gradient(#1d201a 50%, #161813 50%); color: #f4f1e0;
  box-shadow: inset 0 -1px 0 #000;
  font-weight: 700; letter-spacing: .04em; white-space: nowrap;
}
.board .cve-cell .flap { color: var(--hazard); }
.board .what { font-family: var(--sans); color: var(--text); font-size: .95rem; }
.board .what small { display: block; color: var(--muted); font-size: .82rem; margin-top: .15rem; }
.board .date { white-space: nowrap; color: var(--muted); font-size: .88rem; }

.countdown { font: 800 1rem var(--mono); white-space: nowrap; letter-spacing: .03em; }
.countdown[data-level="ok"] { color: var(--ok); }
.countdown[data-level="soon"] { color: var(--soon); }
.countdown[data-level="urgent"] { color: var(--urgent); }
.countdown[data-level="overdue"] {
  color: #fff; background: var(--overdue); padding: .1rem .45rem; border-radius: 4px;
  animation: overdue-flash 1.1s steps(2, jump-none) infinite;
}
@keyframes overdue-flash { 50% { background: transparent; color: var(--overdue); } }

.legend { display: flex; gap: 1rem; flex-wrap: wrap; font: 600 .8rem var(--mono); color: var(--muted); margin: .75rem 0 0; padding: 0; list-style: none; }
.legend span { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }

.more-row { text-align: center; margin-top: 1rem; }

/* ---------- excuses ---------- */

.excuse-card { display: grid; gap: 1rem; margin-top: 1.5rem; }
.bubble {
  border-radius: 18px; padding: 1.25rem 1.4rem; font-size: 1.15rem; position: relative;
}
.bubble .who { display: block; font: 700 .75rem var(--mono); text-transform: uppercase; letter-spacing: .12em; margin-bottom: .4rem; }
.bubble-excuse { background: var(--panel-2); border: 1px solid var(--line); }
.bubble-excuse .who { color: var(--muted); }
.bubble-excuse q { font: 900 clamp(1.4rem, 4vw, 2rem)/1.15 var(--display); text-transform: uppercase; quotes: "“" "”"; }
.bubble-rebuttal { background: #1d1a05; border: 1px solid #5c4e0a; }
.bubble-rebuttal .who { color: var(--hazard); }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.copied { font: 600 .85rem var(--mono); color: var(--ok); }

/* ---------- roundup ---------- */

.tip-box {
  background: var(--hazard); color: var(--hazard-ink); border-radius: var(--radius);
  padding: 1.25rem 1.4rem; margin-bottom: 2rem;
}
.tip-box h2 { font: 900 1rem var(--mono); text-transform: uppercase; letter-spacing: .14em; margin-bottom: .4rem; }
.tip-box p { margin: 0; font-size: 1.2rem; font-weight: 700; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip {
  font: 700 .85rem var(--sans); padding: .35rem .8rem; border-radius: 999px; cursor: pointer;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.feed li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.feed .src { font: 700 .72rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.feed .cat { padding: .05rem .4rem; border-radius: 4px; background: var(--panel-2); }
.feed .cat-kev { background: #3a0c14; color: #ff8fa3; }
.feed .cat-advisory { background: #2c2405; color: var(--hazard); }
.feed a.title { display: block; font-weight: 700; font-size: 1.02rem; margin: .25rem 0; color: var(--text); text-decoration: none; }
.feed a.title:hover { color: var(--hazard); text-decoration: underline; }
.feed p { margin: 0; color: var(--muted); font-size: .92rem; }
.sources { font: 500 .8rem var(--mono); color: var(--muted); margin-top: 1rem; }

/* ---------- stack ---------- */

.stack-groups { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.stack-groups fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin: 0; padding: .75rem 1rem 1rem; }
.stack-groups legend { font: 700 .75rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--hazard); padding: 0 .4rem; }
.check { display: flex; gap: .55rem; align-items: flex-start; padding: .3rem 0; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--hazard); margin-top: .18rem; flex: none; }
.check .count { margin-left: auto; font: 600 .78rem var(--mono); color: var(--muted); }

.stack-results { margin-top: 2rem; }
.stack-tally { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tally { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; min-width: 9rem; }
.tally b { display: block; font: 900 1.8rem var(--display); }
.tally[data-level="overdue"] b { color: var(--overdue); }
.tally[data-level="urgent"] b { color: var(--urgent); }
.tally[data-level="soon"] b { color: var(--soon); }
.tally[data-level="ok"] b { color: var(--ok); }
.tally span { font: 600 .78rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .board-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .board-shell { padding: .75rem; }
  .board-controls select, .board-controls input { font-size: .9rem; padding-inline: .5rem; }
  .board td { overflow-wrap: anywhere; }
  .board-controls label:first-child { grid-column: 1 / -1; }

  /* The board collapses to stacked cards on phones. */
  .board thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .board, .board tbody, .board tr, .board td { display: block; width: 100%; }
  .board tr { background: #0f110d; border: 1px solid #1b1e17; border-radius: 8px; padding: .6rem .7rem; margin-bottom: .5rem; }
  .board td, .board td:first-child, .board td:last-child { border: 0; background: none; padding: .15rem 0; border-radius: 0; }
  .board td[data-label]::before {
    content: attr(data-label); display: inline-block; min-width: 5.5rem;
    font: 700 .68rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
  }
  .kev-card { grid-template-columns: 1fr; }
  .kev-card .when { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .countdown[data-level="overdue"] { text-decoration: underline wavy; }
}

/* ---------- faq ---------- */

.faq-hero { display: flex; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.faq-hero h1 { margin: 0; font-size: clamp(3rem, 12vw, 6rem); line-height: .9; }
.faq-hero .lede { margin: .7rem 0 .35rem; }
.sticker {
  display: inline-block; transform: rotate(-4deg);
  background: var(--hazard); color: var(--hazard-ink);
  font: 900 .85rem var(--mono); text-transform: uppercase; letter-spacing: .1em;
  padding: .35rem .7rem; border-radius: 4px; box-shadow: 3px 3px 0 #000;
}

.faq { display: grid; gap: .75rem; max-width: 860px; counter-reset: faq; }
.faq details {
  counter-increment: faq;
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s ease, transform .15s ease;
}
.faq details:hover { border-color: #4a4f40; }
.faq details::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 0;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 8px, var(--hazard-ink) 8px 16px);
  transition: width .15s ease;
}
.faq details[open] { border-color: #5c4e0a; background: linear-gradient(180deg, #1c1a0c, var(--panel) 120px); }
.faq details[open]::before { width: 8px; }

.faq summary {
  cursor: pointer; list-style: none; padding: 1.05rem 1.25rem 1.05rem 1.4rem;
  font-weight: 800; font-size: 1.1rem; line-height: 1.3;
  display: flex; gap: .9rem; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "Q" counter(faq, decimal-leading-zero);
  flex: none; font: 800 .75rem var(--mono); letter-spacing: .06em;
  color: var(--hazard); border: 1px solid #5c4e0a; background: #1d1a05;
  padding: .2rem .45rem; border-radius: 4px;
}
.faq summary::after {
  content: "+"; margin-left: auto; flex: none;
  width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center;
  font: 900 1.2rem/1 var(--mono); color: var(--hazard-ink); background: var(--hazard);
  transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--hazard); }

.faq .answer-body { padding: 0 1.4rem 1.2rem 1.4rem; margin-left: 3.1rem; color: var(--text); font-size: 1.02rem; }
.faq details[open] .answer-body { animation: faq-open .22s ease; }
@keyframes faq-open { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.faq .answer-body p, .faq .answer-body ul { margin: 0 0 .75rem; }
.faq .answer-body > :last-child { margin-bottom: 0; }
.faq .answer-body strong { color: var(--hazard); }
.faq .answer-body em { color: #fff; font-style: italic; }
.faq .answer-body ul { list-style: none; padding: 0; display: grid; gap: .45rem; }
.faq .answer-body li { position: relative; padding-left: 1.6rem; margin: 0; }
.faq .answer-body li::before {
  content: "▸"; position: absolute; left: .2rem; top: 0; color: var(--urgent); font-weight: 900;
}

.faq .bro {
  display: inline-block; margin: .25rem 0 .5rem; transform: rotate(-2deg);
  font: 900 clamp(1.8rem, 6vw, 2.8rem)/1.05 var(--display); text-transform: uppercase;
  color: var(--urgent); border: 4px solid var(--urgent); border-radius: 8px; padding: .35rem .8rem;
  box-shadow: inset 0 0 0 2px #0e0f0c, 0 0 0 1px #ff5a3c55;
  letter-spacing: .01em;
}

.faq-cta { margin-top: 2rem; display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }

@media (max-width: 760px) {
  .faq .answer-body { margin-left: 0; }
  .faq summary { font-size: 1rem; }
}

/* ---------- cache stamp ---------- */

.stamp { font: 500 .8rem var(--mono); color: var(--muted); margin: 1rem 0 0; }
.stamp:empty { display: none; }

/* ---------- rss ---------- */

.site-nav a.nav-rss::before {
  content: ""; display: inline-block; width: .8em; height: .8em; margin-right: .35em; vertical-align: -.05em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Ccircle cx='1' cy='7' r='1'/%3E%3Cpath d='M0 3a5 5 0 0 1 5 5H3.6A3.6 3.6 0 0 0 0 4.4zM0 0a8 8 0 0 1 8 8H6.6A6.6 6.6 0 0 0 0 1.4z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Ccircle cx='1' cy='7' r='1'/%3E%3Cpath d='M0 3a5 5 0 0 1 5 5H3.6A3.6 3.6 0 0 0 0 4.4zM0 0a8 8 0 0 1 8 8H6.6A6.6 6.6 0 0 0 0 1.4z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.site-nav a.nav-rss:not([aria-current]) { color: var(--hazard); }

.rss-page { max-width: 860px; }
.feed-url { margin: 1.5rem 0 2rem; border-color: #5c4e0a; }
.feed-url label { display: block; font: 700 .75rem var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--hazard); margin-bottom: .5rem; }
.feed-url-row { display: flex; gap: .6rem; }
.feed-url-row input {
  flex: 1; min-width: 0; font: 600 1rem var(--mono); color: var(--text);
  background: #111310; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem;
}
.feed-url .copied { margin: .5rem 0 0; min-height: 1.2em; }
.rss-section { margin-bottom: 2rem; }
.rss-section ul { padding-left: 1.2rem; }
.rss-section li { margin-bottom: .35rem; }
.howto { display: grid; grid-template-columns: max-content 1fr; gap: .75rem 1.25rem; margin: 0; }
.howto dt { font-weight: 800; color: var(--hazard); }
.howto dd { margin: 0; }
code { font: .9em var(--mono); background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: .05rem .35rem; overflow-wrap: anywhere; }
.rss-callout { border-color: #5c4e0a; }

@media (max-width: 760px) {
  .howto { grid-template-columns: 1fr; gap: .2rem; }
  .feed-url-row input { font-size: .8rem; padding-inline: .5rem; }
  .howto dd { margin-bottom: .8rem; }
}
