/* Public pages — landing, auth, legal. Inherits design tokens from style.css */

.public-body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    /* Override the authenticated-app's body rules in style.css which lock the
       page to viewport height and hide overflow for its grid layout. */
    height: auto;
    overflow: visible;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    grid-template-rows: none;
    grid-template-columns: none;
    grid-template-areas: none;
}

/* Header */
.public-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(12px);
    z-index: 10;
}
/* Desktop (Electron) window: macOS hidden-inset title bar leaves traffic
   lights floating at top-left. Clear them, and make the whole header a
   drag region so users can move the window. Interactive elements opt out. */
.is-desktop .public-header {
    padding-left: 96px;
    -webkit-app-region: drag;
    app-region: drag;
}
.is-desktop .public-header a,
.is-desktop .public-header button,
.is-desktop .public-header input,
.is-desktop .public-header select {
    -webkit-app-region: no-drag;
    app-region: no-drag;
}
/* Same treatment for the logged-in app's topbar (index.html). */
.is-desktop .topbar {
    padding-left: 96px;
    -webkit-app-region: drag;
    app-region: drag;
}
.is-desktop .topbar a,
.is-desktop .topbar button,
.is-desktop .topbar input,
.is-desktop .topbar select,
.is-desktop .topbar textarea {
    -webkit-app-region: no-drag;
    app-region: no-drag;
}
.public-brand {
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
}
.brand-logo {
    height: 40px;
    width: auto;
    display: block;
}
.public-footer-brand .brand-logo { height: 32px; }
.public-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.public-nav .nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 200ms ease, background 200ms ease, border-color 200ms ease;
}
.public-nav .nav-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}
.public-nav .nav-cta {
    position: relative;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 9px 18px;
    border-radius: 10px;
    background: linear-gradient(135deg, #a78bfa 0%, #6366f1 60%, #4f46e5 100%);
    border: 1px solid rgba(167, 139, 250, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 6px 20px -4px rgba(99, 102, 241, 0.5);
    transition: transform 200ms ease, box-shadow 200ms ease;
}
.public-nav .nav-cta::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,0.28) 50%, transparent 65%);
    transform: translateX(-100%);
    transition: transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}
.public-nav .nav-cta:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 10px 26px -4px rgba(99, 102, 241, 0.65);
}
.public-nav .nav-cta:hover::before { transform: translateX(100%); }

/* Main */
.public-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Footer */
.public-footer {
    position: relative;
    margin-top: 120px;
    padding: 64px 32px 0;
    border-top: 1px solid var(--border);
    background:
        radial-gradient(ellipse 800px 320px at 50% 0%, rgba(139, 92, 246, 0.08), transparent 70%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 40%);
}
.public-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(140px, 1fr));
    gap: 48px 40px;
    padding-bottom: 56px;
}
@media (max-width: 800px) {
    .public-footer-inner {
        grid-template-columns: 1fr 1fr;
        gap: 36px 24px;
    }
}
@media (max-width: 520px) {
    .public-footer-inner { grid-template-columns: 1fr; }
}

/* Public header fits the brand + nav on a phone screen. Buttons keep their
   text on a single line (nowrap + flex-shrink:0 globally); at each
   breakpoint we drop the least-essential element to make room. */
@media (max-width: 640px) {
    .public-header { padding: 12px 14px; gap: 6px; }
    .public-nav { gap: 6px; flex-wrap: nowrap; }
    .public-nav .nav-link { padding: 7px 10px; font-size: 13px; }
    .public-nav .nav-cta { padding: 7px 12px; font-size: 13px; }
    .public-theme-toggle { width: 32px; height: 32px; flex-shrink: 0; }
    .brand-logo { height: 26px; }
}
@media (max-width: 480px) {
    /* Drop the Download link on phones — it's in the footer and at /download.
       Log in also hides here; users can log in from the Get-started flow or
       the /login URL directly. This gives Get-started real breathing room. */
    .public-nav .nav-link { display: none; }
    .brand-logo { height: 24px; }
    .public-footer { padding: 48px 20px 0; margin-top: 80px; }
}
@media (max-width: 360px) {
    /* Tiniest phones: hide the theme toggle too, leaving only the logo and
       Get-started CTA. Users can still toggle theme via the footer. */
    .public-theme-toggle { display: none; }
    .public-header { padding: 10px 12px; }
}
.footer-brand-col {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.footer-brand-col .brand-logo { height: 34px; width: auto; }
.footer-tagline {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-secondary);
    max-width: 280px;
    margin: 0;
}
.footer-socials {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}
.footer-socials a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.footer-socials a:hover {
    color: var(--text);
    background: rgba(167, 139, 250, 0.12);
    border-color: rgba(167, 139, 250, 0.4);
    transform: translateY(-1px);
}
.footer-col h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text);
    margin: 0 0 16px;
}
.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.footer-col ul a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color var(--fast) var(--ease);
}
.footer-col ul a:hover { color: var(--text); }

