/* ==========================================================================
   Storydeck — to help you remember
   Design System & Global Styles
   ========================================================================== */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
    /* Primary: Deep Teal */
    --storydeck-teal-900: #01372B;
    --storydeck-teal-800: #00453A;
    --storydeck-teal-700: #00594C;
    --storydeck-teal-600: #007A68;
    --storydeck-teal-500: #009B84;
    --storydeck-teal-400: #2BB89E;
    --storydeck-teal-100: #D0F0E8;
    --storydeck-teal-50: #EFFBF7;

    /* Secondary: Warm Cream */
    --storydeck-cream-100: #FDF5EB;
    --storydeck-cream-200: #F9EDD9;
    --storydeck-cream-300: #F3E0C0;
    --storydeck-cream-50: #FFFCF7;

    /* Accent: Warm Orange */
    --storydeck-orange-500: #FA6432;
    --storydeck-orange-600: #E8531F;
    --storydeck-orange-400: #FF8A5C;
    --storydeck-orange-100: #FFF0EB;

    /* Accent 2: Soft Lavender */
    --storydeck-lavender-500: #8194FC;
    --storydeck-lavender-400: #A0AFFD;
    --storydeck-lavender-100: #EEF0FF;

    /* Neutrals */
    --storydeck-gray-900: #1F2937;
    --storydeck-gray-800: #374151;
    --storydeck-gray-700: #4B5563;
    --storydeck-gray-600: #6B7280;
    --storydeck-gray-500: #9CA3AF;
    --storydeck-gray-400: #D1D5DB;
    --storydeck-gray-300: #E5E7EB;
    --storydeck-gray-200: #F3F4F6;
    --storydeck-gray-100: #F9FAFB;
    --storydeck-white: #FFFFFF;

    /* Semantic Colors */
    --color-primary: var(--storydeck-teal-700);
    --color-primary-dark: var(--storydeck-teal-900);
    --color-primary-light: var(--storydeck-teal-100);
    --color-accent: var(--storydeck-orange-500);
    --color-accent-hover: var(--storydeck-orange-600);
    --color-bg: var(--storydeck-cream-50);
    --color-bg-warm: var(--storydeck-cream-100);
    --color-surface: var(--storydeck-white);
    --color-text: var(--storydeck-gray-900);
    --color-text-secondary: var(--storydeck-gray-600);
    --color-text-on-dark: var(--storydeck-cream-50);
    --color-border: var(--storydeck-gray-300);
    --color-border-light: var(--storydeck-gray-200);

    /* Typography */
    --font-display: 'Libre Baskerville', 'Georgia', 'Times New Roman', serif;
    --font-body: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Font Sizes (fluid, accessible) */
    --text-xs: 0.8125rem;
    --text-sm: 0.9375rem;
    --text-base: 1.0625rem;
    --text-lg: 1.1875rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;
    --text-4xl: 3rem;
    --text-5xl: 3.75rem;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(1, 55, 43, 0.06), 0 1px 2px rgba(1, 55, 43, 0.04);
    --shadow-md: 0 4px 12px rgba(1, 55, 43, 0.08), 0 2px 4px rgba(1, 55, 43, 0.04);
    --shadow-lg: 0 12px 32px rgba(1, 55, 43, 0.10), 0 4px 8px rgba(1, 55, 43, 0.05);
    --shadow-xl: 0 20px 48px rgba(1, 55, 43, 0.12), 0 8px 16px rgba(1, 55, 43, 0.06);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Typography Imports --- */
@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');


/* ==========================================================================
   Base / Reset
   ========================================================================== */

html {
    font-size: 16px;
    position: relative;
    min-height: 100%;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        font-size: 17px;
    }
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
    margin-bottom: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Accessible focus states */
:focus-visible {
    outline: 3px solid var(--storydeck-teal-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.btn:focus-visible, .form-control:focus-visible, .form-check-input:focus-visible,
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.15rem var(--storydeck-teal-100), 0 0 0 0.3rem var(--storydeck-teal-500);
}


/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--storydeck-teal-900);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

