/* ==========================================================================
   Aurenza — Landing + Auth surfaces (loads AFTER tokens.css)
   Only landing/auth-specific overrides and components here.
   ========================================================================== */

/* ---------- Masthead (reuses .appbar / .brand from tokens) ---------- */
.ld-nav {
  display: flex;
  align-items: center;
  gap: var(--sp5);
  margin-left: auto;
}
.ld-nav a {
  font-family: var(--sans);
  font-size: var(--text-sm);
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.ld-nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--accent);
  text-decoration: none;
}
/* These buttons must own their colours. `.ld-nav a` is (0,1,1) and would otherwise
   repaint the primary CTA `--muted` on `--accent` (~1.3:1, invisible) and the
   hover state in `--ink` — this is the most visible control on a phone. */
.ld-nav .btn {
  padding: 9px 15px;
  font-size: var(--text-xs);
  color: var(--ink);
}
.ld-nav .btn-primary {
  color: var(--cream);
}
.ld-nav a.btn-primary:hover {
  color: var(--cream);
}

/* ---------- Shell ---------- */
.ld-shell {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--sp5);
}
.ld-section {
  padding: var(--sp8) 0;
  border-top: 1px solid var(--rule-2);
}

/* ---------- Hero ---------- */
.ld-hero {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: var(--sp7);
  align-items: center;
  padding: var(--sp8) 0 var(--sp7);
}

/* Title & copy */
.ld-eyebrow {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--sp4);
}
.ld-title {
  font-family: var(--display);
  font-variation-settings: 'opsz' var(--display-opsz-lg), 'SOFT' var(--display-soft);
  font-weight: 620;
  font-size: clamp(38px, 5.6vw, 68px);
  line-height: 1.02;
  letter-spacing: -.015em;
  margin: 0 0 var(--sp5);
  text-wrap: balance;
}
.ld-title em {
  font-style: italic;
  color: var(--accent);
}
.ld-lede {
  font-family: var(--sans);
  font-size: var(--text-lg);
  line-height: 1.65;
  color: var(--muted);
  max-width: 54ch;
  margin: 0 0 var(--sp6);
}
.ld-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp3);
  align-items: center;
}
.ld-hint {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  max-width: 74ch;
  margin: 0 0 var(--sp4);
}

/* Even out the display headings and stop body copy from leaving one word on a line */
.ld-band h2 { text-wrap: balance; }
.ld-lede, .ld-sub, .ld-card p, .ld-step p, .ld-band p, .ld-footnote, .ld-hint { text-wrap: pretty; }

/* Photographic plate — green scrim keeps any photo inside the palette */
.ld-plate {
  position: relative;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--paper-2);
}
.ld-plate img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ld-plate::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(200deg, rgba(15, 92, 64, .52), rgba(15, 92, 64, .10) 50%, rgba(9, 8, 7, .66));
  mix-blend-mode: multiply;
  pointer-events: none;
}
.ld-plate-hero {
  aspect-ratio: 5 / 4;
}
.ld-plate-cap {
  position: absolute;
  left: var(--sp4);
  bottom: var(--sp4);
  right: var(--sp4);
  z-index: 2;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}

/* ---------- Stat strip (visual bars) ---------- */
.ld-stats-section {
  padding-top: var(--sp6);
  padding-bottom: var(--sp6);
}
.ld-stats-visual {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp5);
}
.ld-stat-visual {
  padding: var(--sp4) 0;
}
.ld-stat-visual + .ld-stat-visual {
  padding-left: var(--sp5);
  border-left: 1px solid var(--rule);
}
.ld-stat-num {
  display: block;
  font-family: var(--display);
  font-variation-settings: 'opsz' var(--display-opsz-md), 'SOFT' var(--display-soft);
  font-weight: 600;
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1;
  color: var(--ink);
}
.ld-stat-num.up {
  color: var(--accent);
}
.ld-stat-label {
  display: block;
  margin-top: var(--sp1);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.ld-stat-bar {
  margin-top: var(--sp3);
  height: 6px;
  background: var(--paper-2);
  border-radius: var(--r-full);
  overflow: hidden;
}
.ld-stat-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width var(--dur-4) var(--ease-out);
}
.ld-stat-bar[style*="--value: 100"] span { width: 100%; }
.ld-stat-bar[style*="--value: 96"] span { width: 96%; }
.ld-stat-bar[style*="--value: 65"] span { width: 65%; }
.ld-stat-bar[style*="--value: 0"] span { width: 0%; }
.ld-stat-detail {
  margin-top: var(--sp2);
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--faint);
  line-height: 1.5;
}

