/*
 * formorrow.app
 *
 * Colors are the app's own (docs/formorrow-overview.md, "What the colors mean"):
 * pine for action and done, amber for the one thing to watch. Amber as text is
 * the darker #A5560F so it reads on the light ground. Numbers use the system's
 * rounded face (SF Pro Rounded on Apple devices), as in the app. Text uses the
 * system sans. No web fonts: the site makes no request to anyone but itself.
 *
 * Workout mode in the app is always dark, so its section here is dark in both
 * themes.
 */

:root {
  --ground: #F2F0EA;
  --card: #FFFFFF;
  --inset: #E7E5DD;
  --hairline: #DAD7CE;
  --ink: #15201B;
  --muted: #5B655F;
  --pine: #1F6B4F;
  --pine-soft: #DCE8E0;
  --on-pine: #FFFFFF;
  --amber: #E08A2E;
  --amber-text: #A5560F;
  --amber-soft: #F6E3CC;
  --easy: #3E6FA8;
  --link: #1F6B4F;
  --shadow: 21 32 27;

  /* Workout mode, the same in both themes. */
  --night: #0F1311;
  --night-card: #1A201C;
  --night-ink: #F2F0EA;
  --night-muted: #A3ADA6;

  --round: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 16px;
  --radius-phone: 28px;
  --page: 1120px;
  --gutter: clamp(16px, 5vw, 40px);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0F1311;
    --card: #1A201C;
    --inset: #151A17;
    --hairline: #2A322D;
    --ink: #F2F0EA;
    --muted: #A3ADA6;
    --pine: #2A7D5C;
    --pine-soft: #17281F;
    --on-pine: #FFFFFF;
    --amber: #E08A2E;
    --amber-text: #E08A2E;
    --amber-soft: #2C2115;
    --easy: #7FA6D6;
    --link: #F2F0EA;
    --shadow: 0 0 0;

    /* The page is already dark, so workout mode sits one step up. */
    --night: #1A201C;
    --night-card: #232A25;
  }
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--pine);
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: var(--gutter);
  top: 12px;
  z-index: 10;
  background: var(--card);
  padding: 8px 12px;
}

.wrap {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Big rounded numbers, as in the app */

.num {
  font-family: var(--round);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Header */

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--round);
  font-size: 1.25rem;
  font-weight: 700;
  white-space: nowrap;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.site-nav {
  display: flex;
  gap: 20px;
  font-size: 0.9375rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

/* Phone frame around a screenshot */

.phone {
  margin: 0;
  border-radius: var(--radius-phone);
  border: 1px solid var(--hairline);
  background: var(--card);
  padding: 6px;
  box-shadow: 0 24px 60px -24px rgb(var(--shadow) / 0.35);
}

.phone img {
  border-radius: calc(var(--radius-phone) - 6px);
  width: 100%;
}

/* Hero */

.hero .wrap {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
  padding-top: clamp(24px, 6vw, 72px);
  padding-bottom: clamp(48px, 8vw, 96px);
}

.hero h1 {
  font-family: var(--round);
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--pine);
}

.hero .promise {
  margin-top: 18px;
  font-size: clamp(1.5rem, 2.8vw, 2.125rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  max-width: 20ch;
}

.hero .lede {
  margin-top: 16px;
  max-width: 38ch;
  font-size: 1.125rem;
  color: var(--muted);
}

.hero .phone {
  max-width: 320px;
  justify-self: center;
}

.availability {
  margin-top: 28px;
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--pine-soft);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 600;
}

/* Sections */

.section {
  padding: clamp(56px, 9vw, 112px) 0;
}

.section h2 {
  font-size: clamp(1.875rem, 3.6vw, 2.75rem);
}

.section .body {
  margin-top: 16px;
  max-width: 52ch;
  color: var(--muted);
}

.band {
  background: var(--inset);
}

/* The one rule: one row per weekday */

.week {
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.week li {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.week .day {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}

/* The app's five short bars. The lit one, in amber, is the day number. */
.bars {
  display: flex;
  gap: 4px;
}

.bars span {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--hairline);
}

.bars .lit {
  background: var(--amber);
}

.week .focus {
  font-weight: 700;
  color: var(--amber-text);
  line-height: 1.25;
}

.week .sets {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  font-size: 0.875rem;
}

.week .sets .num {
  font-size: 2.5rem;
  color: var(--ink);
}

.rule-note {
  margin-top: 24px;
  max-width: 60ch;
  color: var(--muted);
}

/* Split rows: a phone and a column of text */

.feature {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

.feature--flip {
  grid-template-columns: 1.2fr 0.8fr;
}

.feature .phone {
  max-width: 320px;
  justify-self: center;
}

.ticks {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.ticks li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: baseline;
}

/* A tick in a round pine badge, as on a done set. */
.ticks li::before {
  content: "\2713";
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--pine);
  color: var(--on-pine);
  font-size: 0.75rem;
  font-weight: 700;
  transform: translateY(3px);
}

/* Today: one exercise card, as the app draws it */

.feature--card {
  grid-template-columns: 1fr 1fr;
}

.lift-card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 32px);
  box-shadow: 0 24px 60px -32px rgb(var(--shadow) / 0.3);
  max-width: 420px;
  width: 100%;
  justify-self: center;
}

.lift-name {
  font-size: 1.375rem;
  font-weight: 700;
}

.lift-focus {
  margin-top: 2px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--amber-text);
}

.lift-last {
  margin-top: 20px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}

