/* Yhap Development: shared styles for every page.
   Direction: "office supplies, rewritten". The things small businesses run on
   (clipboards, group texts, highlighters, ballpoint ink) set beside the tidy
   software that replaces them. Blue ink on cool paper, one highlighter yellow,
   a condensed grotesque for headlines. Handwriting appears only inside the
   "before" illustrations, never as site typography. */

:root {
  --paper: #f3f5f7;
  --paper-2: #e6eaf0;
  --sheet: #ffffff;
  --ink: #14213d;
  --pencil: #545b6b;
  --rule: #c9d0db;
  --cobalt: #2346d8;
  --cobalt-ink: #ffffff;
  --cobalt-soft: #dfe6ff;
  --highlight: #f2e35a;
  --ok: #1f7a4d;
  --ok-soft: #dcf1e5;
  --warn: #8a4b00;
  --warn-soft: #fbeedd;
  --frame: #14213d;

  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;

  --gutter: clamp(1rem, 4vw, 3rem);
  --max: 74rem;
  --measure: 36rem;

  /* Type scale: perfect fourth (1.333) from a 1.0625rem base */
  --t-sm: 0.875rem;
  --t-base: 1.0625rem;
  --t-md: 1.333rem;
  --t-lg: 1.777rem;
  --t-xl: clamp(2rem, 4.5vw, 2.369rem);
  --t-hero: clamp(2.75rem, 8.4vw, 5.6rem);

  --shadow-sheet: 0 1px 0 rgba(20, 33, 61, 0.06), 0 12px 28px -14px rgba(20, 33, 61, 0.35);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121c33;
    --paper-2: #1a2643;
    --sheet: #1f2c4c;
    --ink: #e8ecf4;
    --pencil: #a9b2c6;
    --rule: #33426a;
    --cobalt: #93a8ff;
    --cobalt-ink: #0f1830;
    --cobalt-soft: #2a3a72;
    --highlight: #e9d94a;
    --ok: #7fd6a6;
    --ok-soft: #1d3d36;
    --warn: #f1c27d;
    --warn-soft: #3d3222;
    --frame: #3a4a75;
    --shadow-sheet: 0 1px 0 rgba(0, 0, 0, 0.2), 0 14px 30px -14px rgba(0, 0, 0, 0.7);
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.55;
  overflow-x: hidden;
}

h1, h2, h3 {
  margin: 0;
  font-stretch: 75%;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-md); line-height: 1.15; }
p { margin: 0; text-wrap: pretty; }

a { color: var(--cobalt); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 0.75rem; }

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

/* ---------- Header ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 1.25rem;
}

.wordmark {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.35rem;
  line-height: 1;
  white-space: nowrap;
}
.wordmark b { font-weight: 700; font-stretch: 75%; font-size: 1.15em; letter-spacing: -0.01em; }
.wordmark span { font-weight: 400; color: var(--pencil); margin-left: 0.1em; }

.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  display: inline-block;
  padding-block: 0.35rem;
  border-bottom: 2px solid transparent;
}
.nav a:hover { border-bottom-color: var(--cobalt); }

/* ---------- Buttons ---------- */

.button {
  display: inline-block;
  padding: 0.85rem 1.35rem;
  background: var(--cobalt);
  color: var(--cobalt-ink);
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  line-height: 1.2;
}
.button:hover { text-decoration: underline; text-decoration-thickness: 1px; }

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(2rem, 6vw, 4.5rem) clamp(3rem, 8vw, 6rem);
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
  align-items: center;
}

.hero h1 {
  font-size: var(--t-hero);
  line-height: 0.95;
  letter-spacing: -0.02em;
  max-width: 11ch;
}

.lede {
  margin-top: 1.5rem;
  font-size: var(--t-md);
  line-height: 1.45;
  color: var(--pencil);
  max-width: 30rem;
}

.hero-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}
.hero-actions .note { color: var(--pencil); font-size: var(--t-sm); }

@media (min-width: 60rem) {
  .hero { grid-template-columns: 1.05fr 1fr; }
}

/* ---------- Before / after stage ---------- */

.stage {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 2rem 1.5rem;
  padding: 0.5rem 0;
}

.caption {
  font-size: var(--t-sm);
  color: var(--pencil);
  line-height: 1.4;
}
.stage .caption { grid-column: 1 / -1; justify-self: start; max-width: 28rem; }

@media (min-width: 34rem) {
  .stage { grid-template-columns: 1fr 1fr; align-items: center; justify-items: stretch; }
}

/* Clipboard sheet (the "before") */

