/* ==========================================================================
   Life tracker — design mock
   Look-only. No data, no storage. Everything themeable lives in :root below.
   ========================================================================== */

:root {
  /* --- Colour ----------------------------------------------------------
     Mostly monochrome. ONE accent, used in only three places on the page. */
  --bg:          #F6F5F3;   /* very light warm grey — the page behind the cards */
  --card:        #FFFFFF;   /* cards are the only white on the page */
  --ink:         #17171A;   /* near-black. Never pure #000 — it looks harsh */
  --ink-muted:   #8A8A93;   /* subtext, units, meta */
  --hairline:    #ECEBE8;   /* 1px dividers and light borders */
  --sunken:      #F4F3F0;   /* inset fields / icon tiles — slightly darker than card */
  --accent:      #2F6B4F;   /* muted forest green */
  --accent-soft: #E9F0EC;   /* barely-there accent tint for the "done" row */

  /* --- Radius ---------------------------------------------------------- */
  --r-card: 20px;
  --r-tile: 12px;
  --r-pill: 999px;          /* anything this big is a perfect pill */

  /* --- Spacing scale (4px steps) --------------------------------------- */
  --s-1:  4px;
  --s-2:  8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;

  /* --- Depth & type ----------------------------------------------------
     Two shadow layers: a tight one for "contact", a wide soft one for lift.
     Both very low opacity — this is what makes a card float instead of
     looking like a box with a border. */
  --shadow: 0 1px 2px rgba(16, 16, 20, 0.04),
            0 8px 24px rgba(16, 16, 20, 0.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* --- Dark theme -------------------------------------------------------
   To switch: uncomment this block AND add data-theme="dark" to <html>.
   Nothing else in the file needs to change.

[data-theme="dark"] {
  --bg:          #111113;
  --card:        #191A1D;
  --ink:         #F2F2F0;
  --ink-muted:   #8E8E96;
  --hairline:    #26272B;
  --sunken:      #202124;
  --accent:      #5E9E7C;
  --accent-soft: #1D2A23;
  --shadow: none;
}
*/

/* ==========================================================================
   Base
   ========================================================================== */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* Mobile-first single column. On desktop it just centres — no extra layout. */
.wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: var(--s-6) var(--s-4) 64px;
}

/* Give every direct child of the page the same rhythm. Consistent gaps do
   more for "calm" than any individual style choice. */
.wrap > * + * { margin-top: var(--s-4); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==========================================================================
   Card — the one repeating container
   ========================================================================== */

.card {
  background: var(--card);
  border-radius: var(--r-card);
  padding: var(--s-5);
  box-shadow: var(--shadow);
}

/* Small medium-weight label that sits above a card's content. */
.card__label {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

/* ==========================================================================
   Page header (not a card)
   ========================================================================== */

.page-head { padding: var(--s-1) var(--s-1) var(--s-2); }

.page-head__date {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}

.page-head__title {
  margin: var(--s-1) 0 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   Streak — the single loudest thing on the page
   ========================================================================== */

.streak__figure {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin: var(--s-1) 0 var(--s-2);
}

/* Big, heavy, and tightly tracked. Large type needs NEGATIVE letter-spacing
   or the gaps between characters start to look like holes. */
.streak__number {
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
}

.streak__unit {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-muted);
}

.streak__note {
  margin: 0 0 var(--s-5);
  font-size: 13px;
  color: var(--ink-muted);
}

/* ==========================================================================
   Chip — rounded pill, coloured dot, short label
   ========================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px var(--s-3);
  border-radius: var(--r-pill);
  background: var(--sunken);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);   /* accent use #1 */
}

/* ==========================================================================
   Buttons — always fully-rounded pills, always a comfortable tap target
   ========================================================================== */

.btn-row {
  display: flex;
  gap: var(--s-2);
}

.btn {
  flex: 1;
  min-height: 44px;            /* 44px is the smallest comfortable tap size */
  padding: 0 var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* Solid, near-black. The primary action. */
.btn--solid {
  background: var(--ink);
  color: #fff;
}

/* Light + outlined. Same size, quieter voice. */
.btn--ghost {
  background: transparent;
  border-color: var(--hairline);
  color: var(--ink);
}

/* Doesn't stretch — used next to an input. */
.btn--tight { flex: 0 0 auto; }

/* ==========================================================================
   Segmented control (Today / Tomorrow) — static in this mock
   ========================================================================== */

.segmented {
  display: inline-flex;
  gap: var(--s-1);
  padding: var(--s-1);
  border-radius: var(--r-pill);
  background: var(--sunken);
}

/* These are real <button>s now, so strip the browser's default look first. */
.segmented__item {
  padding: 6px var(--s-4);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
}

.segmented__item.is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 16, 20, 0.06);
}

/* ==========================================================================
   List rows — icon/dot left, label + subtext middle, value right
   ========================================================================== */

/* Hairline dividers BETWEEN rows only — never a box around each row. */
.list > * + * {
  border-top: 1px solid var(--hairline);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
}

/* Small rounded square. A single muted letter instead of an icon font —
   no dependencies, and it stays monochrome and quiet. */
.row__tile {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-tile);
  background: var(--sunken);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

.row__text {
  flex: 1 1 auto;
  min-width: 0;                /* lets long text truncate instead of pushing */
}

/* display:block because inside a habit these are <span>s — a <button> is not
   allowed to contain <div>s, and inline spans would sit on the same line. */
.row__label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.row__sub {
  display: block;
  margin-top: 1px;
  font-size: 13px;
  color: var(--ink-muted);
}

.row__value {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;  /* times line up in a column */
}

/* ==========================================================================
   Habit rows — the only interactive thing here (JS toggles .is-done)
   ========================================================================== */

.habit {
  /* It's a real <button>, so strip the browser's button look first. */
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  margin: 0;
  border: 0;
  border-radius: var(--r-tile);
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.habit + .habit { margin-top: var(--s-1); }

.habit__mark {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--hairline);
  border-radius: 50%;
  background: transparent;
  font-size: 13px;
  line-height: 1;
  color: #fff;
}

/* The tick lives in the HTML at all times — we just hide it when undone.
   Simpler to follow than swapping content in CSS. */
.habit__mark span { visibility: hidden; }

/* --- done state --- */
.habit.is-done { background: var(--accent-soft); }

.habit.is-done .habit__mark {
  background: var(--accent);   /* accent use #2 */
  border-color: var(--accent);
}

.habit.is-done .habit__mark span { visibility: visible; }

/* ==========================================================================
   Tasks — static checkbox marks
   ========================================================================== */

.task {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
}

.task + .task { border-top: 1px solid var(--hairline); }

.task__box {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--hairline);
  border-radius: 6px;
  font-size: 11px;
  line-height: 1;
  color: #fff;
}

