:root {
  --color-primary: #0F172A;
  --color-secondary: #1F2937;
  --color-accent: #C7A76C;
  --color-background: #0B0F14;
  --color-surface: #121A22;
  --color-text: #E6EAF0;
  --color-text-muted: #A7B0BE;
  --color-border: #263241;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  --radius: 0.375rem;
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  --transition-speed: 0.25s;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-speed: 0s;
  }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

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

body {
  font-family: var(--font-system);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 100%;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.75em;
}

h1 {
  font-size: clamp(1.875rem, 1.5rem + 1.5vw, 2.75rem);
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2.125rem);
  margin-top: 2rem;
}

h3 {
  font-size: clamp(1.25rem, 1.125rem + 0.5vw, 1.625rem);
  margin-top: 1.5rem;
}

h4 {
  font-size: clamp(1.125rem, 1rem + 0.25vw, 1.375rem);
}

p {
  margin-bottom: 1.25em;
}

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--transition-speed) ease, text-decoration-color var(--transition-speed) ease;
}

a:hover {
  color: #D4B87A;
  text-decoration-thickness: 2px;
}

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

header {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem clamp(1rem, 5vw, 2rem);
}

header .site-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

header .site-name {
  font-size: clamp(1.25rem, 1.125rem + 0.5vw, 1.5rem);
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}

header .site-name:hover {
  color: var(--color-accent);
}

nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1rem, 2vw, 1.75rem);
  align-items: center;
}

nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-speed) ease;
}

nav a:hover {
  color: var(--color-accent);
}

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

.breadcrumbs {
  background-color: var(--color-surface);
  padding: 0.75rem clamp(1rem, 5vw, 2rem);
  border-bottom: 1px solid var(--color-border);
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 1280px;
  margin: 0 auto;
  font-size: 0.9rem;
}

.breadcrumbs li:not(:last-child)::after {
  content: "›";
  margin-left: 0.5rem;
  color: var(--color-text-muted);
}

.breadcrumbs a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

main {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 5vw, 2rem);
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  main.has-aside {
    grid-template-columns: 1fr 320px;
  }
}

article, section {
  margin-bottom: 2.5rem;
}

article > *:first-child,
section > *:first-child {
  margin-top: 0;
}

aside {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  align-self: start;
  position: sticky;
  top: 1.5rem;
}

aside h2, aside h3 {
  font-size: 1.125rem;
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--color-accent);
}

aside p {
  font-size: 0.95rem;
  line-height: 1.6;
}

aside ul {
  list-style: none;
  padding-left: 0;
}

aside li {
  margin-bottom: 0.5rem;
  padding-left: 1.25rem;
  position: relative;
}

aside li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: clamp(0.875rem, 0.85rem + 0.15vw, 0.95rem);
}

caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  font-size: 1.125rem;
  padding: 1rem 1rem 0.75rem;
  color: var(--color-text);
  background-color: var(--color-surface);
}

thead {
  background-color: var(--color-primary);
  border-bottom: 2px solid var(--color-accent);
}

th {
  text-align: left;
  padding: 0.875rem 1rem;
  font-weight: 700;
  color: var(--color-text);
  border-right: 1px solid var(--color-border);
}

th:last-child {
  border-right: none;
}

td {
  padding: 0.875rem 1rem;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

td:last-child {
  border-right: none;
}

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

tbody tr:nth-child(odd) {
  background-color: rgba(255, 255, 255, 0.02);
}

tbody tr:nth-child(even) {
  background-color: var(--color-surface);
}

tbody tr:hover {
  background-color: rgba(199, 167, 108, 0.08);
}

tbody tr:last-child td {
  border-bottom: none;
}

@media (max-width: 767px) {
  table {
    font-size: 0.8rem;
  }
  
  th, td {
    padding: 0.625rem 0.75rem;
  }
}

details {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
  color: var(--color-text);
}

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

summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
  transition: transform var(--transition-speed) ease;
  flex-shrink: 0;
  margin-left: 1rem;
}

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

summary:hover {
  background-color: rgba(199, 167, 108, 0.08);
  color: var(--color-accent);
}

summary:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

details[open] summary {
  border-bottom: 1px solid var(--color-border);
  background-color: rgba(199, 167, 108, 0.05);
}

details > *:not(summary) {
  padding: 1.25rem;
}

details p:last-child {
  margin-bottom: 0;
}

blockquote {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--color-accent);
  background-color: var(--color-surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--color-text-muted);
}

blockquote p:last-child {
  margin-bottom: 0;
}

blockquote cite {
  display: block;
  margin-top: 0.75rem;
  font-style: normal;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

blockquote cite::before {
  content: "— ";
}

ul, ol {
  margin-bottom: 1.25rem;
  padding-left: 1.75rem;
}

li {
  margin-bottom: 0.5rem;
}

ul ul, ol ol, ul ol, ol ul {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--color-surface);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--color-border);
}

pre {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
}

footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 2rem clamp(1rem, 5vw, 2rem);
  margin-top: 3rem;
}

footer .footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

footer nav ul {
  gap: 1.5rem;
}

footer p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

@media (min-width: 768px) {
  body {
    font-size: 1.0625rem;
  }
}

@media (min-width: 1024px) {
  body {
    font-size: 1.125rem;
  }
}

@media print {
  body {
    background: white;
    color: black;
  }
  
  header, footer, nav, aside, .breadcrumbs {
    display: none;
  }
  
  main {
    max-width: 100%;
    padding: 0;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
  
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }
  
  details {
    border: 1px solid #ccc;
  }
  
  details[open] summary {
    border-bottom: 1px solid #ccc;
  }
  
  summary::after {
    display: none;
  }
  
  table {
    border: 1px solid #000;
  }
  
  th, td {
    border: 1px solid #000;
  }
  
  thead {
    background: #eee;
  }
}