/**
 * The homepage.
 *
 * Everything here is built from the tokens, which means the whole page — hero,
 * cards, device frames, the lot — repaints when a visitor picks a colour. That
 * is the argument the page is making, so it would be odd for the page not to
 * make it.
 *
 * No inline `style` attributes anywhere on this site: the content security
 * policy in `_headers` allows no inline styling at all, which is only affordable
 * because every colour that varies is a custom property rather than a literal.
 */

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

.hero {
  padding: var(--space-xxl) 0 var(--space-xxl);
}

.hero-grid {
  display: grid;
  gap: var(--space-xl);
  align-items: center;
  grid-template-columns: 1fr;
}

@media (min-width: 60rem) {
  .hero-grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: var(--space-xxl);
  }
}

.hero h1 {
  font-size: calc(2.75rem * var(--scale));
  line-height: calc(1.12 * var(--leading));
  margin-bottom: var(--space-base);
  max-width: 18ch;
}

@media (max-width: 40rem) {
  .hero h1 {
    font-size: calc(2.125rem * var(--scale));
  }
}

.hero-lead {
  font-size: calc(1.25rem * var(--scale));
  line-height: calc(1.5 * var(--leading));
  color: var(--ink-muted);
  max-width: 46ch;
  margin-bottom: var(--space-lg);
}

/**
 * The thin strip of what the app holds — its own tinted band, entered over
 * the settling edge, so the page's tinted zone begins with the app's
 * contents. Glyphs with one-word labels, taking over from a sentence that
 * was crowding the hook. The band after it keeps its ordinary hairline.
 */
/**
 * Sunken, not raised — the token system's third surface. Strict light/dark
 * alternation cannot hold here: both settling edges must cap a tinted
 * surface with an even number of sections between them, so the strip takes
 * its own tone instead, distinct from the hero above and the band below.
 */
.app-strip {
  background: var(--sunken);
  padding: var(--space-xl) 0 var(--space-xxl);
}

/**
 * Centred, unlike the site's prose: the hero's composition is an inverted
 * triangle — headline and buttons upper left, the colour demo upper right,
 * and this strip as the point beneath them. Centring is fine here because a
 * short symmetric label and a row of icons are not prose with a return sweep.
 */
.app-strip-title {
  margin: 0;
  font-size: calc(1.875rem * var(--scale));
  line-height: calc(1.2 * var(--leading));
  color: var(--ink-soft);
  text-align: center;
}

.app-strip-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-lg) var(--space-xxl);
  list-style: none;
  margin: var(--space-base) 0 0;
  padding: 0;
}

.app-strip-items li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
  min-width: 4.5rem;
  font-size: calc(0.9375rem * var(--scale));
  font-weight: 600;
  color: var(--ink-soft);
}

.app-strip-items .glyph {
  margin: 0;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  margin-bottom: var(--space-md);
}

.cta-note {
  font-size: calc(0.8125rem * var(--scale));
  color: var(--ink-muted);
  margin: 0;
}

/**
 * One stroke that settles: wavy on the left, dead straight by the right end,
 * drawn as an underline to the headline it sits beneath.
 *
 * A single line on purpose. The four-stroke version was the icon's own
 * composition at a width the icon never has, so it read as a stretched logo —
 * one stroke enacts the same promise and cannot be mistaken for the mark.
 */
.settling {
  display: block;
  width: min(100%, calc(14rem * var(--scale)));
  height: auto;
  margin: calc(-1 * var(--space-sm)) 0 var(--space-lg);
  color: var(--decorative);
}

/* ---------- The live colour demonstration --------------------------------- */

.demo {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-base);
  background: var(--raised);
}

/**
 * The sample page.
 *
 * It carries its own `data-tint`, so the attribute selectors in `tokens.css`
 * paint it from the same declaration the rest of the site uses. Changing the
 * demo is one attribute, and it cannot drift from the real palette.
 */
.demo-page {
  background: var(--ground);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  min-height: 13rem;
}

.demo-page h2 {
  margin: 0 0 var(--space-sm);
  font-size: calc(1.3125rem * var(--scale));
  line-height: calc(1.3 * var(--leading));
  color: inherit;
}

.demo-page p {
  margin: 0 0 var(--space-md);
  line-height: calc(1.6 * var(--leading));
  color: inherit;
}

.demo-page p:last-child {
  margin-bottom: 0;
}