/* ---------- Split (text + photo) ---------- */
.ld-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp7);
  align-items: center;
}
.ld-split.reverse .ld-split-copy {
  order: 2;
}

/* ---------- Features (bento grid) ---------- */
.ld-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp5);
  margin-top: var(--sp6);
}
.ld-card {
  padding: var(--sp5);
  background: var(--card);
  border: 1px solid var(--rule-2);
  border-top: 3px solid var(--accent);
  border-radius: var(--r);
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.ld-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-line);
}
.ld-card h3 {
  font-family: var(--sans);
  font-size: 15.5px;
  font-weight: 600;
  margin: 0 0 var(--sp2);
}
.ld-card p {
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}
.ld-card svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
  margin-bottom: var(--sp3);
}

/* ---------- Steps ---------- */
.ld-steps {
  margin: var(--sp6) 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.ld-step {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: var(--sp4);
  padding: var(--sp5) 0;
  border-top: 1px solid var(--rule);
}
.ld-step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--accent);
  padding-top: 4px;
}
.ld-step h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  margin: 0 0 var(--sp2);
}
.ld-step p {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.62;
  color: var(--muted);
  margin: 0;
}
/* The counter (::before) owns the narrow gutter; heading and body both belong to the content column */
.ld-step h3, .ld-step p {
  grid-column: 2;
}
.ld-step code {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 1px 5px;
}

/* ---------- Closing band ---------- */
.ld-band {
  margin: var(--sp8) 0;
  padding: var(--sp7);
  background: var(--card);
  border: 1px solid var(--rule-2);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-lg);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp6);
  align-items: center;
  justify-content: space-between;
}
.ld-band h2 {
  font-family: var(--display);
  font-variation-settings: 'opsz' var(--display-opsz-md), 'SOFT' var(--display-soft);
  font-weight: 600;
  font-size: clamp(22px, 2.6vw, 30px);
  margin: 0 0 var(--sp2);
}
.ld-band p {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--muted);
  margin: 0;
  max-width: 52ch;
}

/* ---------- Auth pages ---------- */
.au-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .92fr);
  gap: var(--sp7);
  align-items: stretch;
  padding: var(--sp7) 0 var(--sp8);
}
.au-card {
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
  padding: var(--sp6);
  background: var(--card);
  border: 1px solid var(--rule-2);
  border-top: 3px solid var(--accent);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.au-title {
  font-family: var(--display);
  font-variation-settings: 'opsz' var(--display-opsz-md), 'SOFT' var(--display-soft);
  font-weight: 620;
  font-size: 30px;
  margin: 0 0 var(--sp2);
}
.au-sub {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 var(--sp6);
}
.au-form {
  display: grid;
  gap: var(--sp4);
}
.au-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--sp2);
}
.au-input {
  width: 100%;
  padding: 11px 12px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.au-input::placeholder {
  color: var(--faint);
}
.au-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.au-error {
  display: block;
  margin-top: var(--sp2);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--bad);
}
.au-error:empty {
  display: none;
}
.au-error.is-on {
  display: block;
}
.au-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp3);
}
.au-check {
  display: inline-flex;
  align-items: center;
  gap: var(--sp2);
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
}
.au-input[aria-invalid="true"] {
  border-color: var(--bad);
}
.au-alert {
  display: none;
  margin: 0 0 var(--sp4);
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--bad);
  background: var(--bad-soft);
  border: 1px solid var(--bad);
  border-left-width: 3px;
  border-radius: var(--r-sm);
}
.au-alt {
  margin: var(--sp5) 0 0;
  padding-top: var(--sp5);
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
}
.au-alt a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.au-alt a:hover {
  text-decoration: underline;
}
.au-aside {
  position: relative;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  min-height: 420px;
}
.au-aside img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.au-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(190deg, rgba(15, 92, 64, .58), rgba(15, 92, 64, .18) 50%, rgba(0, 0, 0, .55));
  mix-blend-mode: multiply;
}
.au-aside-body {
  position: absolute;
  inset: auto var(--sp5) var(--sp5) var(--sp5);
  z-index: 2;
  color: #fff;
}
.au-aside-body p {
  font-family: var(--display);
  font-variation-settings: 'opsz' var(--display-opsz-md), 'SOFT' var(--display-soft);
  font-size: 21px;
  line-height: 1.35;
  margin: 0 0 var(--sp3);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}
