/* openNutrition project site. Hand-written, no framework, no build step, one stylesheet for every page.
   Dark by default like the app and like opengym.ch; a light theme follows the system, and the
   button in the top bar overrides it (site.js stores the choice). Colours are the logo's:
   lime #a3e635 on ground #0c0e12, the same family as openGym. */

:root {
  --bg: #000; --surface: #0e0f11; --surface-2: #17181b;
  --hair: rgba(255, 255, 255, .12); --hair-soft: rgba(255, 255, 255, .07);
  --fg: #f5f5f7; --fg-2: #a1a1a6; --fg-3: #86868b;
  --acc: #a3e635;            /* green words and links */
  --lime: #a3e635; --ink: #0c0e12;
  --bar: rgba(0, 0, 0, .78);
  --bad: #ff8a8e;
  --d: block; --l: none;     /* .d-only / .l-only: pictures that exist once per theme */
  --r-s: 12px; --r-m: 20px; --r-l: 28px;
  --max: 1120px; --pad: clamp(20px, 5vw, 34px); --sec: clamp(84px, 11vw, 148px);
  --ease: cubic-bezier(.23, 1, .32, 1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fff; --surface: #f5f5f7; --surface-2: #e9e9ee;
    --hair: rgba(0, 0, 0, .14); --hair-soft: rgba(0, 0, 0, .08);
    --fg: #12151b; --fg-2: #55585f; --fg-3: #6e6e73;
    --acc: #4d7c0f; --bar: rgba(255, 255, 255, .82); --bad: #b4232a;
    --d: none; --l: block;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #fff; --surface: #f5f5f7; --surface-2: #e9e9ee;
  --hair: rgba(0, 0, 0, .14); --hair-soft: rgba(0, 0, 0, .08);
  --fg: #12151b; --fg-2: #55585f; --fg-3: #6e6e73;
  --acc: #4d7c0f; --bar: rgba(255, 255, 255, .82); --bad: #b4232a;
  --d: none; --l: block;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px; line-height: 1.55; letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; overflow-x: clip;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--acc); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
::selection { background: rgba(163, 230, 53, .32); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; border-radius: 6px; }
.d-only { display: var(--d) !important; }
.l-only { display: var(--l) !important; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
.skip { position: absolute; left: 12px; top: -80px; z-index: 50; background: var(--lime); color: var(--ink); font-weight: 600; padding: 12px 18px; border-radius: 10px; }
.skip:focus { top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* type */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.03em; line-height: 1.08; text-wrap: balance; }
h1 { font-size: clamp(44px, 8.6vw, 92px); letter-spacing: -.045em; line-height: 1; }
h2 { font-size: clamp(31px, 5.2vw, 54px); letter-spacing: -.035em; }
h3 { font-size: clamp(19px, 2.2vw, 22px); letter-spacing: -.02em; line-height: 1.25; font-weight: 600; }
p { text-wrap: pretty; }
.lead { color: var(--fg-2); font-size: clamp(18px, 2vw, 21px); line-height: 1.5; max-width: 52ch; margin-top: 18px; }
.muted { color: var(--fg-2); }
.small { font-size: 14.5px; color: var(--fg-3); }
.num, table { font-variant-numeric: tabular-nums; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; letter-spacing: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 24px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--lime); color: var(--ink); font: inherit; font-size: 16.5px; font-weight: 600; letter-spacing: -.01em;
  transition: transform .16s var(--ease), background-color .2s ease;
  touch-action: manipulation;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--hair); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: #b5ee55; }
  .btn.ghost:hover { background: var(--surface-2); }
}
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.more { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: var(--bar); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid var(--hair-soft); }
@media (prefers-reduced-transparency: reduce) { .top { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; } }
.top .wrap { display: flex; align-items: center; gap: 8px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--fg); font-weight: 700; font-size: 18px; letter-spacing: -.03em; margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; margin: 0 -5px; }
.brand span span { color: var(--acc); }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--fg-2); font-size: 15px; font-weight: 500; border-radius: 10px; }
.nav a:hover { color: var(--fg); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--acc); font-weight: 600; }   /* active = green words, nothing filled */
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--fg-2); cursor: pointer; transition: transform .16s var(--ease); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { color: var(--fg); background: var(--surface-2); } }
.theme-btn .sun { display: var(--d); } .theme-btn .moon { display: var(--l); }
.menu-btn { display: none; }
@media (max-width: 800px) {
  .menu-btn { display: grid; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--hair); padding: 8px var(--pad) 16px; }
  .nav.open { display: flex; }
  .nav a { min-height: 50px; font-size: 18px; padding: 0 4px; border-radius: 0; border-bottom: 1px solid var(--hair-soft); }
  .nav a:last-child { border-bottom: 0; }
}