.lift-last .num {
  font-size: clamp(3rem, 7vw, 4rem);
}

.lift-last .unit {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-right: 10px;
}

.lift-last .times {
  font-family: var(--round);
  font-size: 1.75rem;
  color: var(--muted);
  margin-right: 10px;
}

.lift-note {
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--amber-soft);
  font-size: 0.9375rem;
}

.lift-note strong {
  color: var(--amber-text);
}

/* Workout mode: always dark */

.night {
  background: var(--night);
  color: var(--night-ink);
}

.night .body {
  color: var(--night-muted);
}

.readouts {
  margin: 32px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 480px;
}

.readouts div {
  background: var(--night-card);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.readouts dt {
  font-size: 0.875rem;
  color: var(--night-muted);
}

.readouts dd {
  margin: 8px 0 0;
}

.readouts .num {
  font-size: clamp(2.75rem, 6vw, 3.75rem);
}

.readouts .rest {
  color: var(--amber);
}

.readouts .unit {
  font-size: 0.9375rem;
  color: var(--night-muted);
  margin-left: 4px;
}

.night .phone {
  background: var(--night-card);
  border-color: #2A322D;
  box-shadow: none;
}

/* How it felt: one centered statement */

.statement {
  text-align: center;
}

.statement h2,
.statement .body {
  margin-left: auto;
  margin-right: auto;
}

.statement h2 {
  max-width: 20ch;
}

.feel {
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.feel li {
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px solid currentColor;
  font-weight: 700;
  font-size: 0.9375rem;
}

/* The app's feel colors: blue, green, amber. */
.feel .easy {
  color: var(--easy);
}

.feel .right {
  color: var(--on-pine);
  background: var(--pine);
  border-color: var(--pine);
}

.feel .hard {
  color: var(--amber-text);
}

.hint {
  margin: 32px auto 0;
  max-width: 420px;
  text-align: left;
  background: var(--amber-soft);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  align-items: center;
}

.hint .num {
  grid-row: span 2;
  font-size: 2.5rem;
  color: var(--amber-text);
}

.hint strong {
  font-weight: 700;
}

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

/* Cardio and imports */

.sources {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 36px;
}

.sources h3 {
  font-size: 1.125rem;
}

.sources p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 1rem;
}

/* History: two phones under the text */

.history-head {
  max-width: 60ch;
}

.legend {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* The calendar's own dots: green done, amber missed, gray planned. */
.legend li::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 8px;
  background: var(--hairline);
}

.legend .done::before {
  background: var(--pine);
}

.legend .missed::before {
  background: var(--amber);
}

.legend .planned::before {
  background: #9AA39D;
}

.duo {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 300px));
  justify-content: center;
  gap: clamp(20px, 5vw, 64px);
}

.duo figure {
  margin: 0;
}

.duo figcaption {
  margin-top: 14px;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* The second phone sits lower, so the pair does not read as a grid. */
.duo figure + figure {
  margin-top: 56px;
}

/* Privacy promises */

.promises {
  margin: 32px 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  border-top: 1px solid var(--hairline);
  padding-top: 28px;
}

.promises dt {
  font-family: var(--round);
  font-size: 1.25rem;
  font-weight: 700;
}

.promises dd {
  margin: 6px 0 0;
  color: var(--muted);
}

.private-note {
  margin-top: 32px;
  max-width: 60ch;
}

/* Text pages: privacy, help, 404 */

.page {
  padding-top: clamp(24px, 5vw, 56px);
  padding-bottom: clamp(56px, 9vw, 112px);
}

.prose {
  max-width: 68ch;
}

.prose h1 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
}

.prose h2 {
  font-size: 1.5rem;
  margin-top: 40px;
}

.prose h3 {
  font-size: 1.125rem;
  margin-top: 24px;
}

.prose p,
.prose ul,
.prose ol {
  margin-top: 14px;
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose li + li {
  margin-top: 8px;
}

.prose .meta {
  margin-top: 12px;
  color: var(--muted);
}

.notice {
  margin-top: 28px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--hairline);
}

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

/* Footer */

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 32px 0 48px;
  font-size: 0.9375rem;
  color: var(--muted);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  justify-content: space-between;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}

/* A little movement on arrival, and none for people who ask for none */

@media (prefers-reduced-motion: no-preference) {
  .hero .copy,
  .hero .phone {
    animation: rise 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .hero .phone {
    animation-delay: 120ms;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

/* Tablets: the week in two rows */

@media (max-width: 1023px) {
  .week {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .promises {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phones and small tablets: one column */

@media (max-width: 767px) {
  .hero .wrap,
  .feature,
  .feature--flip,
  .feature--card {
    grid-template-columns: 1fr;
  }

  .hero .phone,
  .feature .phone {
    max-width: 280px;
  }

  /* The picture comes after its text. */
  .feature .phone,
  .feature .lift-card {
    order: 2;
  }

  /* One row per day: the day and bars on the left, the lift and sets on the right. */
  .week {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .week li {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 14px 16px;
    gap: 6px 16px;
  }

  .week .day,
  .week .bars {
    grid-column: 1;
  }

  .week .focus {
    grid-column: 1;
  }

  .week .sets {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .week .sets .num {
    font-size: 2.25rem;
  }

  .sources {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .duo {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .duo figure + figure {
    margin-top: 32px;
  }

  .promises {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .site-nav {
    gap: 16px;
  }
}

@media print {
  .site-header nav,
  .site-footer,
  .phone,
  .skip {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