h1, .h1 { font-size: var(--text-4xl); margin-bottom: var(--space-lg); }
h2, .h2 { font-size: var(--text-3xl); margin-bottom: var(--space-lg); }
h3, .h3 { font-size: var(--text-2xl); margin-bottom: var(--space-md); }
h4, .h4 { font-size: var(--text-xl); margin-bottom: var(--space-md); }
h5, .h5 { font-size: var(--text-lg); margin-bottom: var(--space-sm); }

@media (max-width: 767px) {
    h1, .h1 { font-size: var(--text-3xl); }
    h2, .h2 { font-size: var(--text-2xl); }
    h3, .h3 { font-size: var(--text-xl); }
}

p {
    margin-bottom: var(--space-md);
    color: var(--storydeck-gray-700);
}

.lead {
    font-size: var(--text-xl);
    font-weight: 300;
    line-height: 1.6;
    color: var(--storydeck-gray-600);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--storydeck-teal-800);
    text-decoration: underline;
}

.text-muted {
    color: var(--storydeck-gray-500) !important;
}

.font-display {
    font-family: var(--font-display);
}


/* ==========================================================================
   Navigation / Navbar
   ========================================================================== */

.navbar-storydeck {
    background: var(--storydeck-white);
    border-bottom: 1px solid var(--storydeck-gray-200);
    padding: var(--space-sm) 0;
    transition: box-shadow var(--transition-base);
}

.navbar-storydeck.scrolled {
    box-shadow: var(--shadow-md);
}

.navbar-storydeck .navbar-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-2xl);
    color: var(--storydeck-teal-900);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
}

.navbar-storydeck .navbar-brand:hover {
    color: var(--storydeck-teal-700);
    text-decoration: none;
}

.navbar-storydeck .brand-tagline {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: var(--text-sm);
    color: var(--storydeck-gray-500);
    font-style: italic;
    display: none;
}

@media (min-width: 768px) {
    .navbar-storydeck .brand-tagline {
        display: inline;
    }
}

.navbar-storydeck .nav-link {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--storydeck-gray-700) !important;
    padding: var(--space-sm) var(--space-md) !important;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    letter-spacing: 0.01em;
}

.navbar-storydeck .nav-link:hover,
.navbar-storydeck .nav-link:focus {
    color: var(--storydeck-teal-700) !important;
    background: var(--storydeck-teal-50);
}

.navbar-storydeck .nav-link.active {
    color: var(--storydeck-teal-800) !important;
    background: var(--storydeck-teal-50);
    font-weight: 600;
}

.navbar-storydeck .dropdown-menu {
    border: 1px solid var(--storydeck-gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-sm);
    margin-top: var(--space-xs);
}

.navbar-storydeck .dropdown-item {
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--storydeck-gray-700);
    transition: all var(--transition-fast);
}

.navbar-storydeck .dropdown-item:hover {
    background: var(--storydeck-teal-50);
    color: var(--storydeck-teal-800);
}

.navbar-storydeck .user-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    border: 2px solid var(--storydeck-teal-100);
}

/* Floating chat bar — persistent bottom input for AI chat */
.floating-chat-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: var(--storydeck-white);
    border-top: 1px solid var(--color-border-light);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    padding: var(--space-md) 0;
}

.floating-chat-form {
    max-width: 800px;
    margin: 0 auto;
}

.floating-chat-input {
    border: 2px solid var(--storydeck-gray-300) !important;
    border-right: none !important;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
    padding: var(--space-sm) var(--space-lg) !important;
    font-size: var(--text-base) !important;
    transition: border-color var(--transition-fast);
}

.floating-chat-input:focus {
    border-color: var(--storydeck-teal-500) !important;
    box-shadow: none !important;
}

.floating-chat-input::placeholder {
    color: var(--storydeck-gray-500);
    font-style: italic;
}

