/* ==========================================================================
   DUAL MODE STYLES — Web (screen) + PDF (print)

   Web mode: responsive, Google Fonts, site header/footer, NO prices
   PDF mode: A4 print, embedded fonts, cover page, QR back page, WITH prices
   ========================================================================== */

/* ===== WEB FONTS (screen only — PDF uses embedded @font-face) ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

/* Local Francis font for web hero titles */
@font-face {
    font-family: 'Francis';
    src: url('/fonts/Francis-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ===== PDF FONTS (embedded for WeasyPrint) ===== */
@font-face {
    font-family: 'Outfit';
    src: url('fonts/Outfit-Thin.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}

@font-face {
    font-family: 'Minion Pro';
    src: url('fonts/MinionPro-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Francis';
    src: url('fonts/Francis-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

/* ===== CSS VARIABLES ===== */
:root {
    --bordeaux: #8E3024;
    --cream: #FFF8E1;
    --wood: #8B4513;
    --terracotta: #953922;
    --dark-bg: #2C2C2C;
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-script: 'Francis', cursive;
}

/* ===== VISIBILITY TOGGLES ===== */
.web-only { display: block; }
.pdf-only { display: none; }

.pdf-mode .web-only { display: none !important; }
.pdf-mode .pdf-only { display: block !important; }

/* ===== BASE RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================================================================
   SCREEN STYLES (Web Mode)
   ========================================================================== */

body {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 16px;
    color: var(--wood);
    line-height: 1.6;
    background-color: var(--cream);
}

/* ----- SITE HEADER ----- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.site-header nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    transition: padding 0.3s ease;
}

.site-header.scrolled nav {
    padding: 1rem;
}

/* Desktop nav: logo centered, links split */
.header-desktop {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.header-nav-group {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-line {
    width: 12rem;
    height: 1px;
    background: rgba(255, 255, 255, 0.5);
}

.header-nav-group ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.header-nav-group a {
    color: #fff;
    text-decoration: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: opacity 0.2s;
}

.header-nav-group a:hover,
.header-nav-group a.active {
    opacity: 0.7;
}

.header-logo img {
    height: 6rem;
    width: auto;
    transition: height 0.3s ease;
}

.site-header.scrolled .header-logo img {
    height: 3.5rem;
}

/* Mobile nav */
.header-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-mobile .mobile-logo img {
    height: 3rem;
    width: auto;
}

.hamburger-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger-btn svg {
    width: 2rem;
    height: 2rem;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    gap: 0;
    margin-top: 1rem;
    padding: 1rem 0;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 0.5rem;
}

.mobile-menu.open {
    display: flex;
}

.mobile-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: #fff;
    text-decoration: none;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: opacity 0.2s;
}

.mobile-menu a:hover {
    opacity: 0.7;
}

/* ----- HERO SECTION ----- */
.hero-section {
    position: relative;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0 1rem;
    animation: fadeIn 1s ease-out forwards;
}

.hero-title {
    font-family: var(--font-script);
    font-size: clamp(3rem, 10vw, 7rem);
    line-height: 1;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: #fff;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-family: var(--font-script);
    font-size: clamp(1.25rem, 3vw, 2.5rem);
    color: #fff;
    font-weight: 400;
}

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

/* ----- STICKY CATEGORY NAV ----- */
.category-nav {
    position: sticky;
    top: 4rem;
    z-index: 40;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--bordeaux);
    padding: 0.75rem 0;
}

.category-nav ul {
    list-style: none;
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.category-nav ul::-webkit-scrollbar { display: none; }

.category-nav a {
    color: var(--bordeaux);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.category-nav a:hover {
    opacity: 0.7;
}

/* ----- MAIN CONTENT ----- */
.main-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1rem;
    background: #fff;
}

/* ----- MENU SECTION (web) ----- */
.menu-section {
    margin-bottom: 4rem;
    scroll-margin-top: 8rem;
}

.menu-section h2 {
    font-family: var(--font-script);
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--bordeaux);
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.section-divider {
    width: 4rem;
    height: 2px;
    background: var(--bordeaux);
    margin-bottom: 2rem;
}

/* ----- MENU ITEM (web) ----- */
.web-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(142, 48, 36, 0.2);
}

.web-item-content {
    flex: 1;
}

.web-item-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.web-item-name {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--bordeaux);
}

.web-item-tag {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--bordeaux);
}

.web-item-featured {
    font-size: 0.75rem;
    color: #fff;
    background: var(--bordeaux);
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
}

.web-item-description {
    font-size: 0.875rem;
    color: rgba(142, 48, 36, 0.7);
    margin-top: 0.25rem;
    line-height: 1.5;
}

.web-item-producer {
    font-size: 0.875rem;
    color: rgba(142, 48, 36, 0.7);
}

.web-item-year {
    font-size: 0.875rem;
    color: rgba(142, 48, 36, 0.6);
}

.web-item-allergens {
    font-size: 0.75rem;
    color: rgba(142, 48, 36, 0.5);
    margin-top: 0.25rem;
}

.web-item-price {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--bordeaux);
    white-space: nowrap;
}

.web-item-glass {
    font-size: 0.875rem;
    color: rgba(142, 48, 36, 0.6);
    text-align: right;
}

/* ----- WINE INTRO & LEGEND (web) ----- */
.wine-intro {
    text-align: center;
    margin-bottom: 3rem;
}

.wine-intro p {
    font-size: 1.125rem;
    max-width: 42rem;
    margin: 0 auto;
    color: rgba(142, 48, 36, 0.7);
}

.wine-legend-box {
    margin-bottom: 3rem;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(142, 48, 36, 0.2);
    background: rgba(142, 48, 36, 0.03);
}

.wine-legend-box h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--bordeaux);
    margin-bottom: 1rem;
    font-family: var(--font-sans);
}

.wine-legend-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.wine-legend-symbol {
    flex-shrink: 0;
    width: 3rem;
    text-align: center;
    color: var(--bordeaux);
}

.wine-legend-text {
    font-size: 0.875rem;
    color: rgba(142, 48, 36, 0.8);
}

.wine-legend-text strong {
    color: var(--bordeaux);
}

/* ----- FOOTER NOTES ----- */
.footer-notes {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(142, 48, 36, 0.2);
    text-align: center;
    font-size: 0.875rem;
    color: rgba(142, 48, 36, 0.7);
}

.footer-notes p {
    margin-bottom: 0.5rem;
}

.footer-notes em {
    color: rgba(142, 48, 36, 0.8);
}

/* ----- SITE FOOTER ----- */
.site-footer {
    background: var(--dark-bg);
    color: #fff;
    padding: 3rem 1rem;
}

.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.footer-brand {
    text-align: center;
}

.footer-brand img {
    height: 9rem;
    width: auto;
    margin: 0 auto 1rem;
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    line-height: 1.6;
}

.footer-links h4,
.footer-contact h4 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    font-family: var(--font-sans);
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #fff;
}

.footer-contact address {
    font-style: normal;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    line-height: 1.8;
}

.footer-contact a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-contact a:hover {
    color: #fff;
}

.footer-copyright {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

/* ----- RESPONSIVE ----- */
@media (min-width: 640px) {
    .hero-title {
        font-size: clamp(4rem, 10vw, 8rem);
    }
    .hero-section {
        height: 70vh;
    }
}

@media (min-width: 768px) {
    .header-desktop { display: flex; }
    .header-mobile { display: none; }
    .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
    .footer-brand { text-align: left; }
    .category-nav ul {
        justify-content: center;
        gap: 2rem;
    }
}

@media (min-width: 1024px) {
    .hero-title {
        font-size: clamp(5rem, 10vw, 9rem);
    }
    .site-header.scrolled .header-logo img {
        height: 4rem;
    }
    .header-logo img {
        height: 8rem;
    }
    .header-line {
        width: 15rem;
    }
}

/* ==========================================================================
   PDF STYLES (used when body has class "pdf-mode")
   ========================================================================== */

/* Page rules - only apply in PDF rendering */
@page {
    size: A4;
    margin: 30mm 25mm;
}

@page cover {
    margin: 0;
}

@page backpage {
    margin: 30mm 25mm;
}

/* PDF base overrides */
.pdf-mode {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 10pt;
    color: #000;
    line-height: 1.4;
    background: #fff;
}

/* ----- PDF COVER PAGE (replicates InDesign original) ----- */
.pdf-mode .cover-page {
    page: cover;
    width: 210mm;
    height: 297mm;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    page-break-after: always;
    overflow: hidden;
}

/* Thin cream border inset ~8mm from page edge */
.pdf-mode .cover-border {
    position: absolute;
    top: 8mm;
    left: 8mm;
    right: 8mm;
    bottom: 8mm;
    border: 0.25pt solid rgba(255, 228, 179, 0.5);
    pointer-events: none;
}

/* Vertical line creating right tab panel, ~25mm from right edge */
.pdf-mode .cover-vline {
    position: absolute;
    top: 8mm;
    right: 25mm;
    bottom: 8mm;
    width: 0;
    border-left: 0.25pt solid rgba(255, 228, 179, 0.5);
}

/* "MENU" / "CARTA DEI VINI" text rotated vertically in right tab */
.pdf-mode .cover-tab-text {
    position: absolute;
    right: 8mm;
    top: 50%;
    width: 17mm;
    transform: translateY(-50%);
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 100;
    font-size: 10pt;
    letter-spacing: 8pt;
    text-transform: uppercase;
    color: #FFE4B3;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

/* Logo positioned in lower-left area */
.pdf-mode .cover-logo-wrap {
    position: absolute;
    bottom: 80mm;
    left: 20mm;
    width: 130mm;
}

.pdf-mode .cover-logo-wrap img {
    width: 100%;
    height: auto;
}

/* ----- PDF BLANK PAGE (inside front cover) ----- */
.pdf-mode .blank-page {
    page: cover;
    width: 210mm;
    height: 297mm;
    background: #fff;
    page-break-after: always;
}

/* ----- PDF TITLE PAGE ("il nostro menu" / "la nostra carta dei vini") ----- */
.pdf-mode .title-page {
    page: cover;
    width: 210mm;
    height: 297mm;
    position: relative;
    page-break-after: always;
    background: #fff;
}

.pdf-mode .title-text {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-9.5deg);
    font-family: 'Francis', cursive;
    font-size: 56pt;
    font-weight: 400;
    text-align: center;
    color: #000;
    line-height: 1.1;
    white-space: nowrap;
}

.pdf-mode .title-rule {
    position: absolute;
    top: 32%;
    left: 50%;
    width: 80mm;
    transform: translate(-50%, 0) rotate(-9.5deg);
    border-top: 0.25pt solid #000;
}

.pdf-mode .title-subtitle {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate(-50%, 0);
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 14pt;
    text-align: center;
    color: #000;
    white-space: nowrap;
    letter-spacing: 0.5pt;
}

/* ----- PDF CONTENT ----- */
.pdf-mode .content-page {
    page-break-before: auto;
}

.pdf-mode .section-heading {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 18pt;
    color: #953922;
    text-transform: uppercase;
    letter-spacing: 1.5pt;
    margin-top: 20pt;
    margin-bottom: 12pt;
    padding-bottom: 4pt;
    border-bottom: 0.5pt solid #953922;
}

.pdf-mode .section-heading:first-child,
.pdf-mode .content-page:first-of-type .section-heading:first-child {
    margin-top: 0;
}

/* ----- PDF TABLE ----- */
.pdf-mode .items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16pt;
}

.pdf-mode .items-table td {
    vertical-align: top;
    padding: 2pt 0;
}

.pdf-mode .item-row td {
    padding-top: 6pt;
}

.pdf-mode .col-content {
    width: auto;
}

.pdf-mode .col-price {
    width: 57pt;
    text-align: right;
    white-space: nowrap;
}

.pdf-mode .item-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 12pt;
    color: #000;
}

