/*
 * Landing page (logged out) and the Devise auth pages.
 *
 * Everything here is prefixed .home-* / .auth-* so it cannot collide with the
 * app chrome in application.css or the record/dashboard styles in dash.css.
 * Colours are tokens only — the page has to survive the light/dark toggle.
 *
 * Corner geometry follows the house rule: every corner is a cut, never a
 * curve. Components set --cut locally and clip with var(--bevel); the
 * @supports block at the bottom hands the same cut to corner-shape where the
 * browser has it, so borders wrap the diagonal instead of being clipped off.
 */

/* ── Page shell ──────────────────────────────────────── */

/* The layout wraps content in .page-main (padding: 1rem 1.2rem 2rem). Marketing
   bands need edge-to-edge colour, so cancel that padding here and re-apply it
   inside each band via .home-inner. */
.home {
  margin: -1rem -1.2rem -2rem;
}

.home-inner {
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: 1.2rem;
}

.home-section {
  padding: 3.6rem 0;
}

/* Paper band — one step up from --bg, ruled off so the bands read as bands. */
.home-section.is-surface {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

/* Charcoal band. Always dark, in both themes — same board the charts sit on. */
.home-section.is-board {
  background: var(--board);
  color: var(--board-ink);
}

.home-section.is-board h2,
.home-section.is-board h3 {
  color: var(--board-ink);
}

.home-section.is-board p {
  color: var(--board-ink-muted);
}

/* ── Section headings ────────────────────────────────── */

.home-head {
  max-width: 44rem;
  margin-bottom: 2rem;
}

.home-head.is-centered {
  margin-inline: auto;
  text-align: center;
}

.home-eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}

.is-board .home-eyebrow {
  color: var(--twine);
}

.home-head h2 {
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  line-height: 1.2;
  color: var(--ink);
  padding: 0;
}

.home-head p {
  margin-top: 0.6rem;
  color: var(--ink-secondary);
  font-size: 1.03rem;
}

/* ── Hero ────────────────────────────────────────────── */

.home-hero {
  text-align: center;
  padding: 4.2rem 0 3.8rem;
}

.home-hero-logo {
  width: 84px;
  height: 84px;
  margin: 0 auto 1.4rem;
  display: block;
}

.home-hero h1 {
  font-size: clamp(2.1rem, 5.4vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  padding: 0;
  max-width: 20ch;
  margin-inline: auto;
}

.home-hero-lede {
  max-width: 40rem;
  margin: 1.1rem auto 0;
  font-size: 1.12rem;
  color: var(--ink-secondary);
}

.home-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1.8rem;
}

/* Quiet counterpart to .btn — there is no self-signup to offer, so the second
   action is "look before you sign in", not a second front door. */
.home-btn-ghost {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  --cut: 7px;
  clip-path: var(--bevel);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--ink);
  transition: background 0.2s ease, color 0.2s ease;
}

.home-btn-ghost:hover {
  background: var(--surface-raised);
  color: var(--ink);
}

/* clip-path cuts the corner out of the focus ring too, so the ring rides just
   inside the cut instead — the same fix application.css applies to its own
   beveled controls. The @supports block below puts it back outside. */
.home-btn-ghost:focus-visible {
  outline-offset: -3px;
}

.is-board .home-btn-ghost {
  border-color: var(--board-grid);
  color: var(--board-ink);
}

.is-board .home-btn-ghost:hover {
  background: rgba(230, 211, 179, 0.14);
  color: var(--board-ink);
}

/* Invite-only is a real constraint, not fine print — say it near the CTA. */
.home-hero-note {
  margin-top: 1.1rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* ── Pipeline flow ───────────────────────────────────── */

.home-flow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.9rem;
}

.home-flow-step {
  position: relative;
  padding: 1.1rem 1rem;
  background: rgba(244, 241, 234, 0.05);
  border: 1px solid var(--board-grid);
  --cut: 11px;
  clip-path: var(--bevel);
}

/* Chevron in the gutter. Only drawn in the five-across layout — once the grid
   wraps, the step numbers carry the sequence instead. */
.home-flow-step::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -0.68rem;
  width: 0.42rem;
  height: 0.42rem;
  margin-top: -0.21rem;
  border-top: 2px solid var(--twine);
  border-right: 2px solid var(--twine);
  transform: rotate(45deg);
}

.home-flow-step:last-child::after {
  content: none;
}

.home-flow-num {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--twine);
  margin-bottom: 0.45rem;
}

.home-flow-step h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.home-flow-step p {
  font-size: 0.88rem;
  line-height: 1.45;
}

/* ── Card grids (modules, merits) ────────────────────── */

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.1rem;
}

.home-card {
  padding: 1.2rem 1.15rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  --cut: 12px;
  clip-path: var(--bevel);
  box-shadow: var(--shadow);
}

.home-card h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.home-card p {
  font-size: 0.92rem;
  color: var(--ink-secondary);
  line-height: 1.5;
}

/* Small caps kicker inside a merit card — the promise, then the mechanism. */
.home-card-kicker {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.4rem;
}

html[data-theme="dark"] .home-card-kicker {
  color: var(--chip-cool);
}

/* ── Comparison table ────────────────────────────────── */

/* Scrolls itself rather than letting the page scroll sideways. */
.home-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  --cut: 12px;
  clip-path: var(--bevel);
  background: var(--surface-raised);
}

