/* CodeSalat — one stylesheet. Tokens, layout, components, prose. */

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('/fonts/OpenSans.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Unbounded.woff2') format('woff2');
}

:root {
  --bg: #111614;
  --surface: #181f1b;
  --surface-raised: #1d2721;
  --border: #303c34;
  --border-strong: #46584c;
  --text: #e6ece8;
  --muted: #a0afa4;
  --accent: #83ce89;
  --accent-bright: #b9edc0;
  --accent-tint: #83ce8914;
  --mono: ui-monospace, 'SFMono-Regular', 'Cascadia Mono', Consolas, 'Liberation Mono', monospace;
  --sans: 'Open Sans', ui-sans-serif, system-ui, sans-serif;
  --display: 'Unbounded', ui-sans-serif, sans-serif;
  --measure: 72ch;
  --list-measure: 58rem;
  --radius: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sev-none: #a0afa4;
  --sev-low: #93c5a5;
  --sev-medium: #e3c46a;
  --sev-high: #f0945a;
  --sev-critical: #f2707a;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
  scrollbar-color: var(--border-strong) transparent;
}

body {
  margin: 0;
  isolation: isolate;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
  caret-color: var(--accent);
  accent-color: var(--accent);
}

body::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 38rem;
  pointer-events: none;
  z-index: -1;
  background-image: radial-gradient(ellipse 70% 60% at 50% 0%, var(--accent-tint), transparent 70%);
}

::selection {
  background: #83ce893d;
  color: #fff;
}

a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1px;
  transition: color 150ms, border-color 150ms, background-color 150ms;
}
a:hover {
  color: var(--accent);
}
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3, h4 {
  margin: 0;
  text-wrap: balance;
}

code, kbd, samp {
  font-family: var(--mono);
}

/* --------------------------------------------------------------- layout */

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

