/* ai-daybook — public site. Warm editorial "daybook" aesthetic, extending the
   Mini App's coral brand tokens (frontend/src/theme/tokens.css) into a marketing
   surface. Self-contained: one stylesheet, fonts from Google Fonts, no build step. */

:root {
  /* Brand tokens mirror the Mini App's design tokens in
     frontend/src/theme/tokens.css. The two surfaces are served by different
     mechanisms (this is static CSS at the root; the SPA is a Vite bundle at /app),
     so they can't share one file without a build bridge — keep them in sync by hand
     on any rebrand. This is the only intentional cross-surface duplication. */

  /* surfaces — warm paper */
  --page: #FBE4DC;          /* peach, matches the Mini App page */
  --paper: #FFFCFA;
  --surface: #FFFFFF;
  --card-warm: #FBF1EC;

  /* ink */
  --ink: #1F2430;
  --ink-soft: #59606E;
  --muted: #94908C;
  --hairline: #EFE2DB;
  --hairline-strong: #E4D2C9;

  /* accent — coral */
  --accent: #E8836A;
  --accent-deep: #CF6045;
  --accent-wash: #FBE0D7;

  /* domain threads (from the Mini App domain palette) */
  --meal: #E8836A;
  --workout: #7FB45A;
  --planning: #5C84C4;
  --medication: #EFB13C;
  --event: #C76B86;
  --inventory: #A9794F;
  --thought: #5FA89B;

  /* macro chips */
  --protein: #5C84C4;
  --fat: #EFB13C;
  --carbs: #7FB45A;

  --radius-pill: 999px;
  --radius-card: 20px;
  --radius-sheet: 28px;

  --shadow-sm: 0 1px 2px rgba(31, 36, 48, 0.05);
  --shadow-card: 0 2px 6px rgba(31, 36, 48, 0.06), 0 14px 38px -22px rgba(207, 96, 69, 0.32);
  --shadow-float: 0 18px 60px -28px rgba(31, 36, 48, 0.34);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Hanken Grotesk", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Spline Sans Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --maxw: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Warm atmosphere: soft coral/amber gradient blooms + a faint paper grain overlay.
   Fixed so it stays put while the page scrolls. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 50% at 78% -8%, rgba(239, 177, 60, 0.28), transparent 70%),
    radial-gradient(55% 45% at 8% 4%, rgba(232, 131, 106, 0.26), transparent 68%),
    radial-gradient(80% 60% at 50% 120%, rgba(95, 168, 155, 0.12), transparent 70%);
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- type ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 500;
}
h1, h2, h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 560;
  line-height: 1.04;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 0;
}
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
h2 { font-size: clamp(2rem, 3.6vw, 2.9rem); }
h3 { font-size: 1.22rem; letter-spacing: -0.006em; }
p { margin: 0 0 1rem; color: var(--ink-soft); }
.lead { font-size: clamp(1.08rem, 1.6vw, 1.32rem); color: var(--ink-soft); max-width: 46ch; }
em.ink { font-style: italic; color: var(--accent-deep); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.97rem;
  padding: 0.78rem 1.35rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 22px -10px rgba(207, 96, 69, 0.7);
}
.btn-primary:hover { background: var(--accent-deep); transform: translateY(-2px); box-shadow: 0 14px 30px -12px rgba(207, 96, 69, 0.75); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--hairline-strong);
  color: var(--ink);
}
.btn-ghost:hover { background: #fff; transform: translateY(-2px); }

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(1.4) blur(12px);
  background: rgba(251, 228, 220, 0.72);
  border-bottom: 1px solid rgba(228, 210, 201, 0.6);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; }
.brand .mark { width: 30px; height: 30px; flex: none; }
.brand .word { font-family: var(--font-display); font-weight: 600; font-size: 1.18rem; letter-spacing: -0.01em; }
.brand .word b { color: var(--accent-deep); font-weight: 600; }
.nav-links { display: flex; align-items: center; gap: 1.6rem; }
.nav-links a.link { font-size: 0.95rem; color: var(--ink-soft); font-weight: 500; transition: color 0.15s ease; }
.nav-links a.link:hover { color: var(--ink); }
.nav-cta { display: flex; align-items: center; gap: 0.8rem; }