.scrap {
  position: relative;
  width: 100%;
  max-width: 17rem;
  justify-self: center;
  background-color: var(--sheet);
  color: var(--ink);
  padding: 2.1rem 1.1rem 1.25rem;
  box-shadow: var(--shadow-sheet);
  transform: rotate(-2.5deg);
  font-family: var(--hand);
  font-size: 1.35rem;
  line-height: 1.55rem;
  background-image: repeating-linear-gradient(
    to bottom, transparent 0, transparent calc(1.55rem - 1px), var(--rule) calc(1.55rem - 1px), var(--rule) 1.55rem
  );
  background-position: 0 2.1rem;
}
.scrap::before {
  content: "";
  position: absolute;
  top: -0.6rem;
  left: 50%;
  width: 5rem;
  height: 1.4rem;
  transform: translateX(-50%);
  background: var(--pencil);
  border-radius: 0.35rem 0.35rem 0.2rem 0.2rem;
}
.scrap-title { font-weight: 700; font-size: 1.55rem; display: block; }
.scrap ul { list-style: none; margin: 0; padding: 0; }
.scrap s { text-decoration-thickness: 2px; color: var(--pencil); }
.scrap .aside { color: var(--pencil); font-size: 1.1rem; }
.hl {
  background: linear-gradient(transparent 18%, var(--highlight) 18%, var(--highlight) 86%, transparent 86%);
  color: #14213d;
  padding: 0 0.15em;
}

.bubbles {
  display: grid;
  gap: 0.35rem;
  margin: 1rem -0.4rem 0 auto;
  width: 92%;
  font-family: var(--font);
  font-size: 0.78rem;
  line-height: 1.3;
  transform: rotate(2.5deg);
}
.bubble {
  justify-self: end;
  background: var(--paper-2);
  color: var(--ink);
  padding: 0.4rem 0.7rem;
  border-radius: 1rem 1rem 0.25rem 1rem;
}
.bubble:nth-child(even) { justify-self: start; border-radius: 1rem 1rem 1rem 0.25rem; }

/* Phone (the "after") */

.phone {
  width: 100%;
  max-width: 16.5rem;
  justify-self: center;
  background: var(--frame);
  padding: 0.55rem;
  border-radius: 2.1rem;
  box-shadow: var(--shadow-sheet);
}
.screen {
  background: var(--paper);
  color: var(--ink);
  border-radius: 1.65rem;
  padding: 1.1rem 0.85rem 1rem;
  font-size: 0.8rem;
  line-height: 1.3;
  overflow: hidden;
}
.screen-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.screen-title { font-weight: 700; font-stretch: 75%; font-size: 1.35rem; line-height: 1; }
.screen-sub { color: var(--pencil); font-size: 0.72rem; }

.days { display: flex; gap: 0.3rem; margin-bottom: 0.8rem; }
.days span {
  flex: 1;
  text-align: center;
  padding: 0.3rem 0;
  border-radius: 0.5rem;
  color: var(--pencil);
  font-size: 0.7rem;
  background: var(--sheet);
}
.days .on { background: var(--ink); color: var(--paper); font-weight: 600; }

.slot {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 0.8rem;
  padding: 0.65rem 0.7rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.5rem;
  align-items: center;
  margin-bottom: 0.45rem;
}
.slot:last-child { margin-bottom: 0; }
.slot b { font-weight: 600; font-size: 0.85rem; }
.slot small { color: var(--pencil); font-size: 0.7rem; grid-column: 1; }
.slot .pill { grid-row: 1 / span 2; grid-column: 2; }

.meter {
  grid-column: 1 / -1;
  height: 0.25rem;
  background: var(--paper-2);
  border-radius: 1rem;
  margin-top: 0.35rem;
  overflow: hidden;
}
.meter i { display: block; height: 100%; background: var(--cobalt); border-radius: inherit; }

.pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.pill-go { background: var(--cobalt); color: var(--cobalt-ink); }
.pill-in { background: var(--ok-soft); color: var(--ok); }
.pill-full { background: var(--paper-2); color: var(--pencil); }
.pill-due { background: var(--warn-soft); color: var(--warn); }

/* One orchestrated moment: the sheet lands, then the phone settles beside it. */
@media (prefers-reduced-motion: no-preference) {
  .stage .scrap { animation: drop 600ms cubic-bezier(.2, .7, .2, 1) both; }
  .stage .phone { animation: settle 700ms cubic-bezier(.2, .7, .2, 1) 400ms both; }
  @keyframes drop {
    from { opacity: 0; transform: rotate(-6deg) translateY(-0.5rem); }
    to { opacity: 1; transform: rotate(-2.5deg); }
  }
  @keyframes settle {
    from { opacity: 0; transform: translateY(1.25rem); }
    to { opacity: 1; transform: none; }
  }
}