/**
 * A page, wordlessly: a title bar and two paragraphs of prose bars, drawn in
 * the ink token so the whole picture repaints with every tap. It replaced two
 * paragraphs of instructions — now that the chips recolour the entire site,
 * text explaining the demonstration was noise sitting on top of it.
 */
.demo-sample {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: var(--space-sm) 0;
}

.demo-sample span {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--ink);
  opacity: 0.5;
}

.demo-sample span:nth-child(1) {
  width: 55%;
  height: 13px;
  border-radius: 5px;
  opacity: 0.75;
  margin-bottom: 6px;
}

.demo-sample span:nth-child(2) {
  width: 100%;
}

.demo-sample span:nth-child(3) {
  width: 94%;
}

.demo-sample span:nth-child(4) {
  width: 98%;
}

.demo-sample span:nth-child(5) {
  width: 62%;
  margin-bottom: 10px;
}

.demo-sample span:nth-child(6) {
  width: 97%;
}

.demo-sample span:nth-child(7) {
  width: 91%;
}

.demo-sample span:nth-child(8) {
  width: 45%;
}

/**
 * The page settles, once.
 *
 * On load each bar carries a faint ghost double and sits a couple of pixels
 * adrift; over a second, top to bottom, the ghosts fuse back into their lines
 * and the page goes still — the same gesture as the underline, enacted by the
 * page it points at. The symptom appears only long enough to be recognised:
 * it never loops, never repeats on tap, and the state the page holds is
 * stillness, because the held state is the promise. Under reduced motion the
 * page simply starts settled.
 */
@media (prefers-reduced-motion: no-preference) {
  .demo-sample span {
    --drift: 2.5px;
    animation: demo-settle 1.15s cubic-bezier(0.25, 0.6, 0.3, 1) backwards;
  }

  .demo-sample span:nth-child(even) {
    --drift: -2.5px;
  }

  .demo-sample span:nth-child(2) {
    animation-delay: 0.06s;
  }
  .demo-sample span:nth-child(3) {
    animation-delay: 0.12s;
  }
  .demo-sample span:nth-child(4) {
    animation-delay: 0.18s;
  }
  .demo-sample span:nth-child(5) {
    animation-delay: 0.24s;
  }
  .demo-sample span:nth-child(6) {
    animation-delay: 0.3s;
  }
  .demo-sample span:nth-child(7) {
    animation-delay: 0.36s;
  }
  .demo-sample span:nth-child(8) {
    animation-delay: 0.42s;
  }

  @keyframes demo-settle {
    0%,
    30% {
      transform: translateY(var(--drift));
      box-shadow: 0 4px 0 color-mix(in oklab, var(--ink) 28%, transparent);
    }
    100% {
      transform: translateY(0);
      box-shadow: 0 0 0 color-mix(in oklab, var(--ink) 0%, transparent);
    }
  }
}

.demo-try {
  font-size: calc(0.8125rem * var(--scale));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: calc(var(--tracking) * 1em + 0.06em);
  color: var(--ink-muted);
  margin: var(--space-base) 0 0;
}

.demo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: var(--space-sm) 0 var(--space-md);
  padding: 0;
  list-style: none;
}

/**
 * A chip previews itself, for the same reason the panel's swatches do:
 * `[data-tint='rose']` sets `--ground` and `--ink` on whatever carries it.
 */
.chip {
  position: relative;
  display: grid;
  place-items: center;
  min-width: var(--touch);
  min-height: var(--touch);
  padding: 0 var(--space-sm);
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--ground);
  color: var(--ink);
  font-family: inherit;
  font-size: calc(0.875rem * var(--scale));
  font-weight: 600;
  cursor: pointer;
}

.demo-strip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.demo-strip input:checked + .chip {
  border-width: 3px;
  border-color: var(--accent);
}

/* State is never colour alone — a low-chroma palette would swallow the border. */
.demo-strip input:checked + .chip::after {
  content: '✓';
  position: absolute;
  top: -0.5em;
  right: -0.35em;
  width: 1.4em;
  height: 1.4em;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-ink);
  color: var(--ground);
  font-size: calc(0.6875rem * var(--scale));
  line-height: 1;
}

.demo-strip input:focus-visible + .chip {
  outline: 3px solid var(--ink-soft);
  outline-offset: 2px;
}

.demo-note {
  font-size: calc(0.8125rem * var(--scale));
  color: var(--ink-muted);
  margin: 0;
}

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

