/* Auth & marketing surfaces — shared token system (ADR 0039).
   This stylesheet loads AFTER console.css, so the full --sd-* token set
   (fonts, light/dark themes, status, elevation) is available here. Auth no
   longer carries its own color namespace; it tracks the user's stored theme
   via theme-init.js. The marketing "story panel" keeps its dramatic feel by
   pinning to explicit surface regions (--sd-surface) rather than fixed dark. */

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  min-width: 320px;
  width: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--sd-paper);
  color: var(--sd-ink);
  font-family: var(--sd-font-sans);
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(
      860px 520px at 74% 12%,
      color-mix(in oklch, var(--sd-accent) 12%, transparent),
      transparent 58%
    ),
    var(--sd-paper);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  align-items: stretch;
  gap: 28px;
  width: min(1180px, calc(100vw - 48px));
  max-width: 100%;
}

/* The story panel is the dramatic marketing surface. It stays a deep
   elevated region in BOTH themes by pinning to --sd-surface over the paper,
   so the composition reads consistently rather than contradicting the user's
   console theme. */
.auth-story {
  display: grid;
  align-content: space-between;
  gap: 18px;
  min-width: 0;
  min-height: 580px;
  border: 1px solid var(--sd-line-strong);
  border-radius: 18px;
  background:
    linear-gradient(
      180deg,
      color-mix(in oklch, var(--sd-surface) 96%, transparent),
      color-mix(in oklch, var(--sd-surface-panel-2) 98%, transparent)
    ),
    var(--sd-surface);
  box-shadow: var(--sd-shadow-raised);
  padding: clamp(24px, 4vw, 44px);
  overflow: hidden;
}

.auth-story-brand {
  color: var(--sd-ink);
}

.auth-story-copy {
  max-width: 690px;
}

.auth-story h1 {
  margin: 0;
  max-width: 720px;
  color: var(--sd-ink);
  font-family: var(--sd-font-display);
  font-size: clamp(2.5rem, 5.2vw, 4.45rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}

.auth-story .lede {
  max-width: 680px;
  color: var(--sd-muted);
  font-size: 1.06rem;
}

/* Example composer mockup — a sunken well inside the story panel. */
.auth-composer {
  display: grid;
  gap: 14px;
  max-width: 760px;
  border: 1px solid var(--sd-line);
  border-radius: 20px;
  background: var(--sd-surface-muted);
  box-shadow: var(--sd-shadow);
  padding: 18px;
}

.auth-composer p {
  margin: 0;
  min-height: 72px;
  color: var(--sd-ink-muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.auth-composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--sd-line);
  color: var(--sd-subtle);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  padding-top: 12px;
}

.send-dot {
  display: inline-flex;
  width: 38px;
  height: 38px;
  border-radius: var(--sd-radius-pill);
  background: linear-gradient(145deg, var(--sd-accent-hover), var(--sd-accent));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 22%);
}

.auth-capability-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.auth-capability-grid article {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--sd-line);
  border-radius: 14px;
  background: var(--sd-surface-muted);
  padding: 14px;
}

.auth-capability-grid strong {
  color: var(--sd-ink);
  font-size: 0.92rem;
}

.auth-capability-grid span {
  color: var(--sd-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

/* The auth card — the actionable form surface. Floats on the paper. */
.auth-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  align-self: center;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--sd-line);
  border-radius: 16px;
  background: var(--sd-paper-strong);
  box-shadow: var(--sd-shadow-raised);
  color: var(--sd-ink);
  padding: clamp(22px, 2.4vw, 28px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

/* Unified brand mark — same gradient recipe as the console .sd-brand-mark. */
.brand-mark {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--sd-accent-hover), var(--sd-accent));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 26%);
  color: var(--sd-on-accent);
  font-size: 0.82rem;
  font-weight: 800;
}

.brand-mark::after {
  content: "S";
}

.auth-card-brand {
  color: var(--sd-ink);
}

