/* =============================================================================
   Login Page - Modern Redesign (v0.10.1)
   Purple-only accent, refined typography, consistent icons
   ============================================================================= */

/* Hide navbar on login page */
body:has(.login-page) .site-header {
    display: none;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 20px;

    /* Modern gradient background */
    background: var(--gradient-bg-login);
    position: relative;
    overflow: hidden;

    /* PWA safe areas */
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

/* Decorative gradient orbs - reduced intensity for less distraction */
.login-page::before,
.login-page::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4; /* Reduced from 0.5 by 20% */
    pointer-events: none;
    animation: floatOrb 25s ease-in-out infinite;
}

.login-page::before {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(109, 94, 246, 0.16) 0%, transparent 70%); /* Reduced from 0.2 */
    top: -100px;
    right: -100px;
}

.login-page::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 124, 247, 0.12) 0%, transparent 70%); /* Reduced from 0.15 */
    bottom: -150px;
    left: -150px;
    animation-delay: -12s;
}

@keyframes floatOrb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* Tighter layout for laptop screens */
@media (min-height: 700px) and (max-height: 900px) {
    .login-page {
        padding: 16px 20px;
    }
}

.login-container {
    width: 100%;
    max-width: 540px;
    text-align: center;
    position: relative;
    z-index: 1;
    padding-top: 48px;

    /* Entrance animation */
    animation: loginFadeIn 0.6s ease-out;
}

@media (min-height: 800px) {
    .login-container {
        padding-top: 72px;
    }
}

@keyframes loginFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-container {
        animation: none;
    }
    .login-page::before,
    .login-page::after {
        animation: none;
    }
}

/* =============================================================================
   Hero Section
   ============================================================================= */

.login-hero {
    margin-bottom: 24px;
}

/* =============================================================================
   Hero Illustration: Task → Calendar Transfer Animation
   Single 6s loop: idle → travel → snap → idle → reset
   Timeline:
     0.0–1.0s: idle
     1.0–2.6s: chip travels + arrow pulse
     2.6–3.2s: chip snaps + focus ring + checkbox tick
     3.2–5.5s: idle (block visible)
     5.5–6.0s: reset
   ============================================================================= */

.login-hero-illustration {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 32px;
    padding: 28px 32px;
    position: relative;

    /* Subtle card - not competing with CTA */
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.025);
}

@media (min-width: 600px) {
    .login-hero-illustration {
        gap: 24px;
        padding: 32px 40px;
    }
}

/* -----------------------------------------------------------------------------
   Ghost Chip - The traveling task element
   ----------------------------------------------------------------------------- */

.login-hero-ghost-chip {
    position: absolute;
    width: 56px;
    height: 20px;
    background: var(--bg-surface);
    border: 1px solid rgba(22, 123, 255, 0.4);
    border-left: 3px solid rgba(22, 123, 255, 0.8); /* Match executable rail */
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(22, 123, 255, 0.2);
    opacity: 0;
    z-index: 10;
    pointer-events: none;

    /* Position at task-3 (bottom task, executable) */
    left: calc(50% - 118px);
    top: calc(50% + 14px);

    animation: ghostChipTravel 6s ease-out infinite;
}

@media (min-width: 600px) {
    .login-hero-ghost-chip {
        left: calc(50% - 130px);
    }
}

/* Ghost chip travel: appear → travel → snap → hold → fade */
@keyframes ghostChipTravel {
    /* 0-16.67%: idle, chip hidden */
    0%, 16.67% {
        opacity: 0;
        transform: translate(0, 0) scale(1);
    }
    /* 18%: chip appears */
    18% {
        opacity: 0.9;
        transform: translate(0, 0) scale(1);
    }
    /* 43.33%: arrive near calendar (ease-out travel) */
    43.33% {
        opacity: 0.9;
        transform: translate(148px, -14px) scale(0.75);
    }
    /* 46%: snap into slot (quick ease-in) */
    46% {
        opacity: 0;
        transform: translate(148px, -14px) scale(0.5);
    }
    /* Hold invisible until reset */
    91.67%, 100% {
        opacity: 0;
        transform: translate(0, 0) scale(1);
    }
}

