/* ABOUTME: Main stylesheet for Boursot Wine Collection website. */
/* ABOUTME: Modern CSS grid layout with responsive design, preserving brand colours and character. */

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
    --color-green: #004000;
    --color-wine: #660000;
    --color-tan: #ccccb3;
    --color-cream: #ffffcc;
    --color-white: #ffffff;
    --color-grey-nav: #808080;
    --color-grey-dark: #666666;
    --color-button-bg: #c0c080;
    --color-link: #333333;
    --color-link-hover: #a90817;
    --color-nav-hover-text: #ffff00;

    --font-body: Calibri, Verdana, Helvetica, Arial, sans-serif;
    --font-ui: Verdana, Helvetica, Arial, sans-serif;

    --max-width: 960px;
    --sidebar-width: 200px;
    --content-gap: 24px;
    --nav-break: 768px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-white);
    background-image: url('../images/art/bg0617.jpg');
    background-repeat: repeat-x;
    background-attachment: fixed;
    background-size: cover;
    font-family: var(--font-body);
    color: var(--color-green);
    font-size: 15px;
    line-height: 1.6;
}

/* ============================================================
   Site Wrapper
   ============================================================ */
.site-wrapper {
    max-width: var(--max-width);
    margin: 10px auto 20px;
    background-color: var(--color-white);
    border: 2px solid var(--color-tan);
    padding: 20px;
    background-image: url('../images/art/shadow.png');
    background-repeat: no-repeat;
    background-position: bottom right;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
    margin-bottom: 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-link {
    display: block;
    line-height: 0;
}

.logo-link img {
    max-width: 340px;
    width: 100%;
    height: auto;
}

.lang-switch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 9px;
    color: var(--color-wine);
}

.lang-switch img {
    border: 1px solid #ccc;
}

/* ============================================================
   Navigation
   ============================================================ */
.site-nav {
    position: relative;
    margin: 0 0 0 0;
}

/* Hamburger (hidden on desktop) */
.hamburger {
    display: none;
    background: var(--color-grey-nav);
    border: none;
    cursor: pointer;
    padding: 12px 16px;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 3px;
    background-color: var(--color-white);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

/* Hamburger open state */
.hamburger[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.nav-links-wrapper {
    display: block;
}

.nav-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1px;
    background-color: var(--color-white);
    margin-bottom: 0;
}

.nav-primary {
    margin-top: 0;
}

.nav-secondary {
    margin-top: 1px;
}

/* Navigation links */
a.but,
a.but:link,
a.but:visited {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 100px;
    padding: 8px 12px;
    background-color: var(--color-grey-nav);
    color: var(--color-white);
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    line-height: 1.3;
    transition: background-color 0.2s;
}

a.but:hover {
    background-color: var(--color-grey-dark);
    color: var(--color-nav-hover-text);
    text-decoration: underline;
}

a.but:active {
    color: var(--color-white);
    text-decoration: none;
}

/* ============================================================
   Slideshow Banner
   ============================================================ */
.slideshow-banner {
    line-height: 0;
}

.slideshow-banner img {
    width: 100%;
    height: auto;
    min-height: 60px;
    object-fit: cover;
}

/* ============================================================
   Content Grid (main + sidebar)
   ============================================================ */
.content-grid {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: var(--content-gap);
    padding: 16px 0;
}

/* ============================================================
   Main Content
   ============================================================ */
#main-content {
    min-width: 0;
    overflow-x: auto;
}

/* Prevent content tables from causing horizontal scroll */
#main-content table {
    max-width: 100%;
}

#main-content center {
    overflow-x: auto;
}

#main-content p {
    text-align: justify;
    margin: 0 0 1em;
    line-height: 1.65;
}

#main-content img {
    max-width: 100%;
    height: auto;
}

.image-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 1.5em 0;
}

.image-card {
    text-align: center;
}

.image-card img {
    border: 1px solid #808080;
}

.image-center {
    text-align: center;
    margin: 1.5em 0;
}

.image-center img {
    border: 1px solid #808080;
}

.twitter-embed {
    text-align: center;
    margin: 1.5em 0;
    border: 1px solid var(--color-wine);
    padding: 4px;
    display: inline-block;
}

/* ============================================================
   Typography
   ============================================================ */
h1 {
    font-family: var(--font-body);
    font-size: 1.6em;
    font-weight: bold;
    color: var(--color-green);
    margin: 0.8em 0 0.4em;
    line-height: 1.3;
}

h2 {
    font-family: var(--font-body);
    font-size: 1.35em;
    font-weight: bold;
    color: var(--color-green);
    text-align: center;
    margin: 0.8em 0 0.4em;
    line-height: 1.3;
}

h3 {
    font-family: var(--font-body);
    font-size: 1.15em;
    font-weight: bold;
    color: var(--color-green);
    margin: 1em 0 0.4em;
    line-height: 1.3;
}

h4 {
    font-family: var(--font-ui);
    font-size: 1em;
    font-weight: bold;
    color: var(--color-green);
    margin: 1em 0 0.3em;
}