/* ---------- hero ---------- */
.hero { padding: clamp(3rem, 7vw, 6rem) 0 clamp(3rem, 5vw, 5rem); }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero h1 { margin-top: 1.1rem; }
.hero h1 .swash { font-style: italic; color: var(--accent-deep); }
.hero .lead { margin-top: 1.4rem; }
.hero-actions { margin-top: 2rem; display: flex; gap: 0.8rem; flex-wrap: wrap; }
.hero-note {
  margin-top: 1.4rem; font-size: 0.86rem; color: var(--muted);
  font-family: var(--font-mono); letter-spacing: 0.01em;
}

/* reveal-on-load */
.reveal { opacity: 0; transform: translateY(14px); animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- daybook card (hero visual) ---------- */
.daybook {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sheet);
  box-shadow: var(--shadow-float);
  padding: 1.4rem 1.4rem 1.6rem;
  position: relative;
  transform: rotate(-1.3deg);
}
.daybook::before {
  /* a second "page" peeking behind for depth */
  content: "";
  position: absolute;
  inset: 10px -10px -14px 14px;
  background: var(--card-warm);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sheet);
  z-index: -1;
  transform: rotate(2.4deg);
}
.daybook-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.4rem; }
.daybook-date { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; }
.daybook-day { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

.kcal-row { display: flex; align-items: center; gap: 0.9rem; padding: 0.7rem 0 0.9rem; border-bottom: 1px dashed var(--hairline-strong); margin-bottom: 0.6rem; }
.kcal-ring { width: 56px; height: 56px; flex: none; }
.kcal-ring .track { fill: none; stroke: var(--accent-wash); stroke-width: 7; }
.kcal-ring .arc {
  fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: center;
  stroke-dasharray: 100;
  animation: kcal-draw 1s 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes kcal-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 36; } }
.kcal-meta b { font-family: var(--font-display); font-size: 1.34rem; font-weight: 600; color: var(--ink); }
.kcal-meta span { display: block; font-size: 0.78rem; color: var(--muted); }
.macros { display: flex; gap: 0.5rem; margin-left: auto; }
.macro { text-align: center; font-family: var(--font-mono); }
.macro i { display: block; width: 34px; height: 5px; border-radius: 3px; margin-bottom: 5px; }
.macro b { font-size: 0.82rem; font-weight: 500; color: var(--ink); font-style: normal; }
.macro span { font-size: 0.64rem; color: var(--muted); }

/* timeline entries */
.entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.entry {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 14px;
  background: var(--card-warm);
  border-left: 3px solid var(--thread, var(--accent));
  opacity: 0;
  animation: slidein 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes slidein { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.entry .time { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); }
.entry .body { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.entry .ico { font-size: 1.05rem; flex: none; }
.entry .txt { font-size: 0.92rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .tag { margin-left: auto; font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--thread); flex: none; }

/* ---------- sections ---------- */
section { position: relative; }
.section-pad { padding: clamp(3.4rem, 6vw, 5.5rem) 0; }
.section-head { max-width: 40ch; margin-bottom: 2.6rem; }
.section-head .eyebrow { display: block; margin-bottom: 0.9rem; }
.section-head p { margin-top: 0.9rem; }
.divider-rule { height: 1px; background: linear-gradient(90deg, transparent, var(--hairline-strong), transparent); border: 0; }

/* domain grid */
.grid-domains { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.domain-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: 1.3rem 1.3rem 1.4rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.domain-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--thread, var(--accent));
}
.domain-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.domain-ico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.3rem; margin-bottom: 0.9rem;
  background: color-mix(in srgb, var(--thread) 16%, white);
}
.domain-card h3 { margin-bottom: 0.35rem; }
.domain-card p { font-size: 0.95rem; margin: 0; }

/* how it works */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; counter-reset: step; }
.step { position: relative; padding-top: 0.4rem; }
.step .num {
  font-family: var(--font-display); font-size: 2.4rem; font-weight: 600; color: var(--accent);
  line-height: 1; display: block; margin-bottom: 0.7rem;
}
.step h3 { margin-bottom: 0.4rem; }
.step p { font-size: 0.96rem; margin: 0; }
.step::after {
  content: ""; position: absolute; top: 1.4rem; right: -0.9rem; width: 1.4rem; height: 1px;
  background: var(--hairline-strong);
}
.step:last-child::after { display: none; }