.au-aside-body span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  opacity: .9;
}
.au-demo {
  margin-top: var(--sp5);
  padding: var(--sp4);
  background: var(--paper-2);
  border: 1px dashed var(--rule-2);
  border-radius: var(--r);
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--muted);
}
.au-demo strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
}
.au-demo button {
  margin-top: var(--sp3);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- Footnotes + footer spacing ---------- */
.ld-footnote {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
  color: var(--faint);
  max-width: 74ch;
  margin: var(--sp5) 0 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .ld-hero {
    grid-template-columns: 1fr;
    gap: var(--sp6);
  }
  .ld-plate-hero {
    aspect-ratio: 16 / 10;
  }
  .ld-split {
    grid-template-columns: 1fr;
    gap: var(--sp6);
  }
  .ld-split.reverse .ld-split-copy {
    order: 0;
  }
  .au-wrap {
    grid-template-columns: 1fr;
  }
  .au-aside {
    min-height: 240px;
    order: 2;
  }
  .ld-stats-visual {
    grid-template-columns: repeat(2, 1fr);
  }
  .ld-stat-visual:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }
  .ld-stat-visual:nth-child(n + 3) {
    border-top: 1px solid var(--rule);
    padding-top: var(--sp5);
  }
  .ld-grid {
    grid-template-columns: 1fr;
  }
  /* Touch, not pointer: on any screen this size the buttons, the theme switch
     and the masthead links must be comfortably tappable (WCAG 2.2 AA floors at
     24px; 44px is the comfortable target). Measured before: 25.4 / 33.5 / 34.
     The masthead links are 25px tall, so they get the height from padding while
     the underline moves off the box to the text — otherwise growing the target
     would drag the rule 10px away from the word. */
  .btn {
    min-height: 44px;
  }
  .ld-nav .btn {
    padding: 12px 16px;
  }
  .appbar .theme-toggle {
    width: 44px;
    height: 44px;
  }
  .ld-nav a:not(.btn) {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-bottom: 0;
    border-bottom: 0;
  }
  .ld-nav a:not(.btn):hover,
  .ld-nav a:not(.btn):focus-visible {
    text-decoration: underline;
  }
}
@media (max-width: 820px) {
  .ld-nav a:not(.btn) {
    display: none;
  }
  .ld-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 520px) {
  .ld-shell {
    padding: 0 var(--sp4);
  }
  .ld-section {
    padding: var(--sp7) 0;
  }
  .ld-stats-visual {
    grid-template-columns: 1fr;
  }
  .ld-stat-visual {
    padding-left: 0;
    border-left: 0;
  }
  .ld-stat-visual + .ld-stat-visual {
    border-top: 1px solid var(--rule);
    border-left: 0;
    padding-top: var(--sp4);
  }
  .ld-step {
    grid-template-columns: 34px 1fr;
  }
  .au-card {
    padding: var(--sp5);
  }
  .ld-band {
    padding: var(--sp5);
  }
}

/* ---------- Odds and ends ---------- */
/* `hidden` must always win over a class that sets display (nav chips, auth errors). */
[hidden] {
  display: none !important;
}

/* The masthead brand is a link on these pages, not a plain block. */
a.brand {
  text-decoration: none;
  color: inherit;
}

/* Auth pages: breathing room inside the shell. */
.au-main {
  padding-top: var(--sp6);
  padding-bottom: var(--sp8);
}

/* Signed-in / signed-out chips in the masthead. */
.ld-nav [data-session] {
  display: inline-flex;
  align-items: center;
  gap: var(--sp3);
}
.ld-user {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Staggered entrance for the grids (the reveal transition itself lives in
   tokens.css; here we only offset it). */
.ld-grid .ld-card:nth-child(2) { transition-delay: 60ms; }
.ld-grid .ld-card:nth-child(3) { transition-delay: 120ms; }
.ld-grid .ld-card:nth-child(4) { transition-delay: 180ms; }
.ld-grid .ld-card:nth-child(5) { transition-delay: 240ms; }
.ld-grid .ld-card:nth-child(6) { transition-delay: 300ms; }
.ld-stats-visual .ld-stat-visual:nth-child(2) { transition-delay: 70ms; }
.ld-stats-visual .ld-stat-visual:nth-child(3) { transition-delay: 140ms; }
.ld-stats-visual .ld-stat-visual:nth-child(4) { transition-delay: 210ms; }
.ld-steps .ld-step:nth-child(2) { transition-delay: 80ms; }
.ld-steps .ld-step:nth-child(3) { transition-delay: 160ms; }
.ld-steps .ld-step:nth-child(4) { transition-delay: 240ms; }