/*
 * Home page only (/). Loaded after tokens.css, styles.css and site.css.
 * The hero, the sample sort (driven by app.js) and the home sections. Shared pieces the demo is
 * built from (.mock-window, .mail-app, .mail-row, .folder, .chip) live in styles.css/site.css.
 *
 * Section rhythm, top to bottom (no two neighbours share a layout):
 *   hero (centred) · definition + demo window · how it works (three-step line with UI
 *   fragments) · email search (centred intro above a wide window) · labels (sticky intro
 *   beside an index) · dark band · use cases (heading row +
 *   full-width rows) · compare (small heading beside three link cards) · security (surface band,
 *   statement beside a fact sheet) · questions (one narrow column) · closing block.
 */

/* ---- Hero ------------------------------------------------------------------------------ */
.hero {
  padding-block: var(--space-7);
  text-align: center;
}
.hero h1 {
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--track-display);
}
.hero h1 > span {
  color: color-mix(in srgb, var(--blue) 25%, var(--muted));
}
.hero-period {
  color: var(--blue);
}
.hero-copy {
  max-width: 680px;
  margin: var(--space-5) auto 0;
  font-size: var(--fs-lead);
  line-height: var(--lh-body);
  color: var(--muted);
}
.hero .cta-row {
  justify-content: center;
}
.trust-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: fit-content;
  margin: var(--space-4) auto 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-meta);
  text-align: left;
  color: var(--muted);
}
.trust-row li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.trust-row .icon {
  --icon-size: 15px;
  stroke-width: 2.2;
  color: var(--ok);
}
@media (min-width: 760px) {
  .hero {
    padding-block: var(--space-8) var(--space-7);
  }
  .trust-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2) var(--space-5);
    width: auto;
    margin-top: var(--space-5);
  }
}

/* The security assessment badge under the trust row (site.css .casa-badge.is-compact). */
.hero-badge {
  margin: var(--space-5) 0 0;
}

/* ---- Definition: the home page's one-sentence intro above the sample sort (css/sort-demo.css) */
.home-define {
  max-width: 38em;
  margin: 0;
  font-size: clamp(19px, 1.7vw, 23px);
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--muted);
}
.home-define strong {
  font-weight: 600;
  color: var(--ink);
}

/* ---- How it works: one numbered line, each step with a real piece of the product --------
 * <ol class="step-line"><li class="step"><span class="step-num">1</span>
 *   <div class="step-frag" aria-hidden="true">…mock pieces…</div><h3>…</h3><p>…</p></li></ol>
 */
.home-how {
  padding-top: var(--section-y);
}
.how-head {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-7);
}
.how-head h2 {
  font-size: var(--fs-h2);
}
.how-head p {
  max-width: 30em;
  margin: 0;
  font-size: var(--fs-lead);
  color: var(--muted);
}
.step-line {
  display: grid;
  gap: var(--space-7);
  margin: 0;
  padding: 0;
  list-style: none;
}
.step {
  position: relative;
  min-width: 0;
  padding-left: 52px;
}
/* The connecting line: down the left on phones, across the top from 760px. */
.step::before {
  content: '';
  position: absolute;
  top: 40px;
  bottom: calc(-1 * var(--space-7) + 8px);
  left: 16px;
  width: 1px;
  background: var(--line-strong);
}
.step:last-child::before {
  display: none;
}
.step-num {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--page);
  font-size: var(--fs-small);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--blue);
}
.step-frag {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-3);
  min-height: 128px;
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  font-size: var(--mock-fs);
}
.step-frag .tiny-label {
  margin: 0;
}
.step-frag .mock-toggle {
  min-height: 34px;
}
.step-frag .mock-toggle:last-child {
  border-bottom: 0;
}
/* Every row in the three cards has the same shape: a 30px mark (an avatar for a person or
 * sender, an icon for anything else), two lines of text, and what Syfft did on the right. */
