/* Theme: Deep claret (dining) */
:root {
  color-scheme: light dark;
  --bg: #fbf6f6;
  --surface: #ffffff;
  --text: #241417;
  --muted: #6f545a;
  --border: #e8d8da;
  --accent: #7d2436;
  --accent-contrast: #ffffff;
  --heading-font: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --max-width: 68rem;
  --radius: 14px;
  --space: clamp(1rem, 2.5vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #170f11;
    --surface: #201619;
    --text: #f5eaec;
    --muted: #c2a3aa;
    --border: #352529;
    --accent: #d9788c;
    --accent-contrast: #0d0d0d;
  }
}

[data-theme="dark"] {
  --bg: #170f11;
  --surface: #201619;
  --text: #f5eaec;
  --muted: #c2a3aa;
  --border: #352529;
  --accent: #d9788c;
  --accent-contrast: #0d0d0d;
}

[data-theme="light"] {
  --bg: #fbf6f6;
  --surface: #ffffff;
  --text: #241417;
  --muted: #6f545a;
  --border: #e8d8da;
  --accent: #7d2436;
  --accent-contrast: #ffffff;
}

/* Global reset to prevent horizontal overflow */
*, *::before, *::after {
  box-sizing: border-box;
}

img, video, iframe, embed, object, svg {
  max-width: 100%;
  height: auto;
}

/* Ensure the main wrap class doesn’t exceed viewport */
.wrap {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space);
  padding-right: var(--space);
}

/* Force all inline elements to wrap rather than overflow */
code, pre, kbd, samp, .nav-list a, .contact-list a, .social-list a, .source-list a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Navigation flex wrap for mobile */
.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Trust strip – prevent overflow on very small screens */
.trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Hero section – stack on small screens */
.hero-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space);
}

.hero-copy {
  flex: 1 1 300px;
  min-width: 0;
}

.hero-figure {
  flex: 1 1 300px;
  min-width: 0;
  margin: 0;
}

/* Content sections – stack on mobile */
.section-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space);
}

.section-copy {
  flex: 1 1 300px;
  min-width: 0;
}

.section-figure {
  flex: 1 1 300px;
  min-width: 0;
  margin: 0;
}

/* Footer grid – responsive */
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--space);
}

/* Source list – wrap long URLs */
.source-list {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Contact lists – wrap long email addresses */
.contact-list, .social-list {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Button text doesn’t overflow */
.button {
  white-space: normal;
  word-break: break-word;
}

/* Ensure theme toggle does not overflow */
.theme-toggle {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Header inner flex with wrapping */
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

/* Brand name doesn’t clip */
.brand-name {
  overflow-wrap: anywhere;
}

/* Footer note text shouldn’t clip */
.note {
  overflow-wrap: anywhere;
}

/* Prevent any flex items from causing overflow */
[style*="display: flex"], .flex {
  min-width: 0;
}

/* Force all figures to respect container width */
figure {
  max-width: 100%;
  margin: 0;
}

/* Hero actions button group wrap */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Ensure nothing exceeds body width */
body {
  overflow-x: hidden;
  width: 100%;
  margin: 0;
}

/* Restore natural padding for body content */
body > *, main, footer {
  max-width: 100%;
}