/* principles / privacy-forward band */
.care {
  background: linear-gradient(180deg, var(--paper), #fff);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sheet);
  padding: clamp(2rem, 4vw, 3rem);
  box-shadow: var(--shadow-card);
}
.care-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.care-list { list-style: none; margin: 1.4rem 0 0; padding: 0; display: grid; gap: 1rem; }
.care-list li { display: grid; grid-template-columns: 26px 1fr; gap: 0.7rem; align-items: start; }
.care-list .ck { color: var(--workout); font-weight: 700; font-size: 1.05rem; line-height: 1.5; }
.care-list b { color: var(--ink); font-weight: 600; }
.care-list span { color: var(--ink-soft); font-size: 0.96rem; }

/* CTA strip */
.cta {
  text-align: center;
  background: radial-gradient(120% 140% at 50% -20%, rgba(232,131,106,0.18), transparent 60%);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sheet);
  padding: clamp(2.6rem, 5vw, 4rem) 1.5rem;
}
.cta h2 { margin-bottom: 0.8rem; }
.cta .lead { margin: 0 auto 1.8rem; }
.cta .hero-actions { justify-content: center; }

/* ---------- footer ---------- */
.foot { padding: 3rem 0 2.4rem; border-top: 1px solid var(--hairline); margin-top: clamp(2rem, 5vw, 4rem); }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 1.6rem; }
.foot h4 { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.9rem; font-weight: 500; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.foot a { color: var(--ink-soft); font-size: 0.95rem; }
.foot a:hover { color: var(--accent-deep); }
.foot .tagline { color: var(--ink-soft); font-size: 0.95rem; max-width: 30ch; margin: 0.8rem 0 0; }
.foot-bottom { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 2.4rem; padding-top: 1.4rem; border-top: 1px solid var(--hairline); flex-wrap: wrap; }
.foot-bottom small { color: var(--muted); font-size: 0.82rem; font-family: var(--font-mono); }

/* ---------- prose (privacy / terms) ---------- */
.prose-wrap { max-width: 760px; margin: 0 auto; padding: clamp(2.6rem, 5vw, 4rem) 24px clamp(2rem, 4vw, 3rem); }
.prose-head { margin-bottom: 2.2rem; padding-bottom: 1.6rem; border-bottom: 1px solid var(--hairline-strong); }
.prose-head h1 { font-size: clamp(2.2rem, 4.5vw, 3.2rem); }
.prose-head .updated { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); margin-top: 1rem; letter-spacing: 0.03em; }
.toc {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-card);
  padding: 1.1rem 1.3rem; margin-bottom: 2.4rem; box-shadow: var(--shadow-sm);
}
.toc h4 { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.7rem; }
.toc ol { margin: 0; padding-left: 1.2rem; columns: 2; column-gap: 1.6rem; }
.toc li { margin-bottom: 0.35rem; }
.toc a { color: var(--ink-soft); font-size: 0.92rem; }
.toc a:hover { color: var(--accent-deep); }
.prose { background: var(--paper); border: 1px solid var(--hairline); border-radius: var(--radius-sheet); padding: clamp(1.6rem, 4vw, 2.6rem); box-shadow: var(--shadow-sm); }
.prose section { scroll-margin-top: 84px; }
.prose section + section { margin-top: 2rem; }
.prose h2 { font-size: 1.4rem; margin-bottom: 0.7rem; display: flex; align-items: baseline; gap: 0.6rem; }
.prose h2 .n { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-deep); font-weight: 500; }
.prose h3 { font-size: 1.04rem; margin: 1.2rem 0 0.4rem; }
.prose p, .prose li { color: var(--ink-soft); font-size: 0.98rem; }
.prose ul { padding-left: 1.2rem; margin: 0.4rem 0 1rem; }
.prose li { margin-bottom: 0.4rem; }
.prose a.inline { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }
.prose strong { color: var(--ink); }
.callout {
  background: var(--accent-wash); border: 1px solid var(--hairline-strong);
  border-left: 4px solid var(--accent); border-radius: 12px; padding: 0.9rem 1.1rem; margin: 1rem 0;
}
.callout p { margin: 0; color: var(--ink); font-size: 0.94rem; }
.backlink { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent-deep); margin-bottom: 1.4rem; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .daybook { transform: rotate(-1deg); margin-top: 1rem; max-width: 460px; }
  .grid-domains { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .step::after { display: none; }
  .care-grid { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .nav-links .link { display: none; }
  .toc ol { columns: 1; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .grid-domains { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; }
  .macros { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
  .reveal, .entry { opacity: 1 !important; transform: none !important; }
}
