/* GainzTracker app styles. Colours come from each user's settings (see inc/layout.php). */
:root {
  --bg: #05070B; --accent: #1E6BFF; --text: #F2F4F7; --muted: #9AA3B2; --on-accent: #FFFFFF;
  --surface: #14171C; --line: #3D4658; --box-text: #F2F4F7; --box-muted: #9AA3B2; --name: #F2F4F7; --icon: #6AA5FF;
  --accent-text: color-mix(in srgb, var(--accent) 60%, var(--text));
  --bad: #FF6B6B;
}
/* Boxes sit on their own colour, so inside them the text colours follow the box, not the page background. */
.card, details, .stepper, .notice, .error, .acard, .tabs, .site-head, .btn.ghost, .btn.danger, .head-btn,
.phone .p-top, .phone .p-card, .phone .p-steps > div, .phone .p-row {
  --text: var(--box-text); --muted: var(--box-muted);
  --accent-text: color-mix(in srgb, var(--accent) 60%, var(--box-text));
  --field: color-mix(in srgb, var(--surface) 86%, var(--box-text));
  color: var(--text);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.45 Arial, Helvetica, sans-serif; }
body.area-app { padding-bottom: 90px; }
a { color: var(--accent-text); }
h1 { font-size: 1.625rem; line-height: 1.15; margin: 0 0 4px; }
h2 { font-size: 0.75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 0.875rem; }
.wrap { max-width: 920px; margin: 0 auto; padding: 20px; }
.area-auth .wrap { max-width: 480px; }

.link-btn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 0.875rem; min-height: 44px; padding: 0 8px; cursor: pointer; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 16px; }
.notice { background: var(--surface); border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px; }
.error { background: var(--surface); border: 1px solid var(--bad); border-radius: 12px; padding: 12px 14px; }

label { display: block; font-size: 0.8125rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; margin-bottom: 14px; font: inherit; color: var(--text);
  background: var(--field, var(--bg)); border: 1px solid var(--line); border-radius: 12px; }
textarea { min-height: 96px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 14px; color: var(--text); font-size: 0.9375rem; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.hp { position: absolute; left: -9999px; }

.btn { display: block; width: 100%; min-height: 56px; padding: 12px 16px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--accent); color: var(--on-accent); font: inherit; font-size: 1.125rem; font-weight: 700; text-align: center; text-decoration: none; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); font-size: 0.9375rem; min-height: 48px; }
.btn.danger { background: var(--surface); color: color-mix(in srgb, var(--bad) 75%, var(--box-text)); border: 1px solid var(--bad); font-size: 0.9375rem; min-height: 48px; }