/* sections */
main > section { padding-top: var(--sec); }
.head { max-width: 780px; margin-bottom: clamp(36px, 5vw, 64px); }
.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 88px); align-items: center; }
.split.rev > :first-child { order: 2; }
@media (max-width: 880px) { .split { grid-template-columns: minmax(0, 1fr); } .split.rev > :first-child { order: 0; } }

/* device frames: real screenshots inside a plain phone outline drawn in CSS */
.device { --w: 260px; flex: none; width: var(--w); padding: calc(var(--w) * .034); border-radius: calc(var(--w) * .158); background: #17191d; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
.device img { width: 100%; border-radius: calc(var(--w) * .125); background: #000; }
.devices { display: flex; justify-content: center; align-items: flex-start; gap: clamp(14px, 2.6vw, 30px); }
.devices .device { --w: clamp(150px, 20.5vw, 250px); }
.devices .device:nth-child(2) { margin-top: clamp(28px, 5vw, 64px); }
@media (max-width: 880px) { .devices .device { --w: min(42vw, 230px); } }

/* hero */
.hero { padding-top: clamp(44px, 8vw, 96px); text-align: center; overflow: clip; }
.hero-icon { width: clamp(84px, 11vw, 116px); border-radius: 23%; margin: 0 auto clamp(26px, 4vw, 40px); box-shadow: 0 0 0 1px var(--hair); }
.hero .lead { margin-left: auto; margin-right: auto; max-width: 44ch; }
.hero .btns { justify-content: center; }
.status { margin-top: 22px; color: var(--fg-3); font-size: 15px; }
.hero-devices { display: flex; justify-content: center; align-items: flex-start; gap: clamp(16px, 3.4vw, 44px); margin-top: clamp(48px, 7vw, 88px); }
.hero-devices .device { --w: clamp(200px, 23vw, 286px); }
.hero-devices .device:nth-child(1), .hero-devices .device:nth-child(3) { margin-top: clamp(40px, 6vw, 84px); }
@media (max-width: 720px) {
  .hero-devices { gap: 14px; }
  .hero-devices .device { --w: 60vw; }
}

/* facts: real numbers, set large */
.facts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 28px 24px; margin-top: clamp(64px, 9vw, 112px); padding: 0; list-style: none; text-align: left; }
.facts b { display: block; font-size: clamp(34px, 4.4vw, 52px); font-weight: 700; letter-spacing: -.045em; line-height: 1; }
.facts span { display: block; color: var(--fg-2); font-size: 15px; line-height: 1.4; margin-top: 10px; max-width: 20ch; }
@media (max-width: 880px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .facts li:first-child { grid-column: 1 / -1; } }

/* definition rows: a name, then what it does. No icons, no boxes. */
.rows { display: grid; gap: 0; margin-top: 30px; padding: 0; list-style: none; }
.rows li { padding: 18px 0; border-top: 1px solid var(--hair-soft); }
.rows li:last-child { border-bottom: 1px solid var(--hair-soft); }
.rows b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.rows span { display: block; color: var(--fg-2); font-size: 16px; margin-top: 4px; }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px clamp(24px, 4vw, 56px); }
.cols.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols h3 + p { color: var(--fg-2); font-size: 16.5px; margin-top: 8px; }
@media (max-width: 880px) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .cols, .cols.two { grid-template-columns: minmax(0, 1fr); gap: 28px; } }

/* panels: one tone step up from the page, no outline */
.panel { background: var(--surface); border-radius: var(--r-l); padding: clamp(24px, 4.4vw, 56px); }
.note { border-left: 2px solid var(--hair); padding: 2px 0 2px 16px; color: var(--fg-2); font-size: 16px; margin-top: 22px; }   /* callout: a straight thin line on the left, nothing else */
.note b { color: var(--fg); font-weight: 600; }

