/* Habit Tools — site.css
   One stylesheet for the home page and, later, every tool page.
   The look is a wall calendar: pale grey wall, white paper, black ink,
   red marker X's and a yellow sticky note. */

/* Fonts are hosted here, not on Google, so the page needs no third-party
   request. Both are variable fonts (one file covers every weight), Latin
   only. Licence: assets/fonts/OFL.txt */
@font-face {
  font-family: "Big Shoulders Display";
  src: url("/assets/fonts/big-shoulders-display.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("/assets/fonts/public-sans.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --wall: #ECEEF1;     /* page background */
  --paper: #FFFFFF;    /* cards and the spotlight band */
  --ink: #16191D;      /* text and buttons */
  --muted: #4A4F57;    /* secondary text */
  --red: #D92B23;      /* marker X's, step numbers, focus */
  --sticky: #FFE15A;   /* tags, sticky note, Storey band */
  --line: #D5D9DF;     /* rules and dashed tear lines */
  --soft: #FFF6C2;     /* light highlight */

  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Public Sans", system-ui, sans-serif;
  --shadow: 0 2px 0 var(--line), 0 24px 40px -24px rgba(22, 25, 29, .45);
}

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

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

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

h1, h2, h3, p, ul { margin: 0; padding: 0; }
a { color: var(--ink); }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: clamp(20px, 4vw, 40px); }

.skip { position: absolute; left: -999rem; }
.skip:focus { left: 1rem; top: .5rem; z-index: 2; background: var(--paper); padding: .5rem .8rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Shared pieces ──────────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 24px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}
.button:hover { color: #fff; background: #000; }
.button-big { min-height: 58px; padding: 0 34px; font-size: 1.1875rem; }

.tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--sticky);
  font-size: .8125rem;
  font-weight: 800;
  line-height: 1.3;
}

.display-2 {
  font-family: var(--display);
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 900;
  line-height: .9;
  max-width: 14em;
}
.display-3 {
  font-family: var(--display);
  font-size: clamp(2.5rem, 4.6vw, 4.25rem);
  font-weight: 900;
  line-height: .92;
}
.section-lede { margin-top: 18px; max-width: 600px; font-size: 1.1875rem; color: var(--muted); }

/* ── Header and footer ──────────────────────────────────────── */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  padding-block: 24px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 1.875rem;
  font-weight: 900;
  text-decoration: none;
}
.site-header nav { display: flex; flex-wrap: wrap; gap: 8px 28px; font-weight: 600; }
.site-header nav a { text-decoration: none; }
.site-header nav a:hover { text-decoration: underline; }

.site-footer { padding-block: 88px 56px; font-size: .9375rem; color: var(--muted); }

/* ── Opening ────────────────────────────────────────────────── */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-block: clamp(56px, 8vw, 88px) clamp(80px, 10vw, 120px);
}
.hero h1 {
  max-width: 1000px;
  font-family: var(--display);
  font-size: clamp(4rem, 9vw, 9.25rem);
  font-weight: 900;
  line-height: .86;
  text-wrap: balance;
}
.lede { margin-top: 28px; max-width: 560px; font-size: 1.3125rem; color: var(--muted); }
.hero .button { margin-top: 36px; }

/* ── Spotlight ──────────────────────────────────────────────── */

.spotlights { background: var(--paper); padding-block: 96px 32px; }
.spotlights .display-2 { margin-bottom: 40px; }

.spot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 40px 72px;
  padding-block: 72px;
  border-top: 3px solid var(--ink);
}
.spot-flip { flex-direction: row-reverse; }
.spot-text { flex: 1 1 380px; min-width: 0; }
.spot-preview { flex: 1 1 480px; min-width: 0; }

.spot h3 {
  margin-top: 14px;
  font-family: var(--display);
  font-size: clamp(2.75rem, 4.6vw, 4.25rem);
  font-weight: 900;
  line-height: .9;
}
.spot-what { margin-top: 16px; max-width: 460px; font-size: 1.1875rem; color: var(--muted); }
.spot-gets { list-style: none; margin-top: 20px; max-width: 460px; border-bottom: 1px solid var(--line); }
.spot-gets li { padding-block: 10px; border-top: 1px solid var(--line); }
.spot .button { margin-top: 26px; }

.card { padding: clamp(20px, 3vw, 32px); background: var(--paper); box-shadow: var(--shadow); }
.spotlights .card { background: var(--wall); box-shadow: none; }
.card-label { font-size: .875rem; font-weight: 700; color: var(--muted); }
.card-note { margin-top: 18px; font-size: .875rem; color: var(--muted); }

