/* SauceSweet — design system
   Visual direction inspired by kokonutui.com and 21st.dev:
   soft rounded cards, subtle shadows, gentle hover motion,
   light/dark theme via CSS variables, restrained gradients. */

:root {
  --bg: #faf8f5;
  --bg-elevated: #ffffff;
  --text: #211a14;
  --text-muted: #5f5349;
  --border: #e8e1d7;
  --accent: #c9622a;
  --accent-2: #e8a33d;
  --accent-soft: #fbe9da;
  --shadow: 0 1px 2px rgba(33, 26, 20, 0.04), 0 8px 24px rgba(33, 26, 20, 0.06);
  --shadow-hover: 0 4px 10px rgba(33, 26, 20, 0.08), 0 16px 32px rgba(33, 26, 20, 0.10);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --max-width: 1140px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #15110d;
  --bg-elevated: #1e1812;
  --text: #f3ece2;
  --text-muted: #b6a999;
  --border: #322a21;
  --accent: #e8822f;
  --accent-2: #f0b24a;
  --accent-soft: #3a2a1a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.4), 0 16px 32px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15110d;
    --bg-elevated: #1e1812;
    --text: #f3ece2;
    --text-muted: #b6a999;
    --border: #322a21;
    --accent: #e8822f;
    --accent-2: #f0b24a;
    --accent-soft: #3a2a1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.4), 0 16px 32px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
}

/* Focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.brand span { color: var(--accent); }
.main-nav { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.main-nav a { color: var(--text); font-weight: 500; }
.main-nav a:hover { color: var(--accent); text-decoration: none; }

/* Split Nav (kokonutui-inspired pill nav, CSS/JS only — no React/Motion) */
.split-nav {
  gap: 2px;
  background: var(--text);
  border-radius: 999px;
  padding: 4px;
}
.split-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--bg) !important;
  opacity: 0.6;
  font-weight: 500;
  font-size: 0.92rem;
  white-space: nowrap;
  text-decoration: none !important;
  transition: opacity 0.15s ease, margin 0.2s ease;
}
.split-link:hover { opacity: 0.9; margin: 0 4px; }
.split-link:has(+ .split-link:hover) { margin-right: 4px; }
.split-link.is-active { opacity: 1; }
.split-dot {
  position: absolute;
  bottom: 5px;
  left: 50%;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-2);
  transform: translateX(-50%) scaleX(0);
  transition: transform 0.3s cubic-bezier(.23,1,.32,1);
}
.split-link.is-active .split-dot { transform: translateX(-50%) scaleX(1); }
@media (prefers-reduced-motion: reduce) {
  .split-link, .split-dot { transition: none; }
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.theme-toggle:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }

/* Hero */
.hero {
  padding: 72px 0 56px;
  background: linear-gradient(180deg, var(--accent-soft), transparent);
}
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 0 0 16px; letter-spacing: -0.02em; }
.hero p.lead { font-size: 1.15rem; color: var(--text-muted); max-width: 640px; margin: 0 0 28px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: var(--shadow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); text-decoration: none; }
.btn-ghost {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Hero: search + dot-field background (kokonutui "Dot Field" idea, CSS/JS only) */
.hero { position: relative; overflow: hidden; }
.hero .container { position: relative; z-index: 1; }
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--text) 1px, transparent 1.5px);
  background-size: 22px 22px;
  pointer-events: none;
}
.hero::before {
  opacity: 0.12;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 25%, transparent 75%);
}
.hero::after {
  background-image: radial-gradient(circle, var(--accent) 1.4px, transparent 2px);
  opacity: 0;
  transition: opacity 0.3s ease;
  -webkit-mask-image: radial-gradient(180px circle at var(--mx, 50%) var(--my, 50%), #000, transparent);
  mask-image: radial-gradient(180px circle at var(--mx, 50%) var(--my, 50%), #000, transparent);
}
.hero.is-tracking::after { opacity: 1; }

.hero-search {
  display: flex;
  gap: 10px;
  max-width: 560px;
  margin: 0 0 14px;
}
.hero-search input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow);
}
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 28px;
  font-size: 0.88rem;
}
.hero-chips-label { color: var(--text-muted); }
.chip {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.chip:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }

/* Home extras: 3-column grid, feature cards, quick answers */
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.section-cta { margin: 28px 0 0; text-align: center; }
.feature-num {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
}
.faq-list { max-width: 760px; display: grid; gap: 10px; }
.faq-list details {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 18px;
  transition: border-color 0.18s ease;
}
.faq-list details[open] { border-color: var(--accent); }
.faq-list summary {
  cursor: pointer;
  font-weight: 600;
  padding: 14px 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; color: var(--accent); font-size: 1.2rem; line-height: 1; }
.faq-list details[open] summary::after { content: "\2212"; }
.faq-list details p { margin: 0 0 16px; color: var(--text-muted); }

/* Sections */
section { padding: 56px 0; }
.section-title { font-size: 1.6rem; margin: 0 0 8px; }
.section-sub { color: var(--text-muted); margin: 0 0 32px; max-width: 640px; }

/* Card grid */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), var(--accent-soft), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.card:hover::before { opacity: 0.6; }
.card-thumb {
  display: block;
  width: calc(100% + 44px);
  margin: -22px -22px 16px;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card h3 { margin: 10px 0 8px; font-size: 1.05rem; }
.card p { color: var(--text-muted); margin: 0 0 12px; font-size: 0.95rem; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Library / search */
.library-toolbar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow);
}
.library-toolbar input[type="search"],
.library-toolbar select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.library-toolbar input[type="search"] { flex: 1 1 240px; }
.result-count { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 16px; }
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

.fav-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.fav-btn:hover { transform: scale(1.08); color: var(--accent); border-color: var(--accent); }
.fav-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* Article */
.article-header { padding: 48px 0 24px; border-bottom: 1px solid var(--border); }
.breadcrumbs { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 14px; }
.breadcrumbs a { color: var(--text-muted); }
.article-meta { color: var(--text-muted); font-size: 0.9rem; margin-top: 10px; }
.article-body { max-width: 808px; margin: 0 auto; padding: 40px 24px; }
.article-body h2 { margin-top: 2.2em; font-size: 1.4rem; }
.article-body table { width: 100%; border-collapse: collapse; margin: 1.5em 0; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.article-body th { background: var(--accent-soft); }
.article-body .faq dt { font-weight: 700; margin-top: 1.2em; }
.article-body .faq dd { margin: 0.3em 0 0; color: var(--text-muted); }
.sources { font-size: 0.9rem; color: var(--text-muted); }
.related { max-width: 808px; margin: 0 auto 60px; padding: 0 24px; }

.callout {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  margin: 1.6em 0;
}

/* Photo credits */
.media-figure { margin: 28px 0 0; }
.media-figure img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.media-figure figcaption,
.article-media figcaption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
}
.media-figure figcaption a,
.article-media figcaption a { color: var(--text-muted); }

/* Article header photo: smaller, fixed-ratio, never stretched full-width */
.article-media {
  max-width: 808px;
  margin: 28px auto 0;
  padding: 0 24px;
  box-sizing: border-box;
}
.article-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
@media (max-width: 640px) {
  .article-media img { aspect-ratio: 3 / 2; }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 48px 0 32px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 24px;
}
.footer-grid h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 0 0 12px; }
.footer-grid a { display: block; color: var(--text); padding: 4px 0; }
.footer-bottom { color: var(--text-muted); font-size: 0.85rem; border-top: 1px solid var(--border); padding-top: 20px; }

/* Forms */
form.contact-form { display: grid; gap: 16px; max-width: 520px; }
form.contact-form label { font-weight: 600; font-size: 0.9rem; }
form.contact-form input, form.contact-form textarea {
  font-family: inherit;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}
.form-note { color: var(--text-muted); font-size: 0.85rem; }

@media (max-width: 640px) {
  .site-header .container { flex-wrap: wrap; min-height: auto; padding: 10px 24px; }
  .main-nav { order: 3; width: 100%; justify-content: center; gap: 14px; padding-bottom: 10px; font-size: 0.9rem; }
  .hero { padding: 48px 0 40px; }
}
