/* IronRoutine — "Forge" palette on a proper type and spacing system. */

:root {
  /* Brand */
  --ember: #ff7a2f;
  --forge: #e0560f;
  --spark: #ffc59a;
  --accent: #ffb066;

  /* Surfaces, layered rather than uniform */
  --iron: #101216;
  --slab: #191c22;
  --slab-2: #21252d;
  --slab-3: #2a2f39;
  --border: #262b34;
  --border-strong: #343a46;

  /* Text */
  --steel: #eef2f7;
  --smoke: #9aa4b4;
  --hint: #626b7a;

  --protein: #7fb2ff;
  --carbs: #ffd166;
  --fat: #ff8a80;
  --water: #4fc3f7;
  --error: #ff6b6b;
  --good: #5ddba4;

  /* One spacing scale, used everywhere */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;

  --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-pill: 999px;

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
  --ring: 0 0 0 2px rgba(255,122,47,.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--iron);
  color: var(--steel);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Type scale ─────────────────────────────────────────────────────────── */

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: clamp(28px, 5vw, 42px); }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

a { color: var(--ember); text-decoration: none; }
a:hover { color: var(--spark); }

.muted { color: var(--smoke); font-size: 14px; }
.hint  { color: var(--hint);  font-size: 13px; }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ember);
}

.wrap { max-width: 1080px; margin: 0 auto; padding: var(--s5) var(--s4) var(--s8); }
.wrap.narrow { max-width: 720px; }

/* Long-form pages (privacy, terms): section headings should read as headings,
   not as the small uppercase labels the dashboard widgets use. */
.prose .card h2 { font-size: 19px; text-transform: none; letter-spacing: -0.02em;
                  color: var(--steel); }