/* Done tasks use near-black, not the accent — the accent stays rare. */
.task.is-done .task__box {
  background: var(--ink);
  border-color: var(--ink);
}

.task__label {
  flex: 1 1 auto;
  font-size: 15px;
  font-weight: 500;
}

.task.is-done .task__label {
  color: var(--ink-muted);
  text-decoration: line-through;
}

.task__tag {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--ink-muted);
}

/* ==========================================================================
   Reflection
   ========================================================================== */

.reflect {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

/* A sunken field rather than a bordered one — fewer lines on the page. */
.reflect__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 0 var(--s-4);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--sunken);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}

.reflect__input::placeholder { color: var(--ink-muted); }

/* ==========================================================================
   Footer note
   ========================================================================== */

.mock-note {
  margin-top: var(--s-6);
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
}

/* ==========================================================================
   Nav — three pages: Home / Gym / Learning
   ========================================================================== */

.nav {
  display: flex;
  gap: var(--s-1);
  padding: var(--s-1);
  border-radius: var(--r-pill);
  background: var(--sunken);
}

.nav a {
  flex: 1;
  padding: 10px 0;
  border-radius: var(--r-pill);
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}

.nav a.is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 16, 20, 0.06);
}

/* ==========================================================================
   Day picker — big tappable chips for choosing a workout type
   ========================================================================== */

.picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.picker button {
  padding: 10px var(--s-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

/* The chosen one goes solid near-black — same language as the primary button. */
.picker button.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* ==========================================================================
   Mini calendar — one small square per day. Glance only, no detail.
   ========================================================================== */

.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal__dow {
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-muted);
  padding-bottom: var(--s-1);
}

.cal__day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--sunken);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
}

.cal__day.is-empty { background: transparent; }

/* Something was recorded that day. */
.cal__day.has-any {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Today gets a ring so you can always find yourself. */
.cal__day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--ink);
  color: var(--ink);
}

.cal__legend {
  display: flex;
  gap: var(--s-4);
  margin-top: var(--s-4);
  font-size: 12px;
  color: var(--ink-muted);
}

/* ==========================================================================
   Small shared bits
   ========================================================================== */

.empty {
  padding: var(--s-4) 0;
  font-size: 14px;
  color: var(--ink-muted);
}

/* Used for exercises still missing a name on the sheet. */
.needs-name {
  color: var(--ink-muted);
  font-style: italic;
  font-weight: 500;
}

