:root {
  --color-primary: #1E3A8A;
  --color-secondary: #0F766E;
  --color-accent: #D97706;
  --color-background: #F7F3EA;
  --color-surface: #FFFFFF;
  --color-text: #111827;
  --color-text-muted: #4B5563;
  --color-border: #D1D5DB;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.10);
  --measure: 68ch;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-background);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

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

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-secondary);
  text-decoration-color: var(--color-accent);
}

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

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.2;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.3;
  font-weight: 600;
  color: var(--color-secondary);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h4 {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  line-height: 1.4;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

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

ul, ol {
  max-width: var(--measure);
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

header {
  background-color: var(--color-surface);
  border-bottom: 2px solid var(--color-border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.site-name {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  color: var(--color-primary);
}

.site-name a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

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

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

nav a {
  font-weight: 500;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

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

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

.breadcrumbs {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

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

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

.breadcrumbs span {
  color: var(--color-border);
}

section {
  margin-bottom: 3rem;
}

blockquote {
  max-width: var(--measure);
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  background-color: rgba(217, 119, 6, 0.05);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius);
  font-style: italic;
  color: var(--color-text);
}

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

table {
  width: 100%;
  max-width: var(--measure);
  border-collapse: collapse;
  margin: 2rem 0;
  background-color: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: block;
  overflow-x: auto;
}

thead {
  background-color: var(--color-primary);
  color: var(--color-surface);
  position: sticky;
  top: 0;
}

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

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

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

tbody tr:nth-child(odd) {
  background-color: rgba(247, 243, 234, 0.3);
}

tbody tr:hover {
  background-color: rgba(30, 58, 138, 0.05);
}

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

details {
  max-width: var(--measure);
  margin: 1.5rem 0;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

summary {
  padding: 1rem 1.5rem;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  list-style: none;
  transition: background-color 0.2s ease, color 0.2s ease;
  user-select: none;
}

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

summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 0.75rem;
  transition: transform 0.3s ease;
}

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

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

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

details div {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
}

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

footer {
  background-color: var(--color-surface);
  border-top: 2px solid var(--color-border);
  margin-top: auto;
}

footer .footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

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

footer nav ul {
  gap: 1rem;
}

footer a {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

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

@media (min-width: 768px) {
  main {
    padding: 3rem 2rem;
  }

  section {
    margin-bottom: 4rem;
  }

  table {
    display: table;
    overflow-x: visible;
  }

  thead {
    position: sticky;
  }
}

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

  header .header-inner {
    padding: 1.5rem 2rem;
  }

  main {
    display: grid;
    grid-template-columns: 1fr minmax(auto, 85ch) 1fr;
    gap: 2rem;
    padding: 4rem 2rem;
  }

  main > * {
    grid-column: 2;
  }

  .wide {
    grid-column: 1 / -1;
    max-width: 1400px;
    justify-self: center;
    width: 100%;
  }

  aside {
    grid-column: 3;
    grid-row: 2 / span 3;
    position: sticky;
    top: 6rem;
    align-self: start;
    background-color: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }

  summary::before {
    transition: none;
  }
}

@media print {
  body {
    background-color: 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.875rem;
  }

  details {
    border: 1px solid black;
  }

  summary::before {
    content: "";
  }

  details[open] summary {
    border-bottom: 1px solid black;
  }

  table {
    box-shadow: none;
    border: 1px solid black;
  }

  thead {
    background-color: #f0f0f0;
    color: black;
  }

  tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
  }

  h1, h2, h3, h4 {
    page-break-after: avoid;
    color: black;
  }

  blockquote {
    page-break-inside: avoid;
    border-left: 4px solid black;
    background-color: #f5f5f5;
  }
}