hr {
    border: none;
    height: 1px;
    background-color: var(--color-green);
    margin: 1.5em 0;
}

/* ============================================================
   Lists
   ============================================================ */
li {
    list-style-image: url('../images/art/red_wine_glass.png');
    line-height: 1.6;
    margin-bottom: 0.3em;
}

ul, ol {
    padding-left: 2em;
    margin: 0.8em 0;
}

/* ============================================================
   Links
   ============================================================ */
a:link {
    color: var(--color-link);
    text-decoration: underline;
}

a:visited {
    color: var(--color-green);
    text-decoration: underline;
}

a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

a:active {
    color: var(--color-green);
    text-decoration: underline;
}

a.ss:link, a.ss:visited {
    color: var(--color-green);
    text-decoration: underline;
}

a.ss:hover {
    color: var(--color-link-hover);
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Currency widget */
.currency-widget {
    text-align: center;
}

.currency-inner {
    border: 1px solid #000;
    background: var(--color-white);
    padding: 10px;
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--color-wine);
}

.currency-note {
    font-size: 12px;
    margin: 4px 0 0;
}

/* Sidebar buttons */
.sidebar-button {
    display: block;
    padding: 10px 8px;
    background-color: var(--color-button-bg);
    border: 1px solid #000;
    text-align: center;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: bold;
    color: var(--color-wine);
    text-decoration: none;
    font-style: italic;
    line-height: 1.4;
}

.sidebar-button:link,
.sidebar-button:visited {
    color: var(--color-wine);
    text-decoration: none;
}

.sidebar-button:hover {
    text-decoration: underline;
    color: var(--color-wine);
}

/* Events panel */
.events-panel {
    border: 1px solid var(--color-wine);
}

.events-panel h2 {
    margin: 0;
    padding: 8px;
    background-color: var(--color-button-bg);
    color: var(--color-wine);
    font-size: 1.1em;
}

.event-item {
    padding: 0;
    background: var(--color-white);
}

.event-item.event-heading {
    background-color: var(--color-button-bg);
    color: var(--color-wine);
    padding: 8px;
    text-align: center;
    font-size: 13px;
}

.event-item .event {
    font-size: 13px;
    text-align: justify;
    padding: 8px;
    margin: 0;
    line-height: 1.5;
}

/* Sidebar photo */
.sidebar-photo {
    text-align: center;
}

.sidebar-photo img {
    border: 1px solid #808080;
    max-width: 100%;
    height: auto;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
    border-top: 1px solid var(--color-green);
    margin-top: 12px;
    padding-top: 16px;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-button {
    display: block;
    padding: 10px 12px;
    background-color: var(--color-button-bg);
    border: 1px solid #000;
    text-align: center;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: bold;
    color: var(--color-wine);
    text-decoration: none;
    font-style: italic;
    line-height: 1.4;
    min-width: 140px;
}

.footer-button:link, .footer-button:visited {
    color: var(--color-wine);
    text-decoration: none;
}

.footer-button:hover {
    text-decoration: underline;
    color: var(--color-wine);
}

.footer-info {
    text-align: center;
    font-size: 13px;
    flex: 1;
    line-height: 1.5;
}

.footer-hours {
    padding: 8px 12px;
    background-color: var(--color-button-bg);
    border: 1px solid #000;
    text-align: center;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: bold;
    color: var(--color-wine);
    line-height: 1.4;
    min-width: 140px;
}

/* ============================================================
   Utility classes used in page content (from app.js)
   ============================================================ */
.sp2 {
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--color-green);
    font-weight: bold;
    text-align: center;
    margin-top: 8px;
}

.add {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--color-wine);
    font-weight: bold;
}

a.add:link {
    font-style: italic;
    color: var(--color-wine);
    text-decoration: none;
}

a.add:hover {
    text-decoration: underline;
}

a.add:visited {
    color: var(--color-wine);
    text-decoration: none;
}

/* Wine-list classes used by app.js page content */
.sor {
    font-family: var(--font-ui);
    font-size: 12px;
    color: #ff0000;
    font-weight: bold;
    float: right;
    margin: 0;
}

.so {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--color-green);
    font-weight: bold;
    float: right;
    margin: 0;
}

.sol {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--color-green);
    float: right;
    margin-left: 10px;
}

.bd {
    font-family: var(--font-ui);
    font-size: 12px;
    color: #000;
    font-weight: bold;
    float: right;
    margin: 0;
}

.hb {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--color-green);
    font-weight: bold;
    float: right;
    margin: 0;
}

.g {
    font-family: var(--font-ui);
    font-size: 12px;
    color: #00c000;
    font-weight: bold;
    margin: 0;
}

.r {
    font-family: var(--font-ui);
    font-size: 12px;
    color: #ff0000;
    font-weight: bold;
    margin: 0;
}

.or {
    font-family: var(--font-ui);
    font-size: 12px;
    color: #ed510d;
    font-weight: bold;
    margin: 0;
}