.floating-chat-btn {
    background: var(--storydeck-teal-700) !important;
    color: white !important;
    border: 2px solid var(--storydeck-teal-700) !important;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
    padding: var(--space-sm) var(--space-xl) !important;
    font-weight: 600;
    font-size: var(--text-base) !important;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.floating-chat-btn:hover {
    background: var(--storydeck-teal-800) !important;
    border-color: var(--storydeck-teal-800) !important;
    transform: translateY(-1px);
}

/* Hide floating bar on the Chat page (it has its own input) and during onboarding */
.page-chat .floating-chat-bar,
.page-onboarding .floating-chat-bar {
    display: none;
}

/* Bottom padding so page content isn't hidden behind the bar */
body:has(.floating-chat-bar) .footer-storydeck {
    margin-bottom: 70px;
}

@media (max-width: 767.98px) {
    .floating-chat-input {
        font-size: var(--text-sm) !important;
    }
    .floating-chat-btn {
        padding: var(--space-sm) var(--space-lg) !important;
    }
}


/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--text-sm);
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    letter-spacing: 0.01em;
    border: 2px solid transparent;
}

/* Primary Button — Teal */
.btn-primary {
    background: var(--storydeck-teal-700);
    border-color: var(--storydeck-teal-700);
    color: var(--storydeck-white);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--storydeck-teal-800);
    border-color: var(--storydeck-teal-800);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    background: var(--storydeck-teal-900);
    transform: translateY(0);
}

/* CTA Button — Orange accent */
.btn-cta {
    background: var(--storydeck-orange-500);
    border-color: var(--storydeck-orange-500);
    color: var(--storydeck-white);
    font-size: var(--text-base);
    padding: 0.875rem 2rem;
    border-radius: var(--radius-lg);
}

.btn-cta:hover, .btn-cta:focus {
    background: var(--storydeck-orange-600);
    border-color: var(--storydeck-orange-600);
    color: var(--storydeck-white);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(250, 100, 50, 0.3);
}

.btn-cta:active {
    transform: translateY(0);
}

/* Outline Primary */
.btn-outline-primary {
    color: var(--storydeck-teal-700);
    border-color: var(--storydeck-teal-700);
    background: transparent;
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    background: var(--storydeck-teal-700);
    border-color: var(--storydeck-teal-700);
    color: var(--storydeck-white);
    transform: translateY(-1px);
}

/* Soft button (light background) */
.btn-soft {
    background: var(--storydeck-teal-50);
    border-color: var(--storydeck-teal-100);
    color: var(--storydeck-teal-700);
}

.btn-soft:hover {
    background: var(--storydeck-teal-100);
    color: var(--storydeck-teal-800);
    border-color: var(--storydeck-teal-400);
}

/* Large button variant */
.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
}

/* Flashcard button (preserved) */
.btn-flip {
    background: linear-gradient(135deg, var(--storydeck-teal-600), var(--storydeck-teal-800));
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.btn-flip:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 89, 76, 0.3);
    color: white;
}


/* ==========================================================================
   Cards & Surfaces
   ========================================================================== */

.card {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--color-surface);
    transition: all var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: var(--space-lg);
}

.card-title {
    font-family: var(--font-display);
    color: var(--storydeck-teal-900);
    margin-bottom: var(--space-sm);
}

/* Warm surface card */
.card-warm {
    background: var(--storydeck-cream-50);
    border-color: var(--storydeck-cream-200);
}

/* Interactive card — lifts on hover */
.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--storydeck-teal-400);
}

/* Icon cards for features */
.card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
    flex-shrink: 0;
}

.card-icon-teal {
    background: var(--storydeck-teal-50);
    color: var(--storydeck-teal-700);
}

.card-icon-orange {
    background: var(--storydeck-orange-100);
    color: var(--storydeck-orange-500);
}

.card-icon-lavender {
    background: var(--storydeck-lavender-100);
    color: var(--storydeck-lavender-500);
}

.card-icon-cream {
    background: var(--storydeck-cream-200);
    color: var(--storydeck-teal-700);
}