@media (min-width: 600px) {
    @keyframes ghostChipTravel {
        0%, 16.67% {
            opacity: 0;
            transform: translate(0, 0) scale(1);
        }
        18% {
            opacity: 0.9;
            transform: translate(0, 0) scale(1);
        }
        43.33% {
            opacity: 0.9;
            transform: translate(164px, -14px) scale(0.75);
        }
        46% {
            opacity: 0;
            transform: translate(164px, -14px) scale(0.5);
        }
        91.67%, 100% {
            opacity: 0;
            transform: translate(0, 0) scale(1);
        }
    }
}

/* -----------------------------------------------------------------------------
   Task Stack - Static with one ticking checkbox
   ----------------------------------------------------------------------------- */

.login-hero-tasks {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-hero-task {
    width: 60px;
    height: 22px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 5px;
    display: flex;
    align-items: center;
    padding-left: 0;
    overflow: hidden;
    position: relative;
}

/* Clarity rail indicator (left edge) */
.login-hero-task-rail {
    width: 3px;
    height: 100%;
    flex-shrink: 0;
    background: var(--border-default);
}

/* Mode colors - matching app design system */
.login-hero-task.clarity-brainstorm .login-hero-task-rail {
    background: rgba(160, 32, 192, 0.7); /* Magenta - deep thinking */
}

.login-hero-task.clarity-normal .login-hero-task-rail {
    background: rgba(109, 94, 246, 0.7); /* Purple - routine */
}

.login-hero-task.clarity-autopilot .login-hero-task-rail {
    background: rgba(22, 123, 255, 0.8); /* Blue - mindless */
}

.login-hero-task .login-hero-checkbox {
    margin-left: 5px;
}

.login-hero-task-2 { width: 52px; }
.login-hero-task-3 { width: 56px; }

/* Checkbox circle */
.login-hero-checkbox {
    width: 10px;
    height: 10px;
    border: 1.5px solid rgba(15, 23, 42, 0.25);
    border-radius: 50%;
    position: relative;
}

/* Active checkbox - the one that ticks during animation */
.login-hero-checkbox-active {
    animation: checkboxTick 6s ease-out infinite;
}

.login-hero-checkbox-active::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 7px;
    font-weight: 700;
    color: var(--primary);
    opacity: 0;
    animation: checkmarkAppear 6s ease-out infinite;
}

/* Checkbox border color change */
@keyframes checkboxTick {
    0%, 43.33% {
        border-color: rgba(15, 23, 42, 0.25);
        background: transparent;
    }
    46% {
        border-color: var(--primary);
        background: rgba(109, 94, 246, 0.08);
    }
    91.67% {
        border-color: var(--primary);
        background: rgba(109, 94, 246, 0.08);
    }
    95% {
        border-color: rgba(15, 23, 42, 0.25);
        background: transparent;
    }
    100% {
        border-color: rgba(15, 23, 42, 0.25);
        background: transparent;
    }
}

/* Checkmark bounce in */
@keyframes checkmarkAppear {
    0%, 43.33% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    46% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.3);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    91.67% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    95% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
}

/* -----------------------------------------------------------------------------
   Arrow - Intent pulse only during chip travel
   ----------------------------------------------------------------------------- */

.login-hero-arrow {
    color: var(--primary);
    opacity: 0.5;
    animation: arrowIntent 6s ease-out infinite;
}

.login-hero-arrow svg {
    animation: arrowStroke 6s ease-out infinite;
}

/* Arrow opacity lift during travel */
@keyframes arrowIntent {
    0%, 16.67% {
        opacity: 0.5;
        transform: translateX(0);
    }
    25% {
        opacity: 1;
        transform: translateX(3px);
    }
    43.33% {
        opacity: 0.8;
        transform: translateX(0);
    }
    46%, 100% {
        opacity: 0.5;
        transform: translateX(0);
    }
}

