/* caloriemama.ai — the only stylesheet.
   Direction: a viewfinder. White ground, cool neutral greys, the brand orange
   only where something happens (actions, the best match, the frame corners). */

:root {
  --bg: #ffffff;
  --surface: #f3f5f8;
  --surface-2: #e7ebf0;
  --line: #d6dce4;
  --ink: #14181f;
  --ink-2: #5b6572;
  --ink-3: #8a94a3;
  --accent: #f26b1d;
  --accent-ink: #c4500c;
  --ok: #1f8a4c;
  --bad: #c0392b;
  --code-bg: #f3f5f8;
  --display: "Sora", "Manrope", "Helvetica Neue", Arial, sans-serif;
  --body: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161a21;
    --surface-2: #1f2530;
    --line: #2a313c;
    --ink: #eef1f5;
    --ink-2: #a2abb8;
    --ink-3: #6f7987;
    --accent: #ff8a3d;
    --accent-ink: #ffa76b;
    --ok: #4cc37f;
    --bad: #ff7b6e;
    --code-bg: #12161c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  font-feature-settings: "tnum";
}
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; text-wrap: balance; letter-spacing: -.02em; }
h1 { font-size: clamp(34px, 4.8vw, 54px); font-weight: 700; }
h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 600; margin-bottom: 16px; }
h3 { font-size: 19px; font-weight: 600; margin-bottom: 6px; letter-spacing: -.01em; }
p { margin: 0 0 14px; }
ul, ol { margin: 0 0 14px; padding-left: 1.2em; }
li { margin-bottom: 5px; }
li::marker { color: var(--ink-3); }
.lede { font-size: 20px; line-height: 1.45; color: var(--ink-2); max-width: 58ch; }
.prose { max-width: 66ch; }
.fine { font-size: 13.5px; color: var(--ink-2); }
code, pre { font-family: var(--mono); font-size: .88em; }
code { background: var(--code-bg); border: 1px solid var(--line); padding: .05em .35em; border-radius: 4px; }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; margin: 0 0 16px; line-height: 1.5; }
pre code { background: none; border: 0; padding: 0; }
table { border-collapse: collapse; width: 100%; font-size: 15.5px; margin-bottom: 20px; }
th, td { text-align: left; vertical-align: top; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--line); }
th { font-weight: 600; color: var(--ink-2); font-size: 13.5px; }
td.k { white-space: nowrap; font-family: var(--mono); font-size: .88em; }
.tbl-scroll { overflow-x: auto; }
.tbl-scroll table { min-width: 560px; }

/* Layout */
.wrap { max-width: 1120px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 40px); }
main.wrap { padding-block: 8px 72px; }
section { padding-block: 40px 16px; }
section + section { border-top: 1px solid var(--line); }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 48px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px 32px; }
@media (max-width: 760px) {
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
}

/* Buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15.5px;
  padding: 11px 18px;
  border: 0;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--body);
  line-height: 1.2;
  letter-spacing: .01em;
}
.btn:hover { background: var(--accent-ink); color: #fff; }
.btn.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.secondary:hover { border-color: var(--ink); color: var(--ink); background: transparent; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  gap: 8px 28px;
  flex-wrap: wrap;
  padding-block: 16px;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 15px; padding: 6px 10px; border-radius: 6px; }
.site-nav a:hover { color: var(--ink); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.stores { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.stores img { height: 34px; width: auto; }          /* official badges carry their own frame; never restyle them */
.stores.big { margin-left: 0; gap: 12px; }
.stores.big img { height: 48px; }
@media (max-width: 760px) {
  .site-header .stores { display: none; }
  .site-nav a { padding: 6px 8px; }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 28px 40px;
  font-size: 14.5px;
  color: var(--ink-2);
  display: grid;
  gap: 12px 40px;
  grid-template-columns: 1fr auto;
  align-items: center;
}
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer nav a { color: var(--ink-2); }
.site-footer .stores { margin-left: 0; grid-column: 2; grid-row: 1 / 3; }
.site-footer p { margin: 0; }
@media (max-width: 760px) {
  .site-footer { grid-template-columns: 1fr; }
  .site-footer .stores { grid-column: 1; grid-row: auto; }
}

/* Demo component */
.demo { display: grid; gap: 24px 40px; grid-template-columns: 1fr 1fr; align-items: start; }
/* Row 2 is flexible so the row-spanning result column never pushes the photo down. */
.demo:not(.has-intro) { grid-template-areas: "drop result" "photo result" "samples samples"; grid-template-rows: auto 1fr auto; }
.demo .intro { grid-area: intro; }
.demo .drop { grid-area: drop; }
.demo .photo { grid-area: photo; }
.demo .result-col { grid-area: result; min-width: 0; }
.demo .samples { grid-area: samples; }
@media (max-width: 760px) {
  .demo:not(.has-intro) { grid-template-columns: 1fr; grid-template-areas: "drop" "photo" "result" "samples"; }
}

/* Home: the answer first. Intro beside a card that shows a photo and what came back;
   the "try it yourself" row sits underneath. */