/* Flashcard styles (preserved + updated) */
.flashcard {
    transition: all var(--transition-base);
    border: 2px solid var(--storydeck-gray-300);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
}

.flashcard:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--storydeck-teal-500);
}

.flashcard .card-body {
    background: linear-gradient(135deg, var(--storydeck-cream-50) 0%, var(--storydeck-white) 100%);
}

.flashcard.flipped .card-body {
    background: linear-gradient(135deg, var(--storydeck-teal-50) 0%, #f0faf6 100%);
}

.deck-card {
    transition: transform var(--transition-fast);
}

.deck-card:hover {
    transform: translateY(-3px);
}

@keyframes flipIn {
    from {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
}

.flip-animation {
    animation: flipIn 0.6s ease;
}


/* ==========================================================================
   Forms
   ========================================================================== */

.form-control, .form-select {
    font-family: var(--font-body);
    font-size: var(--text-base);
    border: 2px solid var(--storydeck-gray-300);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    transition: all var(--transition-fast);
    color: var(--color-text);
    background: var(--storydeck-white);
}

.form-control:focus, .form-select:focus {
    border-color: var(--storydeck-teal-500);
    box-shadow: 0 0 0 3px rgba(0, 89, 76, 0.1);
}

.form-control::placeholder {
    color: var(--storydeck-gray-500);
}

.form-label {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--storydeck-gray-700);
    margin-bottom: var(--space-xs);
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

textarea.form-control {
    min-height: 120px;
    line-height: 1.7;
}


/* ==========================================================================
   Badges & Labels
   ========================================================================== */

.badge {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--text-xs);
    padding: 0.3em 0.7em;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
}

.badge-teal {
    background: var(--storydeck-teal-100);
    color: var(--storydeck-teal-800);
}

.badge-orange {
    background: var(--storydeck-orange-100);
    color: var(--storydeck-orange-600);
}

.badge-lavender {
    background: var(--storydeck-lavender-100);
    color: var(--storydeck-lavender-500);
}

.badge-cream {
    background: var(--storydeck-cream-200);
    color: var(--storydeck-teal-800);
}

/* Override Bootstrap badge colors to match palette */
.bg-info { background-color: var(--storydeck-teal-100) !important; color: var(--storydeck-teal-800) !important; }
.bg-primary { background-color: var(--storydeck-teal-700) !important; }
.bg-success { background-color: var(--storydeck-teal-500) !important; }
.bg-warning { background-color: var(--storydeck-orange-400) !important; color: var(--storydeck-gray-900) !important; }
.bg-danger { background-color: #DC3545 !important; }


/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
    border-radius: var(--radius-md);
    border: none;
    font-size: var(--text-sm);
    padding: var(--space-md) var(--space-lg);
}

.alert-success {
    background: var(--storydeck-teal-50);
    color: var(--storydeck-teal-800);
    border-left: 4px solid var(--storydeck-teal-500);
}

.alert-danger {
    background: #FEF2F2;
    color: #991B1B;
    border-left: 4px solid #DC3545;
}

.alert-warning {
    background: var(--storydeck-orange-100);
    color: #92400E;
    border-left: 4px solid var(--storydeck-orange-500);
}

.alert-info {
    background: var(--storydeck-lavender-100);
    color: #3730A3;
    border-left: 4px solid var(--storydeck-lavender-500);
}


/* ==========================================================================
   Progress
   ========================================================================== */

.progress {
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--storydeck-gray-200);
}

.progress-bar {
    background: linear-gradient(90deg, var(--storydeck-teal-500), var(--storydeck-teal-700));
    transition: width 0.6s ease;
    border-radius: var(--radius-full);
}


/* ==========================================================================
   Landing Page
   ========================================================================== */

