/* Dosed landing page. Direction: calm, warm, unhurried; paper and a pencil tick
   (see docs/PAGE_PLAN.md). Amber is only ever a fill with dark text on it, and it
   lives in two places: the primary button and the week card. Spacing sits on a 4px grid. */

:root {
  --bg: #fbf6ec;
  --surface: #ffffff;
  --ink: #1c1300;
  --muted: #5c5136;
  --line: rgb(28 19 0 / 10%);
  --control-border: #8a7a55;
  --amber: #eaa634;
  --amber-pressed: #dc9824;
  --on-amber: #1c1300;
  --focus: #1c1300;
  --card-shadow: 0 8px 24px rgb(0 0 0 / 6%);

  --radius-control: 12px;
  --radius-band: 16px;
  --radius-card: 20px;
  --gutter: 1.25rem;
  --max-width: 68rem;
  --control-height: 3.25rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-feedback: 150ms;
  --duration-enter: 400ms;
  --stagger: 50ms;
  --rise: 8px;
  --press-scale: 0.98;

  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15100a;
    --surface: #211a10;
    --ink: #f6eedd;
    --muted: #c2b59a;
    --line: rgb(246 238 221 / 10%);
    --control-border: #8f8163;
    --focus: #f6eedd;
    --card-shadow: none;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
}

h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

