/* The public pages: home, guides, calculators, FAQ, privacy. Plain CSS so they
   render fully without JavaScript; the app itself uses Tailwind (src/shell.php).
   The tokens match the app's. */

:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --surface: #fffefb;
  --sunken: #eceae3;
  --ink: #17160f;
  --muted: #5f5d54;
  --line: #e0ded4;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #131311;
    --surface: #1c1c19;
    --sunken: #292925;
    --ink: #f1f0ea;
    --muted: #aeaca1;
    --line: #34332e;
    --accent: #f27a45;
    --accent-ink: #1a0d06;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
}
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

/* ---- header and footer ---- */

.site-head { padding: 16px 0; }
.site-head .wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { font: 700 1.6rem/1 var(--display); text-decoration: none; }
.brand span { color: var(--accent); }
.brand { white-space: nowrap; }
.brand .brand-mark { color: inherit; margin-right: .3em; font-family: system-ui, sans-serif; }
.site-nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; }
.site-nav a {
  padding: 8px 9px; border-radius: 8px; color: var(--muted);
  font-weight: 600; font-size: .95rem; text-decoration: none;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); background: var(--sunken); }
.head-actions { display: flex; gap: 8px; }
@media (max-width: 1180px) {
  .site-nav { order: 3; flex: 1 1 100%; min-width: 0; margin: 4px -10px 0; overflow-x: auto; flex-wrap: nowrap; }
  .site-nav a { white-space: nowrap; }
  .head-actions { margin-left: auto; }
}

