/* Landing-page design layer, ported from the marketing site (storepilot_public:
   tokens.css + the homepage subset of site.css). Loaded app-wide by the
   layout's `stylesheet_link_tag :app` (which links every stylesheet in this
   directory), but every rule is scoped under .landing so it is inert on
   signed-in screens — only the login/root page (sessions/new) opts in by
   wrapping its markup in .landing. Keep in sync with the marketing site. */

@font-face {
  font-family: "NeusharpCond";
  src: url("/assets/Neusharp-Condensed-988bebda.woff2") format("woff2");
  font-style: normal;
  font-weight: normal;
  font-display: swap;
}

/* ---------- Design tokens (from tokens.css) ---------- */

.landing {
  /* colour · "warm quiet", brand-orange anchor */
  --color-paper:       oklch(98.6% 0.006 75);
  --color-paper-2:     oklch(96.4% 0.01 75);
  --color-rule:        oklch(88% 0.014 70);
  --color-faint:       oklch(47% 0.02 55);
  --color-muted:       oklch(38% 0.02 50);
  --color-ink:         oklch(22% 0.018 45);
  --color-ink-lift:    oklch(30% 0.02 45);
  --color-accent:      oklch(63% 0.19 40);
  --color-accent-text: oklch(53% 0.17 40);
  --color-accent-soft: oklch(94% 0.03 60);
  --color-focus:       oklch(55% 0.19 40);
  --color-ok:          oklch(40% 0.1 150);
  --color-ok-soft:     oklch(94% 0.035 150);
  --color-err:         oklch(47% 0.18 22);
  --color-err-soft:    oklch(94% 0.04 22);

  /* type · Neusharp display / Lexend body / NeusharpCond outlier (wordmark) */
  --font-display: Neusharp, Lexend, Avenir, "Helvetica Neue", Helvetica, sans-serif;
  --font-body:    Lexend, Avenir, Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-outlier: NeusharpCond, Neusharp, Lexend, sans-serif;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-md:   1.125rem;
  --text-lg:   1.25rem;
  --text-2xl:  1.9531rem;
  --text-display-s: clamp(1.875rem, 1.6vw + 1.25rem, 2.6rem);
  --text-display: clamp(2.25rem, 3.2vw + 1rem, 4rem);

  /* space · 4pt scale */
  --space-3xs: 0.125rem;
  --space-2xs: 0.25rem;
  --space-xs:  0.5rem;
  --space-sm:  0.75rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-micro: 120ms;
  --dur-short: 220ms;
  --dur-long:  420ms;

  /* shape */
  --rule-hair:    1px;
  --radius-card:  10px;
  --radius-input: 10px;
  --radius-pill:  999px;

  /* derived */
  --shadow-pill: 0 8px 24px -12px color-mix(in oklch, var(--color-ink) 25%, transparent);
  --nav-clearance: 5.75rem;
  --z-sticky: 200;
}

/* ---------- Base ---------- */

.landing {
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  padding-top: var(--nav-clearance);
}

.landing ::selection { background: var(--color-accent-soft); color: var(--color-ink); }

.landing a { color: var(--color-accent-text); }
.landing a:focus-visible,
.landing button:focus-visible,
.landing input:focus-visible,
.landing summary:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* ---------- Nav · floating pill ---------- */

.landing .nav-pill {
  position: fixed;
  top: var(--space-sm);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2 * var(--space-md));
  max-width: 72rem;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-md);
  background: color-mix(in oklch, var(--color-paper) 85%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-pill);
}
.landing .nav-pill__cta { margin-left: auto; }
.landing .nav-pill .site-logo {
  display: inline-flex;
  align-items: center;
  /* Icon-to-wordmark gap, matching the marketing site. */
  gap: calc(var(--space-xs) + 0.625rem);
  flex: none;
  text-decoration: none;
}
.landing .nav-pill .site-logo:hover { text-decoration: none; }
.landing .nav-pill .logo-mark { width: 1.625rem; height: auto; display: block; flex: none; }
.landing .logo-word {
  font-family: var(--font-outlier);
  padding-top: 4px; /* optical alignment against the box icon */
  font-size: calc(var(--text-lg) * 1.3);
  line-height: 1;
  color: var(--color-ink);
  white-space: nowrap;
}
.landing .logo-word span { color: var(--color-accent-text); }
@media (max-width: 40rem) {
  .landing { --nav-clearance: 5.5rem; }
  .landing .nav-pill { gap: var(--space-sm); padding-left: var(--space-sm); }
}