.band {
  padding: var(--space-section) 0;
  border-top: 1px solid var(--border);
}

.band-tinted {
  background: var(--raised);
}

.band h2 {
  margin-top: 0;
  margin-bottom: var(--space-base);
  font-size: calc(1.875rem * var(--scale));
  line-height: calc(1.2 * var(--leading));
  max-width: 22ch;
}

.band-lead {
  font-size: calc(1.1875rem * var(--scale));
  line-height: calc(1.55 * var(--leading));
  color: var(--ink-muted);
  max-width: 60ch;
  margin-bottom: var(--space-lg);
}

.split {
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: 1fr;
  align-items: center;
}

@media (min-width: 60rem) {
  .split {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xxl);
  }

  .split-narrow {
    grid-template-columns: 1.15fr 0.85fr;
  }

  /**
   * The zigzag. Media alternates sides down the page so scrolling has a
   * rhythm, but only visually: the markup keeps text first, so phones stack
   * text-then-picture and a screen reader hears the words before the figure.
   */
  .split-flip > :last-child {
    order: -1;
  }

  .split-narrow.split-flip {
    grid-template-columns: 0.85fr 1.15fr;
  }
}

/* ---------- Marks beside their words --------------------------------------- */

/* `.mark-head` lives in base.css now — the sub-pages use it too. */

/**
 * Stroke glyphs in the icon's own language: even weight, rounded caps, no
 * fill. The day moments use them because their subjects are things — an
 * envelope, a viewfinder, a link — where the flat marks are kept for ideas.
 * Decorative: every moment says the same thing in words beside it.
 */
.glyph {
  display: block;
  width: calc(2.25rem * var(--scale));
  height: calc(2.25rem * var(--scale));
  margin: 0 0 var(--space-md);
  color: var(--accent);
}

@media (min-width: 40rem) {
  .day li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-sm) var(--space-base);
  }

  .day li .day-time {
    grid-column: 1 / -1;
    margin: 0;
  }

  .day li .glyph {
    grid-column: 1;
    grid-row: 2 / 4;
    margin: 0;
  }

  .day li h3 {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
  }

  .day li p:last-child {
    grid-column: 2;
    grid-row: 3;
    margin: 0;
  }
}

/* ---------- The honest band ----------------------------------------------- */

/**
 * The null result, given the room it deserves.
 *
 * "Colour made no measurable difference for you" is the sentence no competitor
 * in this category can print, so it is not buried on a sub-page.
 */
.honest {
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  background: var(--ground);
}

.honest h2 {
  margin-top: 0;
}

.honest-quote {
  font-size: calc(1.5rem * var(--scale));
  line-height: calc(1.35 * var(--leading));
  font-weight: 650;
  color: var(--ink-soft);
  margin: 0 0 var(--space-base);
  max-width: 26ch;
}

/* ---------- Plain facts list ---------------------------------------------- */

.facts {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin-top: var(--space-xl);
  padding: 0;
  list-style: none;
}

.facts li {
  margin: 0;
  padding-top: var(--space-md);
  border-top: 3px solid var(--border);
}

.facts h3 {
  margin: 0 0 var(--space-sm);
  font-size: calc(1.0625rem * var(--scale));
}

.facts p {
  margin: 0;
  color: var(--ink-muted);
}

/* ---------- Comparison of plain against calibrated ------------------------ */