/* ---------- Sections ---------- */

.section { padding-block: clamp(3.5rem, 9vw, 6.5rem); border-top: 1px solid var(--rule); }
.section-head { max-width: var(--measure); margin-bottom: clamp(2rem, 5vw, 3rem); }
.section-head p { margin-top: 1rem; color: var(--pencil); font-size: var(--t-md); line-height: 1.45; }

/* Problems, each paired with what replaces it */

.swaps { list-style: none; margin: 0; padding: 0; }
.swap {
  display: grid;
  gap: 0.75rem 2rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--rule);
}
.swap:last-child { border-bottom: 1px solid var(--rule); }
.swap .now {
  font-size: var(--t-lg);
  font-weight: 600;
  font-stretch: 75%;
  line-height: 1.15;
  max-width: 20ch;
}
.swap h3 { font-size: var(--t-base); font-stretch: 100%; font-weight: 600; margin-bottom: 0.3rem; }
.swap .fix p { color: var(--pencil); max-width: var(--measure); }

@media (min-width: 48rem) {
  .swap { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: baseline; }
}

.aside-note {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  display: grid;
  gap: 1rem 3rem;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 1.25rem;
}
.aside-note p { color: var(--pencil); max-width: var(--measure); }
@media (min-width: 48rem) {
  .aside-note { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); align-items: baseline; }
}

/* Work */

.work { display: grid; gap: clamp(3.5rem, 8vw, 6rem); }

.case { display: grid; gap: 2rem; align-items: center; }
.case-text { max-width: var(--measure); }
.case-text .kind { color: var(--pencil); font-size: var(--t-sm); margin-bottom: 0.5rem; }
.case-text h3 { font-size: var(--t-lg); margin-bottom: 0.85rem; }
.case-text ul { margin: 1rem 0 0; padding-left: 1.1rem; color: var(--pencil); }
.case-text li + li { margin-top: 0.25rem; }
.case-text li::marker { color: var(--cobalt); }
.case-text .visit { margin-top: 1.25rem; font-weight: 600; }

.case-visual {
  margin: 0;
  background: var(--paper-2);
  border-radius: 1.25rem;
  padding: clamp(1.5rem, 5vw, 2.75rem) clamp(1rem, 4vw, 2.5rem);
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  min-width: 0;
}
.case-visual .caption { justify-self: start; }

@media (min-width: 56rem) {
  .case { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 4rem; }
  .case.flip .case-text { order: 2; }
}

/* Gym: a reminder notification over the owner's ledger */
.gym-stack { width: 100%; max-width: 16.5rem; }
.notice {
  position: relative;
  z-index: 1;
  margin: 0 0.5rem -1.6rem;
  background: var(--sheet);
  color: var(--ink);
  border-radius: 1rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1.3;
  box-shadow: var(--shadow-sheet);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.6rem;
  align-items: center;
}
.notice .app-dot {
  grid-row: 1 / span 2;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.45rem;
  background: var(--cobalt);
}
.notice b { font-weight: 600; }
.notice span { color: var(--pencil); }
.gym-stack .screen { padding-top: 2.2rem; }

.tiers { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.4rem; }
.tiers span {
  font-size: 0.68rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--pencil);
}
.tiers .on { border-color: var(--ink); color: var(--ink); font-weight: 600; }

.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.05rem 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  align-items: center;
}
.ledger li:last-child { border-bottom: 0; padding-bottom: 0; }
.ledger b { font-weight: 600; }
.ledger small { color: var(--pencil); font-size: 0.7rem; grid-column: 1; }
.ledger .pill { grid-column: 2; grid-row: 1 / span 2; }

/* Meal prep: the hand-tallied list next to an order card */
.meal-pair { display: grid; gap: 1.75rem; width: 100%; justify-items: center; }
@media (min-width: 34rem) {
  .meal-pair { grid-template-columns: 1fr 1.2fr; align-items: center; }
}
.scrap.small { max-width: 14rem; font-size: 1.1rem; padding-top: 1.55rem; background-position: 0 1.55rem; transform: rotate(2deg); }
.scrap.small::before { display: none; }

