/* Rack & Ruck web pages: paper, the plate and orange, with large, tap-friendly controls. Plain CSS, no build step. */

/* Barlow Condensed ExtraBold, the face stamped in the app icon. Served from
   this site (SIL Open Font License; the license is in the font's metadata), so
   no visitor's IP goes to a font host. */
@font-face {
  font-family: "Barlow Condensed";
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  src: url("/assets/BarlowCondensed-ExtraBold-b2464834.ttf") format("truetype");
}

/* The Rack & Ruck look, as in the app: paper, the plate's black for what's
   done, orange for what to tap. Kind colors stay on stickers. */
:root {
  color-scheme: light dark;

  --bg: #f7f4ef;
  --surface: #ffffff;
  --text: #1a1918;
  --muted: #6f6a62;
  --border: #e4ded4;
  --input-bg: #ffffff;
  --accent: #c4520e;
  --accent-hover: #a9450a;
  --on-accent: #ffffff;
  --focus: rgba(196, 82, 14, 0.28);
  --danger: #c92a2a;
  --danger-bg: #fff5f5;
  --notice: #1a1918;
  --notice-bg: #efeae1;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);

  --plate: #1a1918;
  --plate-ink: #f2eee8;
  --stamp: #a8a29a;
  --orange: #f26b1d;
  --done: #1a1918;

  --lift: #34c759;
  --cardio: #30b0c7;
  --hiit: #ff2d55;
  --other: #32ade6;
  --walk: #8e8e93;
  --rest: #e9e4dc;
  --paused: #c9c4bb;
  --missed: #e5484d;
  --z2: #15aabf;
  --z3: #37b24d;
  --z4: #f76707;

  --display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --radius: 16px;
  --control-height: 3rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141312;
    --surface: #1f1e1c;
    --text: #f2eee8;
    --muted: #a39d93;
    --border: #34312d;
    --input-bg: #262422;
    --accent: #f37a32;
    --accent-hover: #ff8f4d;
    --on-accent: #1a0c04;
    --focus: rgba(243, 122, 50, 0.35);
    --danger: #ff6b6b;
    --danger-bg: #2a1a1a;
    --notice: #f2eee8;
    --notice-bg: #2a2825;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --plate: #f2eee8;
    --plate-ink: #1a1918;
    --stamp: #6b665f;
    --done: #f2eee8;
    --rest: #2c2a27;
    --paused: #57534d;
    --z2: #3bc9db;
    --z3: #51cf66;
    --z4: #ff922b;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  text-decoration: underline;
}

/* Layout */

.shell {
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  padding: 3rem 1rem 4rem;
}

/* Reading pages (privacy, support) get a wider card. */
.shell--wide {
  max-width: 42rem;
}

.brand {
  margin-bottom: 1.5rem;
  text-align: center;
}

.brand__name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-family: var(--display);
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.brand__name .plate {
  width: 1.25rem;
}

.brand__name:hover {
  text-decoration: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
}

.card > :first-child {
  margin-top: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

.card__footer {
  margin-top: 1.5rem;
  text-align: center;
}

h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.25rem;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.125rem;
  margin: 0 0 0.5rem;
}

p {
  margin: 0 0 1rem;
}

.lead {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.lead strong {
  color: var(--text);
  font-weight: 600;
  word-break: break-all;
}

/* Forms */

.form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.field {
  display: grid;
  gap: 0.375rem;
}

label {
  font-size: 0.875rem;
  font-weight: 600;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  height: var(--control-height);
  padding: 0 0.875rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 16px keeps iOS Safari from zooming in on focus */
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--control-height);
  padding: 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button:hover {
  border-color: var(--muted);
}

.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}

