/* CSS Variables - StarCite Aurora Ink Palette */
:root {
  --color-primary: #2B2A6E;
  --color-secondary: #0F766E;
  --color-accent: #E24A8D;
  --color-bg: #F7F5F0;
  --color-surface: #FFFFFF;
  --color-text: #14131A;
  --color-muted: #5B5A66;
  --color-border: #D7D3C8;
  --radius-1: 4px;
  --shadow-1: 0 2px 8px rgba(20, 19, 26, 0.08);
  --space-1: 1rem;
  --space-2: 2rem;
}

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

html {
  font-size: 16px;
  line-height: 1.6;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  overflow-x: hidden;
}

/* Typography - Mobile First */
h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  margin-bottom: var(--space-1);
  color: var(--color-primary);
  font-weight: 700;
}

h2 {
  font-size: 1.5rem;
  line-height: 1.3;
  margin-top: var(--space-2);
  margin-bottom: var(--space-1);
  color: var(--color-primary);
  font-weight: 600;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.4;
  margin-top: var(--space-1);
  margin-bottom: 0.5rem;
  color: var(--color-secondary);
  font-weight: 600;
}

p {
  margin-bottom: var(--space-1);
}

a {
  color: var(--color-secondary);
  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: var(--radius-1);
}

/* Container - Editorial Grid */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-1);
}

/* Header - Flexbox Alignment */
header {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-1) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-1);
}

header .container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

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

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

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

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

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

/* Breadcrumbs */
.breadcrumbs {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 0;
  font-size: 0.875rem;
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

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

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

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

.breadcrumbs li[aria-current="page"] {
  color: var(--color-muted);
}

/* Main Content */
main {
  padding: var(--space-2) 0;
  min-height: 60vh;
}

article {
  background-color: var(--color-surface);
  padding: var(--space-2);
  border-radius: var(--radius-1);
  box-shadow: var(--shadow-1);
}

section {
  margin-bottom: var(--space-2);
}

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

/* Aside - Editorial Callout */
aside {
  background-color: var(--color-bg);
  border-left: 4px solid var(--color-accent);
  padding: var(--space-1);
  margin: var(--space-1) 0;
  border-radius: var(--radius-1);
}

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

aside ul {
  margin-left: 1.25rem;
  margin-bottom: 0;
}

aside li {
  margin-bottom: 0.5rem;
}

/* Blockquote - Editorial Styling */
blockquote {
  background-color: var(--color-surface);
  border-left: 4px solid var(--color-secondary);
  padding: var(--space-1);
  margin: var(--space-1) 0;
  font-style: italic;
  color: var(--color-muted);
  box-shadow: var(--shadow-1);
}

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

/* Tables - Semantic and Responsive */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-1) 0;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-1);
  overflow: hidden;
}

caption {
  font-weight: 600;
  text-align: left;
  padding: 0.75rem;
  background-color: var(--color-primary);
  color: var(--color-surface);
  font-size: 1rem;
}

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

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

tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.2s ease;
}

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

tbody tr:hover {
  background-color: #EDE9E0;
}

tbody td {
  padding: 0.75rem;
}

/* Table Responsive Wrapper */
@media (max-width: 767px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* Sticky Table Header on Desktop */
@media (min-width: 1024px) {
  thead {
    position: sticky;
    top: 0;
    z-index: 10;
  }
}

/* Details/Summary Accordion */
details {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-1);
  margin-bottom: var(--space-1);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

details:hover {
  box-shadow: var(--shadow-1);
}

details[open] {
  box-shadow: var(--shadow-1);
}

summary {
  padding: var(--space-1);
  font-weight: 600;
  cursor: pointer;
  background-color: var(--color-bg);
  transition: background-color 0.2s ease, color 0.2s ease;
  list-style: none;
  position: relative;
  padding-left: 2.5rem;
}

summary::before {
  content: "+";
  position: absolute;
  left: var(--space-1);
  font-size: 1.25rem;
  color: var(--color-accent);
  transition: transform 0.2s ease;
}

details[open] summary::before {
  content: "−";
}

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

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

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

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

/* Footer - Flexbox Alignment */
footer {
  background-color: var(--color-primary);
  color: var(--color-surface);
  padding: var(--space-1) 0;
  text-align: center;
  margin-top: var(--space-2);
}

footer p {
  margin: 0;
  font-size: 0.875rem;
}

/* Schema Pre - Hidden but Accessible */
pre.schema {
  display: none;
}

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

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Tablet Breakpoint - 768px */
@media (min-width: 768px) {
  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.375rem;
  }

  header .container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .container {
    padding: 0 var(--space-2);
  }

  article {
    padding: var(--space-2) 3rem;
  }
}

/* Desktop Breakpoint - 1024px */
@media (min-width: 1024px) {
  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 2rem;
  }

  main {
    padding: 3rem 0;
  }

  article {
    padding: 3rem 4rem;
  }
}

/* Link Underline Editorial Feel */
main a {
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

main a:hover {
  text-decoration-thickness: 2px;
}

/* List Styling */
ul, ol {
  margin-left: 1.5rem;
  margin-bottom: var(--space-1);
}

li {
  margin-bottom: 0.5rem;
}

/* Utility - Visually Hidden */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}