.home-table {
  width: 100%;
  min-width: 40rem;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.home-table caption {
  text-align: left;
  padding: 0.9rem 1rem 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* Positioned so the absolutely-positioned .home-sr labels resolve against the
   cell. Without this they resolve against the viewport, escape the wrapper's
   scroll container, and drag the whole document sideways on a phone. */
.home-table th,
.home-table td {
  position: relative;
  padding: 0.62rem 0.9rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.home-table thead th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  vertical-align: bottom;
}

.home-table tbody th {
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.home-table tbody tr:last-child th,
.home-table tbody tr:last-child td {
  border-bottom: none;
}

/* The product's own column, tinted the whole height so the eye lands on it. */
.home-table .is-ours {
  background: var(--chip-cool-bg);
  border-inline: 1px solid var(--chip-cool-line);
  color: var(--ink);
  font-weight: 600;
}

.home-table thead .is-ours {
  color: var(--chip-cool);
}

.home-mark-yes {
  color: var(--chip-cool);
  font-weight: 700;
}

.home-mark-partial {
  color: var(--chip-warm);
  font-weight: 700;
}

.home-mark-no {
  color: var(--ink-muted);
}

/* ── Metric family chips ─────────────────────────────── */

.home-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.home-chip {
  padding: 0.34rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--board-ink);
  background: rgba(244, 241, 234, 0.08);
  border: 1px solid var(--board-grid);
  --cut: 7px;
  clip-path: var(--bevel);
}

/* ── Roles table ─────────────────────────────────────── */

/* Two columns of prose, so it does not need the comparison table's width floor. */
.home-roles {
  min-width: 26rem;
}

.home-roles th,
.home-roles td {
  text-align: left;
}

.home-roles tbody th {
  width: 11rem;
}

.home-roles td {
  color: var(--ink-secondary);
}

/* ── Closing CTA ─────────────────────────────────────── */

.home-close {
  text-align: center;
}

.home-close h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  color: var(--ink);
  padding: 0;
}

.home-close p {
  margin: 0.6rem auto 1.5rem;
  max-width: 34rem;
  color: var(--ink-secondary);
}

/* ── Screen-reader-only text ─────────────────────────── */

/* The comparison marks are glyphs; each one is paired with a real word here so
   a screen reader reads "Yes" rather than a check character. */
.home-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Auth pages (Devise) ─────────────────────────────── */

.auth-wrap {
  max-width: 26rem;
  margin: 3rem auto;
}

.auth-card {
  padding: 1.6rem 1.5rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  --cut: 14px;
  clip-path: var(--bevel);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 1.45rem;
  padding: 0;
  margin-bottom: 0.3rem;
}

.auth-lede {
  color: var(--ink-secondary);
  font-size: 0.92rem;
  margin-bottom: 1.3rem;
}

.auth-card .form-row {
  max-width: none;
}

.auth-card label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
  width: 100%;
}

/* Checkbox rows read as a sentence, not as a labelled field. */
.auth-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.auth-check label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink-secondary);
}

.auth-actions .btn,
.auth-actions input[type="submit"] {
  width: 100%;
  text-align: center;
}

.auth-links {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 1.2rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

.auth-note {
  margin-top: 1.2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* Devise renders this partial on the recoverable/confirmable forms; borrow the
   flash treatment so errors look the same everywhere. */
.auth-errors {
  margin-bottom: 1.1rem;
  padding: 0.6rem 0.9rem;
  --cut: 10px;
  clip-path: var(--bevel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--tag-red);
  background: var(--surface);
  font-size: 0.9rem;
}

.auth-errors h2 {
  font-size: 0.92rem;
  color: var(--ink);
  padding: 0 0 0.2rem;
}

.auth-errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* ── Topbar sign-in (logged out) ─────────────────────── */

/* Deliberately not .topbar-nav — that whole block is display:none under 640px,
   and the one link a signed-out visitor needs must survive on a phone. */
.topbar-signin {
  color: var(--board-ink);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  margin-right: 0.8rem;
}

.topbar-signin:hover {
  color: var(--twine);
}

/* ── Bevel upgrade ───────────────────────────────────── */

/* Same progressive enhancement as application.css: where corner-shape ships,
   the box cuts its own corner, so borders follow the diagonal and focus rings
   sit outside the shape again. */
@supports (corner-shape: bevel) {
  .home-btn-ghost,
  .home-flow-step,
  .home-card,
  .home-table-wrap,
  .home-chip,
  .auth-card,
  .auth-errors {
    clip-path: none;
    corner-shape: bevel;
    border-radius: var(--cut);
  }

  .home-btn-ghost:focus-visible {
    outline-offset: 2px;
  }
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 900px) {
  .home-flow {
    grid-template-columns: repeat(2, 1fr);
  }

  /* The chevron pointed across a row that no longer exists. */
  .home-flow-step::after {
    content: none;
  }

  .home-section {
    padding: 2.8rem 0;
  }
}

@media (max-width: 640px) {
  .home-flow {
    grid-template-columns: 1fr;
  }

  .home-hero {
    padding: 2.6rem 0 2.4rem;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  /* Two columns of prose fit a phone if the role name is allowed to wrap —
     better than making a plain reference table scroll sideways. */
  .home-roles {
    min-width: 0;
  }

  .home-roles tbody th {
    width: auto;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-btn-ghost {
    transition: none;
  }
}