.skip-link {
  position: fixed;
  top: -5rem;
  left: 1rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.85rem;
  border-radius: 4px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus,
.skip-link:hover {
  color: var(--bg);
}
.skip-link:focus {
  top: 1rem;
}

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

.brand {
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-mark {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.site-nav a {
  display: inline-block;
  padding-block: 0.35rem;
  white-space: nowrap;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.4em;
}
.site-nav a:hover {
  color: var(--accent-bright);
}
.site-nav a[aria-current] {
  color: var(--accent);
  text-decoration-color: currentColor;
}

#page-content {
  flex: 1;
}

/* ------------------------------------------------------------ home page */

.hero {
  padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 6vw, 4.5rem);
  max-width: 52rem;
}

.hero-title {
  font-family: var(--display);
  font-size: clamp(2.5rem, 6.8vw, 5rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.04em;
  margin-bottom: 1.75rem;
}
.hero-title::after {
  content: '_';
  color: var(--accent);
}

.hero-lede {
  color: var(--muted);
  font-size: clamp(1rem, 1.2vw + 0.8rem, 1.2rem);
  max-width: 42rem;
  margin: 0 0 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.2;
}
.button-primary {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.button-primary:hover {
  color: var(--bg);
  background: var(--accent-bright);
  border-color: var(--accent-bright);
}
.button-secondary {
  color: var(--text);
}
.button-secondary:hover {
  color: var(--accent-bright);
  background: var(--surface);
  border-color: var(--border-strong);
}
.button span[aria-hidden] {
  transition: transform 200ms var(--ease);
}
.button:hover span[aria-hidden] {
  transform: translateX(2px);
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 2.5rem;
}
.social-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding-block: 0.35rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}
.social-links a:hover {
  color: var(--accent-bright);
}
.social-links img {
  width: 17px;
  height: 17px;
  opacity: 0.7;
  transition: opacity 150ms;
}
.social-links a:hover img {
  opacity: 1;
}

/* ---------------------------------------------------------- list pages */

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.9rem;
}
.section-heading h2 {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-heading > a {
  display: inline-block;
  padding-block: 0.3rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}
.section-heading > a:hover {
  color: var(--accent);
}

.recent-writing {
  margin-bottom: 4.5rem;
}

.report-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding: 0;
  list-style: none;
}

.report-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.report-card:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-raised);
}
.report-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 0.9rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  margin-bottom: 0.6rem;
  font-variant-numeric: tabular-nums;
}
.report-meta time {
  letter-spacing: 0.02em;
}
.report-title {
  font-size: 1rem;
  line-height: 1.55;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.report-arrow {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 1.3rem;
  line-height: 1;
  transition: transform 200ms var(--ease);
}
.report-card:hover .report-arrow {
  transform: translate(2px, -2px);
}

.empty-state {
  margin: 1.5rem 0 0;
  padding: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.95rem;
}
.empty-state p {
  margin: 0 0 1.25rem;
}

/* --------------------------------------------------------- page shells */

.page {
  width: min(var(--measure), calc(100% - 3rem));
  max-width: none;
  margin-inline: auto;
  padding-block: clamp(2rem, 6vw, 3.5rem) 0;
}
.page--list {
  width: min(var(--list-measure), calc(100% - 3rem));
}
.page--list .page-title {
  margin-bottom: 1.5rem;
}

.page-head {
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: clamp(1.8rem, 3.2vw + 0.6rem, 2.5rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-weight: 600;
  margin-bottom: 0;
}
.page-subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0.9rem 0 0;
}

/* Facts block: severity, CVSS, affected versions, status. */
.facts {
  margin: 1.75rem 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.fact {
  display: grid;
  grid-template-columns: 9rem 1fr;
  align-items: baseline;
  gap: 0.25rem 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
.fact:last-child {
  border-bottom: 0;
}
.fact dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.fact dd {
  margin: 0;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.fact dd code {
  font-size: 0.8rem;
}

.severity-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0.05rem 0.5rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--sev-none);
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-variant-numeric: tabular-nums;
}
.severity-none { color: var(--sev-none); }
.severity-low { color: var(--sev-low); }
.severity-medium { color: var(--sev-medium); }
.severity-high { color: var(--sev-high); }
.severity-critical { color: var(--sev-critical); }

/* ------------------------------------------------------------- prose */

.prose {
  padding-block: 0.5rem 1rem;
}
.prose p,
.prose ul,
.prose ol,
.prose table,
.prose figure {
  margin-block: 0 1.25rem;
}
.prose h2,
.prose h3,
.prose h4,
.prose h1 {
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin-block: 2.5rem 0.9rem;
}
.prose h2,
.prose h1 {
  font-size: 1.45rem;
}
.prose h3 {
  font-size: 1.15rem;
}
.prose h4 {
  font-size: 1rem;
}
.prose > :first-child {
  margin-top: 0;
}
.prose ul,
.prose ol {
  padding-left: 1.35rem;
}
.prose ul {
  list-style: disc;
}
.prose ol {
  list-style: decimal;
}
.prose li {
  margin-block: 0.35rem;
}
.prose li::marker {
  color: var(--border-strong);
}
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: #83ce8955;
}
.prose a:hover {
  text-decoration-color: var(--accent);
}
.prose strong {
  font-weight: 600;
  color: #f2f7f3;
}
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.prose td,
.prose th {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.prose th {
  background: var(--surface);
  font-weight: 600;
}

pre {
  max-width: 100%;
  margin-block: 1.5rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: #0b100d !important;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.7;
  scrollbar-width: thin;
}
code {
  font-family: var(--mono);
  background: #83ce890d;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}
pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  overflow-wrap: normal;
}

blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}
.prose blockquote p:last-child {
  margin-bottom: 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin-block: 2rem;
}

.release-details {
  margin-block: 0.4rem 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.release-details summary {
  cursor: pointer;
  color: var(--accent);
}
.release-details > div {
  margin-top: 0.6rem;
}
.release-details p {
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Click-to-load video: the placeholder occupies the player's exact box. */
.video-embed {
  margin-block: 1.5rem;
}
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0b100d;
  overflow: hidden;
}
.video-frame iframe,
.video-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.video-frame iframe {
  border: 0;
}
.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: clamp(1rem, 4vw, 1.75rem);
  text-align: center;
  background:
    radial-gradient(ellipse 80% 120% at 50% 0%, var(--accent-tint), transparent 70%),
    linear-gradient(160deg, #16201a, #0b100d 70%);
  color: var(--text);
}
a.video-placeholder,
a.video-placeholder:hover,
a.video-placeholder:focus-visible {
  color: var(--text);
  text-decoration: none;
}
.video-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px #83ce8940;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms var(--ease);
}
.video-placeholder:hover::after,
.video-placeholder:focus-visible::after {
  opacity: 1;
}
.video-play {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  transition: transform 200ms var(--ease), background-color 150ms;
}
.video-play svg {
  width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.15rem;
  fill: currentColor;
}
.video-placeholder:hover .video-play,
.video-placeholder:focus-visible .video-play {
  background: var(--accent-bright);
  transform: scale(1.06);
}
.video-placeholder-title {
  max-width: 34ch;
  margin-top: 0.15rem;
  font-weight: 600;
  font-size: clamp(0.95rem, 1.6vw, 1.1rem);
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.video-caption {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
  text-align: center;
  text-wrap: pretty;
}
.video-caption-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  justify-content: center;
  margin-top: 0.4rem;
}
.video-caption a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: #83ce8955;
  white-space: nowrap;
}
.video-caption a:hover {
  text-decoration-color: var(--accent);
}

