/* ============================================
   CSS Variables
   ============================================ */
:root {
  --color-primary: #2E1A47;
  --color-secondary: #0E5A6A;
  --color-accent: #C86B2C;
  --color-background: #FBF7F1;
  --color-surface: #FFFFFF;
  --color-text: #1B1B1F;
  --color-text-muted: #5A5A66;
  --color-border: #D7D0C6;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(27, 27, 31, 0.10);
  --max-width: 1100px;
  --transition-speed: 0.25s;
}

/* ============================================
   CSS Reset & Base Styles
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  line-height: 1.2;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.625rem;
  margin-top: 2rem;
  margin-bottom: 0.875rem;
}

h3 {
  font-size: 1.375rem;
  margin-top: 1.5rem;
}

h4 {
  font-size: 1.125rem;
}

p {
  margin-bottom: 1.25rem;
  max-width: 75ch;
}

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--transition-speed) ease, text-decoration var(--transition-speed) ease;
}

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

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

main {
  flex: 1;
}

/* ============================================
   Editorial Masthead Header
   ============================================ */
header {
  background: linear-gradient(to bottom, var(--color-surface) 0%, var(--color-surface) calc(100% - 3px), var(--color-border) calc(100% - 3px), var(--color-border) calc(100% - 2px), var(--color-primary) calc(100% - 2px), var(--color-primary) 100%);
  padding: 1.5rem 1rem 1.25rem;
  margin-bottom: 2rem;
}

header .header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

header .site-name {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

header .site-name a {
  color: inherit;
  text-decoration: none;
}

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

/* ============================================
   Navigation
   ============================================ */
nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

nav a {
  display: inline-block;
  padding: 0.375rem 0;
  font-weight: 500;
  transition: color var(--transition-speed) ease, transform var(--transition-speed) ease;
}

nav a:hover {
  transform: translateX(4px);
}

/* ============================================
   Breadcrumbs
   ============================================ */
.breadcrumbs {
  max-width: var(--max-width);
  margin: 0 auto 1.5rem;
  padding: 0 1rem;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.breadcrumbs nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

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

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

/* ============================================
   Main Content Container
   ============================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* ============================================
   Grid-Based Section Cards
   ============================================ */
article {
  display: grid;
  gap: 2rem;
}

section {
  background-color: var(--color-surface);
  padding: 1.75rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

section h2 {
  margin-top: 0;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-border);
}

/* ============================================
   Aside
   ============================================ */
aside {
  background-color: var(--color-surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  font-size: 0.9375rem;
}

aside h3, aside h4 {
  font-size: 1.125rem;
  margin-top: 0;
}

/* ============================================
   Tables
   ============================================ */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(27, 27, 31, 0.06);
}

caption {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  text-align: left;
  padding: 1rem 1rem 0.75rem;
  caption-side: top;
}

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

th {
  text-align: left;
  padding: 0.875rem 1rem;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
}

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

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

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

tbody tr:hover {
  background-color: rgba(14, 90, 106, 0.05);
}

tbody a:focus-visible {
  outline-offset: 2px;
}

.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.table-wrapper table {
  margin: 0;
  border: none;
}

/* ============================================
   Details/Summary Accordion
   ============================================ */
details {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

details:hover {
  border-color: var(--color-secondary);
}

details[open] {
  border-left: 4px solid var(--color-accent);
  box-shadow: 0 4px 12px rgba(27, 27, 31, 0.08);
}

summary {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  list-style: none;
  padding: 0.5rem 0;
  transition: color var(--transition-speed) ease;
  user-select: none;
}

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

summary::before {
  content: "▸ ";
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform var(--transition-speed) ease;
  color: var(--color-accent);
}

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

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

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

details p {
  margin-top: 1rem;
  padding-left: 1.5rem;
}

/* ============================================
   Blockquotes - Editorial Pull-Quote
   ============================================ */
blockquote {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--color-primary);
  margin: 2rem 0;
  padding: 1.5rem 1.5rem 1.5rem 2rem;
  border-left: 5px solid var(--color-accent);
  background-color: var(--color-surface);
  box-shadow: 0 2px 8px rgba(27, 27, 31, 0.05);
  border-radius: 0 var(--radius) var(--radius) 0;
}

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

/* ============================================
   Footer
   ============================================ */
footer {
  background: linear-gradient(to top, var(--color-surface) 0%, var(--color-surface) calc(100% - 2px), var(--color-primary) calc(100% - 2px), var(--color-primary) 100%);
  padding: 1.5rem 1rem;
  margin-top: 3rem;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

footer .footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ============================================
   Responsive Breakpoints - 768px
   ============================================ */
@media (min-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }
  
  h2 {
    font-size: 1.875rem;
  }
  
  header {
    padding: 2rem 1.5rem 1.75rem;
  }
  
  header .site-name {
    font-size: 2.25rem;
    margin-bottom: 1.25rem;
  }
  
  nav ul {
    flex-direction: row;
    gap: 2rem;
  }
  
  nav a:hover {
    transform: translateY(-2px);
  }
  
  section {
    padding: 2.25rem 2rem;
  }
  
  table {
    font-size: 1rem;
  }
  
  th, td {
    padding: 1rem 1.25rem;
  }
  
  .container {
    padding: 0 1.5rem 3rem;
  }
}

/* ============================================
   Responsive Breakpoints - 1024px
   ============================================ */
@media (min-width: 1024px) {
  h1 {
    font-size: 2.75rem;
  }
  
  h2 {
    font-size: 2rem;
  }
  
  body.has-aside .container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2.5rem;
    align-items: start;
  }
  
  body.has-aside article {
    min-width: 0;
  }
  
  section {
    padding: 2.5rem 2.5rem;
  }
  
  article {
    gap: 2.5rem;
  }
  
  blockquote {
    font-size: 1.375rem;
    margin: 2.5rem 0;
    padding: 2rem 2rem 2rem 2.5rem;
  }
}

/* ============================================
   Accessibility - Prefers Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* ============================================
   Focus Visible Enhancement
   ============================================ */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  body {
    background-color: white;
    color: black;
    font-size: 12pt;
    line-height: 1.5;
  }
  
  header, footer, nav, aside, .breadcrumbs {
    display: none;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
  
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.875em;
  }
  
  section {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  table {
    border: 1px solid #000;
  }
  
  thead {
    background-color: #eee;
    color: #000;
  }
  
  th, td {
    border: 1px solid #999;
  }
  
  details[open] summary ~ * {
    display: block;
  }
  
  summary::before {
    content: "";
  }
}