/* the maths, written out */
.maths { display: grid; gap: 0; }
.maths > div { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 6px 32px; padding: 20px 0; border-top: 1px solid var(--hair-soft); }
.maths > div:first-child { border-top: 0; padding-top: 0; }
.maths > div:last-child { padding-bottom: 0; }
.maths dt { font-weight: 600; font-size: 17px; }
.maths dd { color: var(--fg-2); font-size: 16.5px; }
.maths dd b { color: var(--fg); font-weight: 600; }
@media (max-width: 700px) { .maths > div { grid-template-columns: minmax(0, 1fr); } }
.honest { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px clamp(24px, 4vw, 56px); margin-top: clamp(40px, 6vw, 72px); }
.honest b { display: block; font-size: clamp(38px, 5vw, 58px); font-weight: 700; letter-spacing: -.045em; line-height: 1; }
.honest b small { font-size: .36em; font-weight: 600; letter-spacing: -.01em; color: var(--fg-2); }
.honest p { color: var(--fg-2); font-size: 16px; margin-top: 12px; max-width: 32ch; }
@media (max-width: 760px) { .honest { grid-template-columns: minmax(0, 1fr); } }

/* tables */
.table-wrap { overflow-x: auto; border-radius: var(--r-m); background: var(--surface); -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: 2px; }
table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
th, td { padding: 13px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hair-soft); }
tr:last-child td, tr:last-child th { border-bottom: 0; }
thead th { font-size: 14px; font-weight: 600; color: var(--fg-2); white-space: nowrap; }
tbody th { font-weight: 600; }
.cmp { min-width: 720px; }
.cmp td:nth-child(2), .cmp thead th:nth-child(2) { color: var(--fg); font-weight: 600; }
.cmp thead th:nth-child(2) { color: var(--acc); }
.cmp td { color: var(--fg-2); }
.table-note { font-size: 14.5px; color: var(--fg-3); margin-top: 12px; }

/* code with a copy button (site.js adds the button) */
.code { position: relative; }
pre { background: var(--surface); border-radius: var(--r-m); padding: 22px; overflow-x: auto; font: 14.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0; color: var(--fg); tab-size: 2; }
pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
pre .c { color: var(--fg-3); }
.code.has-copy pre { padding-top: 54px; }
.copy { position: absolute; top: 6px; right: 6px; min-width: 76px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: transparent; color: var(--fg-2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: transform .16s var(--ease); }
.copy:active { transform: scale(.96); }
.copy.done { color: var(--acc); }
@media (hover: hover) and (pointer: fine) { .copy:hover { color: var(--fg); background: var(--surface-2); } }

/* sister apps */
.sisters { display: flex; align-items: center; gap: 18px; }
.sisters img { width: clamp(72px, 9vw, 104px); border-radius: 23%; box-shadow: 0 0 0 1px var(--hair); }
.sisters .plus { font-size: 34px; font-weight: 300; color: var(--fg-3); line-height: 1; }
.flow { list-style: none; padding: 0; display: grid; }
.flow li { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--hair-soft); font-size: 16.5px; }
.flow li:first-child { border-top: 0; }
.flow em { font-style: normal; color: var(--fg-3); font-size: 14.5px; white-space: nowrap; }