.prose .card .muted { font-size: 15px; color: #b3bcc9; }
.prose h1 { margin-bottom: var(--s2); }

/* ── Header ─────────────────────────────────────────────────────────────── */

header.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: rgba(16,18,22,.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
header.top .brand {
  display: flex; align-items: center; gap: var(--s2);
  font-size: 17px; font-weight: 700; color: var(--steel); letter-spacing: -0.01em;
}
header.top nav { margin-left: auto; display: flex; gap: var(--s1); flex-wrap: wrap; }
header.top nav a {
  color: var(--smoke); padding: var(--s2) var(--s3);
  border-radius: var(--r-pill); font-size: 14px; font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
header.top nav a:hover { background: var(--slab-2); color: var(--steel); }
header.top nav a.active { background: var(--ember); color: #16181d; }

/* ── Cards ──────────────────────────────────────────────────────────────── */

.card {
  position: relative;
  background: var(--slab);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s5);
}
.card + .card { margin-top: var(--s3); }
.card h2 { margin-bottom: var(--s3); font-size: 15px; color: var(--smoke);
           letter-spacing: .04em; text-transform: uppercase; font-weight: 700; }

/* Accent rule on feature cards, so the grid isn't twelve identical boxes. */
.card.accent::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(var(--ember), transparent);
  border-radius: var(--r-md) 0 0 var(--r-md);
}

.grid { display: grid; gap: var(--s3); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.stat { font-size: 30px; font-weight: 800; color: var(--steel); line-height: 1.1;
        letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--smoke); text-transform: uppercase;
              letter-spacing: .08em; font-weight: 600; }

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero { position: relative; text-align: center; padding: var(--s8) var(--s4) var(--s7); }
.hero::after {
  content: ""; position: absolute; inset: -10% 20% 40%;
  background: radial-gradient(closest-side, rgba(255,122,47,.16), transparent 75%);
  pointer-events: none; z-index: -1;
}
.hero h1 { margin: var(--s4) 0 var(--s3); }
.hero p { color: var(--smoke); max-width: 540px; margin: 0 auto var(--s5); font-size: 17px; }
.hero-actions { display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; }

/* Hero with the app beside the pitch rather than under it. */
.hero.split {
  display: grid; grid-template-columns: 1fr auto; gap: var(--s8);
  align-items: center; text-align: left;
  padding: var(--s7) var(--s4) var(--s6);
  /* The phone's glow bleeds past this box by design; clip rather than let it
     widen the page. `clip` (not `hidden`) keeps vertical overflow visible. */
  overflow-x: clip;
}
.hero.split .hero-copy p { margin-left: 0; }
.hero.split .hero-actions { justify-content: flex-start; }

/* ── Phone frames ───────────────────────────────────────────────────────── */

.phone {
  position: relative;
  width: 250px; max-width: 100%;
  padding: 10px;
  border-radius: 34px;
  background: linear-gradient(160deg, #33393f, #14161a 55%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.06),
    0 24px 48px -12px rgba(0,0,0,.7),
    0 2px 8px rgba(0,0,0,.5);
}
.phone svg { display: block; width: 100%; height: auto; border-radius: 25px; }
/* Speaker slit, so the frame reads as a device and not a rounded rectangle. */
.phone::before {
  content: ""; position: absolute; top: 17px; left: 50%; transform: translateX(-50%);
  width: 46px; height: 4px; border-radius: 2px; background: #0d0f12;
}

.hero-phone { position: relative; }
.hero-phone::after {
  content: ""; position: absolute; inset: 8% -18% 12%;
  background: radial-gradient(closest-side, rgba(255,122,47,.28), transparent 72%);
  z-index: -1;
}

/* ── Screenshot gallery ─────────────────────────────────────────────────── */

.gallery {
  display: grid; gap: var(--s6);
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  justify-items: center;
}
.gallery figure { margin: 0; max-width: 300px; }
.gallery .phone { margin: 0 auto; }
.gallery figcaption {
  margin-top: var(--s4); color: var(--smoke); font-size: 14px; line-height: 1.6;
  text-align: center;
}
.gallery figcaption strong {
  display: block; color: var(--steel); font-size: 16px;
  margin-bottom: var(--s2); letter-spacing: -0.01em;
}

/* ── Closing call to action ─────────────────────────────────────────────── */

.cta {
  margin-top: var(--s8); padding: var(--s7) var(--s5);
  text-align: center;
  background: var(--slab); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.cta h2 { font-size: 26px; text-transform: none; letter-spacing: -0.02em;
          color: var(--steel); margin-bottom: var(--s2); }
.cta p { margin: 0 0 var(--s5); }

/* ── Buttons ────────────────────────────────────────────────────────────── */

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  width: 100%; padding: var(--s3) var(--s5);
  background: var(--ember); color: #16181d;
  border: 0; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: transform .12s ease, background .15s ease;
}
button:hover, .btn:hover { background: var(--spark); color: #16181d; transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 0; box-shadow: var(--ring); }
button.ghost, .btn.ghost {
  background: transparent; color: var(--ember); border: 1px solid var(--border-strong);
}
button.ghost:hover, .btn.ghost:hover { background: var(--slab-2); color: var(--spark); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.auto, button.auto { width: auto; }

/* ── Forms ──────────────────────────────────────────────────────────────── */

label { display: block; font-size: 13px; color: var(--smoke); margin: var(--s4) 0 var(--s2);
        font-weight: 500; }

input[type=email], input[type=password], input[type=text],
input[type=number], input[type=date], select {
  width: 100%; padding: var(--s3) var(--s4);
  background: var(--iron); color: var(--steel);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font-size: 15px; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus { outline: 0; border-color: var(--ember); box-shadow: var(--ring); }
input::placeholder { color: var(--hint); }

.msg { margin-top: var(--s4); padding: var(--s3) var(--s4);
       border-radius: var(--r-sm); font-size: 14px; }
.msg.error { background: rgba(255,107,107,.1); color: var(--error);
             border: 1px solid rgba(255,107,107,.4); }
.msg.ok { background: rgba(93,219,164,.1); color: var(--good);
          border: 1px solid rgba(93,219,164,.4); }

/* ── Rows and lists ─────────────────────────────────────────────────────── */

.row { display: flex; align-items: center; gap: var(--s3);
       padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; }
.row .kcal { color: var(--ember); font-weight: 700; white-space: nowrap;
             font-variant-numeric: tabular-nums; }

.meal-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: var(--s4); padding-bottom: var(--s2);
  border-bottom: 1px solid var(--border-strong);
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--spark);
}
.meal-head span:last-child { color: var(--smoke); letter-spacing: 0; text-transform: none;
                             font-size: 13px; }

/* ── Bars and ring ──────────────────────────────────────────────────────── */

.bar { height: 8px; background: var(--slab-3); border-radius: var(--r-pill);
       overflow: hidden; margin: var(--s2) 0; }
.bar > span { display: block; height: 100%; border-radius: var(--r-pill);
              background: var(--ember); transition: width .45s cubic-bezier(.2,.8,.2,1); }
.bar.protein > span { background: var(--protein); }
.bar.carbs > span { background: var(--carbs); }
.bar.fat > span { background: var(--fat); }
.bar.water > span { background: var(--water); }

.ring-wrap { display: flex; justify-content: center; padding: var(--s2) 0; }
.ring-track { stroke: var(--slab-3); }
.ring-value { stroke: var(--ember); stroke-linecap: round;
              transition: stroke-dasharray .6s cubic-bezier(.2,.8,.2,1); }
.ring-over { stroke: var(--error); }

/* ── Today hero ─────────────────────────────────────────────────────────── */
/* The ring alone left a lot of empty card; the numbers beside it are the ones
   people actually read off. */
.today-hero { display: grid; gap: var(--s5); align-items: center;
              grid-template-columns: minmax(0, 210px) 1fr; }
.today-hero .ring-wrap { padding: 0; }
.today-stats { display: grid; gap: var(--s2); grid-template-columns: repeat(2, 1fr); }
.today-stats .cell { background: var(--slab-2); border: 1px solid var(--border);
                     border-radius: var(--r-sm); padding: var(--s3) var(--s4); }
.today-stats .cell .stat { font-size: 21px; }
.today-stats .cell .stat.burn { color: var(--spark); }
.today-stats .cell .stat.over { color: var(--error); }

.day-nav { display: flex; align-items: center; gap: var(--s2);
           margin-bottom: var(--s4); }
.day-nav .grow { flex: 1; min-width: 0; }
.day-nav h1 { font-size: 24px; }
.day-nav button { width: 40px; height: 40px; padding: 0; font-size: 20px; line-height: 1; }

/* ── Gyms ───────────────────────────────────────────────────────────────── */

.searchbar { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s4); }
.searchbar input { flex: 1; min-width: 180px; }
.searchbar button { width: auto; padding: var(--s3) var(--s5); }

.gym { display: flex; align-items: flex-start; gap: var(--s3);
       padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.gym:last-child { border-bottom: 0; }
.gym .grow { flex: 1; min-width: 0; }
.gym .dist { color: var(--ember); font-weight: 700; white-space: nowrap;
             font-variant-numeric: tabular-nums; }

.badges { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
.badge { font-size: 11px; font-weight: 600; letter-spacing: .04em;
         padding: 2px var(--s2); border-radius: var(--r-pill);
         background: var(--slab-3); color: var(--smoke); }

.star { width: auto; padding: var(--s1) var(--s2); background: none; border: 0;
        color: var(--hint); font-size: 19px; line-height: 1; }
.star:hover { background: none; color: var(--spark); transform: none; }
.star.on { color: var(--ember); }

/* ── Auth ───────────────────────────────────────────────────────────────── */

.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); }
.auth .card { width: 100%; max-width: 400px; box-shadow: var(--shadow); padding: var(--s6); }
.auth .logo { display: flex; justify-content: center; margin-bottom: var(--s3); }
.auth h1 { font-size: 26px; text-align: center; }
.auth .sub { color: var(--smoke); font-size: 14px; text-align: center;
             margin: var(--s2) 0 var(--s3); }
.auth .alt { margin-top: var(--s4); font-size: 14px; color: var(--smoke); text-align: center; }

/* ── Landing ────────────────────────────────────────────────────────────── */

/* Prose cards need a wider minimum than the dashboard's number tiles, or a
   three-card row gets laid out across five narrow tracks. */
.card-grid { display: grid; gap: var(--s3);
             grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card-grid .card { padding: var(--s5); }
.card-grid h3 { margin-bottom: var(--s2); color: var(--steel); }
.card-grid p { margin: 0; color: var(--smoke); font-size: 14px; }

.section-head { margin: var(--s8) 0 var(--s5); text-align: center; }
.section-head h2 { font-size: 26px; color: var(--steel); text-transform: none;
                   letter-spacing: -0.02em; margin-bottom: var(--s2); }

footer.site { border-top: 1px solid var(--border); margin-top: var(--s8);
              padding: var(--s5); text-align: center; }
footer.site a { color: var(--smoke); font-size: 14px; margin: 0 var(--s3); }
footer.site a:hover { color: var(--steel); }

/* Below this the ring and the stat grid can't both hold their width. */
@media (max-width: 720px) {
  .today-hero { grid-template-columns: 1fr; gap: var(--s4); }
  .today-hero .ring-wrap svg { max-width: 240px; }
}

/* The split hero needs room for a 250px phone plus readable copy. */
@media (max-width: 860px) {
  .hero.split {
    grid-template-columns: 1fr; text-align: center; gap: var(--s6);
  }
  .hero.split .hero-copy p { margin-left: auto; margin-right: auto; }
  .hero.split .hero-actions { justify-content: center; }
  .hero-phone { display: flex; justify-content: center; }
}

@media (max-width: 640px) {
  header.top { flex-wrap: wrap; }
  header.top nav { width: 100%; margin-left: 0; }
  .wrap { padding: var(--s4) var(--s3) var(--s7); }
  .card { padding: var(--s4); }
  .hero { padding: var(--s6) var(--s3) var(--s5); }
  .hero.split { padding: var(--s6) var(--s2) var(--s5); }
  .searchbar button { width: 100%; }
  .cta { padding: var(--s6) var(--s4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