/* ----------------------------------------------------- page foot / next */

.page-meta {
  padding-block: 1.5rem 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}
.foot-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  font-variant-numeric: tabular-nums;
}
.foot-meta span[aria-hidden] {
  opacity: 0.4;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.9rem;
  padding: 0;
  list-style: none;
}
.tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}
.tag:hover {
  color: var(--accent);
  border-color: var(--border-strong);
}

.term-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.term-list li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.term-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.prevnext {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.prevnext a {
  display: grid;
  gap: 0.15rem;
  padding-block: 0.35rem;
}
.prevnext-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.prevnext-title {
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}
.prevnext a:hover .prevnext-title {
  color: var(--accent-bright);
}

/* ------------------------------------------------------- fediverse UI */

.fediverse-comments {
  margin-top: 2.5rem;
  font-size: 0.9rem;
}
.fediverse-comments h2 {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.fediverse-comments > p {
  margin-bottom: 1rem;
}
.fediverse-comments a {
  color: var(--accent);
}
.comment-list,
.comment-replies {
  list-style: none;
  margin: 0;
  padding: 0;
}
.comment-replies {
  margin-inline-start: 1.25rem;
  padding-inline-start: 1rem;
  border-inline-start: 1px solid var(--border);
}
.comment-replies-flat {
  margin-inline-start: 0;
  padding-inline-start: 0;
  border-inline-start: 0;
}
.fediverse-comment {
  display: flex;
  gap: 0.75rem;
  padding-block: 1.25rem;
  border-top: 1px solid var(--border);
}
.comment-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 6px;
}
.comment-body {
  min-width: 0;
}
.comment-author {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}
.comment-author time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}
.mastodon-comment-content p {
  margin-bottom: 0.75rem;
}
.mastodon-comment-content ul {
  list-style: disc;
  padding-left: 1.5rem;
}
.mastodon-comment-content ol {
  list-style: decimal;
  padding-left: 1.5rem;
}
.comment-emoji {
  display: inline;
  width: 1.2em;
  height: 1.2em;
  vertical-align: text-bottom;
}

/* ---------------------------------------------------------------- 404 */

.notfound {
  padding-block: clamp(4rem, 12vw, 8rem);
  max-width: 34rem;
}
.notfound h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.5rem, 7vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--accent);
  margin: 0 0 1.25rem;
}
.notfound-line {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.4;
  color: var(--text);
  max-width: 24ch;
  margin: 0 0 0.5rem;
}
.notfound p {
  color: var(--muted);
  margin: 0 0 2rem;
}

/* -------------------------------------------------------------- footer */

.footer {
  margin-top: auto;
  padding-block: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}
.footer-links a {
  display: inline-block;
  padding-block: 0.3rem;
}

/* ------------------------------------------------------------ motion */

@media (prefers-reduced-motion: no-preference) {
  .hero-title,
  .hero-lede,
  .hero-actions,
  .social-links {
    animation: rise 700ms var(--ease) both;
  }
  .hero-lede { animation-delay: 70ms; }
  .hero-actions { animation-delay: 140ms; }
  .social-links { animation-delay: 200ms; }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(0.6rem);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

@media (max-width: 640px) {
  .wrap,
  .page,
  .page--list {
    width: calc(100% - 2rem);
  }
  .site-header {
    padding-block: 1.1rem;
  }
  .site-nav {
    gap: 1rem;
    font-size: 0.72rem;
  }
  .hero {
    padding-top: 3.5rem;
  }
  .hero-title {
    margin-bottom: 1.25rem;
  }
  .report-card {
    padding: 1rem;
    gap: 0.75rem;
  }
  .report-title {
    font-size: 0.95rem;
  }
  .fact {
    grid-template-columns: 1fr;
    gap: 0.15rem;
    padding-block: 0.7rem;
  }
  .social-links {
    gap: 1rem;
  }
  .comment-replies {
    margin-inline-start: 0.5rem;
    padding-inline-start: 0.5rem;
  }
  .comment-replies-flat {
    margin-inline-start: 0;
    padding-inline-start: 0;
  }
  .prose td,
  .prose th {
    padding: 0.5rem;
  }
}
