/* SeePlate / ChefBear — Static Site Stylesheet
   Design tokens aligned with the Flutter app's classical palette.
   Fonts: Noto Serif (display, italic accents) + Plus Jakarta Sans (body).
*/

/* ── Google Fonts ────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ── CSS Variables ───────────────────────────────────────── */
:root {
  /* palette – light */
  --primary:            #3a2d2d;
  --secondary:          #7c5730;
  --tertiary:           #544436;
  --ink-green:          #465A52;
  --ink-green-tint:     #E8F0EC;

  --text-primary:       #1b1c19;
  --text-secondary:     #504441;
  --text-tertiary:      #8a7e79;

  --bg-page:            #fbf9f4;
  --bg-card:            #ffffff;
  --bg-components:      #f0eee9;
  --bg-hero:            #f5f3ee;

  --border-color:       #d4c3be;
  --divider:            #E4E2DD;

  --success:            #4CAF50;
  --warning:            #FF9800;
  --error:              #E53935;

  /* radii */
  --radius-card:        28px;
  --radius-inner:       16px;
  --radius-pill:        999px;

  /* shadows */
  --shadow-card:        0 4px 20px rgba(0,0,0,.08);
  --shadow-float:       0 8px 40px rgba(0,0,0,.12);

  /* fonts */
  --font-display:       'Noto Serif', 'Songti SC', 'STSong', Georgia, serif;
  --font-body:          'Plus Jakarta Sans', 'PingFang SC', 'Heiti SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* spacing */
  --page-pad:           24px;
  --section-gap:        48px;
}

/* ── Dark mode — system preference ──────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary:          #d6c2c1;
    --secondary:        #eebd8e;
    --tertiary:         #d9c2b0;

    --text-primary:     #f2f1ec;
    --text-secondary:   #a89e99;
    --text-tertiary:    #787069;

    --bg-page:          #1b1c19;
    --bg-card:          #30312e;
    --bg-components:    #2d2b28;
    --bg-hero:          #252422;

    --border-color:     #4a4340;
    --divider:          #3a3835;

    --shadow-card:      0 4px 20px rgba(0,0,0,.25);
    --shadow-float:     0 8px 40px rgba(0,0,0,.35);
  }
}

/* ── Dark mode — manual toggle ─────────────────────────── */
:root[data-theme="dark"] {
  --primary:          #d6c2c1;
  --secondary:        #eebd8e;
  --tertiary:         #d9c2b0;

  --text-primary:     #f2f1ec;
  --text-secondary:   #a89e99;
  --text-tertiary:    #787069;

  --bg-page:          #1b1c19;
  --bg-card:          #30312e;
  --bg-components:    #2d2b28;
  --bg-hero:          #252422;

  --border-color:     #4a4340;
  --divider:          #3a3835;

  --shadow-card:      0 4px 20px rgba(0,0,0,.25);
  --shadow-float:     0 8px 40px rgba(0,0,0,.35);
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.7;
}

a { color: var(--secondary); text-decoration: none; transition: opacity .2s; }
a:hover { opacity: .75; }

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

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.25; }

h1 { font-size: 2.4rem; font-style: italic; letter-spacing: -.02em; }
h2 { font-size: 1.6rem; margin-top: var(--section-gap); margin-bottom: 16px; color: var(--primary); }
h3 { font-size: 1.15rem; margin-top: 28px; margin-bottom: 10px; color: var(--tertiary); }
h4 { font-size: 1rem; margin-top: 20px; margin-bottom: 8px; }

p, li { margin-bottom: .6em; color: var(--text-secondary); }

ul, ol { padding-left: 1.4em; }

strong { color: var(--text-primary); font-weight: 600; }

/* section label — small caps above headings */
.section-label {
  font-family: var(--font-body);
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--secondary);
  display: block;
  margin-bottom: 6px;
}

/* italic serif accent */
.serif-accent {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
}

/* ── Layout ──────────────────────────────────────────────── */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

.container-wide {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251,249,244,.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--divider);
  padding: 14px 0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .navbar { background: rgba(27,28,25,.82); }
}
:root[data-theme="dark"] .navbar { background: rgba(27,28,25,.82); }
:root[data-theme="light"] .navbar { background: rgba(251,249,244,.82); }

.navbar .container-wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}

.navbar-links { display: flex; gap: 24px; align-items: center; }
.navbar-links a {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.navbar-links a:hover { color: var(--primary); opacity: 1; }

/* mobile nav toggle */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text-primary); margin: 5px 0;
  transition: .3s;
}

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .navbar-links {
    display: none; flex-direction: column; gap: 0;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--divider);
    box-shadow: var(--shadow-card);
  }
  .navbar-links.open { display: flex; }
  .navbar-links a { padding: 14px var(--page-pad); border-bottom: 1px solid var(--divider); width: 100%; }
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 80px var(--page-pad) 64px;
  background: var(--bg-hero);
  border-bottom: 1px solid var(--divider);
}
.hero h1 { margin-bottom: 16px; }
.hero p {
  font-size: 1.05rem;
  color: var(--text-tertiary);
  max-width: 520px;
  margin: 0 auto;
}