/* screens rail */
.rail { display: flex; gap: clamp(16px, 2.4vw, 28px); overflow-x: auto; padding: 4px var(--pad) 22px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.rail figure { flex: none; scroll-snap-align: center; }
.rail .device { --w: clamp(190px, 19vw, 232px); }
.rail figcaption { color: var(--fg-2); font-size: 14.5px; margin-top: 12px; text-align: center; }
.rail { justify-content: safe center; }

/* FAQ */
.faq { border-top: 1px solid var(--hair-soft); }
.faq details { border-bottom: 1px solid var(--hair-soft); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 64px; padding: 16px 0; cursor: pointer; list-style: none; font-size: clamp(17px, 2vw, 20px); font-weight: 600; letter-spacing: -.02em; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 10px; height: 10px; margin-right: 6px; border-right: 2px solid var(--fg-3); border-bottom: 2px solid var(--fg-3); transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.faq .a { padding: 0 0 22px; color: var(--fg-2); max-width: 70ch; }
.faq .a p + p, .faq .a p + ul { margin-top: 12px; }
.faq .a ul { padding-left: 20px; }
.faq-group { margin-top: clamp(44px, 6vw, 72px); }
.faq-group h2 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 18px; }

/* page head for the inner pages */
.page-head { padding-top: clamp(48px, 8vw, 96px); }
.page-head h1 { font-size: clamp(40px, 7vw, 76px); }
.crumb { color: var(--fg-3); font-size: 15px; margin-bottom: 16px; }
.crumb a { color: var(--fg-2); }

/* long text: docs, about, privacy, brand */
.prose { max-width: 74ch; }
.prose h2 { font-size: clamp(27px, 3.6vw, 38px); margin-top: clamp(64px, 8vw, 96px); scroll-margin-top: 84px; }
.prose h3 { margin-top: 36px; scroll-margin-top: 84px; }
.prose p, .prose ul, .prose ol, .prose .code, .prose .table-wrap, .prose .note { margin-top: 16px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose p, .prose li { color: var(--fg-2); }
.prose p b, .prose li b { color: var(--fg); font-weight: 600; }
.prose .table-wrap table { min-width: 600px; }
.prose td:first-child code { white-space: nowrap; }
.doc { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: start; padding-top: clamp(28px, 4vw, 48px); }
.toc { position: sticky; top: 84px; max-height: calc(100vh - 108px); overflow-y: auto; padding-bottom: 12px; }
.toc summary { display: none; }
.toc ol { list-style: none; padding: 0; display: grid; }
.toc a { display: flex; align-items: center; min-height: 36px; padding: 4px 0; color: var(--fg-2); font-size: 15px; line-height: 1.3; }
.toc a:hover { color: var(--fg); text-decoration: none; }
.toc a.on { color: var(--acc); font-weight: 600; }
.toc-title { font-size: 14px; font-weight: 600; color: var(--fg-3); margin-bottom: 8px; }
.doc .prose > h2:first-child { margin-top: 0; }
@media (max-width: 960px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .toc { position: static; max-height: none; background: var(--surface); border-radius: var(--r-m); padding: 0 18px; }
  .toc-title { display: none; }
  .toc summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; cursor: pointer; font-weight: 600; list-style: none; }
  .toc summary::-webkit-details-marker { display: none; }
  .toc summary::after { content: ""; width: 9px; height: 9px; margin-right: 4px; border-right: 2px solid var(--fg-3); border-bottom: 2px solid var(--fg-3); transform: rotate(45deg) translate(-2px, -2px); }
  .toc[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
  .toc ol { padding-bottom: 12px; }
  .toc a { min-height: 44px; font-size: 16px; }
  .doc .prose > h2:first-child { margin-top: 36px; }
}

/* footer */
.foot { margin-top: var(--sec); border-top: 1px solid var(--hair-soft); padding: 48px 0 calc(40px + env(safe-area-inset-bottom)); font-size: 15px; color: var(--fg-3); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 32px 24px; }
.foot .brand { font-size: 17px; margin-bottom: 10px; }
.foot h2 { font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--fg); margin-bottom: 6px; }
.foot ul { list-style: none; padding: 0; }
.foot li a { display: inline-flex; align-items: center; min-height: 36px; color: var(--fg-2); }
.foot-legal { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--hair-soft); display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between; font-size: 14px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .foot-grid > div:first-child { grid-column: 1 / -1; } .foot li a { min-height: 44px; } }

/* reveal on scroll: only with JS, never with reduced motion (site.js adds .js-rv to <html>) */
.js-rv .rv { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js-rv .rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js-rv .rv { opacity: 1; transform: none; transition: none; }
  .btn, .icon-btn, .copy { transition: none; }
}
@media (prefers-contrast: more) { :root { --hair: currentColor; --hair-soft: currentColor; } .top { background: var(--bg); } }
@media print { .top, .foot, .toc, .copy { display: none; } body { background: #fff; color: #000; } }