.mock-line {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-small);
  color: var(--muted);
  --icon-size: 16px;
}
.mock-line:last-child {
  border-bottom: 0;
}
.mock-line > .icon {
  justify-self: center;
  color: var(--subtle);
}
.mock-line > .avatar {
  width: 30px;
  height: 30px;
  font-size: 11px;
}
.mock-quiet {
  font-size: var(--fs-meta);
  color: var(--subtle);
}
/* Narrow cards: the chip or action drops under the text instead of squeezing it. */
@media (max-width: 479px) {
  .mock-line {
    grid-template-columns: 30px minmax(0, 1fr);
  }
  .mock-line > :nth-child(3) {
    grid-column: 2;
    justify-self: start;
  }
}
.mock-line > .icon.is-star {
  color: var(--tone-deadline, #d59b1e);
  fill: currentColor;
}
.mock-line strong {
  display: block;
  font-weight: 600;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.mock-line .chip {
  justify-self: end;
}
.mock-undo {
  padding: 2px var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  font-weight: 500;
  color: var(--blue);
}
.step-frag .mock-search-box {
  min-height: 36px;
}
.step h3 {
  margin: 0 0 var(--space-2);
}
.step > p {
  max-width: 34ch;
  margin: 0;
  color: var(--muted);
}
.how-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
  margin: var(--space-7) 0 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  font-size: var(--fs-small);
  color: var(--muted);
}
@media (min-width: 760px) {
  .step-line {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-6);
  }
  .step {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    padding: 56px 0 0;
  }
  .step-frag {
    margin-bottom: 0;
  }
  .step h3 {
    margin-top: var(--space-4);
  }
  .step::before {
    top: 16px;
    right: calc(-1 * var(--space-6));
    bottom: auto;
    left: 44px;
    width: auto;
    height: 1px;
  }
  .step-frag {
    min-height: 164px;
  }
}
@media (min-width: 1000px) {
  .how-head {
    margin-bottom: var(--space-8);
  }
  .step-line {
    gap: var(--space-7);
  }
  .step::before {
    right: calc(-1 * var(--space-7) + 12px);
  }
}

/* ---- Email search: a centred intro above the animated search window (demos.js) ---------- */
.home-search {
  padding-top: var(--section-y);
}
.search-head {
  display: grid;
  justify-items: center;
  gap: var(--space-4);
  max-width: 720px;
  margin: 0 auto var(--space-7);
  text-align: center;
}
.search-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}
.search-kicker .eyebrow {
  margin: 0;
}
.search-head h2 {
  font-size: var(--fs-h2);
  text-wrap: balance;
}
.search-head p {
  max-width: 34em;
  margin: 0;
  font-size: var(--fs-lead);
  color: var(--muted);
}
.search-stage {
  position: relative;
  isolation: isolate;
  max-width: 820px;
  margin: 0 auto;
}
.search-stage > figcaption {
  margin-top: var(--space-3);
  font-size: var(--fs-meta);
  text-align: center;
  color: var(--subtle);
}
.search-points {
  justify-content: center;
  margin-top: var(--space-6);
}
.search-foot {
  margin: var(--space-5) 0 0;
  text-align: center;
}
@media (min-width: 760px) {
  .search-points {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-6);
  }
}

/* ---- Labels: a sticky intro beside the index of 12 --------------------------------------- */
.home-labels {
  display: grid;
  align-items: start;
  gap: var(--space-6);
  padding-top: var(--section-y);
}
.labels-head h2 {
  font-size: var(--fs-h2);
}
.labels-head .text-link {
  margin-top: var(--space-4);
}
.label-index h3 + ul {
  margin-bottom: var(--space-6);
}
.label-index ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.label-index li {
  border-bottom: 1px solid var(--line);
}
.label-index a {
  display: grid;
  gap: var(--space-2);
  align-items: center;
  min-height: 52px;
  padding: var(--space-3) 0;
  font-size: var(--fs-small);
  color: var(--muted);
}
.label-index .chip {
  justify-self: start;
}
.label-index a:is(:hover, :focus-visible) {
  color: var(--ink);
}
@media (min-width: 600px) {
  .label-index a {
    grid-template-columns: 196px minmax(0, 1fr);
    gap: var(--space-5);
    padding-block: var(--space-2);
    font-size: var(--fs-body);
  }
}
@media (min-width: 1000px) {
  .home-labels {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--space-8);
  }
  .labels-head {
    position: sticky;
    top: calc(var(--site-nav-height) + var(--space-6));
  }
}

/* ---- The dark band, home version: a dotted field so it reads as its own place, even when the
   page around it is dark too. Colours are the --night tokens only. ------------------------ */
.home-approach::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    color-mix(in srgb, var(--night-accent) 22%, transparent) 1px,
    transparent 1.5px
  );
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse at 85% 30%, #000 0%, transparent 65%);
  mask-image: radial-gradient(ellipse at 85% 30%, #000 0%, transparent 65%);
  pointer-events: none;
}
.home-approach .approach-inner {
  z-index: 1;
}
.home-approach .certainty-card {
  border-color: color-mix(in srgb, var(--night-accent) 18%, var(--night-line));
}