.button--primary {
  margin-top: 0.5rem;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.button--primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.button--danger {
  border-color: var(--danger);
  background: transparent;
  color: var(--danger);
}

.button--danger:hover {
  border-color: var(--danger);
  background: var(--danger-bg);
}

/* button_to wraps each button in a form */
form.button_to {
  margin: 0;
}

/* Account deletion */

.danger {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.danger p {
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Reading pages */

.prose h2 {
  margin-top: 2rem;
}

.prose ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.prose li {
  margin-bottom: 0.375rem;
}

.prose .updated {
  color: var(--muted);
  font-size: 0.875rem;
}

.prose details {
  border-top: 1px solid var(--border);
  padding: 0.875rem 0;
}

.prose details:last-of-type {
  border-bottom: 1px solid var(--border);
}

.prose summary {
  cursor: pointer;
  font-weight: 600;
}

.prose details > p {
  margin: 0.625rem 0 0;
}

.contact {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: var(--bg);
}

.contact p {
  margin: 0;
}

/* Footer */

.site-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
}

.site-footer nav {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
}

.site-footer a {
  color: var(--muted);
}

/* Dashboard */

.muted {
  color: var(--muted);
  font-size: 0.9375rem;
}

.section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.streak__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.streak__count {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0;
  font-family: var(--display);
  font-size: 4rem;
  font-weight: 800;
  line-height: 0.95;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}

.streak__count span {
  color: var(--muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0;
}

.streak__caption {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.streak__best {
  display: grid;
  justify-items: end;
  line-height: 1.2;
}

.streak__best strong {
  font-size: 1.375rem;
  font-variant-numeric: tabular-nums;
}

.streak__best span {
  color: var(--muted);
  font-size: 0.8125rem;
}

/* 12 weeks across, Sunday to Saturday down, like the app's Progress tab. */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin-top: 1.25rem;
}

.grid__week {
  display: grid;
  gap: 4px;
}

.grid__mark {
  height: 0.875rem;
  color: var(--lift);
  font-size: 0.6875rem;
  font-weight: 900;
  line-height: 0.875rem;
  text-align: center;
  visibility: hidden;
}

.grid__mark--on {
  visibility: visible;
}

.day {
  display: block;
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--rest);
}

.day--lift {
  background: var(--lift);
}

.day--cardio {
  background: var(--cardio);
}

.day--both {
  background: linear-gradient(to top, var(--cardio) 0 30%, var(--lift) 30%);
}

.day--paused {
  background: var(--paused);
}

.day--missed {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--missed);
}

.day--future {
  background: transparent;
  outline: 1px dashed var(--border);
  outline-offset: -1px;
}

/* A ring outside the square, so today never looks like a missed lift. */
.day--today {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1rem;
  margin: 0.875rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.8125rem;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.legend .day {
  width: 0.75rem;
}

.goal {
  margin-top: 1rem;
}

.goal__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.375rem;
  font-size: 0.9375rem;
}

.goal__label {
  font-weight: 600;
}

.goal__value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.goal--met .goal__value {
  color: var(--text);
}

.goal--met .goal__value::after {
  content: " ✓";
  color: var(--lift);
  font-weight: 800;
}

.bar {
  height: 0.5rem;
  border-radius: 999px;
  background: var(--rest);
  overflow: hidden;
}

.bar__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.bar__fill--z2 {
  background: var(--z2);
}

.bar__fill--z3 {
  background: var(--z3);
}

.bar__fill--z4 {
  background: var(--z4);
}

.section .muted {
  margin: 1rem 0 0;
}

.workouts {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.workout {
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}

.workout:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.workout__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.workout__title {
  font-weight: 600;
}

.workout__date {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.workout__details,
.workout__exercises {
  margin: 0.125rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Flash messages */

.flash {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 500;
}

.flash--notice {
  background: var(--notice-bg);
  color: var(--notice);
}

.flash--alert {
  background: var(--danger-bg);
  color: var(--danger);
}

@media (max-width: 480px) {
  .shell {
    padding-top: 2rem;
  }

  .card {
    padding: 1.5rem 1.25rem;
  }
}

/* The plate: inline SVG, 80 wide by 100 tall. */
.plate {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  overflow: visible;
}

.plate--outline {
  color: var(--muted);
  opacity: 0.6;
}

/* Stickers, as on the app's plates. */
.sticker {
  display: inline-grid;
  place-items: center;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  border: 1.5px solid var(--surface);
  color: #fff;
}

.sticker svg {
  width: 62%;
  height: 62%;
  fill: currentColor;
}

.sticker--lift { background: var(--lift); }
.sticker--ruck { background: var(--cardio); }
.sticker--hiit { background: var(--hiit); }
.sticker--cardio { background: var(--other); }
.sticker--walk { background: var(--walk); }

/* Dashboard: recent weeks as rows of day plates, like the app. */
.weeks {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.weeks__head,
.weeks__row {
  display: grid;
  grid-template-columns: 4.5rem repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: end;
}

.weeks__head span {
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.weeks__label {
  align-self: center;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
}

.weeks__label--on::after {
  content: " \2713";
  color: var(--done);
  font-weight: 900;
}

.dayplate {
  position: relative;
  max-width: 3.5rem;
  width: 100%;
  justify-self: center;
}

.dayplate__num {
  position: absolute;
  inset: 40% 0 auto;
  text-align: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(0.875rem, 3.2vw, 1.25rem);
  line-height: 1;
  color: var(--text);
}

.dayplate--trained .dayplate__num {
  color: var(--plate-ink);
  opacity: 0.85;
}

.dayplate--easy .plate {
  opacity: 0.3;
}

.dayplate--missed .plate--outline {
  color: var(--missed);
  opacity: 0.9;
}

.dayplate--today::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.6rem;
  width: 0.3rem;
  height: 0.3rem;
  margin-left: -0.15rem;
  border-radius: 50%;
  background: var(--orange);
}

.dayplate__stickers {
  position: absolute;
  left: -0.25rem;
  bottom: -0.25rem;
  display: flex;
}

.dayplate__stickers .sticker + .sticker {
  margin-left: -0.35rem;
}

.legend .sticker {
  width: 0.875rem;
  height: 0.875rem;
  border-width: 1px;
}

.legend__missed {
  display: inline-block;
  width: 0.7rem;
  height: 0.875rem;
}

/* Sign in: the card is the plate. */
.shell--plate {
  max-width: 28rem;
}

.plate-card {
  position: relative;
  width: min(100%, 24rem);
  aspect-ratio: 4 / 5;
  margin: 0 auto;
}

/* The plate stretches behind the form: on a narrow phone the card grows a
   little taller instead of the form spilling onto the shoulders or stripes. */
.plate-card > .plate {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.18));
}

.plate-card__body {
  position: relative;
  display: grid;
  gap: 0.75rem;
  padding: 27% 11% 40%;
  color: var(--plate-ink);
}

.plate-card__body h1 {
  margin: 0 0 0.25rem;
  text-align: center;
  font-size: 2rem;
  color: var(--plate-ink);
}

.plate-card__body .lead {
  margin: 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--stamp);
}

.plate-card__body .form {
  gap: 0.75rem;
}

.plate-card__body label {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stamp);
}

.plate-card__body input[type="email"],
.plate-card__body input[type="password"],
.plate-card__body input[type="text"] {
  background: color-mix(in srgb, var(--plate-ink) 9%, var(--plate));
  border-color: color-mix(in srgb, var(--plate-ink) 16%, var(--plate));
  color: var(--plate-ink);
}

/* Lifted off the stripes by a shadow, so the button reads as on top. */
.plate-card__body .button--primary {
  margin-top: 0.25rem;
  background: var(--orange);
  color: #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.plate-card__body .button--primary:hover {
  background: #e05f14;
}

.plate-card__link {
  text-align: center;
  font-size: 0.875rem;
}

.plate-card__link a {
  color: var(--stamp);
  font-weight: 500;
}

.plate-card__note {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9375rem;
}

.plate--missed {
  color: var(--missed);
  opacity: 0.9;
}