/* ── Legal page header ───────────────────────────────────── */
.legal-header {
  padding: 56px var(--page-pad) 40px;
  background: var(--bg-hero);
  border-bottom: 1px solid var(--divider);
}
.legal-header h1 { margin-bottom: 8px; font-size: 2rem; }
.legal-header .meta {
  font-size: .85rem;
  color: var(--text-tertiary);
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  padding: 32px;
  margin-bottom: 24px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

/* ── Region selector ─────────────────────────────────────── */
.region-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 32px 0;
}
.region-selector a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: .85rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: var(--bg-card);
  transition: all .2s;
}
.region-selector a:hover,
.region-selector a.active {
  background: var(--primary);
  color: var(--bg-page);
  border-color: var(--primary);
  opacity: 1;
}

/* ── Legal body ──────────────────────────────────────────── */
.legal-body {
  padding: 40px 0 80px;
}
.legal-body h2:first-child { margin-top: 0; }

.legal-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: .9rem;
}
.legal-body th, .legal-body td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider);
}
.legal-body th {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-components);
}

.highlight-box {
  background: var(--bg-components);
  border-left: 3px solid var(--secondary);
  padding: 16px 20px;
  border-radius: 0 var(--radius-inner) var(--radius-inner) 0;
  margin: 20px 0;
}
.highlight-box p { margin-bottom: 0; }

/* ── Support page ────────────────────────────────────────── */
.support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 32px;
}
.support-card {
  text-align: center;
  padding: 40px 24px;
}
.support-card .icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px;
  background: var(--ink-green-tint);
  color: var(--ink-green);
  font-size: 1.5rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .support-card .icon { background: rgba(143,163,150,.15); color: var(--secondary); }
}
:root[data-theme="dark"] .support-card .icon { background: rgba(143,163,150,.15); color: var(--secondary); }
.support-card h3 { margin-top: 0; color: var(--text-primary); font-size: 1.1rem; }
.support-card p { font-size: .9rem; }

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--divider);
  padding: 32px 0 40px;
  text-align: center;
  font-size: .8rem;
  color: var(--text-tertiary);
}
.footer a { color: var(--text-tertiary); }
.footer-links { display: flex; gap: 20px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }

/* ── Utility ─────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── App Store Button ────────────────────────────────────── */
.hero-cta {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.app-store-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff !important;
  font-size: .95rem;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 4px 16px rgba(58,45,45,.25);
}
.app-store-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(58,45,45,.35);
  opacity: 1;
}
.app-store-btn .apple-logo { flex-shrink: 0; }
.app-store-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  text-align: left;
}
.app-store-text small {
  font-size: .65rem;
  font-weight: 400;
  letter-spacing: .3px;
  opacity: .85;
  color: #fff;
  margin-bottom: 0;
}
.app-store-text strong {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.hero-tagline {
  font-size: .85rem;
  color: var(--text-tertiary);
  font-style: italic;
  font-family: var(--font-display);
  margin: 0;
}

/* ── Download Banner ─────────────────────────────────────── */
.download-banner {
  background: var(--primary);
  padding: 48px var(--page-pad);
}
.download-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.download-banner-text h2 {
  color: #fff;
  font-style: italic;
}
.download-banner-text p {
  color: rgba(255,255,255,.8);
  margin-bottom: 0;
}
.app-store-btn--light {
  background: #fff;
  color: var(--primary) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.app-store-btn--light .apple-logo { color: var(--primary); }
.app-store-btn--light .app-store-text small { color: var(--text-tertiary); }
.app-store-btn--light .app-store-text strong { color: var(--primary); }
.app-store-btn--light:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,.2);
}

@media (max-width: 640px) {
  .download-banner-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* ── Language Grid ───────────────────────────────────────── */
.lang-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
}
.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: transform .15s, box-shadow .15s;
}
.lang-pill:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.lang-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink-green);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .5px;
  flex-shrink: 0;
}

/* ── CJK font tuning ────────────────────────────────────── */
:lang(zh-Hans), :lang(zh-CN) { font-family: var(--font-body); }
:lang(zh-Hant), :lang(zh-TW), :lang(zh-HK) { font-family: var(--font-body); }
:lang(fr) { font-family: var(--font-body); }

/* ── Print ───────────────────────────────────────────────── */
@media print {
  .navbar, .footer, .region-selector { display: none; }
  body { background: #fff; color: #000; }
  .legal-header { background: none; border: none; padding-top: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