.site-foot { margin-top: 80px; border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--muted); font-size: .95rem; }
.site-foot .wrap { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.site-foot h2 { margin: 0 0 8px; font: 700 1.1rem/1.2 var(--display); color: var(--ink); letter-spacing: .02em; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-foot a { text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }

/* ---- buttons ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 1rem/1 var(--body); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--sunken); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.1); }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 1.1rem; }

/* ---- type ---- */

.eyebrow { margin: 0 0 8px; color: var(--accent); font-weight: 600; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0; }
h1 { font-size: clamp(2.6rem, 7vw, 4.5rem); }
.lede { margin: 20px 0 0; max-width: 38rem; color: var(--muted); font-size: 1.2rem; }
.section { padding: 56px 0 0; }
.section > .wrap > h2, .section h2.title { font-size: clamp(2rem, 4.5vw, 2.8rem); }
.section-intro { margin: 12px 0 0; max-width: 40rem; color: var(--muted); }
.muted { color: var(--muted); }

/* ---- hero ---- */

.hero { padding: 40px 0 0; }
.hero .wrap { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .hero .wrap { grid-template-columns: 1.1fr 1fr; gap: 56px; } }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero-note { margin: 12px 0 0; color: var(--muted); font-size: .95rem; }

/* A static picture of the log, in HTML so it stays sharp and readable. */
.mock { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding: 20px; box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px rgba(0,0,0,.25); }
.mock-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.mock-head strong { font: 700 1.6rem/1 var(--display); }
.mock-head span { color: var(--muted); font-size: .9rem; }
.mock h3 { margin: 16px 0 4px; font: 600 .75rem/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.mock ul { list-style: none; margin: 0; padding: 0; }
.mock li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mock li:last-child { border-bottom: 0; }
.mock li b { display: block; }
.mock li small { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.mock-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.mock-stats div { padding: 12px; border-radius: 12px; background: var(--sunken); }
.mock-stats small { display: block; color: var(--muted); font-size: .85rem; }
.mock-stats b { font: 700 1.8rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.mock-chart { width: 100%; height: 170px; margin-top: 16px; }
.mock-chart line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.mock-chart polyline { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mock .hint { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--sunken); font-size: .9rem; color: var(--muted); }

/* ---- cards and grids ---- */

/* Grid and flex children may shrink below their content, so a wide table scrolls instead of widening the page. */
.hero .wrap > *, .grid > *, .calc > *, .form-row > *, .cta .card > * { min-width: 0; }
body { overflow-x: clip; }

.grid { display: grid; gap: 16px; margin-top: 28px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 20px; }
.card h3 { font-size: 1.6rem; }
.card p { margin: 8px 0 0; color: var(--muted); }
a.card { display: block; text-decoration: none; }
a.card:hover { border-color: var(--muted); }
a.card .more { display: inline-block; margin-top: 12px; color: var(--ink); font-weight: 600; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { counter-increment: step; border-top: 2px solid var(--ink); padding-top: 14px; }
.steps li::before { content: counter(step); font: 700 2.4rem/1 var(--display); color: var(--accent); }
.steps h3 { margin-top: 6px; font-size: 1.5rem; }
.steps p { margin: 6px 0 0; color: var(--muted); }

.cta { margin-top: 64px; }
.cta .card { padding: 32px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.cta h2 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.cta p { margin: 8px 0 0; }

/* ---- long-form pages: article on the left, sticky panel on the right ---- */

.page-head { padding: 40px 0 0; }
.article { display: grid; gap: 40px; align-items: start; }
@media (min-width: 960px) {
  .article { grid-template-columns: minmax(0, 46rem) minmax(16rem, 20rem); justify-content: space-between; gap: 64px; }
  .aside { position: sticky; top: 24px; }
}
.article > * { min-width: 0; }
.aside { display: grid; gap: 16px; }
.aside h2 { font-size: 1.5rem; }
.side-cta { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.side-cta p { color: color-mix(in srgb, var(--bg) 75%, transparent); margin: 6px 0 16px; }
.side-cta .btn { width: 100%; }
.side-signin { display: block; margin-top: 10px; text-align: center; font-size: .9rem; color: color-mix(in srgb, var(--bg) 75%, transparent); }
.side-signin:hover { color: var(--bg); }
.side-links ul { list-style: none; margin: 8px 0 0; padding: 0; }
.side-links li + li { border-top: 1px solid var(--line); }
.side-links a { display: block; padding: 10px 0; text-decoration: none; }
.side-links b { display: block; font-weight: 600; }
.side-links span { display: block; color: var(--muted); font-size: .9rem; }
.side-links a:hover b { color: var(--accent); }

.prose > :first-child { margin-top: 0; }
.prose h2 { margin: 44px 0 0; font-size: clamp(1.8rem, 3.5vw, 2.3rem); }
.prose h3 { margin: 28px 0 0; font-size: 1.45rem; }
.prose p, .prose ul, .prose ol { margin: 14px 0 0; }
.prose ul { list-style: none; padding: 0; }
.prose ul > li { position: relative; padding-left: 22px; }
.prose ul > li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.prose li + li { margin-top: 8px; }
.prose a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent); }
.prose code { font-size: .88em; background: var(--sunken); padding: 2px 6px; border-radius: 6px; }
.prose .table-scroll { margin-top: 16px; }
.updated { margin-top: 12px; color: var(--muted); font-size: .95rem; }

.faq details { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq details:first-child { padding-top: 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 1.1rem; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--sunken); display: grid; place-items: center; font-weight: 500; color: var(--muted); line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq summary:hover { color: var(--accent); }
.faq details p { margin: 10px 0 0; color: var(--muted); }

/* ---- calculators and tables ---- */

.calc { display: grid; gap: 24px; margin-top: 28px; align-items: start; }
@media (min-width: 900px) { .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.form-row + .form-row { margin-top: 14px; }
label { display: block; font-weight: 500; font-size: .95rem; margin-bottom: 4px; }
input, select {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 400 1rem var(--body);
}
.help { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }
.result { margin-top: 18px; padding: 16px; border-radius: 12px; background: var(--sunken); }
.result .big { font: 700 clamp(2.4rem, 6vw, 3.4rem)/1 var(--display); font-variant-numeric: tabular-nums; }
.result p { margin: 6px 0 0; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 .9rem var(--body); cursor: pointer; }
.chip:hover { background: var(--sunken); }

.table-scroll { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .98rem; }
caption { text-align: left; color: var(--muted); font-size: .9rem; padding-bottom: 8px; }
th, td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { color: var(--muted); font-weight: 500; }
tbody th { font-weight: 600; }

.notfound { padding: 80px 0 0; text-align: center; }
.notfound .hero-actions { justify-content: center; }

/* ---- public profiles: /@handle and /@handle/date ---- */

.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.share-row .btn { min-height: 40px; padding: 0 14px; font-size: .95rem; }
.eyebrow a { text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }

.stat-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 0; }
.stat small { display: block; color: var(--muted); font-size: .9rem; }
.stat b { display: block; margin-top: 4px; font: 700 2.4rem/1 var(--display); font-variant-numeric: tabular-nums; }

.activity-card { margin-top: 16px; }
.activity-card h2 { font-size: 1.5rem; }
.activity { display: grid; grid-template-columns: repeat(var(--weeks, 52), minmax(9px, 1fr)); gap: 3px; margin-top: 14px; overflow-x: auto; padding-bottom: 4px; }
.activity-week { display: grid; grid-template-rows: repeat(7, auto); gap: 3px; }
.activity i { display: block; aspect-ratio: 1; border-radius: 2px; background: var(--sunken); }
.activity i.on { background: var(--accent); }
.activity i.future { background: transparent; }

h2.title { font-size: clamp(1.8rem, 3.5vw, 2.3rem); }
.workout-list { display: grid; gap: 12px; margin-top: 16px; }
.workout-card { padding: 16px 20px; }
.workout-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; }
.workout-card-head b { font-size: 1.1rem; }
.workout-card-head span { color: var(--muted); font-size: .9rem; }
.workout-card ul { list-style: none; margin: 8px 0 0; padding: 0; color: var(--ink); }
.workout-card li { padding: 3px 0; }
.workout-card li span { color: var(--muted); font-variant-numeric: tabular-nums; }
a.workout-card:hover b { color: var(--accent); }
.best-row { display: flex !important; justify-content: space-between; gap: 12px; }
.best-row b:last-child { font-variant-numeric: tabular-nums; }

.day { display: grid; gap: 16px; }
.day h2 { font-size: 1.6rem; }
.entry-list { list-style: none; margin: 8px 0 0; padding: 0; }
.entry-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.entry-list li:last-child { border-bottom: 0; }
.entry-list b { display: block; font-size: 1.1rem; }
.entry-list span { color: var(--muted); font-size: .9rem; }
.entry-list strong { font-variant-numeric: tabular-nums; font-weight: 600; }
.entry-notes { margin: 6px 0 0; color: var(--muted); white-space: pre-line; }
.big-number { margin: 8px 0 0; font: 700 2.4rem/1 var(--display); }
.day-nav { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

.stat-list li { padding: 10px 0; }
.stat-list li > span { display: block; color: var(--muted); font-size: .9rem; }
.stat-list .best-row b { display: inline; font-size: 1rem; color: var(--ink); }
.stat-list .mock-stats { margin-top: 12px; }

/* The sign-up card beside the name on /@handle pages, not buried under the log. */
.profile-head .wrap { display: grid; gap: 24px; align-items: end; }
@media (min-width: 900px) { .profile-head .wrap { grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem); gap: 48px; } }
.head-cta .btn { width: 100%; }
.head-cta-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.head-cta-buttons .btn:not(.btn-primary) { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, transparent); }
.day-wrap { max-width: 46rem; }

/* ---- the connector's consent page ---- */
.consent { max-width: 40rem; }
.consent-card { padding: 28px; }
.consent-card h1 { font-size: clamp(2.2rem, 5vw, 3rem); }
.consent-scopes { list-style: none; margin: 20px 0; padding: 0; display: grid; gap: 10px; }
.consent-scopes li { position: relative; padding: 12px 14px 12px 40px; border-radius: 10px; background: var(--sunken); font-weight: 500; }
.consent-scopes li::before { content: '✓'; position: absolute; left: 14px; color: var(--accent); font-weight: 700; }
.consent-dest { font-size: .9rem; margin-top: 16px; }
.prose ol { padding-left: 1.3em; }
.prose ol > li + li { margin-top: 8px; }

/* ---- the Claude section on the home page ---- */
.claude-section { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .claude-section { grid-template-columns: 1fr 1fr; gap: 56px; } }
.claude-section > * { min-width: 0; }
.claude-section h2 { font-size: clamp(2rem, 4.5vw, 2.8rem); }
.chat { display: grid; gap: 10px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px rgba(0,0,0,.25); }
.chat p { margin: 0; padding: 10px 14px; border-radius: 14px; max-width: 88%; font-size: .98rem; line-height: 1.45; }
.chat-q { justify-self: end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 4px; }
.chat-a { justify-self: start; background: var(--sunken); border-bottom-left-radius: 4px; }
.chat .chat-foot { justify-self: center; padding: 0; color: var(--muted); font-size: .8rem; }

/* ---- "free" on the home page ---- */
.free-list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 8px 20px; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); max-width: 38rem; }
.free-list li { position: relative; padding-left: 28px; font-weight: 600; }
.free-list li::before { content: '✓'; position: absolute; left: 0; top: -1px; width: 20px; height: 20px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; display: grid; place-items: center; }
.free-band { border-radius: 20px; background: var(--ink); color: var(--bg); padding: 32px; display: grid; gap: 24px; }
@media (min-width: 900px) { .free-band { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: center; padding: 40px; gap: 40px; } }
.free-band h2 { font-size: clamp(2rem, 4.5vw, 2.8rem); color: var(--bg); }
.free-band .section-intro { color: color-mix(in srgb, var(--bg) 75%, transparent); }
.free-band .eyebrow { color: var(--accent); }
.free-grid { margin-top: 0; }
.free-band .card { background: color-mix(in srgb, var(--bg) 8%, transparent); border-color: color-mix(in srgb, var(--bg) 16%, transparent); }
.free-band .card h3 { color: var(--bg); font-size: 1.4rem; }
.free-band .card p { color: color-mix(in srgb, var(--bg) 72%, transparent); }