.pdf-mode .item-price {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 12pt;
    color: #000;
}

.pdf-mode .dietary-marker {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 8pt;
    color: #953922;
    margin-left: 4pt;
    vertical-align: super;
}

.pdf-mode .wine-tag {
    font-size: 8pt;
    color: #953922;
    margin-left: 4pt;
}

.pdf-mode .item-description {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 10pt;
    color: #333;
    padding-top: 1pt;
    padding-bottom: 1pt;
    line-height: 1.3;
}

.pdf-mode .item-producer {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 9pt;
    color: #666;
    font-style: italic;
}

.pdf-mode .item-allergens {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 8pt;
    color: #555;
    text-decoration: underline;
    padding-bottom: 6pt;
}

.pdf-mode .glass-price {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 9pt;
    color: #666;
}

/* ----- PDF LEGEND ----- */
.pdf-mode .legend {
    margin-top: 24pt;
    padding-top: 12pt;
    border-top: 0.5pt solid #ccc;
}

.pdf-mode .legend-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 10pt;
    color: #953922;
    margin-bottom: 6pt;
}

.pdf-mode .legend-item {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 8pt;
    color: #555;
    margin-bottom: 2pt;
    line-height: 1.5;
}

.pdf-mode .legend-item strong {
    font-weight: 600;
    color: #000;
}