/* ============================================================
   Lightbox
   ============================================================ */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    border: 2px solid var(--color-tan);
}

.lightbox-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 30px;
    height: 30px;
    background-color: var(--color-wine);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background-color: #990000;
}

/* ============================================================
   Product Grid & Filters
   ============================================================ */

/* Filter bar */
.product-filters {
    margin-bottom: 16px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filter-btn {
    padding: 8px 16px;
    background-color: var(--color-button-bg);
    border: 1px solid var(--color-green);
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: bold;
    color: var(--color-green);
    cursor: pointer;
}

.filter-btn.active {
    background-color: var(--color-green);
    color: var(--color-white);
}

.filter-btn:hover {
    background-color: var(--color-green);
    color: var(--color-white);
}

.filter-select {
    padding: 7px 10px;
    border: 1px solid var(--color-green);
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--color-green);
    background: var(--color-white);
    cursor: pointer;
    min-width: 140px;
}

/* Product count */
.product-count {
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--color-grey-dark);
    margin-bottom: 12px;
}

/* Loading state */
.product-loading {
    text-align: center;
    font-style: italic;
    color: var(--color-grey-dark);
    padding: 40px 0;
}

/* Grid layout */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Product card */
.product-card {
    border: 1px solid var(--color-tan);
    background: var(--color-white);
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    border-color: var(--color-wine);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.product-card-img {
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #f5f5f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-no-img {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--color-grey-dark);
}

.product-card-info {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card-title {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: bold;
    color: var(--color-green);
    margin: 0 0 4px;
    text-align: left;
    line-height: 1.3;
}

.product-card-meta {
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--color-grey-dark);
    margin: 0 0 6px;
    text-align: left;
}

.product-card-price {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: bold;
    color: var(--color-wine);
    margin: auto 0 0;
    text-align: left;
}

/* Product detail overlay */
.product-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.product-detail-inner {
    position: relative;
    background: var(--color-white);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    border: 2px solid var(--color-tan);
}

.product-detail-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--color-green);
    cursor: pointer;
    line-height: 1;
}

.product-detail-close:hover {
    color: var(--color-wine);
}

.product-detail-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 24px;
    align-items: start;
}

.product-detail-img img {
    width: 100%;
    height: auto;
    border: 1px solid var(--color-tan);
}

.product-detail-text h2 {
    text-align: left;
    margin-top: 0;
    font-size: 1.2em;
}

.product-detail-price {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: bold;
    color: var(--color-wine);
    margin: 0 0 12px;
}

.product-detail-desc {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.product-detail-tags {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--color-grey-dark);
    margin-bottom: 12px;
}

.product-detail-order {
    font-size: 13px;
    padding: 10px;
    background: var(--color-cream);
    border: 1px solid var(--color-tan);
}

/* ============================================================
   Responsive: Tablet (below 768px)
   ============================================================ */
@media (max-width: 768px) {
    .site-wrapper {
        margin: 0;
        padding: 12px;
        border-width: 0;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .sidebar {
        border-top: 1px solid var(--color-tan);
        padding-top: 20px;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-button,
    .footer-hours {
        width: 100%;
        max-width: 240px;
    }

    .image-row {
        flex-direction: column;
        align-items: center;
    }

    /* Product grid: 2 columns on tablet */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-detail-layout {
        grid-template-columns: 180px 1fr;
    }
}

/* ============================================================
   Responsive: Mobile (below 480px)
   ============================================================ */
@media (max-width: 480px) {
    /* Show hamburger, collapse nav */
    .hamburger {
        display: flex;
    }

    .nav-links-wrapper {
        display: none;
    }

    .nav-links-wrapper.open {
        display: block;
    }

    .nav-row {
        flex-direction: column;
    }

    a.but,
    a.but:link,
    a.but:visited {
        min-width: auto;
        padding: 10px 16px;
        justify-content: flex-start;
        text-align: left;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }

    .header-inner {
        flex-wrap: wrap;
    }

    .logo-link img {
        max-width: 240px;
    }

    .site-wrapper {
        padding: 8px;
    }

    .content-grid {
        padding: 8px 0;
    }

    #main-content p {
        text-align: left;
        font-size: 14px;
    }

    h1 { font-size: 1.3em; }
    h2 { font-size: 1.2em; }
    h3 { font-size: 1.05em; }

    /* Product grid: 1 column on mobile */
    .product-grid {
        grid-template-columns: 1fr;
    }

    .product-detail-layout {
        grid-template-columns: 1fr;
    }

    .product-detail-img {
        max-width: 200px;
        margin: 0 auto;
    }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
    .site-nav,
    .hamburger,
    .slideshow-banner,
    .twitter-embed,
    .lightbox-overlay {
        display: none;
    }

    .site-wrapper {
        border: none;
        padding: 0;
        margin: 0;
        max-width: 100%;
        background-image: none;
    }

    body {
        background: none;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }
}
