/* ======================================================================
   GUEST LAYOUT — Evident Technologies
   Structural styles for the guest.njk layout.
   Simplified, trust-focused navigation for public/auth pages.
   Uses Gemstone Design Tokens from tokens.css.
   ====================================================================== */

/* ── Auth pages in guest layout ─────────────────────────────────────── */

main.auth-guest {
  background: var(--surface-ground, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: center;
  min-block-size: calc(100vh - var(--header-height, 72px));
  padding: 2rem 1rem;
}

/* ── Onboarding page in guest layout ───────────────────────────────── */

main.onboarding-guest {
  background: var(--surface-ground, #f8fafc);
  min-block-size: 100vh;
  padding: 2rem 1rem;
}

/* ── 404 page in guest layout ───────────────────────────────────────── */

main.not-found-page {
  background: var(--surface-ground, #f8fafc);
  min-block-size: 100vh;
  padding: 4rem 1rem;
}

/* ── Feature grid for legal/security pages ─────────────────────────── */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-block-start: 2rem;
}

.feature-grid--narrow {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Feature cards in guest layout context */
.guest-layout .feature-card,
.auth-guest .feature-card,
.legal-page .feature-card {
  background: linear-gradient(180deg, rgb(13 23 38 / 92%), rgb(7 13 23 / 88%));
  border: 1px solid rgb(126 157 202 / 12%);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 8px 32px rgb(0 0 0 / 30%);
}

@media (prefers-reduced-motion: no-preference) {
  .guest-layout .feature-card,
  .auth-guest .feature-card,
  .legal-page .feature-card {
    transition:
      border-color 0.2s ease,
      box-shadow 0.2s ease;
  }
}

.guest-layout .feature-card:hover,
.auth-guest .feature-card:hover,
.legal-page .feature-card:hover {
  border-color: rgb(98 181 255 / 22%);
  box-shadow: 0 12px 40px rgb(0 0 0 / 40%);
}

.guest-layout .feature-card__title,
.auth-guest .feature-card__title,
.legal-page .feature-card__title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #fff2da;
  margin: 0 0 0.75rem;
}

.guest-layout .feature-card__body,
.auth-guest .feature-card__body,
.legal-page .feature-card__body {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #9eb0cb;
  margin: 0;
}

/* Surface panel for compliance notes */
.surface-panel {
  background: rgb(217 175 103 / 6%);
  border: 1px solid rgb(217 175 103 / 18%);
  border-radius: 0.75rem;
  padding: 2rem;
  margin-block-start: 2rem;
}

.prose-block--narrow {
  max-width: 640px;
  margin: 0 auto;
}

.prose-block h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text, #1a2040);
  margin: 0 0 1rem;
}

.prose-block p {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--color-text-secondary, #374151);
  margin: 0;
}

/* CTA section for legal pages */
.page-section--cta {
  text-align: center;
  padding: 3rem 1rem;
  margin-block-start: 3rem;
  border-top: 1px solid var(--border-subtle, #e2e8f0);
}

.cta-lead {
  font-size: 1.125rem;
  color: var(--color-text-secondary, #374151);
  margin: 0 0 1.5rem;
}

.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* ── Guest header ───────────────────────────────────────────────────── */

.guest-header {
  position: sticky;
  top: 0;
  z-index: var(--z-auth-nav, 2000);
  border-block-end: 1px solid var(--border-subtle, color-mix(in srgb, var(--gem-labradorite-flat, #2d3f6e) 10%, white));
  background: var(--glass-bg-strong, rgb(255 255 255 / 92%));
  backdrop-filter: blur(16px);
  overflow: visible;
}

.guest-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 5rem;
  padding-block: 0.5rem;

  /* 1.25rem matches site-header__inner inline padding — consistent edge rhythm
     across all nav surfaces. Mobile tightens to 1rem via breakpoint below. */
  padding-inline: 1.25rem;
  overflow: visible;
}

/* ── Brand / logo ──────────────────────────────────────────────────── */

.guest-header__brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  overflow: visible;
}

.guest-header__brand-shell {
  position: relative;
  display: inline-flex;
  align-items: center;

  /* clip prevents the universal-logo feDropShadow filter (stdDeviation=14,
     dy=10) from bleeding below the header into the page body */
  overflow: clip;
}

.guest-header__logo,
.guest-header__brand-shell .evident-logo {
  height: clamp(2.75rem, 4.5vw, 4.5rem);
  width: auto;

  /* Suppress the SVG's built-in drop shadow in the header — too large for
     this context. A subtle CSS replacement is applied below. */
  filter: drop-shadow(0 2px 6px rgb(6 16 28 / 20%));
}

/* Dark mode: show light logo, hide dark logo */
.guest-header__logo--light {
  display: block;
}

.guest-header__logo--dark {
  display: none;
}

[data-theme="dark"] .guest-header__logo--light,
[data-appearance="dark"] .guest-header__logo--light {
  display: none;
}

[data-theme="dark"] .guest-header__logo--dark,
[data-appearance="dark"] .guest-header__logo--dark {
  display: block;
}

/* ── Navigation links ───────────────────────────────────────────────── */

.guest-header__nav {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.guest-header__link {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full, 999px);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
}

@media (prefers-reduced-motion: no-preference) {
  .guest-header__link {
    transition:
      background 180ms ease,
      color 180ms ease,
      box-shadow 180ms ease;
  }
}

.guest-header__link--secondary {
  color: #102142;
  background: rgb(255 255 255 / 68%);
  box-shadow: inset 0 0 0 1px rgb(31 58 153 / 10%);
}

.guest-header__link--secondary:hover {
  background: color-mix(in srgb, var(--gem-labradorite-flat, #2d3f6e) 12%, white);
}

.guest-header__link--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary, #1f3a99), color-mix(in srgb, var(--color-primary, #1f3a99) 72%, black));
  box-shadow: 0 4px 14px rgb(31 58 153 / 22%);
}

.guest-header__link--primary:hover {
  box-shadow: 0 6px 20px rgb(31 58 153 / 30%);
}

/* ── Mobile menu toggle ─────────────────────────────────────────────── */

.guest-header__menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: var(--radius-md, 0.75rem);
  background: transparent;
  color: var(--color-text, #1a2040);
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  .guest-header__menu-toggle {
    transition: background 180ms ease;
  }
}

.guest-header__menu-toggle:hover {
  background: color-mix(in srgb, var(--gem-labradorite-flat, #2d3f6e) 6%, transparent);
}

@media (width >= 1024px) {
  .guest-header__menu-toggle {
    display: none;
  }
}

/* ── Mobile menu ────────────────────────────────────────────────────── */

.guest-header__mobile-menu {
  border-block-start: 1px solid var(--border-subtle, color-mix(in srgb, var(--gem-labradorite-flat, #2d3f6e) 10%, white));
  background: var(--glass-bg-strong, rgb(255 255 255 / 96%));
  backdrop-filter: blur(16px);
}

.guest-header__mobile-menu__content {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
}

.guest-header__mobile-menu__link {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md, 0.75rem);
  font-size: 0.9375rem;
  font-weight: 600;
  color: #102142;
  text-decoration: none;
}

@media (prefers-reduced-motion: no-preference) {
  .guest-header__mobile-menu__link {
    transition: background 180ms ease;
  }
}

.guest-header__mobile-menu__link:hover {
  background: color-mix(in srgb, var(--gem-labradorite-flat, #2d3f6e) 6%, transparent);
}

.guest-header__mobile-menu__link--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary, #1f3a99), color-mix(in srgb, var(--color-primary, #1f3a99) 72%, black));
  text-align: center;
  margin-block-start: 0.5rem;
}

.guest-header__mobile-menu__link--secondary {
  color: var(--color-primary, #1f3a99);
  text-align: center;
}

.guest-header__mobile-menu__divider {
  height: 1px;
  background: var(--border-subtle, color-mix(in srgb, var(--gem-labradorite-flat, #2d3f6e) 10%, white));
  margin: 0.5rem 0;
}

/* ── Desktop: hide mobile nav, show desktop nav ────────────────────── */

@media (width < 1024px) {
  .guest-header__inner {
    min-height: 4.5rem;
    padding-inline: 1rem;
  }

  .guest-header__logo {
    height: 4.55rem;
  }

  .guest-header__nav {
    display: none;
  }
}

@media (width >= 1024px) {
  .guest-header__nav {
    display: flex;
  }

  .guest-header__mobile-menu {
    display: none !important;
  }
}

/* Transitions are guarded by (prefers-reduced-motion: no-preference) above */

/* --------------------------------------------------------------------------
   Auth/login background de-duplication hotfix
   The public shell already provides the atmospheric background. Login/auth pages
   must not add a second full-height structural background that splits the page.
   -------------------------------------------------------------------------- */

body:has([data-auth-surface]),
body:has(.auth-shell),
body:has(.login-shell),
body:has(.guest-auth),
body:has(.login-page) {
  background:
    radial-gradient(circle at 18% 0%, rgba(106, 56, 96, 0.22), transparent 34rem),
    radial-gradient(circle at 88% 12%, rgba(50, 91, 147, 0.18), transparent 36rem),
    linear-gradient(180deg, #081323 0%, #07111f 52%, #06101d 100%) !important;
}

/* Kill duplicate full-page slabs inside the login/auth route. */
.auth-shell,
.login-shell,
.guest-auth,
.login-page,
.auth-page,
.auth-layout {
  background: transparent !important;
}

/* Inner panels may keep glass depth, but not page-sized duplicate backplates. */
.auth-shell::before,
.auth-shell::after,
.login-shell::before,
.login-shell::after,
.guest-auth::before,
.guest-auth::after,
.login-page::before,
.login-page::after,
.auth-page::before,
.auth-page::after,
.auth-layout::before,
.auth-layout::after {
  pointer-events: none;
}

/* Prevent split-column auth layouts from creating a second solid page wall. */
.auth-shell__visual,
.auth-shell__aside,
.auth-shell__panel,
.login-shell__visual,
.login-shell__aside,
.login-shell__panel,
.guest-auth__visual,
.guest-auth__aside,
.guest-auth__panel {
  background-color: transparent !important;
}

/* Keep cards intentional. Only the card itself should have glass/background. */
.auth-card,
.login-card,
.signin-card,
.guest-auth-card {
  background:
    linear-gradient(180deg, rgba(10, 24, 43, 0.92), rgba(6, 16, 30, 0.94)) !important;
  border: 1px solid rgba(125, 167, 216, 0.18);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.32);
}

/* Avoid awkward oversized right-side voids on auth pages. */
.auth-shell,
.login-shell,
.guest-auth,
.login-page,
.auth-page,
.auth-layout {
  min-height: calc(100svh - var(--site-header-height, 5.5rem));
  align-items: center;
}

/* Mobile/narrow windows: stack cleanly and remove decorative duplicate columns. */
@media (max-width: 900px) {
  .auth-shell,
  .login-shell,
  .guest-auth,
  .login-page,
  .auth-page,
  .auth-layout {
    display: grid;
    grid-template-columns: 1fr !important;
    padding-inline: clamp(1rem, 4vw, 1.5rem);
  }

  .auth-shell__visual,
  .login-shell__visual,
  .guest-auth__visual {
    display: none !important;
  }
}