/* Arrow stroke weight pulse */
@keyframes arrowStroke {
    0%, 16.67% {
        stroke-width: 2;
    }
    25% {
        stroke-width: 2.3;
    }
    43.33%, 100% {
        stroke-width: 2;
    }
}

/* -----------------------------------------------------------------------------
   Calendar - With destination cell and focus ring
   ----------------------------------------------------------------------------- */

.login-hero-calendar {
    width: 72px;
    background: var(--bg-surface);
    border: 2px solid var(--primary);
    border-radius: 8px;
    overflow: visible; /* Allow focus ring to overflow */
    box-shadow: var(--shadow-glow-sm);
    position: relative;
}

.login-hero-calendar-header {
    height: 16px;
    background: var(--gradient-primary);
}

.login-hero-calendar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 6px;
}

.login-hero-calendar-grid span {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: var(--bg-panel);
}

/* Pre-filled cells (static, show existing calendar items) */
.login-hero-calendar-grid span.prefilled {
    background: rgba(109, 94, 246, 0.15);
}

/* Destination cell - where the chip lands */
.login-hero-calendar-grid span.destination {
    animation: destinationFill 6s ease-out infinite;
}

@keyframes destinationFill {
    0%, 43.33% {
        background: var(--bg-panel);
        transform: scale(1);
    }
    46% {
        background: var(--primary);
        transform: scale(1.15);
    }
    50% {
        background: var(--primary);
        transform: scale(1);
    }
    91.67% {
        background: var(--primary);
        transform: scale(1);
    }
    95% {
        background: var(--bg-panel);
        transform: scale(1);
    }
    100% {
        background: var(--bg-panel);
        transform: scale(1);
    }
}

/* Focus ring - expands and fades when chip lands */
.login-hero-focus-ring {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 2px solid var(--primary);
    opacity: 0;
    pointer-events: none;

    /* Position over destination cell (row 2, col 1) */
    top: calc(16px + 6px + 14px + 3px); /* header + padding + first row + gap */
    left: 6px;

    animation: focusRingExpand 6s ease-out infinite;
}

@keyframes focusRingExpand {
    0%, 43.33% {
        opacity: 0;
        transform: scale(0.9);
    }
    46% {
        opacity: 0.8;
        transform: scale(1);
    }
    53.33% {
        opacity: 0;
        transform: scale(1.5);
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Brand */
.login-hero-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Legacy logo (deprecated) */
.login-logo {
    height: 56px;
    width: auto;
    object-fit: contain;
}

/* New wordmark in login hero */
.login-hero-brand .wm.lg svg {
    width: 36px;
    height: 32px;
    margin-bottom: 4px;
    margin-right: 2px;
}

.login-hero-brand .wm.lg > span:first-of-type {
    font-size: 2.5rem;
}

@media (min-width: 600px) {
    .login-logo {
        height: 64px;
    }

    .login-hero-brand .wm.lg svg {
        width: 42px;
        height: 37px;
        margin-bottom: 5.5px;
    }

    .login-hero-brand .wm.lg > span:first-of-type {
        font-size: 3rem;
    }
}

/* =============================================================================
   Value Proposition Card
   ============================================================================= */

.login-value-card {
    /* Plain text block - no card styling */
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 32px;
    text-align: center;
    box-shadow: none;
}

.login-value-line {
    font-size: 1rem;
    color: var(--text-muted);
    margin: 0 0 6px 0;
    line-height: 1.65; /* Increased for better readability */
}

.login-value-line:last-child {
    margin-bottom: 0;
}

.login-value-punchline {
    color: var(--text-primary);
    font-weight: 500;
    margin-top: 8px;
    white-space: nowrap;
}

.login-value-punchline em {
    color: var(--primary);
    font-style: normal;
    font-weight: 600;
}

/* =============================================================================
   Sign In Button
   ============================================================================= */

.login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;

    width: 100%;
    height: 56px;

    /* Gradient background */
    background: var(--gradient-primary);
    border: none;
    border-radius: 14px;

    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;

    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s ease;

    /* CTA shadow tier */
    box-shadow: var(--shadow-cta);

    /* For shine animation */
    position: relative;
    overflow: hidden;
}

/* Shine animation on hover */
.login-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.25) 50%,
        transparent 100%
    );
    pointer-events: none;
}

