/* ===========================
   CSS Variables (Obsidian Aurora)
   =========================== */
:root {
  --bg: #070A12;
  --surface: #0D1324;
  --text: #E7EAF3;
  --muted: #A7B0C3;
  --border: #1C2742;
  --primary: #8B5CF6;
  --secondary: #22D3EE;
  --accent: #F97316;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,0.45);
  --measure: 68ch;
  --transition: 0.25s ease;
}

/* ===========================
   Reset & Base
   =========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

@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;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* ===========================
   Typography
   =========================== */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-bottom: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--secondary);
}

p {
  max-width: var(--measure);
  margin-bottom: 1rem;
}

a {
  color: var(--secondary);
  text-decoration: underline;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary);
}

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

strong {
  font-weight: 700;
  color: var(--text);
}

blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--muted);
  background: rgba(139, 92, 246, 0.05);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
}

blockquote p {
  margin-bottom: 0;
}

/* ===========================
   Skip Link
   =========================== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--accent);
  color: var(--bg);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  z-index: 9999;
  transition: top var(--transition);
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* ===========================
   Container
   =========================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===========================
   Header
   =========================== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.site-header .container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .site-header .container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.site-brand {
  font-size: 1.5rem;
  color: var(--primary);
}

.site-header nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-header nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  color: var(--primary);
}

.site-header nav a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ===========================
   Main Content
   =========================== */
main {
  padding: 3rem 0;
}

article {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow);
}

@media (max-width: 767px) {
  article {
    padding: 1.5rem;
  }
}

section {
  margin-bottom: 3rem;
}

section:last-child {
  margin-bottom: 0;
}

/* ===========================
   Breadcrumbs
   =========================== */
.breadcrumb {
  margin-bottom: 2rem;
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--border);
}

.breadcrumb a {
  color: var(--secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ===========================
   Tables
   =========================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

caption {
  font-weight: 700;
  font-size: 1.1rem;
  text-align: left;
  padding: 1rem;
  background: var(--surface);
  color: var(--primary);
  border-bottom: 2px solid var(--border);
}

thead {
  background: var(--surface);
  color: var(--text);
}

@media (min-width: 768px) {
  thead {
    position: sticky;
    top: 0;
    z-index: 10;
  }
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 700;
  color: var(--secondary);
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:nth-child(even) {
  background: rgba(139, 92, 246, 0.03);
}

tbody tr:hover {
  background: rgba(34, 211, 238, 0.08);
}

@media (max-width: 767px) {
  table, thead, tbody, th, td, tr {
    display: block;
  }
  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  tr {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  td {
    border: none;
    position: relative;
    padding-left: 50%;
  }
  td::before {
    content: attr(data-label);
    position: absolute;
    left: 1rem;
    width: 45%;
    padding-right: 0.5rem;
    font-weight: 700;
    color: var(--secondary);
  }
}

/* ===========================
   Details / Summary (Accordions)
   =========================== */
details {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  transition: background var(--transition), border-color var(--transition);
}

details[open] {
  background: rgba(139, 92, 246, 0.05);
  border-color: var(--primary);
}

summary {
  font-weight: 700;
  cursor: pointer;
  color: var(--primary);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color var(--transition);
  padding: 0.5rem 0;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  font-size: 1.5rem;
  color: var(--secondary);
  transition: transform var(--transition);
}

details[open] summary::after {
  content: "−";
  transform: rotate(180deg);
}

summary:hover {
  color: var(--secondary);
}

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

details p {
  margin-top: 1rem;
  color: var(--text);
}

/* ===========================
   Lists
   =========================== */
ul, ol {
  margin: 1rem 0 1rem 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

nav ul, nav ol {
  margin: 0;
}

nav li {
  margin-bottom: 0;
}

/* ===========================
   Aside / Glossary
   =========================== */
aside {
  background: rgba(34, 211, 238, 0.05);
  border-left: 4px solid var(--secondary);
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: var(--radius);
}

aside h3 {
  margin-top: 0;
  color: var(--secondary);
}

dl {
  margin: 1rem 0;
}

dt {
  font-weight: 700;
  color: var(--primary);
  margin-top: 1rem;
}

dt:first-child {
  margin-top: 0;
}

dd {
  margin-left: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
}

/* ===========================
   Footer
   =========================== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
  max-width: none;
}

/* ===========================
   Accessibility Note
   =========================== */
.accessibility-note {
  background: rgba(249, 115, 22, 0.05);
  border-left: 4px solid var(--accent);
}

.accessibility-note h3 {
  color: var(--accent);
}

/* ===========================
   Responsive Utilities
   =========================== */
@media (min-width: 768px) {
  .container {
    padding: 0 2rem;
  }
}

@media (min-width: 1024px) {
  main {
    padding: 4rem 0;
  }
  article {
    padding: 3rem;
  }
}