/* ---------- Buttons ---------- */

.landing .sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-lg);
  border: var(--rule-hair) solid transparent;
  border-radius: var(--radius-pill);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease-out),
              border-color var(--dur-micro) var(--ease-out),
              color var(--dur-micro) var(--ease-out),
              transform 100ms var(--ease-out);
}
.landing .sp-btn:hover { text-decoration: none; transform: translateY(-1.5px); }
.landing .sp-btn:active { transform: translateY(0); }
.landing .sp-btn-primary { background: var(--color-ink); color: var(--color-paper); }
.landing .sp-btn-primary:hover { background: var(--color-ink-lift); color: var(--color-paper); }
.landing .sp-btn-secondary { background: transparent; color: var(--color-ink); border-color: var(--color-ink); }
.landing .sp-btn-secondary:hover { background: var(--color-ink); color: var(--color-paper); }
.landing .sp-btn-sm { padding: var(--space-xs) var(--space-md); font-size: var(--text-sm); }
@media (pointer: coarse) { .landing .sp-btn { min-height: 2.75rem; } }

/* typographic link with arrow — the secondary CTA voice */
.landing .link-arrow {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2xs);
  color: var(--color-ink);
  font-weight: 500;
  font-size: var(--text-sm);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: var(--rule-hair) solid var(--color-rule);
  padding-bottom: var(--space-3xs);
  transition: border-color var(--dur-micro) var(--ease-out);
}
.landing .link-arrow::after { content: "→"; }
.landing .link-arrow:hover { text-decoration: none; border-color: var(--color-accent); }

/* ---------- Login · branded split ---------- */

.landing .hero { width: 100%; max-width: 60rem; margin: 0 auto; padding: var(--space-xl) var(--space-md) var(--space-2xl); }
.landing .login-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: stretch;
}

/* Brand panel — the photo carries atmosphere only (decorative). A slim banner
   on mobile, a full-height panel beside the form on wide screens. */
.landing .login-media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-card);
  height: 7rem;
}
.landing .login-media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
/* Warm corner wash so the photo reads as part of the palette, not a stock drop-in. */
.landing .login-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, color-mix(in oklch, var(--color-accent) 16%, transparent), transparent 55%);
}

/* Sign-in panel — vertically centres the card against the brand panel. */
.landing .login-panel { display: flex; align-items: center; justify-content: center; }

.landing .hero-workspace {
  margin-bottom: var(--space-xs);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent-text);
}

@media (min-width: 56rem) {
  .landing .login-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-xl);
    min-height: 24rem;
  }
  .landing .login-media { height: auto; }
}

/* ---------- Auth card ---------- */

.landing .auth-card {
  max-width: 26rem;
  margin: 0 auto;
  padding: var(--space-xl);
  text-align: center;
}
.landing .auth-head { margin-bottom: var(--space-lg); }
.landing .auth-card h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-2xl);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
}
.landing .auth-card .sp-btn { width: 100%; }
/* The passkey path is the primary action — give it more height than the fallbacks. */
.landing .auth-card .sp-btn-primary { padding-block: var(--space-sm); font-size: var(--text-base); }
.landing .auth-btn-icon { width: 1.15em; height: 1.15em; flex: none; }
.landing .auth-error { margin-top: var(--space-sm); font-size: var(--text-xs); color: var(--color-err); text-align: center; }
.landing .auth-error.hidden { display: none; }