.pdf-mode .allergen-notice {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 7pt;
    color: #777;
    margin-top: 8pt;
    font-style: italic;
    line-height: 1.4;
}

.pdf-mode .tag-legend {
    margin-top: 20pt;
    padding-top: 12pt;
    border-top: 0.5pt solid #ccc;
}

.pdf-mode .tag-legend-item {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 8pt;
    color: #555;
    margin-bottom: 3pt;
}

.pdf-mode .tag-legend-item .tag-symbol {
    color: #953922;
    font-weight: 600;
}

/* ----- PDF BACK PAGE (QR) ----- */
.pdf-mode .back-page {
    page: backpage;
    page-break-before: always;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 100%;
    padding-top: 60mm;
}

.pdf-mode .back-logo {
    width: 120px;
    margin-bottom: 20pt;
}

.pdf-mode .back-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 16pt;
    color: #953922;
    margin-bottom: 6pt;
}

.pdf-mode .back-info {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 9pt;
    color: #555;
    line-height: 1.6;
    margin-bottom: 20pt;
}

.pdf-mode .qr-label {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 9pt;
    color: #777;
    margin-bottom: 8pt;
}

.pdf-mode .qr-code {
    width: 100px;
    height: 100px;
}

.pdf-mode .back-url {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 8pt;
    color: #999;
    margin-top: 6pt;
}

/* ----- PDF PAGE BREAK RULES ----- */
.pdf-mode .item-block {
    page-break-inside: avoid;
}

.pdf-mode .section-block {
    page-break-inside: auto;
}

.pdf-mode .section-heading {
    page-break-after: avoid;
}