/* drop-down panels */
details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
summary { min-height: 48px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  font-weight: 700; font-size: 0.9375rem; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
details[open] > summary::after { transform: rotate(-135deg); }
.panel { padding: 4px 16px 16px; }
.count { color: var(--muted); font-weight: 400; margin-left: 8px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list a { display: flex; align-items: center; justify-content: space-between; min-height: 48px; color: var(--text); text-decoration: none; font-weight: 700; }
.list a span { color: var(--muted); font-weight: 400; font-size: 0.875rem; }

.stats { display: flex; gap: 12px; }
.stats div { flex: 1; }
.stats b { display: block; font-size: 1.25rem; }
.stats span { font-size: 0.6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* exercise page */
.pills { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; }
.pills a { flex: 1; min-width: 52px; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px;
  border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 0.875rem; font-weight: 700; white-space: nowrap; padding: 0 8px; }
.pills a.done { background: var(--surface); }
.pills a.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.suggest { font-size: 1.75rem; font-weight: 700; color: var(--accent-text); margin: 0; }
.rule { height: 1px; background: var(--line); margin: 12px 0; }
.steppers { display: flex; gap: 12px; margin-bottom: 16px; }
.stepper { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; text-align: center; }
.stepper label { font-size: 0.75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.stepper input[type=text] { border: 0; background: transparent; font-size: 2.5rem; font-weight: 700; text-align: center; padding: 0; margin: 0 0 8px; min-height: 52px; }
.stepper .pm { display: flex; gap: 8px; }
.stepper .pm button { flex: 1; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--field, var(--bg)); color: var(--text); font-size: 1.5rem; font-weight: 700; cursor: pointer; }
table.hist { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.hist td { padding: 10px 0; border-top: 1px solid var(--line); }
table.hist td:last-child { text-align: right; width: 44px; }
table.hist .muted { font-size: 0.875rem; }
.x-btn { width: 44px; height: 44px; background: none; border: 0; color: var(--muted); font-size: 1.25rem; cursor: pointer; }
.row2 { display: flex; gap: 12px; }
.row2 > div { flex: 1; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: 72px; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px 10px; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 0.6875rem; font-weight: 700; }
.tabs a.on { color: var(--accent-text); }



/* home page */
.home { display: grid; grid-template-columns: 1fr; gap: 32px; align-items: center; padding: 16px 0 8px; }
.home h1 { font-size: 2.125rem; margin-bottom: 12px; }
.home .lead { font-size: 1.125rem; color: var(--muted); margin-bottom: 20px; }
.home .cta { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.home .small { font-size: 0.875rem; color: var(--muted); margin-top: 12px; }
.phones { display: flex; gap: 20px; justify-content: center; }
.steps { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 32px; }
.steps .card { margin: 0; }
.steps b { display: block; margin-bottom: 4px; font-size: 1.0625rem; }
.steps span { color: var(--muted); font-size: 0.9375rem; }
.foot { text-align: center; color: var(--muted); font-size: 0.875rem; margin-top: 32px; }
@media (min-width: 820px) {
  .home { grid-template-columns: 1fr auto; padding-top: 40px; }
  .home h1 { font-size: 2.75rem; }
  .steps { grid-template-columns: repeat(3, 1fr); }
}

/* phone pictures drawn in CSS, so they always match the real app */
.phone { width: 236px; flex: none; border: 9px solid #20252F; border-radius: 34px; background: var(--bg); overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5); font-size: 0.6875rem; line-height: 1.35; position: relative; }
.phone::before { content: ""; position: absolute; top: 0; left: 50%; width: 84px; height: 14px; margin-left: -42px; background: #20252F; border-radius: 0 0 10px 10px; }
.phone .p-top { height: 40px; padding-top: 12px; display: flex; align-items: center; justify-content: center; background: var(--surface); border-bottom: 1px solid var(--line); font-weight: 700; font-size: 0.8125rem; }
.phone .p-body { padding: 12px 12px 16px; min-height: 380px; }
.phone .p-h { font-size: 1.0625rem; font-weight: 700; }
.phone .p-m { color: var(--muted); margin-bottom: 10px; }
.phone .p-pills { display: flex; gap: 5px; margin-bottom: 10px; }
.phone .p-pills span { flex: 1; height: 26px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.625rem; }
.phone .p-pills .on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.phone .p-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.phone .p-card .m { color: var(--muted); }
.phone .p-card .line { height: 1px; background: var(--line); margin: 8px 0; }
.phone .p-big { font-size: 1.125rem; font-weight: 700; color: var(--accent-text); }
.phone .p-steps { display: flex; gap: 8px; margin-bottom: 10px; }
.phone .p-steps > div { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; }
.phone .p-steps small { display: block; color: var(--muted); font-size: 0.5rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.phone .p-steps strong { display: block; font-size: 1.5rem; margin: 2px 0 6px; }
.phone .p-steps i { display: flex; gap: 5px; font-style: normal; }
.phone .p-steps i span { flex: 1; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 0.9375rem; font-weight: 700; }
.phone .p-btn { height: 36px; border-radius: 11px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8125rem; }
.phone .p-row { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; margin-bottom: 5px; padding: 0 10px; }
.phone .p-row > div { min-height: 30px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; }
.phone .p-row > div + div { border-top: 1px solid var(--line); }
.phone .p-row span { color: var(--muted); font-weight: 400; font-size: 0.625rem; }
.phone.two { display: none; }
@media (min-width: 560px) { .phone.two { display: block; margin-top: 36px; } }

/* header bar */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.head-in { max-width: 920px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; }
.site-head > .head-in { min-height: 60px; }
.brand { color: var(--text); font-size: 1.5rem; font-weight: 700; text-decoration: none; letter-spacing: .01em; }
.head-btn { min-height: 40px; padding: 0 16px; display: flex; align-items: center; border-radius: 10px; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 700; font-size: 0.875rem; }
.mainnav { background: var(--accent); }
.mainnav .head-in { justify-content: flex-start; gap: 4px; overflow-x: auto; }
.mainnav a { color: var(--on-accent); text-decoration: none; font-weight: 700; font-size: 0.9375rem; padding: 0 14px; min-height: 46px; display: flex; align-items: center; white-space: nowrap; opacity: .85; border-bottom: 3px solid transparent; }
.mainnav a:hover, .mainnav a.on { opacity: 1; border-bottom-color: var(--on-accent); }
.area-app .mainnav { display: none; }
.site-foot { max-width: 920px; margin: 32px auto 0; padding: 20px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 0.875rem; }

/* two columns on a computer */
.cols { display: grid; grid-template-columns: 1fr; gap: 0 16px; align-items: start; }
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.acard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: var(--text); text-decoration: none; font-weight: 700; font-size: 0.9375rem; }
.acard img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; background: var(--line); }
.acard span { padding: 12px; }
.acard small { display: block; padding: 0 12px 12px; color: var(--muted); font-weight: 400; font-size: 0.8125rem; margin-top: -6px; }
.sec { margin-top: 36px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.sec-h b { font-size: 1.375rem; }
.join-strip { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.join-strip b { display: block; font-size: 1.125rem; }
.join-strip span { color: var(--muted); font-size: 0.9375rem; }
.prose { max-width: 720px; }
.prose h1 { font-size: 1.875rem; margin-bottom: 12px; }
.prose h2 { font-size: 1.25rem; letter-spacing: 0; text-transform: none; color: var(--text); margin: 24px 0 8px; }
.prose h3 { font-size: 1.0625rem; margin: 20px 0 6px; }
.prose img { max-width: 100%; height: auto; border-radius: 12px; }
.prose p, .prose li { font-size: 1.0625rem; line-height: 1.6; }
.tags a { display: inline-block; padding: 8px 14px; margin: 0 6px 6px 0; border: 1px solid var(--line); border-radius: 20px; text-decoration: none; font-size: 0.875rem; }
.funny { text-align: center; }
.funny img { max-width: 100%; max-height: 320px; border-radius: 12px; }

/* diet */
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
.macros b { display: block; font-size: 1.25rem; }
.macros span { font-size: 0.6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.food { display: flex; gap: 12px; align-items: center; padding: 12px 0; }
.food img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: var(--line); }
.food .f-name { font-weight: 700; }
.food .f-mac { color: var(--muted); font-size: 0.8125rem; }
.food-row { border-top: 1px solid var(--line); }
.food-row:first-child { border-top: 0; }
.food-row details { background: none; border: 0; margin: 0 0 8px; }
.food-row summary { min-height: 36px; padding: 0; font-weight: 400; font-size: 0.875rem; color: var(--accent-text); justify-content: flex-start; gap: 10px; }
.food-row .panel { padding: 4px 0 8px; }
.mini { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 8px; }
.mini input[type=text] { width: 110px; margin: 0; }
.mini .btn { width: auto; min-height: 48px; font-size: 0.9375rem; padding: 0 16px; }
.divider { text-align: center; color: var(--muted); font-size: 0.75rem; letter-spacing: .1em; text-transform: uppercase; padding: 10px 0 0; }
table.sheet { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.sheet th, table.sheet td { border: 1px solid var(--line); padding: 8px; text-align: left; }

/* settings */
.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.swatches button { width: 44px; height: 44px; border-radius: 22px; border: 3px solid var(--line); padding: 0; cursor: pointer; }
.swatches input[type=color] { width: 64px; height: 44px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--field, var(--bg)); cursor: pointer; }

@media (min-width: 820px) {
  .area-app .mainnav { display: block; }
  .area-app .tabs { display: none; }
  body.area-app { padding-bottom: 0; }
  .site-head > .head-in { min-height: 72px; }
  .brand { font-size: 1.75rem; }
  .cols { grid-template-columns: 1fr 1fr; }
  .cols > .full { grid-column: 1 / -1; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .join-strip { flex-direction: row; align-items: center; justify-content: space-between; }
  .join-strip .btn { width: auto; padding: 0 28px; }
  .narrow { max-width: 560px; }
}

@media print {
  .site-head, .tabs, .site-foot, .btn, form, .no-print { display: none !important; }
  body, .card { background: #fff !important; color: #000 !important; border-color: #999 !important; }
  table.sheet th, table.sheet td { border-color: #999; }
}

/* header name, phone icons, extra settings */
.brand { color: var(--name); font-weight: 800; }
.area-app .site-head > .head-in { justify-content: center; }
.area-app .brand { font-size: 1.9rem; letter-spacing: .03em; text-align: center; }
.tabs { height: 92px; }
.tabs a { color: var(--icon); opacity: .6; font-size: .8rem; border-top: 4px solid transparent; }
.tabs a.on { color: var(--icon); opacity: 1; border-top-color: var(--icon); }
.tabs svg { width: 40px; height: 40px; stroke-width: 2.6; }
body.area-app { padding-bottom: 112px; }
.colours { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.colours input[type=color] { width: 100%; height: 48px; padding: 3px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--field, var(--bg)); cursor: pointer; }
.bw { display: flex; gap: 8px; align-items: flex-end; }
.bw > div { flex: 1; }
.bw input[type=text] { margin: 0; }
.bw .btn { width: auto; min-height: 48px; padding: 0 20px; font-size: 1rem; }
@media (min-width: 820px) { .area-app .brand { font-size: 2.2rem; } body.area-app { padding-bottom: 0; } }

/* diet: edit a food's figures, and the planner */
.fig { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 8px; margin: 8px 0 12px; }
.fig .wide { grid-column: 1 / -1; }
.fig input[type=text], .fig select { margin-bottom: 10px; }
.meal { margin-bottom: 16px; }
.meal h3 { margin: 0 0 4px; font-size: 1.05rem; }
.meal table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.meal td { padding: 8px 0; border-top: 1px solid var(--line); }
.meal td:last-child { text-align: right; color: var(--muted); white-space: nowrap; }
.meal .sum td { font-weight: 700; color: var(--text); }
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.picks .check { margin-bottom: 0; font-size: .9rem; }
.target { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.target:first-of-type { border-top: 0; }
.target b { font-size: 1.25rem; }

/* text boxes that grow with what is typed, where the browser supports it */
textarea.grow { field-sizing: content; min-height: 5.5rem; max-height: 70vh; resize: vertical; }
summary .count { font-size: .85rem; }

/* date boxes: phones give these their own width unless told otherwise, which pushed them out of the box */
input[type=date] { display: block; -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
.cols > *, .row2 > *, .bw > div { min-width: 0; }

/* add a food: suggestions under the box */
.suggest-wrap { position: relative; }
.suggest-wrap input[type=text] { margin-bottom: 8px; }
.food-suggest { list-style: none; margin: -4px 0 12px; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--field, var(--bg)); }
.food-suggest li + li { border-top: 1px solid var(--line); }
.food-suggest button { display: block; width: 100%; min-height: 48px; padding: 8px 12px; background: none; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.food-suggest button:hover, .food-suggest button:focus { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.food-suggest b { display: block; }
.food-suggest span { display: block; color: var(--muted); font-size: .8rem; }

/* home page price box */
.price { display: flex; flex-direction: column; gap: 14px; border-color: var(--accent); margin: 0; }
.price b { display: block; font-size: 1.5rem; margin-bottom: 6px; }
.price span { color: var(--muted); }
.prose .card h2 { margin-top: 0; }
.prose .card p { font-size: 1rem; }
@media (min-width: 820px) { .price { flex-direction: row; align-items: center; justify-content: space-between; } .price .btn { width: auto; padding: 0 36px; flex: none; } }

/* link buttons: keep the words in the middle whatever height the button ends up */
a.btn { display: flex; align-items: center; justify-content: center; }
