:root {
  --bg: #fbfbf8;
  --surface: #ffffff;
  --text: #1f2124;
  --muted: #4f5964;
  --border: #d7dde5;
  --focus: #0a63d8;
  --max-width: 76ch;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Source Serif 4", Georgia, serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
  text-underline-offset: 0.2rem;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -10rem;
  background: #0a63d8;
  color: #fff;
  padding: 0.5rem 0.75rem;
  z-index: 20;
}

.skip-link:focus {
  top: 0.75rem;
}

.site {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.site-header,
.site-main,
.site-footer,
.controls {
  width: min(94vw, var(--max-width));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0 1rem;
}

.site-title__name {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.site-title__subtitle {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.nav-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.95rem;
  padding: 0;
  margin: 0.9rem 0 0;
}

.controls {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
}

.controls__title {
  margin-top: 0;
  font-size: 1rem;
}

.controls__status {
  margin: 0.5rem 0;
  color: var(--muted);
}

.controls__row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.6rem;
}

.controls__button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.controls__button[aria-pressed="true"] {
  border-color: var(--focus);
}

.controls button,
.controls select,
.controls input {
  font: inherit;
}

.site-main {
  padding: 1.6rem 0 3rem;
}

h1,
h2,
h3 {
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.card {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}

.card__title {
  margin: 0;
}

.card__meta {
  color: var(--muted);
}

.tag-list {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0;
}

.tag {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.9rem;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin-block: 1rem;
}

pre {
  overflow-x: auto;
  border: 1px solid var(--border);
  padding: 1rem;
  background: var(--surface);
}

figure {
  margin: 1rem 0;
}

figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
}

figcaption {
  color: var(--muted);
  margin-top: 0.4rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 1rem 0 2rem;
}

.theme-dark {
  --bg: #111417;
  --surface: #171b1f;
  --text: #e8edf2;
  --muted: #b0bcc8;
  --border: #2a323b;
  --focus: #7db3ff;
}

.high-contrast {
  --bg: #000;
  --surface: #000;
  --text: #fff;
  --muted: #fff;
  --border: #fff;
  --focus: #ffef00;
}

.drift-page {
  display: grid;
  gap: 1rem;
}

.drift-controls {
  border: 1px solid var(--border);
  padding: 0.9rem;
  background: var(--surface);
}

.drift-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.9rem;
}

.drift-summary p {
  margin: 0;
}

.drift-controls__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.75rem;
}

.drift-controls__row:last-child {
  margin-bottom: 0;
}

.drift-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
  gap: 1rem;
}

.drift-canvas {
  min-height: 28rem;
  border: 1px solid var(--border);
  background: #101318;
}

.drift-panel {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.95rem;
}

.drift-panel__title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.2rem;
}

.drift-panel__meta {
  color: var(--muted);
  margin-top: 0;
}

.drift-panel__scores,
.drift-panel__kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.55rem;
  margin: 0;
}

.drift-panel__scores dt,
.drift-panel__kv dt {
  font-weight: 700;
}

.drift-panel__scores dd,
.drift-panel__kv dd {
  margin: 0;
}

.drift-panel__block {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.drift-panel__block h3 {
  margin: 0 0 0.5rem;
}

.drift-panel__diffs {
  margin: 0;
  padding-left: 1rem;
}

.drift-legend {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.5rem;
  padding: 0;
  margin: 0.3rem 0 0;
}

.drift-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.drift-timeline {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.9rem;
}

.drift-timeline h2 {
  margin-top: 0;
}

.drift-timeline ol {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.4rem;
}

.drift-severity-dot {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
}

.drift-severity-dot--healthy {
  background: #4a7c59;
}

.drift-severity-dot--attention {
  background: #c2943d;
}

.drift-severity-dot--high {
  background: #d36a2e;
}

.drift-severity-dot--critical {
  background: #c13a32;
}

@media (max-width: 980px) {
  .drift-layout {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  transition: none !important;
}
