/* 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;
}

/* ===== Horizontal overflow fixes ===== */

/* Constrain all media to viewport width */
img, svg, video, iframe {
  max-width: 100%;
  height: auto;
}

/* Remove default figure margins that can cause overflow */
figure {
  margin: 0;
}

/* Allow long text to break anywhere to avoid overflow */
ul, ol, li, a, p, h1, h2, h3, h4, h5, h6, span, div {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Make the navigation list wrap on narrow screens */
.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

/* Ensure the header inner container wraps its children */
.header-inner {
  flex-wrap: wrap;
}

/* Force all .wrap containers to stay within the viewport */
.wrap {
  box-sizing: border-box;
  max-width: 100%;
  padding-left: var(--space);
  padding-right: var(--space);
}

/* Extra safety for hero and section figures */
.hero-figure img,
.section-figure img {
  max-width: 100%;
  height: auto;
}

/* Prevent the theme toggle button from causing overflow */
.theme-toggle {
  flex-shrink: 0;
}

/* Ensure the footer grid does not overflow */
.footer-grid {
  box-sizing: border-box;
  max-width: 100%;
}

/* Break extremely long unspaced strings in contact list */
.contact-list li:last-child {
  word-break: break-all;
}