/* Hero */
.landing-hero {
    background: linear-gradient(170deg, var(--storydeck-teal-900) 0%, var(--storydeck-teal-700) 50%, var(--storydeck-teal-600) 100%);
    color: var(--color-text-on-dark);
    padding: var(--space-3xl) 0 var(--space-3xl);
    position: relative;
    overflow: hidden;
    min-height: 85vh;
    display: flex;
    align-items: flex-start;
    padding-top: 10vh;
}

/* Scroll indicator — text + bouncing chevron at bottom of hero */
.scroll-indicator {
    position: absolute;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    animation: scroll-bounce 2s ease-in-out infinite;
    opacity: 0.85;
    cursor: pointer;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    text-decoration: none;
}

.scroll-indicator:hover {
    opacity: 1;
}

.scroll-indicator-text {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 400;
}

.scroll-indicator svg {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

@keyframes scroll-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(10px); }
}

.landing-hero::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(250, 100, 50, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.landing-hero::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(129, 148, 252, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.landing-hero h1 {
    font-size: var(--text-5xl);
    color: var(--storydeck-white);
    line-height: 1.1;
    margin-bottom: var(--space-lg);
    max-width: 680px;
}

@media (max-width: 767px) {
    .landing-hero {
        padding: var(--space-3xl) 0;
    }
    .landing-hero h1 {
        font-size: var(--text-3xl);
    }
}

.landing-hero .tagline {
    font-family: var(--font-display);
    font-style: italic;
    font-size: var(--text-xl);
    color: var(--storydeck-teal-100);
    opacity: 0.9;
    margin-bottom: var(--space-xl);
    font-weight: 400;
}

.landing-hero .lead {
    color: rgba(255, 255, 255, 0.85);
    max-width: 540px;
    font-size: var(--text-lg);
}

.hero-trust {
    display: flex;
    gap: var(--space-lg);
    margin-top: var(--space-2xl);
    flex-wrap: wrap;
}

.hero-trust-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.7);
}

.hero-trust-item svg {
    flex-shrink: 0;
}

/* Sections */
.landing-section {
    padding: var(--space-4xl) 0;
}

.landing-section-warm {
    background: var(--storydeck-cream-100);
}

.landing-section-teal {
    background: var(--storydeck-teal-900);
    color: var(--color-text-on-dark);
}

.section-label {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--storydeck-teal-500);
    margin-bottom: var(--space-sm);
}

.section-title {
    max-width: 600px;
}

.section-subtitle {
    max-width: 580px;
    color: var(--storydeck-gray-600);
    font-size: var(--text-lg);
    line-height: 1.6;
}

/* Steps */
.step-number {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--storydeck-teal-700);
    color: var(--storydeck-white);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: var(--space-md);
}

.step-connector {
    display: none;
}

@media (min-width: 768px) {
    .step-connector {
        display: block;
        height: 2px;
        background: linear-gradient(90deg, var(--storydeck-teal-200), var(--storydeck-teal-400));
        flex-grow: 1;
        margin-top: 24px;
    }
}

/* Feature icons */
.feature-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: var(--space-lg);
    flex-shrink: 0;
}

/* Trust badges */
.trust-card {
    text-align: center;
    padding: var(--space-xl);
}

.trust-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    font-size: 1.25rem;
}

/* CTA section */
.landing-cta {
    background: linear-gradient(135deg, var(--storydeck-teal-800) 0%, var(--storydeck-teal-900) 100%);
    color: var(--color-text-on-dark);
    padding: var(--space-4xl) 0;
    text-align: center;
}

.landing-cta h2 {
    color: var(--storydeck-white);
}

.landing-cta p {
    color: rgba(255, 255, 255, 0.8);
}


/* ==========================================================================
   Dashboard (Authenticated Home)
   ========================================================================== */

.dashboard-greeting {
    margin-bottom: var(--space-2xl);
}

.dashboard-greeting h1 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-xs);
}

.dashboard-greeting p {
    font-size: var(--text-lg);
    color: var(--storydeck-gray-500);
}

