/* ============================================
   Ally — Base Styles
   ============================================ */

/* --- Reset & Variables --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Brand colors — Ally teal-to-blue gradient palette */
    --color-primary: #4EC9B2;
    --color-primary-dark: #3AAFA0;
    --color-primary-light: #EAF8F5;

    /* Brand blue (right side of gradient) */
    --color-secondary: #5B8FE0;
    --color-secondary-dark: #4A7ACF;
    --color-secondary-light: #EAF1FB;

    /* Neutrals */
    --color-bg: #ffffff;
    --color-bg-alt: #F7FAFB;
    --color-bg-dark: #111D3C;
    --color-text: #1B3264;
    --color-text-light: #4A6490;
    --color-text-muted: #7B92B0;
    --color-border: #D9E5F0;

    /* Accent (mid-gradient) */
    --color-accent: #4A7ACF;

    /* Gradient shorthand */
    --gradient-brand: linear-gradient(90deg, #4EC9B2 0%, #6BAED4 50%, #5B8FE0 100%);

    /* Sizing */
    --container-max: 1140px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.6;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.10);

    /* Transitions */
    --transition: 0.2s ease;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: var(--line-height-base);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

/* Escludi il marchio header/footer: altrimenti height:auto + intrinseco grande SVG = logo enorme se mancano le regole .logo-mark (cache/deploy vecchio). */
img:not(.logo-mark) {
    max-width: 100%;
    height: auto;
}
a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-dark); }

/* --- Container --- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Section Headers --- */
.section-header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 3rem;
}
.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}
.section-header p {
    font-size: 1.125rem;
    color: var(--color-text-light);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.625rem 1.5rem;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}
.btn-primary {
    background: var(--gradient-brand);
    color: #fff;
    border-color: transparent;
}
.btn-primary:hover {
    background: linear-gradient(90deg, #3AAFA0 0%, #5B9FCA 50%, #4A7ACF 100%);
    border-color: transparent;
    color: #fff;
}
.btn-ghost {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn-ghost:hover {
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}
.btn-sm { font-size: 0.8125rem; padding: 0.4rem 1rem; }
.btn-lg { font-size: 1.0625rem; padding: 0.875rem 2rem; }
.btn-block { width: 100%; }

/* ============================================
   Header / Navigation
   ============================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    flex-shrink: 0;
}
.logo:hover { opacity: 0.85; }
.logo-mark {
    height: 32px;
    width: auto;
    max-height: 32px;
    max-width: 72px;
    display: block;
    flex-shrink: 0;
    object-fit: contain;
}
.logo-text {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
    line-height: 1;
}
.main-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.nav-list {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}
.nav-list a {
    color: var(--color-text-light);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: color var(--transition);
}
.nav-list a:hover { color: var(--color-primary-dark); }
.nav-link-highlight {
    color: var(--color-primary-dark) !important;
    font-weight: 600 !important;
}
.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1rem;
}

/* Mobile toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.mobile-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: var(--transition);
}

/* ============================================
   Hero
   ============================================ */
.hero {
    padding: 5rem 0 4rem;
    background: linear-gradient(160deg, var(--color-bg) 45%, var(--color-secondary-light) 100%);
}
.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}
.hero-badge {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-accent);
    background: var(--color-primary-light);
    padding: 0.375rem 1rem;
    border-radius: var(--radius-xl);
    margin-bottom: 1.25rem;
}
.hero h1 {
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 1.25rem;
}
.hero-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-light);
    margin-bottom: 2rem;
    max-width: 480px;
}
.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Chat preview */
.chat-preview {
    background: #e5ddd5;
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    margin-left: auto;
}
.chat-bubble {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    line-height: 1.5;
    max-width: 85%;
    box-shadow: var(--shadow-sm);
}
.chat-bubble-user {
    background: #dcf8c6;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-bubble-ally {
    background: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* ============================================
   Features
   ============================================ */
.features {
    padding: 5rem 0;
    background: var(--color-bg);
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
.feature-card {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 2rem 1.5rem;
    transition: box-shadow var(--transition), transform var(--transition);
}
.feature-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}
.feature-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.feature-card p {
    font-size: 0.9375rem;
    color: var(--color-text-light);
}

/* ============================================
   How It Works
   ============================================ */
.how-it-works {
    padding: 5rem 0;
    background: var(--color-bg-alt);
}
.steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 1.5rem;
}
.step {
    text-align: center;
    max-width: 260px;
}
.step-number {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-brand);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}
.step h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.step p {
    font-size: 0.9375rem;
    color: var(--color-text-light);
}
.step-arrow {
    font-size: 1.5rem;
    color: var(--color-text-muted);
    padding-top: 1rem;
}

/* ============================================
   Scenarios
   ============================================ */
.scenarios {
    padding: 5rem 0;
    background: var(--color-bg);
}
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.scenario-card {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.75rem 1.5rem;
    transition: box-shadow var(--transition), transform var(--transition);
}
.scenario-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.scenario-emoji {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.75rem;
}
.scenario-card h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.scenario-card p {
    font-size: 0.9375rem;
    color: var(--color-text-light);
}

/* ============================================
   Privacy
   ============================================ */
.privacy-section {
    padding: 4rem 0;
    background: var(--color-bg-dark);
    color: #fff;
}
.privacy-content {
    text-align: center;
    max-width: 580px;
    margin: 0 auto;
}
.privacy-icon { font-size: 3rem; margin-bottom: 1rem; }
.privacy-content h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: #fff;
}
.privacy-content p {
    font-size: 1.0625rem;
    color: rgba(255,255,255,0.75);
    line-height: 1.7;
}

/* ============================================
   CTA
   ============================================ */
.cta-section {
    padding: 5rem 0;
    background: linear-gradient(160deg, var(--color-primary-light) 0%, var(--color-secondary-light) 60%, var(--color-bg) 100%);
}
.cta-content {
    text-align: center;
    max-width: 560px;
    margin: 0 auto;
}
.cta-content h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.cta-content p {
    font-size: 1.0625rem;
    color: var(--color-text-light);
    margin-bottom: 2rem;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    background: var(--color-bg-dark);
    color: rgba(255,255,255,0.7);
    padding: 3rem 0 1.5rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-brand .logo { color: #4EC9B2; }
.logo-mark--footer {
    filter: none;
}
.footer-tagline {
    margin-top: 0.75rem;
    font-size: 0.9375rem;
    color: rgba(255,255,255,0.5);
}
.footer-links h4 {
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 0.5rem; }
.footer-links a {
    color: rgba(255,255,255,0.6);
    font-size: 0.9375rem;
    transition: color var(--transition);
}
.footer-links a:hover { color: var(--color-primary); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.8125rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .hero-subtitle { margin-left: auto; margin-right: auto; }
    .hero-actions { justify-content: center; }
    .chat-preview { margin: 0 auto; }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .hero h1 { font-size: 2rem; }
    .section-header h2 { font-size: 1.5rem; }
    .features-grid { grid-template-columns: 1fr; }
    .steps { flex-direction: column; align-items: center; }
    .step-arrow { transform: rotate(90deg); }
    .footer-grid { grid-template-columns: 1fr; }

    /* Mobile nav */
    .main-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        padding: 1.5rem;
        border-bottom: 1px solid var(--color-border);
        box-shadow: var(--shadow-md);
    }
    .main-nav.open { display: flex; }
    .nav-list { flex-direction: column; gap: 1rem; }
    .nav-auth { margin-left: 0; flex-direction: column; gap: 0.5rem; }
    .nav-auth .btn { width: 100%; }
    .mobile-toggle { display: flex; }
}