/* Server-side flash messages. sessions#new renders them here in the card,
   next to the form they concern (as toasts they once vanished under the nav
   pill, before layouts/_flash was raised above the landing z-scale).
   Banner rather than bare coloured text: this palette's accent is itself an
   orange-red (--color-accent-text sits 1.32:1 from --color-err), so red type
   alone reads as body copy next to the recovery link. The tint and icon carry
   the signal instead of the hue. */
.landing .auth-flash {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  margin: 0 0 var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border: var(--rule-hair) solid;
  border-radius: var(--radius-card);
  font-size: var(--text-sm);
  line-height: 1.4;
}
.landing .auth-flash-icon { width: 1.15em; height: 1.15em; flex: none; }
.landing .auth-flash--alert {
  color: var(--color-err);
  background: var(--color-err-soft);
  border-color: color-mix(in oklch, var(--color-err) 20%, transparent);
}
.landing .auth-flash--notice {
  color: var(--color-ok);
  background: var(--color-ok-soft);
  border-color: color-mix(in oklch, var(--color-ok) 20%, transparent);
}

/* Exactly one sign-in path is the primary at a time, and the other wears this
   quiet link. Collapsed, the password disclosure wears it: passwords are
   bootstrap-only and retire once an account has a passkey, so a full-width
   tinted pill overstated them — it read as a co-equal choice beside the
   passkey primary and sat at the same weight as the error banner above it.
   Opened, the two swap (see below).

   :has() is what makes the swap possible: the passkey button is a *preceding*
   sibling of the disclosure, so its style has to be driven from their shared
   parent. */
.landing .auth-alt { margin-top: var(--space-md); }
.landing .auth-alt > summary,
.landing .auth-card:has(.auth-alt[open]) .sp-btn-primary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  width: auto;
  padding: var(--space-2xs) var(--space-xs);
  border: 0;
  border-radius: var(--radius-input);
  background: none;
  color: var(--color-faint);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in oklch, var(--color-faint) 35%, transparent);
  transition: color var(--dur-micro) var(--ease-out);
}
.landing .auth-alt > summary::-webkit-details-marker { display: none; }
.landing .auth-alt > summary:hover,
.landing .auth-card:has(.auth-alt[open]) .sp-btn-primary:hover {
  color: var(--color-ink-lift);
  background: none;
  transform: none;
}

/* Once the password form is open it owns the card. The summary has done its
   job — the demoted passkey link above is the way back to the other path — and
   the fingerprint shrinks to the link's own type size. */
.landing .auth-alt[open] > summary { display: none; }
.landing .auth-card:has(.auth-alt[open]) .auth-btn-icon { width: 1em; height: 1em; }
.landing .auth-note { margin: var(--space-md) 0; font-size: var(--text-xs); color: var(--color-faint); }

.landing .form-row { display: grid; gap: var(--space-2xs); margin-bottom: var(--space-md); }
.landing .auth-card label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-ink);
}
.landing .auth-card input {
  width: 100%;
  min-height: 2.75rem;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-base);
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-paper);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-input);
  transition: border-color var(--dur-micro) var(--ease-out);
}
.landing .auth-card input:hover { border-color: var(--color-faint); }
.landing .auth-card input::placeholder { color: var(--color-faint); }

.landing .auth-recover { margin-top: var(--space-lg); text-align: center; font-size: var(--text-sm); }

/* One orchestrated entrance. */
@media (prefers-reduced-motion: no-preference) {
  .landing .reveal {
    opacity: 0;
    transform: translateY(8px);
    animation: sp-reveal var(--dur-long) var(--ease-out) forwards;
    animation-delay: calc(var(--i, 0) * 60ms);
  }
  @keyframes sp-reveal { to { opacity: 1; transform: none; } }
}

/* ---------- Footer · legal band only ---------- */

.landing .foot-legal { margin-top: var(--space-3xl); border-top: var(--rule-hair) solid var(--color-rule); }
.landing .foot-legal p {
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--space-md) var(--space-md) var(--space-lg);
  font-size: var(--text-xs);
  color: var(--color-faint);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .landing *, .landing *::before, .landing *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
  }
  .landing .sp-btn:hover { transform: none; }
}
