:root {
  --color-primary: #1F6FEB;
  --color-secondary: #0E7C66;
  --color-accent: #D06A2C;
  --color-background: #0B0F14;
  --color-surface: #111826;
  --color-text: #E8EEF6;
  --color-text-muted: #A9B4C2;
  --color-border: #263246;
  
  --radius: 2px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--color-border);
  --space: 1.5rem;
  --measure: 70ch;
  
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Courier New", monospace;
}

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

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

@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: var(--font-system);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  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 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.75em;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

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

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

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

p, ul, ol, dl, table, figure {
  margin-bottom: 1.5rem;
}

ul, ol {
  padding-left: 1.5em;
}

li {
  margin-bottom: 0.5em;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

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

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: var(--space) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space);
}

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

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

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

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

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

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

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--space) * 2) var(--space);
  width: 100%;
}

main > * {
  max-width: var(--measure);
}

main > table,
main > figure,
main > .full-width {
  max-width: 100%;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  list-style: none;
  padding: 0;
}

.breadcrumbs li {
  margin: 0;
}

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

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

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

section, article, aside {
  margin-bottom: calc(var(--space) * 3);
}

aside {
  background-color: var(--color-surface);
  border-left: 3px solid var(--color-accent);
  padding: var(--space);
  margin: calc(var(--space) * 2) 0;
  box-shadow: var(--shadow);
}

blockquote {
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  font-style: italic;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: calc(var(--space) * 1.5) 0;
  padding-left: 1.5rem;
  border-left: 3px solid var(--color-primary);
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--color-surface);
  box-shadow: var(--shadow);
  font-size: 0.9375rem;
  overflow: hidden;
  border-radius: var(--radius);
}

table caption {
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  background-color: var(--color-surface);
  border-bottom: 2px solid var(--color-border);
  caption-side: top;
}

thead {
  background-color: rgba(31, 111, 235, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  font-weight: 600;
  text-align: left;
  padding: 0.875rem 1rem;
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text);
  letter-spacing: 0.01em;
}

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

tbody tr {
  transition: background-color 0.2s ease;
}

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

tbody tr:hover {
  background-color: rgba(31, 111, 235, 0.08);
}

@media (max-width: 767px) {
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  th, td {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
  }
}

details {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.2s ease;
}

details:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

details[open] {
  border-color: var(--color-primary);
}

summary {
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: color 0.2s ease;
  padding: 0.25rem 0;
}

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

summary::before {
  content: "▶";
  display: inline-block;
  font-size: 0.75em;
  transition: transform 0.2s ease;
  color: var(--color-primary);
  flex-shrink: 0;
}

details[open] summary::before {
  transform: rotate(90deg);
}

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

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

details > *:not(summary) {
  margin-top: 1rem;
  padding-left: 1.5rem;
}

footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: calc(var(--space) * 2) var(--space);
  margin-top: calc(var(--space) * 3);
}

footer .container {
  max-width: 1200px;
  margin: 0 auto;
}

footer h2, footer h3 {
  font-size: clamp(1.125rem, 1rem + 0.25vw, 1.375rem);
  margin-top: 0;
}

footer ul {
  list-style: none;
  padding: 0;
}

footer li {
  margin-bottom: 0.75rem;
}

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

footer a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

footer .copyright {
  margin-top: calc(var(--space) * 1.5);
  padding-top: var(--space);
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 0.125em 0.375em;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

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

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

img, video, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

figure {
  margin: calc(var(--space) * 1.5) 0;
}

figcaption {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: calc(var(--space) * 2) 0;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

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

::selection {
  background-color: var(--color-primary);
  color: var(--color-background);
}

@media (min-width: 768px) {
  :root {
    --space: 2rem;
  }
  
  header .container {
    flex-wrap: nowrap;
  }
  
  nav ul {
    gap: 2rem;
  }
  
  main {
    padding: calc(var(--space) * 3) var(--space);
  }
  
  aside {
    padding: calc(var(--space) * 1.5);
  }
  
  thead {
    position: sticky;
  }
}

@media (min-width: 1024px) {
  :root {
    --space: 2.5rem;
  }
  
  body {
    font-size: 1.125rem;
  }
  
  main {
    display: grid;
    grid-template-columns: 1fr min(var(--measure), 100%) 1fr;
    gap: 0 var(--space);
  }
  
  main > * {
    grid-column: 2;
  }
  
  main > .full-width {
    grid-column: 1 / -1;
    max-width: 100%;
  }
}

@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  h1 {
    font-size: 24pt;
  }
  
  h2 {
    font-size: 18pt;
  }
  
  h3 {
    font-size: 14pt;
  }
  
  a {
    text-decoration: underline;
    color: black !important;
  }
  
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.875em;
  }
  
  header, footer, nav, aside {
    display: none;
  }
  
  main {
    max-width: 100%;
    padding: 0;
  }
  
  table {
    border-collapse: collapse;
    border: 1px solid black;
  }
  
  th, td {
    border: 1px solid black;
    padding: 0.5em;
  }
  
  thead {
    display: table-header-group;
  }
  
  tr, img {
    page-break-inside: avoid;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
}