/* ============================================================
   DietPattern — site.css
   Styling for the static content pages (/tools, /guides).
   Matches the app's brand tokens in assets/css/app.css:
   light slate surfaces, Outfit type, blue/indigo/green accents.
   ============================================================ */

:root {
  --bg: #f0f4f8;
  --ink: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --blue: #2563eb;
  --indigo: #4f46e5;
  --green: #16a34a;
  --rose: #e11d48;
  --amber: #d97706;
  --shadow: 0 20px 50px rgba(15, 23, 42, .11);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Outfit, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(37, 99, 235, .4); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.container-readable { max-width: 820px; }

/* ── Header ─────────────────────────────────────────────────── */
.site-top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(240, 244, 248, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand svg { width: 44px; height: 24px; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
  padding: 8px 14px; border-radius: 999px; color: var(--muted);
  font-weight: 600; font-size: .93rem;
}
.site-nav a:hover { color: var(--ink); background: rgba(255,255,255,.85); text-decoration: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 22px; border: none; border-radius: 999px;
  font-weight: 700; font-size: .95rem; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--blue), var(--indigo)); color: #fff; box-shadow: 0 10px 24px rgba(37, 99, 235, .25); }
.btn.light { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.light:hover { border-color: #cbd5e1; }

/* ── Page hero ──────────────────────────────────────────────── */
.page-hero { padding: 64px 0 40px; text-align: center; }
.page-hero .eyebrow {
  display: inline-block; padding: 6px 16px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 18px;
}
.page-hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); line-height: 1.12; letter-spacing: -.03em; margin: 0 0 14px; font-weight: 800; }
.page-hero .gradient-text { background: linear-gradient(100deg, var(--blue), var(--indigo)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-hero p { color: var(--muted); font-size: 1.08rem; max-width: 640px; margin: 0 auto; }

/* ── Cards ──────────────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 24px 0 40px; }
.content-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; color: var(--ink); text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease;
}
a.content-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.icon-box {
  width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: #eff6ff;
}
.content-card h2, .content-card h3 { margin: 4px 0 0; font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }
.content-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.content-card .card-cta { margin-top: auto; padding-top: 8px; color: var(--blue); font-weight: 700; font-size: .9rem; }
.card-tag {
  align-self: flex-start; padding: 4px 12px; border-radius: 999px;
  background: #f0fdf4; color: var(--green); font-size: .72rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
}

/* ── Tool panel ─────────────────────────────────────────────── */
.tool-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); padding: 30px; margin: 8px 0 30px;
}
.tool-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 30px; align-items: start; }
.tool-inputs h2, .tool-results h2 { font-size: 1.05rem; margin: 0 0 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: .88rem; font-weight: 600; color: var(--ink); }
.field .hint { font-size: .78rem; color: var(--muted); }
.field input, .field select {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg {
  display: flex; gap: 5px; background: var(--bg); border-radius: 12px; padding: 5px;
}
.seg button {
  flex: 1; min-height: 42px; border: none; border-radius: 9px; background: none;
  font-weight: 600; color: var(--muted); font-size: .9rem;
}
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(15, 23, 42, .08); }
.tool-results {
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 22px;
}
.result-hero {
  text-align: center; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 20px 14px; margin-bottom: 14px;
}
.result-hero .amount { font-size: 2.15rem; font-weight: 800; letter-spacing: -.02em; color: var(--blue); line-height: 1.15; font-variant-numeric: tabular-nums; }
.result-hero .label { font-size: .8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.result-hero .sub { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.result-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .93rem;
}
.result-row:last-child { border-bottom: none; }
.result-row span { color: var(--muted); }
.result-row strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bmi-scale { display: flex; height: 12px; border-radius: 999px; overflow: hidden; margin: 14px 0 4px; }
.bmi-scale div { height: 100%; }
.bmi-marker-track { position: relative; height: 18px; }
.bmi-marker {
  position: absolute; top: 0; transform: translateX(-50%);
  width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-bottom: 9px solid var(--ink); transition: left .4s cubic-bezier(.2,.8,.2,1);
}
.tool-note { font-size: .8rem; color: var(--muted); margin-top: 12px; line-height: 1.55; }

/* ── Article prose ──────────────────────────────────────────── */
.article {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 38px 42px; margin-bottom: 26px;
}
.article h2 { font-size: 1.4rem; letter-spacing: -.02em; margin: 30px 0 10px; }
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: 1.08rem; margin: 22px 0 8px; }
.article p { color: #334155; line-height: 1.8; margin: 0 0 13px; }
.article ul, .article ol { margin: 0 0 15px; padding-left: 22px; color: #334155; }
.article li { margin-bottom: 7px; line-height: 1.7; }
.article strong { color: var(--ink); }
.article table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .92rem; }
.article th, .article td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.article th { color: var(--muted); font-weight: 600; background: var(--bg); white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.table-wrap table { margin: 0; }
.callout {
  background: #eff6ff; border: 1px solid #bfdbfe; border-left: 4px solid var(--blue);
  border-radius: 12px; padding: 14px 18px; margin: 18px 0;
}
.callout.green { background: #f0fdf4; border-color: #bbf7d0; border-left-color: var(--green); }
.callout p { margin: 0; font-size: .93rem; }

/* ── CTA panel ──────────────────────────────────────────────── */
.cta-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  border-radius: 20px; padding: 30px 34px; color: #fff; margin: 26px 0 40px;
}
.cta-panel h2 { margin: 0 0 6px; font-size: 1.3rem; letter-spacing: -.01em; }
.cta-panel p { margin: 0; color: rgba(255, 255, 255, .85); font-size: .95rem; }
.cta-panel .btn { background: #fff; color: var(--blue); }
.related-links { display: flex; gap: 12px; flex-wrap: wrap; padding-bottom: 48px; }

/* ── Footer ─────────────────────────────────────────────────── */
.site-bottom { border-top: 1px solid var(--line); background: #fff; padding: 28px 0 34px; margin-top: 20px; }
.site-bottom-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.site-bottom-links { display: flex; gap: 4px 18px; flex-wrap: wrap; }
.site-bottom a { color: var(--muted); font-size: .88rem; }
.site-bottom a:hover { color: var(--ink); }
.site-bottom p { margin: 0; color: var(--muted); font-size: .85rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .site-nav a:not(.btn) { display: none; }
  .page-hero { padding: 42px 0 28px; }
  .card-grid { grid-template-columns: 1fr; padding-bottom: 28px; }
  .tool-panel { padding: 20px; }
  .article { padding: 24px 20px; }
  .cta-panel { padding: 24px; }
  .field-row { grid-template-columns: 1fr; }
  .result-hero .amount { font-size: 1.8rem; }
}