/* Journal prompt card */
.journal-prompt {
    background: linear-gradient(135deg, var(--storydeck-teal-700) 0%, var(--storydeck-teal-800) 100%);
    border-radius: var(--radius-xl);
    padding: var(--space-xl) var(--space-2xl);
    color: var(--storydeck-white);
    position: relative;
    overflow: hidden;
    margin-bottom: var(--space-2xl);
}

.journal-prompt::after {
    content: '';
    position: absolute;
    top: -30%;
    right: -5%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.journal-prompt h3 {
    color: var(--storydeck-white);
    font-size: var(--text-2xl);
    margin-bottom: var(--space-sm);
}

.journal-prompt p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--space-lg);
}

.journal-prompt .btn {
    background: var(--storydeck-orange-500);
    border-color: var(--storydeck-orange-500);
    color: var(--storydeck-white);
    font-size: var(--text-base);
    padding: 0.75rem 1.5rem;
}

.journal-prompt .btn:hover {
    background: var(--storydeck-orange-600);
    border-color: var(--storydeck-orange-600);
    transform: translateY(-1px);
}

/* Quick stats */
.stat-card {
    text-align: center;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.stat-card-link,
.row.g-3 > .col-6 > .card {
    height: 100%;
}

.stat-number {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--storydeck-teal-700);
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--storydeck-gray-500);
    font-weight: 500;
}

.stat-card-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card-link:hover .stat-label {
    color: var(--storydeck-teal-700);
}

/* Quick action buttons */
.quick-action {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--storydeck-white);
    border: 1px solid var(--storydeck-gray-200);
    border-radius: var(--radius-md);
    color: var(--storydeck-gray-700);
    font-weight: 500;
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
    text-decoration: none;
    width: 100%;
}

.quick-action:hover {
    background: var(--storydeck-teal-50);
    border-color: var(--storydeck-teal-400);
    color: var(--storydeck-teal-800);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.quick-action-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Recent entries */
.recent-entry {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--storydeck-gray-200);
    transition: background var(--transition-fast);
}

.recent-entry:last-child {
    border-bottom: none;
}

.recent-entry:hover {
    background: var(--storydeck-teal-50);
    margin: 0 calc(-1 * var(--space-md));
    padding-left: var(--space-md);
    padding-right: var(--space-md);
    border-radius: var(--radius-sm);
}

.recent-entry-date {
    font-size: var(--text-xs);
    color: var(--storydeck-gray-500);
    font-weight: 500;
}

.recent-entry-title {
    font-weight: 600;
    color: var(--storydeck-teal-900);
    margin-bottom: 2px;
}

.recent-entry-preview {
    font-size: var(--text-sm);
    color: var(--storydeck-gray-600);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Upcoming dates */
.upcoming-date {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
}

.upcoming-date-cal {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--storydeck-orange-100);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.upcoming-date-cal .month {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--storydeck-orange-600);
    letter-spacing: 0.08em;
}

.upcoming-date-cal .day {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--storydeck-orange-500);
}

.upcoming-date-info {
    flex: 1;
    min-width: 0;
}

.upcoming-date-title {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--storydeck-gray-800);
}

.upcoming-date-person {
    font-size: var(--text-xs);
    color: var(--storydeck-gray-500);
}


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

.footer-storydeck {
    background: var(--storydeck-teal-900);
    color: rgba(255, 255, 255, 0.6);
    padding: var(--space-2xl) 0;
    font-size: var(--text-sm);
    margin-top: var(--space-3xl);
}

.layout-landing .footer-storydeck {
    margin-top: 0;
}

.footer-storydeck a {
    color: rgba(255, 255, 255, 0.7);
    transition: color var(--transition-fast);
}

.footer-storydeck a:hover {
    color: var(--storydeck-white);
}

.footer-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-lg);
    color: var(--storydeck-white);
}

.footer-tagline {
    font-family: var(--font-display);
    font-style: italic;
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.5);
}


/* ==========================================================================
   Page-Level Overrides & Utility Classes
   ========================================================================== */

