/* ══════════════════════════════════════════════════
   BREWSTER PITCH DECK STYLES
   Optimized for PDF generation (16:9, 1024×576px)
   ══════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════
   CSS VARIABLES & BASE STYLES
   ══════════════════════════════════════════════════ */

:root {
    /* Brand Colors - Nature, Ecology, Craft, Local */
    --color-primary:        #15803d;  /* Forest green - natura e territorio */
    --color-primary-dark:   #14532d;  /* Deep forest - boschi e tradizione */
    --color-accent:         #d97706;  /* Amber/Gold - birra artigianale */
    --color-success:        #16a34a;  /* Natural green - sostenibilità */
    --color-craft:          #92400e;  /* Brown - artigianato e legno */
    
    /* Text Colors */
    --color-text-primary:   #1c1917;  /* Stone dark - più caldo del nero */
    --color-text-secondary: #57534e;  /* Stone gray - toni naturali */
    --color-text-muted:     #a8a29e;  /* Stone light */
    --color-text-inverse:   #fafaf9;  /* Off-white - più naturale */
    
    /* Background Colors */
    --color-bg-page:        #ffffff;
    --color-bg-dark:        #292524;  /* Warm dark - terra e legno */
    --color-bg-light:       #f5f5f4;  /* Stone 100 - neutro caldo */
    --color-bg-accent:      #dcfce7;  /* Light green - ecologico */
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Spacing */
    --spacing-unit: 1rem;
    
    /* Slide Dimensions (16:9 aspect ratio, optimized for PDF) */
    --slide-width: 1024px;
    --slide-height: 576px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    line-height: 1.5;
    color: var(--color-text-primary);
    background-color: #e5e7eb;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ══════════════════════════════════════════════════
   SLIDE CONTAINER
   ══════════════════════════════════════════════════ */

.deck {
    max-width: var(--slide-width);
    margin: 0 auto;
    padding: 2rem 0;
}

.slide {
    width: var(--slide-width);
    min-height: var(--slide-height);
    background: var(--color-bg-page);
    margin: 0 auto 2rem;
    padding: 3rem 4rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    page-break-after: always;
    page-break-inside: avoid;
    position: relative;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
}

.slide.slide-exit {
    opacity: 0;
    transform: translateX(-30px);
}

.slide.slide-enter {
    opacity: 0;
    transform: translateX(30px);
}

.slide.slide-active {
    opacity: 1;
    transform: translateX(0);
}

.slide:last-child {
    margin-bottom: 0;
}

/* ══════════════════════════════════════════════════
   SLIDE LAYOUTS
   ══════════════════════════════════════════════════ */

/* Cover Slide */
.slide.cover {
    background: linear-gradient(135deg, var(--color-primary) 0%, #166534 50%, var(--color-craft) 100%);
    color: var(--color-text-inverse);
    justify-content: center;
    align-items: center;
    text-align: center;
}

.slide.cover h1 {
    font-size: 4.5rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    margin-bottom: 1rem;
}

.slide.cover .tagline {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 3rem;
    max-width: 800px;
    color: var(--color-text-inverse);
}

.slide.cover .meta {
    font-size: 0.9rem;
    margin-top: 2rem;
}

/* Section Divider */
.slide.section-divider {
    background: var(--color-bg-dark);
    color: var(--color-text-inverse);
    justify-content: center;
    align-items: center;
    text-align: center;
}

.slide.section-divider h2 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.slide.section-divider p {
    color: var(--color-text-inverse);
}

.slide.section-divider strong {
    color: var(--color-text-inverse);
}

/* Content Slide */
.slide-header {
    margin-bottom: 2rem;
}

.slide-number {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.slide h2 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.02em;
    margin-top: 0.25rem;
}

.slide h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.slide h3:first-of-type {
    margin-top: 0;
}

.slide-content {
    flex: 1;
}

/* ══════════════════════════════════════════════════
   TYPOGRAPHY
   ══════════════════════════════════════════════════ */

p {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1rem;
    color: var(--color-text-secondary);
}

p.lead {
    font-size: 1.25rem;
    line-height: 1.6;
    font-weight: 500;
    color: var(--color-text-primary);
}

strong {
    font-weight: 700;
    color: var(--color-text-primary);
}

em {
    font-style: italic;
    color: var(--color-text-secondary);
}

.highlight {
    background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-weight: 600;
}

/* ══════════════════════════════════════════════════
   LISTS
   ══════════════════════════════════════════════════ */

ul, ol {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

li {
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 0.75rem;
    color: var(--color-text-secondary);
}

li strong {
    color: var(--color-text-primary);
}

ul.checklist {
    list-style: none;
    margin-left: 0;
}

ul.checklist li:before {
    content: "✓";
    color: var(--color-success);
    font-weight: 700;
    margin-right: 0.75rem;
    font-size: 1.2rem;
}

ul.biglist li {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

/* ══════════════════════════════════════════════════
   METRIC BOXES & STATS
   ══════════════════════════════════════════════════ */

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.metric {
    background: var(--color-bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--color-primary);
}

.metric-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* ══════════════════════════════════════════════════
   CALLOUT BOXES
   ══════════════════════════════════════════════════ */

.callout {
    background: var(--color-bg-accent);
    border-left: 4px solid var(--color-primary);
    padding: 1.5rem;
    border-radius: 6px;
    margin: 1.5rem 0;
}

.callout p {
    color: var(--color-text-primary);
    font-weight: 500;
    margin: 0;
}

.callout.success {
    background: #dcfce7;
    border-left-color: var(--color-success);
}

.callout.success p {
    color: #0a0a0a;
}

.callout.warning {
    background: #fef4e6;
    border-left-color: var(--color-accent);
}

/* ══════════════════════════════════════════════════
   TWO-COLUMN LAYOUT
   ══════════════════════════════════════════════════ */

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.column h3 {
    font-size: 1.25rem;
    margin-top: 0;
}

/* ══════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════ */

.slide-footer {
    margin-top: auto;
    padding-top: 1rem;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    text-align: center;
}

/* ══════════════════════════════════════════════════
   TABLE STYLES
   ══════════════════════════════════════════════════ */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th {
    background: var(--color-bg-dark);
    color: var(--color-text-inverse);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}

tr:last-child td {
    border-bottom: none;
}

/* ══════════════════════════════════════════════════
   PRINT STYLES (CRITICAL FOR PDF GENERATION)
   ══════════════════════════════════════════════════ */

@media print {
    @page {
        size: landscape;
        margin: 0;
    }
    
    html, body {
        background: white;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
    }
    
    .deck {
        max-width: none;
        padding: 0;
        margin: 0;
    }
    
    .slide {
        width: 100vw;
        height: 100vh;
        margin: 0;
        padding: 3rem 4rem;
        box-sizing: border-box;
        box-shadow: none;
        border: none;
        border-radius: 0;
        page-break-after: always;
        page-break-inside: avoid;
        break-after: page;
        break-inside: avoid;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        color-adjust: exact;
        display: flex !important;
        flex-direction: column;
        overflow: hidden;
        position: relative;
    }
    
    .slide:last-child {
        page-break-after: auto;
        break-after: auto;
    }
    
    /* Ensure gradients and colors print correctly */
    .slide.cover,
    .slide.section-divider {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Fix text rendering in PDF */
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Ensure metric boxes print with backgrounds */
    .metric,
    .callout {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Hide all interactive/navigation elements */
    .slide-nav,
    .slide-progress,
    .slide-counter {
        display: none !important;
    }
    
    /* Compact slides with dense content */
    .slide.print-compact .slide-content {
        transform: scale(0.72);
        transform-origin: top left;
        width: 138%;
    }
    
    .slide.print-compact h3 {
        font-size: 0.85rem;
        margin: 0.3rem 0 0.15rem;
    }
    
    .slide.print-compact ul {
        margin: 0 0 0.2rem;
    }
    
    .slide.print-compact li {
        font-size: 0.75rem;
        line-height: 1.3;
        margin-bottom: 0.05rem;
    }
}

/* ══════════════════════════════════════════════════
   RESPONSIVE (for screen preview)
   ══════════════════════════════════════════════════ */

@media screen and (max-width: 1100px) {
    .deck {
        padding: 1rem;
    }
    
    .slide {
        width: 100%;
        height: auto;
        min-height: 400px;
        padding: 2rem;
    }
    
    .slide.cover h1 {
        font-size: 3rem;
    }
    
    .slide h2 {
        font-size: 1.75rem;
    }
    
    .metrics {
        grid-template-columns: 1fr;
    }
    
    .two-columns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .slide-nav {
        bottom: 1rem;
        right: 1rem;
    }
    
    .slide-progress {
        bottom: 1rem;
        left: 1rem;
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
    }
}

@media screen and (max-width: 768px) {
    .slide {
        padding: 1.5rem;
    }
    
    .slide.cover h1 {
        font-size: 2.5rem;
    }
    
    .slide.cover .tagline {
        font-size: 1.25rem;
    }
    
    .slide h2 {
        font-size: 1.5rem;
    }
    
    .slide h3 {
        font-size: 1.25rem;
    }
    
    p.lead {
        font-size: 1.1rem;
    }
    
    .metric-value {
        font-size: 1.75rem;
    }
    
    .biglist li {
        font-size: 1rem;
    }
    
    .slide-nav {
        gap: 0.25rem;
    }
    
    .slide-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}

/* ══════════════════════════════════════════════════
   MOBILE LANDSCAPE ORIENTATION
   ══════════════════════════════════════════════════ */

@media screen and (max-width: 932px) and (orientation: landscape) {
    .deck {
        padding: 0.5rem;
    }
    
    .slide {
        width: 100%;
        min-height: auto;
        padding: 1.25rem 2rem;
        margin-bottom: 1rem;
    }
    
    /* Optimize cover slide for landscape */
    .slide.cover {
        padding: 2rem;
    }
    
    .slide.cover h1 {
        font-size: 3rem;
        margin-bottom: 0.5rem;
    }
    
    .slide.cover .tagline {
        font-size: 1.15rem;
        margin-bottom: 1.5rem;
    }
    
    .slide.cover .meta {
        font-size: 0.8rem;
        margin-top: 1rem;
        opacity: 1;
    }
    
    /* Compact headers */
    .slide-header {
        margin-bottom: 1rem;
    }
    
    .slide h2 {
        font-size: 1.5rem;
    }
    
    .slide h3 {
        font-size: 1.15rem;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }
    
    /* Adjust typography */
    p.lead {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 0.75rem;
    }
    
    p {
        font-size: 0.9rem;
        line-height: 1.6;
        margin-bottom: 0.75rem;
    }
    
    li {
        font-size: 0.9rem;
        line-height: 1.6;
        margin-bottom: 0.5rem;
    }
    
    .biglist li {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    /* Optimize two-column layout for landscape */
    .two-columns {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    /* Compact metrics */
    .metrics {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.75rem;
        margin: 1rem 0;
    }
    
    .metric {
        padding: 1rem;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .metric-label {
        font-size: 0.75rem;
    }
    
    /* Compact callouts */
    .callout {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .callout p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Adjust navigation for landscape */
    .slide-nav {
        bottom: 0.75rem;
        right: 0.75rem;
        gap: 0.25rem;
    }
    
    .slide-nav-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    .slide-progress {
        bottom: 0.75rem;
        left: 0.75rem;
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* Compact tables */
    th, td {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    /* Section dividers for landscape */
    .slide.section-divider h2 {
        font-size: 2rem;
    }
    
    .slide.section-divider .text-large {
        font-size: 1rem;
    }
}

/* Small mobile landscape (phones < 6.7") */
@media screen and (max-height: 430px) and (orientation: landscape) {
    .slide {
        padding: 0.75rem 1.5rem;
    }
    
    .slide.cover h1 {
        font-size: 2.25rem;
    }
    
    .slide.cover .tagline {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .slide h2 {
        font-size: 1.25rem;
    }
    
    .slide h3 {
        font-size: 1rem;
    }
    
    p.lead {
        font-size: 0.95rem;
    }
    
    p, li {
        font-size: 0.85rem;
    }
    
    .metrics {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.5rem;
    }
    
    .metric {
        padding: 0.75rem;
    }
    
    .metric-value {
        font-size: 1.25rem;
    }
    
    .callout {
        padding: 0.75rem;
        margin: 0.75rem 0;
    }
    
    .slide-nav-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

/* ══════════════════════════════════════════════════
   UTILITY CLASSES FOR SPACING
   ══════════════════════════════════════════════════ */

.mt-1 {
    margin-top: 1rem;
}

.mt-1-5 {
    margin-top: 1.5rem;
}

.mt-2 {
    margin-top: 2rem;
}

.link-inherit {
    color: inherit;
}

.text-small {
    font-size: 0.875rem;
}

.text-large {
    font-size: 1.25rem;
}

.opacity-90 {
    opacity: 0.95;
}

.list-unstyled {
    margin-left: 0;
    list-style: none;
}

/* ══════════════════════════════════════════════════
   NAVIGATION CONTROLS (HIDDEN IN PRINT)
   ══════════════════════════════════════════════════ */

.slide-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    gap: 0.5rem;
    z-index: 1000;
}

.slide-nav-btn {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    font-weight: bold;
}

.slide-nav-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

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

.slide-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.slide-nav-btn:disabled:hover {
    transform: none;
    background: var(--color-primary);
}

.slide-progress {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    background: white;
    padding: 0.75rem 1.25rem;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
    z-index: 1000;
}



/* ══════════════════════════════════════════════════
   PRESENTATION MODE (FULLSCREEN)
   ══════════════════════════════════════════════════ */

.presentation-mode .deck {
    padding: 0;
}

.presentation-mode .slide {
    margin: 0;
    display: none;
    width: 100vw;
    height: 100vh;
    max-width: none;
}

.presentation-mode .slide.active {
    display: flex;
}

.presentation-mode body {
    overflow: hidden;
}