.demo.has-intro { grid-template-columns: 1fr 1.15fr; grid-template-areas: "intro showcase" "drop samples"; gap: 32px 40px; }
.demo.has-intro .showcase { grid-area: showcase; }
.demo.has-intro .drop { align-self: stretch; align-content: center; }
.showcase .items li { font-size: 14px; gap: 10px; }
.showcase .items .serving { white-space: nowrap; }
.showcase .items .kcal { min-width: 4.6em; }
.showcase { display: grid; grid-template-columns: 34% 1fr; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; align-items: start; }
.showcase .photo { grid-area: auto; }
.showcase .result-col { grid-area: auto; }
.showcase .result { background: none; border: 0; padding: 0; }
.showcase .result-head { padding-top: 4px; }
.showcase .photo::before { inset: 10px 10px auto; --l: 20px; }
.showcase .photo figcaption { font-size: 12.5px; }
.showcase .status:empty { display: none; }
@media (max-width: 900px) {
  .demo.has-intro { grid-template-columns: 1fr; grid-template-areas: "intro" "showcase" "drop" "samples"; }
}
@media (max-width: 560px) {
  .showcase { grid-template-columns: 1fr; }
  /* Landscape crop on phones so the photo and the answer share the first screen. */
  .showcase .photo img, .showcase .photo::before { aspect-ratio: 16 / 9; }
}
.kicker { font-weight: 600; color: var(--ink-2); font-size: 14.5px; margin: 0 0 10px; }
.intro h1 { margin-bottom: 14px; }
.intro .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.drop {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px 22px;
  text-align: center;
  display: grid;
  gap: 10px;
  justify-items: center;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop:focus-within { border-color: var(--ink-3); }
.drop.active { border-color: var(--accent); background: var(--surface-2); }
.drop-title { font-family: var(--display); font-weight: 600; font-size: 19px; margin: 0; letter-spacing: -.01em; }
.drop .fine { margin: 0; max-width: 40ch; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.btn:has(.file-input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

/* The photo sits in a viewfinder: four corner brackets, like the app's camera. */
.photo { margin: 0; position: relative; }
.photo img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius); background: var(--surface); }
.photo::before {
  content: "";
  position: absolute;
  inset: 12px 12px auto;
  aspect-ratio: 1 / 1; /* matches the square image, not the caption below it */
  pointer-events: none;
  --c: var(--accent);
  --l: 26px;
  --t: 3px;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) top left / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--t) var(--l) no-repeat;
}
.photo:has(img[hidden])::before { display: none; }
.photo figcaption { font-size: 13.5px; color: var(--ink-2); margin-top: 10px; }

.status { min-height: 1.5em; font-weight: 600; margin: 0 0 8px; color: var(--ink-2); }
.status.error { color: var(--bad); }
.status.busy::after { content: ""; display: inline-block; width: .6em; height: .6em; margin-left: .5em; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status.busy::after { animation: none; } .drop { transition: none; } }

.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px 14px; }
.result:empty { display: none; }
.result-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 12px 0 10px; border-bottom: 1px solid var(--line); }
.result-verdict { font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -.01em; }
.result-verdict.no { color: var(--ink-2); }
.result-time { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.groups { list-style: none; padding: 0; margin: 0; }
.group { border-bottom: 1px solid var(--line); }
.group:last-child { border-bottom: 0; }
.group-head {
  width: 100%; background: none; border: 0; padding: 11px 0; cursor: pointer; text-align: left;
  display: grid; grid-template-columns: 1fr 88px 34px; gap: 12px; align-items: center;
  font: inherit; color: inherit; border-radius: 4px;
}
.group-head .name { font-weight: 700; }
.group-head .name small { display: block; font-weight: 500; color: var(--ink-2); font-size: 13px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink-3); border-radius: 3px; }
.group.top .bar i { background: var(--accent); }
.score-num { text-align: right; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.macros { margin: 0 0 8px; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.group:not(.open) .macros { display: none; }
.items { list-style: none; padding: 0 0 10px; margin: 0; }
.group:not(.open) .items { display: none; }
.items li { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; font-size: 15px; margin: 0; padding: 4px 0; }
.items .serving { color: var(--ink-2); }
.items .kcal { min-width: 5.5em; text-align: right; font-weight: 600; }
.score-note { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; }
details.raw { margin-top: 12px; font-size: 14px; }
details.raw summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
details.raw pre { margin-top: 8px; max-height: 320px; font-size: 12.5px; }

.samples-title { font-weight: 600; margin-bottom: 8px; color: var(--ink-2); font-size: 15px; }
.sample-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 8px; }
.demo.has-intro .sample-grid { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 760px) { .sample-grid, .demo.has-intro .sample-grid { grid-template-columns: repeat(3, 1fr); } }
.sample { padding: 0; border: 2px solid transparent; border-radius: 9px; background: none; cursor: pointer; overflow: hidden; }
.sample img { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; border-radius: 7px; }
.sample:hover { border-color: var(--ink-3); }
.sample.current { border-color: var(--accent); }

/* Feature trio on home */
.trio > div { border-top: 3px solid var(--line); padding-top: 14px; }
.trio h3 { font-size: 17px; }
.trio p { color: var(--ink-2); font-size: 15.5px; }

/* App page */
.screens { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 760px) { .screens { grid-template-columns: 1fr 1fr; } }
.screens figure { margin: 0; }
.screens img { border-radius: 18px; border: 1px solid var(--line); }
.screens figcaption { font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.wordmark { width: 200px; margin-bottom: 10px; }

/* Forms */
form.contact { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; max-width: 720px; }
form.contact .full { grid-column: 1 / -1; }
@media (max-width: 600px) { form.contact { grid-template-columns: 1fr; } }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: none; }
textarea { min-height: 140px; resize: vertical; }
.form-status { font-weight: 600; }
.form-status.error { color: var(--bad); }
.form-status.ok { color: var(--ok); }

.callout { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 16px 0 22px; max-width: 66ch; }
.callout p:last-child { margin-bottom: 0; }
.changelog dt { font-weight: 700; }
.changelog dd { margin: 0 0 12px; color: var(--ink-2); }