h1,
h2 {
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.5rem, 1.5rem + 5vw, 4.5rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h2 {
  font-size: clamp(1.75rem, 1.3rem + 2.2vw, 2.5rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h3 {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.3;
}

strong {
  font-weight: 600;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

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

.lead {
  color: var(--muted);
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
  max-width: 36rem;
}

.fill-amber {
  fill: var(--amber);
}

.stroke-on-amber {
  fill: none;
  stroke: var(--on-amber);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 1;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-control);
  background: var(--amber);
  color: var(--on-amber);
  font-weight: 600;
}

.skip-link:focus {
  top: 0.75rem;
}

/* Header */

.site-header {
  padding-block: 1.5rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1;
}

.wordmark__mark {
  width: 1.5rem;
  height: 1.5rem;
}

/* Hero */

.hero {
  display: grid;
  gap: 3rem;
  padding-block: clamp(1.5rem, 3vw, 3rem) clamp(4rem, 8vw, 6rem);
}

.hero__copy {
  display: grid;
  gap: 1.5rem;
  min-width: 0;
}

@media (min-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    align-items: center;
    gap: 4rem;
  }
}

/* Sign-up form */

.signup {
  display: grid;
  gap: 0.75rem;
  max-width: 28rem;
  margin-top: 0.5rem;
}

.signup__label {
  font-weight: 500;
}

.signup__input {
  width: 100%;
  min-height: var(--control-height);
  padding: 0.75rem 1rem;
  border: 2px solid var(--control-border);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.signup__input:hover {
  border-color: var(--ink);
}

.signup__input[aria-invalid="true"] {
  border-color: var(--ink);
  border-width: 3px;
}

.signup__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

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

.signup__consent a {
  display: inline-block;
  padding-block: 0.25rem;
}

.button {
  min-height: var(--control-height);
  margin-top: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 2px solid transparent;
  border-radius: var(--radius-control);
  background: var(--amber);
  color: var(--on-amber);
  font: inherit;
  font-weight: 600;
  font-size: 1.125rem;
  cursor: pointer;
}

.button:hover,
.button:active {
  background: var(--amber-pressed);
}

.button:focus-visible {
  border-radius: var(--radius-control);
}

.signup__status {
  font-weight: 500;
}

/* Stays in the page when empty so screen readers announce it when a message arrives. */
.signup__status:empty {
  height: 0;
  margin-top: -0.75rem;
  overflow: hidden;
}

.signup__status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.signup__tick {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0.25rem;
  border-radius: 50%;
  background: var(--amber);
  fill: none;
  stroke: var(--on-amber);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

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

/* The week card: the one rich moment on the page */

.week {
  display: grid;
  gap: 1.5rem;
  width: 100%;
  max-width: 26rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.week__title {
  font-size: 1.125rem;
  font-weight: 500;
}

.week__days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(0.25rem, 1.5vw, 0.5rem);
}

.day {
  display: grid;
  gap: 0.5rem;
  justify-items: center;
}

.day__dot {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
}

.day--done .day__dot {
  background: var(--amber);
}

.day--done .day__dot::after {
  content: "";
  width: 42%;
  height: 22%;
  margin-top: -12%;
  border-left: 3px solid var(--on-amber);
  border-bottom: 3px solid var(--on-amber);
  border-radius: 1px;
  transform: rotate(-45deg);
}

/* Signature detail: the hollow dashed rest-day circle. */
.day--rest .day__dot,
.key-dot--rest,
.rest__dot {
  border: 2px dashed var(--control-border);
}

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

.week__key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

.week__key li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.key-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
}

.key-dot--done {
  border: 2px solid var(--on-amber);
  background: var(--amber);
}

/* How it works */

.how {
  display: grid;
  gap: 2.5rem;
  padding-block: clamp(3rem, 7vw, 5rem);
  border-top: 1px solid var(--line);
}

.steps {
  display: grid;
  gap: 2rem;
}

@media (min-width: 48rem) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3rem;
  }
}

.step {
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

.step__icon {
  width: 1.5rem;
  height: 1.5rem;
  margin-bottom: 0.5rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step p {
  color: var(--muted);
}

/* Rest-day band */

.rest {
  padding-bottom: clamp(3rem, 7vw, 5rem);
}

.rest__card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  padding: clamp(1.5rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-band);
  background: var(--surface);
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
}

.rest__card p {
  flex: 1 1 14rem;
}

.rest__dot {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
}

/* Second sign-up */

.again {
  display: grid;
  gap: 1rem;
  padding-block: clamp(3rem, 7vw, 5rem);
  border-top: 1px solid var(--line);
}

/* Privacy notice and other plain reading pages */

.prose {
  max-width: 44rem;
  padding-block: clamp(1.5rem, 3vw, 3rem) clamp(3rem, 7vw, 5rem);
}

.prose > * + * {
  margin-top: 1rem;
}

.prose h2 {
  margin-top: 2.5rem;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.prose h2 + * {
  margin-top: 0.75rem;
}

.prose ul {
  padding-left: 1.5rem;
  list-style: disc;
}

.prose li + li {
  margin-top: 0.5rem;
}

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

/* Footer */

.site-footer {
  display: grid;
  gap: 0.5rem;
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

.site-footer a {
  display: inline-block;
  padding-block: 0.25rem;
}

/* Motion: one curve, short distances, nothing loops. All of it is off when the
   visitor has "reduce motion" switched on. */

@media (prefers-reduced-motion: no-preference) {
  .button {
    transition:
      background-color var(--duration-feedback) var(--ease),
      transform var(--duration-feedback) var(--ease);
  }

  .button:active {
    transform: scale(var(--press-scale));
  }

  .signup__input {
    transition: border-color var(--duration-feedback) var(--ease);
  }

  a {
    transition: text-decoration-color var(--duration-feedback) var(--ease);
  }

  /* One entrance on load: lead, form, then the week card. */
  [data-enter] {
    animation: enter var(--duration-enter) var(--ease) backwards;
  }

  .signup[data-enter] {
    animation-delay: var(--stagger);
  }

  .week[data-enter] {
    animation-delay: calc(var(--stagger) * 2);
  }

  /* Then the week fills in, Monday to Sunday, skipping the rest day. */
  .day--done .day__dot {
    animation: tick var(--duration-enter) var(--ease) backwards;
    animation-delay: calc(var(--duration-enter) + var(--stagger) * var(--tick-order));
  }

  .day:nth-child(1) { --tick-order: 0; }
  .day:nth-child(2) { --tick-order: 1; }
  .day:nth-child(3) { --tick-order: 2; }
  .day:nth-child(5) { --tick-order: 3; }
  .day:nth-child(6) { --tick-order: 4; }
  .day:nth-child(7) { --tick-order: 5; }

  .signup__tick path {
    stroke-dasharray: 1;
    animation: draw var(--duration-enter) var(--ease) backwards;
  }

  @keyframes draw {
    from {
      stroke-dashoffset: 1;
    }
  }

  @keyframes enter {
    from {
      opacity: 0;
      transform: translateY(var(--rise));
    }
  }

  @keyframes tick {
    from {
      opacity: 0;
      transform: scale(0.9);
    }
  }
}
