/* CSS Variables - Balcony Ink Editorial Palette */
:root {
  --color-bg: #FBF7F2;
  --color-surface: #FFFFFF;
  --color-text: #1A1F2B;
  --color-muted: #5B6475;
  --color-border: #D9D2C8;
  --color-primary: #2E3A59;
  --color-secondary: #6B4E71;
  --color-accent: #C86B4A;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(26, 31, 43, 0.10);
  --maxw: 1120px;
  --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
}

/* Reset and Base */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-base);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

/* Responsive Typography with clamp() */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  line-height: 1.2;
  margin-bottom: 0.75em;
  color: var(--color-primary);
  font-weight: 600;
}

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

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-top: 2em;
}

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  margin-top: 1.5em;
  color: var(--color-secondary);
}

p, li {
  max-width: 70ch;
  margin-bottom: 1em;
}

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

a:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(200, 107, 74, 0.2);
  border-radius: 2px;
}

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

/* Layout Grid - Editorial Shell */
.container {
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

@media (min-width: 768px) {
  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

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

header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

nav[aria-label="Primary navigation"] ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

nav[aria-label="Primary navigation"] a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) / 2);
  transition: background-color 0.2s ease, color 0.2s ease;
}

nav[aria-label="Primary navigation"] a:hover,
nav[aria-label="Primary navigation"] a[aria-current="page"] {
  background-color: var(--color-bg);
  color: var(--color-primary);
}

nav[aria-label="Primary navigation"] a:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* Breadcrumb Navigation */
.breadcrumb {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 0;
  font-size: 0.9375rem;
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

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

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

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

.breadcrumb [aria-current="page"] {
  color: var(--color-text);
  font-weight: 500;
}

/* Main Content */
main {
  padding: 3rem 0;
  min-height: 60vh;
}

article {
  background-color: var(--color-surface);
  padding: 2.5rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

section {
  margin-bottom: 3rem;
}

section:last-of-type {
  margin-bottom: 0;
}

/* Tables - Semantic, Responsive, Zebra Rows */
figure {
  margin: 2rem 0;
  overflow-x: auto;
}

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

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

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

@media (min-width: 1024px) {
  thead {
    position: sticky;
    top: 0;
    z-index: 10;
  }
}

th {
  text-align: left;
  padding: 1rem;
  font-weight: 600;
}

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

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

tbody tr:hover {
  background-color: rgba(200, 107, 74, 0.08);
}

/* Details/Summary Accordion with Marker Control */
details {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: box-shadow 0.2s ease;
}

details:hover {
  box-shadow: 0 4px 12px rgba(26, 31, 43, 0.08);
}

details[open] {
  box-shadow: 0 6px 20px rgba(26, 31, 43, 0.12);
}

summary {
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--color-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: color 0.2s ease;
}

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

summary::before {
  content: '+';
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  background-color: var(--color-accent);
  color: var(--color-surface);
  border-radius: 50%;
  text-align: center;
  line-height: 1.5rem;
  font-weight: 700;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

details[open] summary::before {
  content: '−';
  background-color: var(--color-secondary);
  transform: rotate(90deg);
}

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

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

details p {
  margin-top: 1rem;
  padding-left: 2.25rem;
  color: var(--color-text);
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--color-accent);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--color-muted);
}

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

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

/* Focus-visible High-Contrast Ring */
*:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(200, 107, 74, 0.2);
}

/* Utility: Visually Hidden (for screen readers) */
.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;
}

/* Responsive Adjustments */
@media (max-width: 767px) {
  table {
    font-size: 0.875rem;
  }
  th, td {
    padding: 0.75rem 0.5rem;
  }
}

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

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