.eyebrow {
  margin: 8px 0 0;
  color: var(--sd-accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-card h1 {
  margin: 0;
  font-family: var(--sd-font-display);
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}

.lede,
.hint {
  margin: 0;
  color: var(--sd-muted);
  line-height: 1.5;
  overflow-wrap: break-word;
}

.hint {
  font-size: 0.9rem;
}

.delivery-note {
  margin: 0;
  border: 1px solid var(--sd-line);
  border-radius: var(--sd-radius);
  background: var(--sd-surface-muted);
  color: var(--sd-ink);
  line-height: 1.5;
  padding: 10px 12px;
}

/* Error states reuse the console's danger tone + soft fill. */
.error {
  margin: 0;
  border: 1px solid color-mix(in oklch, var(--sd-danger) 45%, var(--sd-line));
  border-radius: var(--sd-radius);
  background: var(--sd-error-soft);
  color: var(--sd-tone-stopped-fg);
  padding: 10px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form.compact {
  margin-top: 2px;
}

.dev-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--sd-line);
  margin-top: 4px;
  padding-top: 16px;
}

.dev-title {
  margin: 0;
  color: var(--sd-ink);
  font-weight: 700;
}

label {
  display: grid;
  gap: 6px;
  color: var(--sd-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

input {
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  border: 1px solid var(--sd-line-strong);
  border-radius: var(--sd-radius);
  background: var(--sd-paper-strong);
  color: var(--sd-ink);
  font: inherit;
  padding: 9px 12px;
}

input:focus-visible {
  outline: 2px solid var(--sd-accent);
  outline-offset: 2px;
  border-color: var(--sd-accent);
}

button,
.button-link {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--sd-accent);
  border-radius: var(--sd-radius);
  background: var(--sd-accent);
  color: var(--sd-on-accent);
  font: inherit;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  padding: 9px 14px;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button-link:hover {
  background: var(--sd-accent-hover);
  border-color: var(--sd-accent-hover);
}

.secondary-button {
  border-color: var(--sd-line);
  background: transparent;
  color: var(--sd-accent);
}

.text-link {
  color: var(--sd-accent);
  font-weight: 600;
  text-decoration: none;
}

/* Signup page — the marketing landing variant of the auth surface. */
.signup-page {
  min-height: 100vh;
  color: var(--sd-ink);
  background:
    radial-gradient(
      860px 460px at 72% 14%,
      color-mix(in oklch, var(--sd-accent) 8%, transparent),
      transparent 62%
    ),
    var(--sd-paper);
  padding: 26px 54px 54px;
}

.signup-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1220px;
  margin: 0 auto 28px;
}

.signup-brand {
  color: var(--sd-ink);
  text-decoration: none;
}

.signup-topbar nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.signup-topbar a {
  color: var(--sd-muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.signup-layout {
  display: grid;
  grid-template-columns: minmax(360px, 560px) minmax(0, 1fr);
  gap: 34px;
  max-width: 1220px;
  margin: 0 auto;
}

.signup-card {
  display: grid;
  align-content: start;
  gap: 16px;
  border: 1px solid var(--sd-line);
  border-radius: 24px;
  background: var(--sd-paper-strong);
  box-shadow: var(--sd-shadow-raised);
  padding: clamp(26px, 4.4vw, 48px);
}

.signup-card h1 {
  max-width: 460px;
  margin: 0;
  color: var(--sd-ink);
  font-family: var(--sd-font-display);
  font-size: clamp(2.45rem, 5vw, 3.8rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.signup-card .lede {
  max-width: 460px;
  font-size: 1rem;
}

.signup-card button {
  min-height: 46px;
  border-color: var(--sd-accent-hover);
  background: var(--sd-accent);
  color: var(--sd-on-accent);
}

.signup-plan-stack {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.signup-plan {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--sd-line);
  border-radius: 16px;
  background: var(--sd-surface-muted);
  padding: 15px;
}

.signup-plan.is-selected {
  border: 2px solid var(--sd-accent);
  background: var(--sd-accent-soft);
}

.signup-plan strong {
  display: block;
  color: var(--sd-ink);
  margin-bottom: 5px;
}

.signup-plan p {
  margin: 0;
  color: var(--sd-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.signup-plan span {
  align-self: flex-start;
  border: 1px solid var(--sd-line);
  border-radius: var(--sd-radius-pill);
  background: var(--sd-paper-strong);
  color: var(--sd-muted);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 6px 9px;
}

.signup-examples {
  min-width: 0;
  padding: 22px 0;
}

.signup-examples-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.signup-examples h2 {
  margin: 0;
  color: var(--sd-ink);
  font-family: var(--sd-font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.06;
  letter-spacing: -0.018em;
}

.signup-examples p {
  max-width: 520px;
  margin: 8px 0 0;
  color: var(--sd-muted);
  line-height: 1.45;
}

.signup-examples-head > span {
  border: 1px solid var(--sd-line);
  border-radius: var(--sd-radius-pill);
  background: var(--sd-paper-strong);
  color: var(--sd-ink-muted);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 8px 11px;
}

.signup-example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.signup-example-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--sd-line);
  border-radius: 18px;
  background: var(--sd-paper-strong);
  box-shadow: var(--sd-shadow);
  padding: 12px;
}

.signup-example-card strong {
  color: var(--sd-ink);
  font-size: 0.9rem;
}

.signup-example-card span {
  color: var(--sd-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

/* Example thumbnails keep their decorative gradients — these are intentional
   marketing accents, not theme-tied surfaces, so they stay vivid in both
   themes. */
.signup-example-thumb {
  position: relative;
  height: 94px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--sd-line-stronger), var(--sd-accent));
}

.signup-example-thumb::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid rgb(255 255 255 / 42%);
  border-radius: 9px;
  background: rgb(255 255 255 / 10%);
}

.signup-example-thumb.blue {
  background: linear-gradient(135deg, var(--sd-surface-muted), var(--sd-accent));
}

.signup-example-thumb.purple {
  background: linear-gradient(135deg, var(--sd-surface-muted), var(--sd-accent-iris));
}

.signup-example-thumb.green {
  background: linear-gradient(135deg, var(--sd-surface-muted), var(--sd-sage));
}

.signup-example-thumb.teal {
  background: linear-gradient(135deg, var(--sd-surface-muted), var(--sd-info));
}

.signup-example-thumb.red {
  background: linear-gradient(135deg, var(--sd-surface-muted), var(--sd-danger));
}

@media (max-width: 940px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-story {
    min-height: auto;
  }
  .auth-card {
    align-self: auto;
  }
  .auth-capability-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .signup-page {
    padding: 22px 24px 36px;
  }
  .signup-layout {
    grid-template-columns: 1fr;
  }
  .signup-examples {
    padding-top: 0;
  }
}

@media (max-height: 760px) and (min-width: 941px) {
  .auth-page {
    padding-top: 18px;
    padding-bottom: 18px;
  }
  .auth-story {
    min-height: 0;
    padding: 28px;
  }
  .auth-story h1 {
    font-size: clamp(2.4rem, 4.8vw, 4rem);
  }
  .auth-composer p {
    min-height: 48px;
  }
  .auth-capability-grid article {
    padding: 12px;
  }
  .auth-card {
    padding: 24px;
  }
}

@media (max-width: 520px) {
  .auth-page { padding: 16px; place-items: center stretch; }
  .auth-shell { width: 100%; gap: 16px; }
  .auth-story,
  .auth-card {
    width: 100%;
    padding: 22px;
    border-radius: 14px;
  }
  .auth-story h1 {
    font-size: clamp(2.25rem, 13vw, 3.4rem);
  }
  .auth-capability-grid {
    grid-template-columns: 1fr;
  }
  .signup-page {
    padding: 18px 16px 28px;
  }
  .signup-topbar {
    align-items: flex-start;
    margin-bottom: 18px;
  }
  .signup-topbar nav {
    gap: 14px;
  }
  .signup-card {
    border-radius: 18px;
    padding: 24px 20px;
  }
  .signup-card h1 {
    font-size: clamp(2.3rem, 12vw, 3.2rem);
  }
  .signup-examples-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .signup-example-grid {
    grid-template-columns: 1fr;
  }
  .signup-plan {
    flex-direction: column;
  }
}