/* ---- Use cases: a heading row over full-width rows ---------------------------------------- */
.home-uses {
  padding-top: var(--section-y);
}
.row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  margin-bottom: var(--space-6);
}
.row-head h2 {
  max-width: 16em;
  font-size: var(--fs-h2);
}
.use-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.use-list li {
  border-bottom: 1px solid var(--line);
}
.use-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-5) 0;
  color: var(--ink);
}
.use-list strong {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.use-line {
  color: var(--muted);
}
.use-line,
.use-list .chip-row {
  grid-column: 1;
}
.use-arrow {
  grid-column: 2;
  grid-row: 1;
  --icon-size: 18px;
  color: var(--subtle);
}
.use-list a:is(:hover, :focus-visible) :is(strong, .use-arrow) {
  color: var(--blue);
}
@media (min-width: 760px) {
  .row-head {
    margin-bottom: var(--space-7);
  }
}
@media (min-width: 1000px) {
  .use-list a {
    grid-template-columns: minmax(0, 16rem) minmax(0, 1fr) auto 20px;
    gap: var(--space-6);
  }
  .use-line,
  .use-list .chip-row,
  .use-arrow {
    grid-column: auto;
    grid-row: auto;
  }
}

/* ---- Compare: a small heading beside three whole-card links ------------------------------
 * <li class="compare-card"><h3><a href="/compare/x/">…</a></h3><p>…</p>
 *   <svg class="icon" aria-hidden="true">…</svg></li>   (the link's ::after covers the card)
 */
.home-compare {
  display: grid;
  gap: var(--space-5);
  padding-top: var(--section-y);
}
.compare-title {
  max-width: 18em;
  font-size: calc(var(--fs-h2) * 0.62);
}
.compare-cards {
  display: grid;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.compare-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-5);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-l);
  background: var(--surface);
}
.compare-card a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.compare-card a:focus-visible {
  outline: 0;
}
.compare-card a:focus-visible::after {
  outline: 2px solid var(--focus);
  outline-offset: var(--focus-offset);
}
.compare-card a {
  color: inherit;
  text-decoration: none;
}
.compare-card p {
  margin: 0;
  color: var(--muted);
}
.compare-card h3 {
  padding-right: var(--space-6);
}
.compare-card .icon {
  position: absolute;
  top: calc(var(--space-5) + 3px);
  right: var(--space-5);
  color: var(--subtle);
  --icon-size: 18px;
}
.compare-card:is(:hover, :focus-within) .icon {
  color: var(--blue);
}
.compare-card:is(:hover, :focus-within) {
  border-color: var(--control);
}
.compare-card:is(:hover, :focus-within) a {
  color: var(--blue);
}
@media (min-width: 760px) {
  .compare-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1000px) {
  .home-compare {
    grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
    align-items: start;
    gap: var(--space-7);
  }
}

/* ---- Security: a surface band, one statement beside a fact sheet ------------------------- */
.home-band {
  margin-top: var(--section-y);
  padding-block: var(--section-y);
  border-block: 1px solid var(--line);
  background: var(--surface);
}
.home-security {
  display: grid;
  align-items: center;
  gap: var(--space-6);
}
.security-lead h2 {
  max-width: 11em;
  font-size: var(--fs-h2);
}
.security-lead .text-link {
  margin-top: var(--space-4);
}
.security-badge {
  margin: var(--space-6) 0 0;
}
.home-facts {
  margin: 0;
  border-top: 1px solid var(--line-strong);
}
.home-facts > div {
  display: grid;
  gap: var(--space-1) var(--space-6);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--line);
}
.home-facts dt {
  font-weight: 600;
}
.home-facts dd {
  margin: 0;
  color: var(--muted);
}
@media (min-width: 600px) {
  .home-facts > div {
    grid-template-columns: 13rem minmax(0, 1fr);
    padding-block: var(--space-5);
  }
}
@media (min-width: 1000px) {
  .home-security {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--space-8);
  }
}

/* ---- Questions: one narrow column ------------------------------------------------------- */
.home-questions {
  max-width: calc(820px + 2 * var(--page-gutter));
  padding-top: var(--section-y);
}
.home-questions h2 {
  margin-bottom: var(--space-6);
  font-size: calc(var(--fs-h2) * 0.75);
}
.home-questions .faq + .text-link {
  margin-top: var(--space-4);
}

/* Section headings break evenly instead of leaving one word on its own line. */
:is(.how-head, .labels-head, .row-head, .security-lead, .home-questions) h2,
.compare-title,
.home-define {
  text-wrap: balance;
}

/* ---- Motion ----------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .label-index a,
  .use-list strong,
  .compare-card a {
    transition: color 0.2s;
  }
  .compare-card {
    transition: border-color 0.2s;
  }
  .label-index .chip,
  .use-arrow,
  .compare-card .icon {
    transition:
      transform 0.3s var(--ease),
      color 0.2s;
  }
  .mail-row.is-new .chip {
    animation: chip-in 0.35s var(--ease);
  }
  @keyframes chip-in {
    from {
      opacity: 0;
      transform: translateX(8px) scale(0.92);
    }
  }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .label-index a:hover .chip,
  .use-list a:hover .use-arrow,
  .compare-card:hover .icon {
    transform: translateX(3px);
  }
}
