/* Root Access — terminal theme, built to pass WCAG AA by default. */

:root {
  --bg: #0d1117;
  --bg-raised: #161b22;
  --fg: #e6edf3;
  --fg-muted: #9da7b3;
  --accent: #3fd668;
  --accent-strong: #7ee89a;
  --border: #30363d;
  --link-visited: #b083f0;
  --focus-ring: #58a6ff;

  --font-mono: ui-monospace, "Cascadia Code", "Fira Code", "JetBrains Mono",
    Consolas, "Courier New", monospace;
  --font-scale: 1;
  --transition-speed: 150ms;
}

/* High-contrast mode, toggled via [data-contrast="high"] on <html>. */
html[data-contrast="high"] {
  --bg: #000000;
  --bg-raised: #000000;
  --fg: #ffffff;
  --fg-muted: #ffffff;
  --accent: #ffff00;
  --accent-strong: #ffff00;
  --border: #ffffff;
  --link-visited: #ffff00;
  --focus-ring: #00ffff;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-speed: 0ms;
  }
}
html[data-motion="reduced"] {
  --transition-speed: 0ms !important;
}
html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after {
  animation: none !important;
  transition: none !important;
}

* {
  box-sizing: border-box;
}

html {
  font-size: calc(16px * var(--font-scale));
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  line-height: 1.6;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:visited {
  color: var(--link-visited);
}
a:hover,
a:focus {
  color: var(--accent);
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #000;
  padding: 0.75rem 1rem;
  z-index: 1000;
  font-weight: bold;
}
.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

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

.site-branding {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-width: 60rem;
  margin: 0 auto;
}

.prompt {
  color: var(--accent);
}

.site-title {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--fg);
  text-decoration: none;
}
.site-title:hover,
.site-title:focus {
  color: var(--accent-strong);
}

.site-tagline {
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.main-nav {
  max-width: 60rem;
  margin: 0.75rem auto 0;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.main-nav a {
  text-decoration: none;
  color: var(--fg);
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}
.main-nav a:hover,
.main-nav a:focus,
.main-nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--accent-strong);
}

main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.page-heading {
  border-bottom: 1px dashed var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.post-card {
  border: 1px solid var(--border);
  background: var(--bg-raised);
  padding: 1.25rem;
  border-radius: 4px;
}

.post-card__meta,
.post-meta {
  color: var(--fg-muted);
  font-size: 0.85rem;
  margin: 0.25rem 0 0.75rem;
}

.post-card__title {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}
.post-card__title a {
  text-decoration: none;
}
.post-card__title a:hover,
.post-card__title a:focus {
  text-decoration: underline;
}

.post-card__excerpt {
  margin: 0;
}

.taxonomy-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.taxonomy-list a {
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  text-decoration: none;
}
.taxonomy-list a:hover,
.taxonomy-list a:focus {
  border-color: var(--accent);
}

.post-body {
  max-width: 42rem;
}
.post-body img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
}
.post-body pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  padding: 1rem;
  overflow-x: auto;
}
.post-body code {
  font-family: var(--font-mono);
}

.pagination {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

.empty-state {
  color: var(--fg-muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem;
  color: var(--fg-muted);
  font-size: 0.85rem;
}
.site-footer .footer-inner {
  max-width: 60rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Accessibility toggle panel */
.a11y-panel {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 999;
  font-size: 0.85rem;
}

.a11y-toggle-button {
  background: var(--bg-raised);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-family: var(--font-mono);
}
.a11y-toggle-button:hover,
.a11y-toggle-button:focus {
  border-color: var(--accent);
}

.a11y-menu {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem;
  min-width: 14rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.a11y-menu[hidden] {
  display: none;
}

.a11y-menu fieldset {
  border: none;
  padding: 0;
  margin: 0;
}
.a11y-menu legend {
  color: var(--fg-muted);
  padding: 0;
  margin-bottom: 0.3rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.a11y-menu label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0;
}

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