.public-footer-bottom {
    border-top: 1px solid var(--border);
}
.public-footer-bottom-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 22px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
}
.footer-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}
.footer-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
    animation: footer-pulse 2.4s ease-in-out infinite;
}
@keyframes footer-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15); }
    50%      { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.05); }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
    text-decoration: none;
    line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 16px 28px; font-size: 15px; }
.btn-primary {
    background: var(--grad);
    color: #fff;
    box-shadow: var(--shadow-glow);
}
.btn-primary:hover:not(:disabled) { background: var(--grad-hover); transform: translateY(-1px); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-hover); background: var(--surface-1); }

/* Auth card (login/signup/profile) */
.auth-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.auth-card h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 10px;
    letter-spacing: -0.01em;
}
.auth-card .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 28px;
    line-height: 1.5;
}
/* Form fields keep their input text left-aligned even though the card is
   centered — typed emails/OTPs look wrong when centered. */
.auth-card .form-input { text-align: left; }
.auth-card .form-input.otp-input { text-align: center; letter-spacing: 0.5em; }
.auth-card .form-field { margin-bottom: 16px; text-align: left; }
.auth-card .form-checkbox { text-align: left; }
.auth-card .auth-meta { margin-top: 24px; }
.auth-card .form-help { margin-top: 6px; margin-bottom: 0; text-align: left; }
.auth-step { display: none; }
.auth-step.active { display: block; }

/* Form */
.form-field { margin-bottom: 20px; }
.form-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.form-input {
    width: 100%;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
    box-sizing: border-box;
}
.form-input:focus {
    outline: none;
    border-color: var(--border-accent);
    background: var(--surface-2);
}
.form-input.otp-input {
    font-family: var(--font-mono);
    font-size: 22px;
    letter-spacing: 10px;
    text-align: center;
    padding: 16px;
}
.form-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}
.form-checkbox {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 16px 0;
}
.form-checkbox input {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--accent);
}
.form-checkbox a {
    color: var(--accent);
    text-decoration: none;
}
.form-checkbox a:hover { text-decoration: underline; }

.btn-full { width: 100%; padding: 14px; }
.form-error {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--error);
    font-size: 13px;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    display: none;
}
.form-error.active { display: block; }

.auth-meta {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}
.auth-meta a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.auth-meta a:hover { text-decoration: underline; }

.auth-link-btn {
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}
.auth-link-btn:hover { text-decoration: underline; }

/* Landing hero */
.hero {
    max-width: 1100px;
    margin: 0 auto;
    padding: 80px 24px 40px;
    text-align: center;
}
.hero h1 {
    font-size: clamp(40px, 6vw, 64px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin: 0 0 24px;
    color: var(--text);
}
.hero p.lead {
    font-size: clamp(16px, 2vw, 20px);
    color: var(--text-secondary);
    max-width: 720px;
    margin: 0 auto 40px;
    line-height: 1.55;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-pills {
    display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
    margin: 32px auto 0; max-width: 680px;
}
.hero-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px;
    background: var(--accent-dim); color: var(--text-secondary);
    font-size: 12px; font-weight: 500;
    border: 1px solid var(--border);
}

.audiences {
    max-width: 1100px; margin: 80px auto 0; padding: 0 24px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}
@media (max-width: 720px) { .audiences { grid-template-columns: 1fr; } }
.audience-card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
}
.audience-card h3 {
    font-size: 20px; font-weight: 700; margin: 0 0 12px;
}
.audience-card p {
    color: var(--text-secondary); font-size: 14px; line-height: 1.6; margin: 0 0 16px;
}
.audience-card ul {
    color: var(--text-secondary); font-size: 14px; padding-left: 18px;
    margin: 0; line-height: 1.8;
}

/* Legal pages */
.legal-wrapper {
    max-width: 760px;
    margin: 60px auto;
    padding: 0 24px;
}
.legal-wrapper h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
}
.legal-wrapper .legal-updated {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 40px;
}
.legal-wrapper h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 40px 0 16px;
    color: var(--text);
}
.legal-wrapper p, .legal-wrapper li {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}
.legal-wrapper ul { padding-left: 20px; }
.legal-wrapper a { color: var(--accent); }

/* ============================================
   THEME TOGGLE (public pages)
   ============================================ */
.public-theme-toggle {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}
.public-theme-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}
[data-theme="light"] .public-theme-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}
.public-theme-toggle .theme-sun { display: none; }
.public-theme-toggle .theme-moon { display: inline; }
[data-theme="light"] .public-theme-toggle .theme-sun { display: inline; }
[data-theme="light"] .public-theme-toggle .theme-moon { display: none; }

/* ============================================
   LIGHT MODE — public pages (header/footer/auth/legal)
   ============================================ */
[data-theme="light"] .public-header {
  background: rgba(255, 255, 255, 0.75);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .public-footer {
  border-top-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .public-nav .nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .auth-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .form-input {
  background: #fafafc;
  border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .form-input:focus {
  background: #ffffff;
  border-color: var(--accent);
}
[data-theme="light"] .btn-ghost {
  color: var(--text);
  border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .btn-ghost:hover {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.15);
}