/* Container with more breathing room */
.container-narrow {
    max-width: 800px;
    margin: 0 auto;
}

/* Divider */
.divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--storydeck-teal-200), transparent);
    border: none;
    margin: var(--space-2xl) 0;
}

/* Page header */
.page-header {
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--storydeck-gray-200);
}

.page-header h1 {
    margin-bottom: var(--space-xs);
}

/* Animate on scroll (simple) */
.fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays */
.fade-up.delay-1 { transition-delay: 0.1s; }
.fade-up.delay-2 { transition-delay: 0.2s; }
.fade-up.delay-3 { transition-delay: 0.3s; }
.fade-up.delay-4 { transition-delay: 0.4s; }

/* Responsive adjustments for flashcard views */
@media (max-width: 768px) {
    .flashcard {
        min-height: 250px;
    }
    .btn-group .btn {
        font-size: 0.875rem;
    }
}

/* Landing page sections are full-width (no outer container from layout).
   Inner .container divs inside each section provide centering + padding. */

/* Override Bootstrap's default anchor color */
a.text-decoration-none {
    text-decoration: none !important;
}

a.text-decoration-none:hover {
    text-decoration: none !important;
}

/* Ensure tables look good */
.table {
    font-size: var(--text-sm);
}

.table th {
    font-weight: 600;
    color: var(--storydeck-gray-700);
    border-bottom-width: 2px;
    border-color: var(--storydeck-gray-200);
}

/* Mark tags for search highlighting */
mark {
    background: var(--storydeck-orange-100);
    color: var(--storydeck-orange-600);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

/* Entity links in journal content — subtle at rest, revealed on hover */
.entity-link {
    color: var(--color-primary);
    text-decoration: none;
    padding: 0.05em 0.15em;
    border-radius: var(--radius-sm);
    transition: text-decoration var(--transition-fast),
                background-color var(--transition-fast);
    cursor: pointer;
}
.entity-link:hover,
.entity-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 2px;
    background-color: rgba(0, 89, 76, 0.08);
    color: var(--color-primary);
}

/* Admin: compact inline role dropdown */
.role-dropdown {
    display: inline-block;
    width: auto;
    min-width: 5rem;
    padding: 0.15rem 1.5rem 0.15rem 0.4rem;
    font-size: 0.8rem;
    line-height: 1.4;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--radius-sm);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='%23495057' d='M0 0l4 5 4-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    background-size: 8px 5px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.role-dropdown:focus {
    border-color: var(--color-primary);
    outline: 0;
    box-shadow: 0 0 0 2px rgba(0, 89, 76, 0.15);
}

/* ==========================================================================
   Onboarding (full-screen, one question per screen)
   ========================================================================== */

.onboarding-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--storydeck-gray-900) 0%, var(--storydeck-teal-900) 100%);
    padding: var(--space-xl) var(--space-lg);
}

.onboarding-content {
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.onboarding-heading {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--storydeck-white);
    margin-bottom: var(--space-md);
    line-height: 1.3;
}

.onboarding-subtitle {
    font-family: var(--font-body);
    font-size: var(--text-lg);
    color: var(--storydeck-gray-400);
    margin-bottom: var(--space-2xl);
    line-height: 1.6;
}

.onboarding-input {
    font-family: var(--font-body);
    font-size: var(--text-xl);
    padding: 1rem 1.25rem;
    border: 2px solid var(--storydeck-gray-700);
    border-radius: var(--radius-lg);
    background: var(--storydeck-gray-800);
    color: var(--storydeck-white);
    width: 100%;
    transition: all var(--transition-fast);
    text-align: center;
}

.onboarding-input:focus {
    border-color: var(--storydeck-teal-400);
    box-shadow: 0 0 0 3px rgba(43, 184, 158, 0.2);
    outline: none;
}

.onboarding-input::placeholder {
    color: var(--storydeck-gray-600);
}

.onboarding-textarea {
    text-align: left;
    min-height: 120px;
    resize: vertical;
}