/* Habit stack builder preview */
.cues { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cue {
  min-height: 44px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: .9375rem;
  font-weight: 700;
  cursor: pointer;
}
.cue[aria-pressed="true"] { background: var(--sticky); }
.sticky-sentence {
  margin-top: 26px;
  padding: 24px 22px 26px;
  background: var(--sticky);
  transform: rotate(-1.2deg);
  font-family: var(--display);
  font-size: clamp(1.875rem, 3vw, 2.625rem);
  font-weight: 800;
  line-height: 1;
}

/* Habit formation calculator preview */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { margin-top: 6px; padding: 12px 14px; border: 2px solid var(--ink); background: var(--paper); font-weight: 700; }
.result {
  margin-top: 28px;
  font-family: var(--display);
  font-size: clamp(2.25rem, 3.6vw, 3.25rem);
  font-weight: 900;
  line-height: .95;
}
.range { position: relative; height: 44px; margin-top: 22px; border-bottom: 2px solid var(--ink); }
.range-band { position: absolute; left: 7%; right: 0; bottom: 0; height: 22px; background: var(--soft); border: 2px solid var(--ink); border-bottom: 0; }
.range-mark { position: absolute; left: 26%; bottom: 0; width: 4px; height: 40px; background: var(--red); }
.range-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: .8125rem; font-weight: 700; color: var(--muted); }
.range-typical { color: var(--red); }

/* Weekly habit tracker preview */
.week { width: 100%; border-collapse: separate; border-spacing: 6px 8px; table-layout: fixed; }
.week th, .week td { padding: 0; font-size: .75rem; font-weight: 700; color: var(--muted); text-align: center; }
.week thead th:first-child { width: 34%; }
.week thead th:last-child { width: 13%; text-align: right; }
.week tbody th { font-size: .9375rem; color: var(--ink); text-align: left; line-height: 1.2; }
.week td:not(.goal) {
  height: clamp(24px, 3vw, 36px);    /* table cells ignore aspect-ratio */
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 0;            /* "Done" is for screen readers; the X is drawn */
}
.week td.x {
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M8 9C15 16 23 24 32 32M31 8C24 16 16 24 8 32' fill='none' stroke='%23D92B23' stroke-width='4.5' stroke-linecap='round'/%3E%3C/svg%3E") center / 82% no-repeat;
}
.goal { font-size: .875rem; font-weight: 800; text-align: right; white-space: nowrap; }
.goal-met { color: var(--red); }

/* ── All the tools ──────────────────────────────────────────── */

.all { padding-top: 104px; scroll-margin-top: 16px; }
.all .section-lede { margin-bottom: 40px; }

.step {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 48px;
  padding-block: 40px;
  border-top: 3px solid var(--ink);
}
.step-head { flex: 1 1 240px; min-width: 0; }
.step-num { font-family: var(--display); font-size: 4.5rem; font-weight: 900; line-height: .8; color: var(--red); }
.step-head h3 { margin-top: 12px; font-family: var(--display); font-size: 2.25rem; font-weight: 800; line-height: 1; }
.step-head p:last-child { margin-top: 8px; font-size: 1rem; color: var(--muted); }

.tool-list { flex: 3 1 560px; min-width: 0; list-style: none; }
.tool-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding-block: 20px;
  border-bottom: 2px dashed var(--line);
}
.tool-list a {
  flex: 1 1 250px;
  font-size: 1.3125rem;
  font-weight: 800;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.tool-desc { flex: 2 1 300px; font-size: 1rem; color: var(--muted); }
.tool-list .tag { flex: 0 0 88px; text-align: center; }

/* ── Storey ─────────────────────────────────────────────────── */

.storey {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px 56px;
  margin-top: 104px;
  padding: clamp(32px, 5vw, 48px) clamp(24px, 5vw, 52px);
  background: var(--sticky);
}
.storey > div { flex: 1 1 440px; min-width: 0; }
.storey p { margin-top: 14px; max-width: 540px; font-size: 1.125rem; }

/* ── Questions ──────────────────────────────────────────────── */

.faq { padding-top: 104px; }
.faq .display-3 { margin-bottom: 28px; }
.faq-grid { display: flex; flex-wrap: wrap; gap: 0 48px; }
.faq-grid > div { flex: 1 1 440px; min-width: 0; padding-block: 24px; border-top: 2px solid var(--ink); }
.faq-grid h3 { font-size: 1.25rem; font-weight: 800; }
.faq-grid p { margin-top: 8px; color: var(--muted); }

/* ── Small screens ──────────────────────────────────────────── */

@media (max-width: 560px) {
  .spot { padding-block: 56px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .week { border-spacing: 3px 6px; }
  .week thead th:first-child { width: 30%; }
  .week thead th:last-child { width: 15%; }
  .week tbody th { font-size: .8125rem; }
  .goal { font-size: .75rem; }
  .button { width: 100%; justify-content: center; text-align: center; }
  .hero .button, .storey .button { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