.order {
  width: 100%;
  max-width: 17rem;
  background: var(--sheet);
  color: var(--ink);
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sheet);
  font-size: 0.82rem;
  line-height: 1.35;
}
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.order-head b { font-size: 1.05rem; font-stretch: 75%; font-weight: 700; }
.order dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 0.75rem; }
.order dd { margin: 0; color: var(--pencil); text-align: right; font-variant-numeric: tabular-nums; }
.order .total { border-top: 1px solid var(--rule); padding-top: 0.5rem; font-weight: 600; color: var(--ink); }
.order-foot { margin-top: 0.8rem; color: var(--pencil); font-size: 0.75rem; }

/* Word duel: one round in progress */
.duel {
  width: 100%;
  max-width: 19rem;
  background: var(--frame);
  color: #f3f5f7;
  border-radius: 1.25rem;
  padding: 1.1rem 1rem 1.2rem;
  font-size: 0.8rem;
}
.duel-top { display: flex; justify-content: space-between; gap: 0.5rem; color: #c9d0db; margin-bottom: 1rem; }
.duel-top b { color: #ffffff; font-weight: 600; }
.duel-prompt { font-weight: 600; font-stretch: 75%; font-size: 1.2rem; margin-bottom: 0.7rem; }
.tiles { display: flex; gap: 0.3rem; margin-bottom: 1rem; }
.tiles span {
  flex: 1;
  aspect-ratio: 1;
  max-width: 2.6rem;
  display: grid;
  place-items: center;
  background: #f3f5f7;
  color: #14213d;
  border-radius: 0.4rem;
  font-weight: 700;
  font-size: 1.15rem;
  font-stretch: 75%;
}
.duel-send {
  display: block;
  text-align: center;
  background: var(--highlight);
  color: #14213d;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.5rem;
  margin-bottom: 0.9rem;
}
.duel-vs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.duel-vs div { background: rgba(255, 255, 255, 0.1); border-radius: 0.6rem; padding: 0.5rem 0.6rem; }
.duel-vs small { display: block; color: #c9d0db; font-size: 0.68rem; }

/* Process: a real sequence, so it is numbered */
.process { display: grid; gap: 0; }
@media (min-width: 56rem) {
  .process { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 4rem; align-items: start; }
  .process .section-head { position: sticky; top: 2rem; }
}

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  gap: 0.25rem 1rem;
  padding-block: 1.35rem;
  border-top: 1px solid var(--rule);
}
.steps li:first-child { border-top: 0; padding-top: 0; }
.steps li::before {
  content: counter(step);
  grid-row: 1 / span 3;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  font-weight: 700;
  font-stretch: 75%;
  font-size: 1.1rem;
}
.steps h3 { font-size: var(--t-md); }
.steps p { color: var(--pencil); max-width: var(--measure); }
.steps .money {
  justify-self: start;
  margin-top: 0.35rem;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink);
  background: var(--cobalt-soft);
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
}
.steps-after { margin-top: 1.5rem; padding-top: 1.35rem; border-top: 1px solid var(--rule); color: var(--pencil); max-width: var(--measure); }

/* Contact */
.contact h2 { font-size: var(--t-hero); line-height: 0.95; letter-spacing: -0.02em; max-width: 12ch; }
.contact p { margin-top: 1.25rem; font-size: var(--t-md); color: var(--pencil); max-width: 32rem; line-height: 1.45; }
.mail {
  display: inline-block;
  margin-top: 2rem;
  font-size: clamp(1.35rem, 5.2vw, 2.6rem);
  font-weight: 600;
  font-stretch: 75%;
  color: #14213d;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: var(--highlight);
  padding: 0.1em 0.35em;
  border-radius: 0.15em;
}
.mail:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.mail:focus-visible { outline-color: var(--ink); }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 2rem 2.5rem;
  color: var(--pencil);
  font-size: var(--t-sm);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.site-footer a { color: var(--ink); }

/* ---------- Legal pages ---------- */

.legal { padding-block: clamp(2rem, 6vw, 4rem) clamp(3.5rem, 8vw, 6rem); }
.legal-body { max-width: 40rem; }
.legal h1 { font-size: clamp(2.5rem, 7vw, 4rem); line-height: 0.98; letter-spacing: -0.02em; }
.legal .updated { margin-top: 0.75rem; color: var(--pencil); font-size: var(--t-sm); }
.legal .intro { margin-top: 2rem; font-size: var(--t-md); line-height: 1.45; }
.legal h2 {
  font-size: var(--t-lg);
  margin-top: 2.75rem;
  margin-bottom: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.legal h2:first-of-type { margin-top: 2.25rem; }
.legal p + p, .legal ul + p { margin-top: 0.85rem; }
.legal ul { margin: 0; padding-left: 1.2rem; }
.legal li + li { margin-top: 0.6rem; }
.legal li::marker { color: var(--cobalt); }