.login-button:hover {
    background: var(--gradient-primary-hover);
    box-shadow: var(--shadow-cta-hover);
}

.login-button:hover::before {
    animation: shine 0.6s ease-out;
}

.login-button:active {
    box-shadow: 0 2px 8px rgba(109, 94, 246, 0.18);
}

/* Google icon in white circle */
.login-button-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #fff;
    border-radius: 50%;
    flex-shrink: 0;
}

.login-button-icon {
    display: block;
}

@media (min-width: 600px) {
    .login-button {
        height: 56px;
        width: auto;
        min-width: 320px;
        font-size: 1rem;
    }

    .login-button:active {
        transform: translateY(0);
    }
}

/* =============================================================================
   Demo Login Section
   ============================================================================= */

.login-demo-section {
    margin-top: 20px;
    width: 100%;
}

.login-demo-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.login-demo-divider::before,
.login-demo-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-default);
}

.login-demo-divider span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Override Pico's aggressive <a> styling with higher specificity */
a.login-demo-button,
a.login-demo-button:link,
a.login-demo-button:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    width: 100%;
    height: 50px;

    background: var(--glass-bg-strong);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid var(--border-default);
    border-radius: 14px;

    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;

    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

a.login-demo-button:hover,
a.login-demo-button:focus-visible {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(109, 94, 246, 0.06);
    box-shadow: 0 0 0 3px rgba(109, 94, 246, 0.08);
    text-decoration: none;
}

a.login-demo-button:active {
    background: rgba(109, 94, 246, 0.1);
    box-shadow: none;
    text-decoration: none;
}

a.login-demo-button .demo-icon {
    font-size: 1.05rem;
    line-height: 1;
}

@media (min-width: 600px) {
    a.login-demo-button,
    a.login-demo-button:link,
    a.login-demo-button:visited {
        width: auto;
        min-width: 320px;
    }
}

/* =============================================================================
   Meta Block (Trust + Features)
   ============================================================================= */

.login-meta {
    margin-top: 16px;
    text-align: center;
}

.login-meta-trust {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.login-meta-features {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

/* =============================================================================
   Footer / Terms
   ============================================================================= */

.login-footer {
    margin-top: 24px;
    text-align: center;
}

.login-footer a {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
    /* Increased tap target for mobile */
    display: inline-block;
    padding: 8px 12px;
    margin: -8px -12px;
}

.login-footer a:hover {
    color: var(--text-muted);
}

/* =============================================================================
   Desktop Styles
   ============================================================================= */


/* =============================================================================
   Reduced Motion
   Show final state without movement: checkbox checked + calendar cell filled
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    /* Disable CTA shine animation */
    .login-button:hover::before {
        animation: none;
    }

    /* Disable all hero animations */
    .login-hero-ghost-chip,
    .login-hero-arrow,
    .login-hero-arrow svg,
    .login-hero-checkbox-active,
    .login-hero-checkbox-active::after,
    .login-hero-calendar-grid span.destination,
    .login-hero-focus-ring {
        animation: none;
    }

    /* Hide ghost chip entirely */
    .login-hero-ghost-chip {
        display: none;
    }

    /* Show arrow at steady state */
    .login-hero-arrow {
        opacity: 0.6;
    }

    /* Show checkbox as checked */
    .login-hero-checkbox-active {
        border-color: var(--primary);
        background: rgba(109, 94, 246, 0.08);
    }

    .login-hero-checkbox-active::after {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    /* Show destination cell as filled */
    .login-hero-calendar-grid span.destination {
        background: var(--primary);
    }

    /* Hide focus ring */
    .login-hero-focus-ring {
        display: none;
    }

    /* Disable background orb animations */
    .login-page::before,
    .login-page::after {
        animation: none;
    }

    /* Disable entrance animation */
    .login-container {
        animation: none;
    }
}