.compare {
  display: grid;
  gap: var(--space-base);
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.compare > div {
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  border: 1px solid var(--border);
}

.compare p {
  margin: 0 0 var(--space-sm);
}

.compare p:last-child {
  margin-bottom: 0;
}

.compare-label {
  font-size: calc(0.8125rem * var(--scale));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: calc(var(--tracking) * 1em + 0.06em);
}

/**
 * The one deliberate use of maximum contrast on the site, and it is the exhibit
 * rather than the design: this is the pairing the product exists to get away
 * from, so it has to be shown as it actually is.
 */
.plain {
  background: #ffffff;
  color: #000000;
  border-color: #cccccc;
}

/**
 * The cycling card changes colour with a settling wave: the next ground
 * sweeps down the card behind a leading edge drawn with the logo's own curve
 * structure, and the wave flattens as it travels — the mark's story, played
 * as a transition. The layer is an SVG the script builds and animates; the
 * words sit above it and never move, only the colour boundary passes beneath
 * them. The ink crossfades in step.
 *
 * Under reduced motion the script does not cycle at all, and without
 * JavaScript there is no layer — the card holds its preset.
 */
.compare .demo-page {
  position: relative;
  overflow: hidden;
  transition: color 1100ms ease;
}

.compare .demo-page > * {
  position: relative; /* keeps the words above the wipe layer */
}

.compare .demo-page .wipe-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Referral band ------------------------------------------------- */

.referral {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: 1fr;
}

@media (min-width: 48rem) {
  .referral {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

/* ---------- Read-aloud demonstration -------------------------------------- */

/**
 * The word-by-word highlight, shown rather than claimed — and shown *still*,
 * deliberately. Animating it would put moving text on a site for people whose
 * complaint is text that moves; the caption says so, which turns the restraint
 * into the argument.
 */
.spoken-demo {
  background: var(--ground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.spoken-line {
  font-size: calc(1.3125rem * var(--scale));
  line-height: calc(1.7 * var(--leading));
  color: var(--ink-soft);
  max-width: 24ch;
  margin: 0 0 var(--space-base);
}

.spoken-line span {
  padding: 0.05em 0.12em;
  border-radius: 4px;
}

/* The same pairing as the buttons and the step counters, so it is already
   asserted at 4.5:1 on every tint by the accent-fill test. */
.spoken-line .spoken {
  background: var(--accent-ink);
  color: var(--ground);
}

/* The lit word is carried by a background, which forced colours removes. */
@media (forced-colors: active) {
  .spoken-line .spoken {
    outline: 2px solid Highlight;
  }
}

.spoken-note {
  font-size: calc(0.8125rem * var(--scale));
  line-height: calc(1.4 * var(--leading));
  color: var(--ink-muted);
  margin: 0 0 var(--space-md);
}

.spoken-note:last-child {
  margin-bottom: 0;
}

/* ---------- A working day ------------------------------------------------- */

.day {
  list-style: none;
  padding: 0;
  margin: var(--space-xl) 0 0;
}

.day li {
  margin: 0 0 var(--space-xl);
  padding-left: var(--space-lg);
  border-left: 3px solid var(--border);
}

.day li:last-child {
  margin-bottom: 0;
}

.day-time {
  font-size: calc(0.8125rem * var(--scale));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: calc(var(--tracking) * 1em + 0.06em);
  color: var(--ink-muted);
  margin: 0 0 var(--space-xs);
}

.day h3 {
  margin: 0 0 var(--space-sm);
  font-size: calc(1.125rem * var(--scale));
}

.day li p:last-child {
  margin: 0;
  color: var(--ink-muted);
}

/* ---------- The founder note ----------------------------------------------- */

/**
 * First person, once, on the whole site. It is the only social proof available
 * before there are any readers, and it is why the null result exists — so it
 * sits on its own plate rather than being worked into the product copy.
 */
.founder {
  background: var(--ground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 48rem;
  margin-inline: auto;
}

/**
 * The single settling stroke, as the note's letterhead — the same one-line
 * gesture as the hero's underline, and one stroke for the same reason: the
 * four-stroke version was the icon's composition at a width the icon never
 * has. Drawn as a mask so the colour is a token; without mask support the
 * right failure is no ornament, not a grey block.
 */
@supports ((-webkit-mask-image: url('')) or (mask-image: url(''))) {
  .founder::before {
    content: '';
    display: block;
    width: calc(4.5rem * var(--scale));
    height: calc(0.45rem * var(--scale));
    margin-bottom: var(--space-base);
    background-color: var(--decorative);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 32' fill='none' stroke='%23000' stroke-width='8' stroke-linecap='round'%3E%3Cpath d='M8 16 q18 -12 36 0 q18 10 36 0 q18 -7 36 0 q18 5 36 0 q18 -3 36 0 q18 2 36 0 h84'/%3E%3C/svg%3E")
      no-repeat left center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 32' fill='none' stroke='%23000' stroke-width='8' stroke-linecap='round'%3E%3Cpath d='M8 16 q18 -12 36 0 q18 10 36 0 q18 -7 36 0 q18 5 36 0 q18 -3 36 0 q18 2 36 0 h84'/%3E%3C/svg%3E")
      no-repeat left center / contain;
  }
}

.founder h2 {
  margin-top: 0;
}

.founder p {
  max-width: calc(var(--measure) * 1ch);
}

.founder-signature {
  font-weight: 650;
  color: var(--ink-muted);
  margin-bottom: 0;
}
