/* CSS Variables - Custard Ink Editorial Palette */
:root {
  --vp-bg: #FBF6EE;
  --vp-surface: #FFF9F1;
  --vp-text: #1E1A16;
  --vp-muted: #5E544B;
  --vp-border: #E4D7C6;
  --vp-primary: #3B2A1E;
  --vp-secondary: #6E4B2E;
  --vp-accent: #C58A2C;
  --vp-radius: 14px;
  --vp-shadow: 0 10px 30px rgba(59, 42, 30, 0.10);
  --vp-max: 1100px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

@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: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.7;
  color: var(--vp-text);
  background-color: var(--vp-bg);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

/* Typography - Responsive with clamp() */
h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
  font-weight: 700;
  color: var(--vp-primary);
  margin-bottom: 1rem;
}

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

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  line-height: 1.4;
  font-weight: 600;
  color: var(--vp-secondary);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--vp-accent);
  text-decoration: underline;
  transition: color 0.2s ease;
}

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

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

/* Container */
.container {
  max-width: var(--vp-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

/* Header - Flexbox for nav/utility row */
.site-header {
  background-color: var(--vp-surface);
  border-bottom: 1px solid var(--vp-border);
  padding: 1rem 0;
  box-shadow: var(--vp-shadow);
}

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

.site-branding .site-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--vp-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

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

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

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

/* Breadcrumbs */
.breadcrumbs {
  margin: 1.5rem 0 1rem;
  font-size: 0.9rem;
}

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

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

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

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

/* Main Content - Editorial Grid Layout */
main {
  padding: 2rem 0;
}

.page-content {
  background-color: var(--vp-surface);
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius);
  padding: 2rem 1.5rem;
  box-shadow: var(--vp-shadow);
}

@media (min-width: 768px) {
  .page-content {
    padding: 3rem 2.5rem;
  }
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--vp-border);
}

.content-section {
  margin-bottom: 2.5rem;
}

.subsection {
  margin-top: 1.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--vp-accent);
}

/* Aside Section */
.aside-section {
  background-color: var(--vp-bg);
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius);
  padding: 1.5rem;
  margin-top: 2rem;
}

/* Table Styling - Sticky header at >=768px, zebra striping */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius);
  background-color: var(--vp-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

caption {
  font-weight: 600;
  text-align: left;
  padding: 1rem;
  color: var(--vp-primary);
  background-color: var(--vp-bg);
  border-bottom: 2px solid var(--vp-border);
}

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

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

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

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

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

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

/* Details/Summary Accordion - Marker control and hover/focus states */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  background-color: var(--vp-surface);
  border: 1px solid var(--vp-border);
  border-radius: var(--vp-radius);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.faq-item:hover {
  box-shadow: var(--vp-shadow);
}

.faq-item summary {
  padding: 1rem 1.5rem;
  font-weight: 600;
  color: var(--vp-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.5rem;
  color: var(--vp-accent);
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item summary:hover,
.faq-item summary:focus-visible {
  background-color: var(--vp-bg);
}

.faq-item summary:focus-visible {
  outline: 2px solid var(--vp-accent);
  outline-offset: -2px;
}

.faq-answer {
  padding: 0 1.5rem 1.5rem;
  color: var(--vp-text);
}

.faq-answer p {
  margin-bottom: 1rem;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

/* Footer */
.site-footer {
  background-color: var(--vp-primary);
  color: var(--vp-surface);
  padding: 1.5rem 0;
  text-align: center;
  margin-top: 3rem;
}

.site-footer p {
  margin: 0;
  font-size: 0.9rem;
}

/* Focus-visible ring using accent color and offset */
*:focus-visible {
  outline: 2px solid var(--vp-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .main-nav ul {
    gap: 1rem;
  }
  .table-wrapper {
    font-size: 0.85rem;
  }
  th, td {
    padding: 0.5rem 0.75rem;
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 3rem;
  }
}