.onboarding-continue {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--text-lg);
    padding: 1rem 3rem;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--storydeck-teal-500);
    color: var(--storydeck-white);
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-block;
    margin-top: var(--space-2xl);
}

.onboarding-continue:hover {
    background: var(--storydeck-teal-400);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(43, 184, 158, 0.3);
}

.onboarding-continue:active {
    transform: translateY(0);
}

.onboarding-skip {
    display: block;
    margin-top: var(--space-lg);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--storydeck-gray-600);
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    transition: color var(--transition-fast);
}

.onboarding-skip:hover {
    color: var(--storydeck-gray-400);
}

.onboarding-skip-all {
    margin-top: var(--space-xl);
    font-size: var(--text-xs);
    color: var(--storydeck-gray-700);
}

.onboarding-skip-all:hover {
    color: var(--storydeck-gray-500);
}

/* Progress bar — thin line at top of screen */
.onboarding-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--storydeck-gray-800);
    z-index: 100;
}

.onboarding-progress-fill {
    height: 100%;
    background: var(--storydeck-teal-400);
    transition: width var(--transition-slow);
}

/* Family input mode toggle */
.onboarding-choice-group {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    margin-bottom: var(--space-xl);
}

.onboarding-choice {
    flex: 1;
    max-width: 250px;
    padding: var(--space-lg) var(--space-md);
    border: 2px solid var(--storydeck-gray-700);
    border-radius: var(--radius-lg);
    background: var(--storydeck-gray-800);
    color: var(--storydeck-white);
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-fast);
    font-family: var(--font-body);
    font-size: var(--text-base);
}

.onboarding-choice:hover,
.onboarding-choice.active {
    border-color: var(--storydeck-teal-400);
    background: rgba(43, 184, 158, 0.1);
}

.onboarding-choice-title {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.onboarding-choice-desc {
    font-size: var(--text-sm);
    color: var(--storydeck-gray-400);
}

/* Person cards on review screen */
.person-card {
    background: var(--storydeck-gray-800);
    border: 1px solid var(--storydeck-gray-700);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
    transition: all var(--transition-fast);
}

.person-card:hover {
    border-color: var(--storydeck-gray-600);
}

.person-card-info {
    text-align: left;
}

.person-card-name {
    font-weight: 600;
    color: var(--storydeck-white);
    font-size: var(--text-base);
}

.person-card-relationship {
    font-size: var(--text-sm);
    color: var(--storydeck-gray-400);
}

.person-card-actions {
    display: flex;
    gap: var(--space-sm);
}

.person-card-btn {
    background: none;
    border: none;
    color: var(--storydeck-gray-500);
    cursor: pointer;
    padding: var(--space-xs);
    font-size: var(--text-base);
    transition: color var(--transition-fast);
}

.person-card-btn:hover {
    color: var(--storydeck-white);
}

.person-card-btn.delete:hover {
    color: var(--storydeck-orange-500);
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .onboarding-heading {
        font-size: var(--text-2xl);
    }

    .onboarding-subtitle {
        font-size: var(--text-base);
    }

    .onboarding-input {
        font-size: var(--text-lg);
    }

    .onboarding-continue {
        width: 100%;
        padding: 1rem;
    }

    .onboarding-choice-group {
        flex-direction: column;
        align-items: center;
    }

    .onboarding-choice {
        max-width: 100%;
    }
}

/* Greyed-out card for soft-deleted/removed records */
.card-removed {
    opacity: 0.55;
    border-style: dashed;
}

.card-removed .card-title {
    text-decoration: line-through;
}

/* Subtle delete button for entity cards — grey by default, red background on hover */
.card-delete-btn {
    background: none;
    border: none;
    line-height: 1;
    padding: 0.3rem 0.4rem;
    border-radius: var(--radius-sm, 0.25rem);
    cursor: pointer;
    color: #adb5bd;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.card-delete-btn:hover {
    color: #6c757d;
    background-color: rgba(220, 53, 69, 0.15);
}