.saved-note {
  margin-top: var(--s-3);
  font-size: 12px;
  color: var(--ink-muted);
}

/* A whole row that is a link (Sport hub → each sport's page). */
.row--link {
  text-decoration: none;
  color: inherit;
}

/* The little chevron that says "this opens a page". */
.row--link .row__value::after {
  content: '  ›';
  color: var(--ink-muted);
}

/* ==========================================================================
   Set editor — reps × weight, one line per set
   ========================================================================== */

.exercise {
  padding: var(--s-4) 0;
}

.exercise + .exercise { border-top: 1px solid var(--hairline); }

.exercise__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

.exercise__name {
  font-size: 15px;
  font-weight: 600;
}

.exercise__target {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.set-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}

.set-row__n {
  flex: 0 0 auto;
  width: 26px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
}

/* Number fields: sunken pills, big enough to tap on a phone. */
.num {
  width: 100%;
  min-height: 40px;
  padding: 0 var(--s-3);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--sunken);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-align: center;
}

/* Hide the spinner arrows — they're fiddly on touch. */
.num::-webkit-outer-spin-button,
.num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num { -moz-appearance: textfield; }

.set-row__unit {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--ink-muted);
}

.set-row__x {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--ink-muted);
}

.set-row__del {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink-muted);
  cursor: pointer;
}

.btn--mini {
  min-height: 36px;
  padding: 0 var(--s-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

/* ==========================================================================
   Big number entry (running / biking)
   ========================================================================== */

.big-field {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin: var(--s-2) 0 var(--s-5);
}

.big-field input {
  width: 140px;
  border: 0;
  border-bottom: 2px solid var(--hairline);
  background: transparent;
  font-family: inherit;
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-align: left;
}

.big-field input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.big-field span {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-muted);
}

/* Multi-line text box — same sunken treatment as the other fields. */
.learned {
  width: 100%;
  margin-top: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 0;
  border-radius: var(--r-tile);
  background: var(--sunken);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  resize: vertical;
}

.learned::placeholder { color: var(--ink-muted); }
.learned:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   Top bar — back on the left, close on the right
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.topbar__btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  text-decoration: none;
  font-size: 16px;
  color: var(--ink);
}

.topbar__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* The × that removes a whole muscle group */
.group-x {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--sunken);
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
}

/* Divider label between your sheet and the common exercises */
.sub-label {
  margin: var(--s-5) 0 0;
  padding-top: var(--s-4);
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
}

/* From / to time fields */
.time-row {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-3);
}

.time-row > div { flex: 1; }

.time-row__lbl {
  display: block;
  margin-bottom: var(--s-1);
  font-size: 12px;
  color: var(--ink-muted);
}

/* ==========================================================================
   History
   ========================================================================== */

.day-card__date {
  font-size: 15px;
  font-weight: 600;
}

.day-card__ago {
  font-size: 12px;
  color: var(--ink-muted);
}

/* Small summary pills inside a history day */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.tag {
  padding: 5px var(--s-3);
  border-radius: var(--r-pill);
  background: var(--sunken);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}

.tag--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.quote {
  margin: var(--s-3) 0 0;
  padding-left: var(--s-3);
  border-left: 2px solid var(--hairline);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
}

/* ==========================================================================
   Password overlay
   ========================================================================== */

#pass-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  background: var(--bg);
}

.pass-card {
  width: 100%;
  max-width: 320px;
  padding: var(--s-6);
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow);
}

/* ==========================================================================
   Celebration — the ONE animation in the app, and only on finishing something
   ========================================================================== */

.confetti {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;      /* never blocks a tap */
  overflow: hidden;
}

.confetti i {
  position: absolute;
  top: -12px;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  animation: fall 1.2s ease-in forwards;
}

@keyframes fall {
  to {
    transform: translateY(105vh) rotate(420deg);
    opacity: 0;
  }
}

/* Anyone who's asked their system to reduce motion gets the buzz, not the
   confetti. Standard courtesy, one rule. */
@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
}

/* Small "offline / saved locally" note */
.sync-note {
  margin-top: var(--s-4);
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
}

/* ==========================================================================
   Last 7 days — a 2×2 grid of quiet stats
   ========================================================================== */

.week-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  margin-top: var(--s-3);
}

.week-stat {
  padding: var(--s-4);
  border-radius: var(--r-tile);
  background: var(--sunken);
}

.week-stat__n {
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.week-stat__l {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
}

/* ==========================================================================
   Today's study task (inside the study-calendar card)
   ========================================================================== */

.today-task {
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px solid var(--hairline);
}

.today-task__time {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.today-task__title {
  margin-top: 3px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.today-task__sub {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-muted);
}
