/* Full Screen Foundation for Signage */
html:has(body.is-signage),
body.is-signage {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

html:not(:has(body.is-signage)),
body:not(.is-signage) {
    min-height: 100%;
    height: auto;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

:root {
    /* --- CONFIGURABLE VARIABLES --- */
    /* These are the defaults, but they will be overwritten by script.js from config.json */

    /* Fonts */
    --font-drink-name: 'Lora', serif;
    --font-brewery: 'Lora', serif;
    --font-details: 'Lora', serif;
    --font-number: 'Oswald', sans-serif;
    --font-price: 'Oswald', sans-serif;

    /* Font Colors */
    --color-font-drink-name: #E6DCD2;
    --color-font-brewery: #E6C251;
    --color-font-details: #D3B99E;
    --color-font-number: #D38C6C;
    --color-font-price: #E6DCD2;
    --color-font-price-amount: #D3B99E;

    /* Font Scales */
    --font-scale-drink-name: 1;
    --font-scale-brewery: 1;
    --font-scale-details: 1;
    --font-scale-number: 1;
    --font-scale-price: 1;

    /* Theme Colors */
    --color-page-bg: #382C27;
    --color-item-bg: #4A3A34;
    --color-item-border: #5A4B45;
    --color-header-bg: #2F2420;
    --color-header-text: #D3B99E;
    --color-separator: #B5A79E;

    /* Layout */
    --layout-tap-number-width: 2.0vw;
    --layout-tap-number-padding: 0.8vw;
    --layout-item-gap: 0.3vw;
    --layout-marquee-duration: 8s;
    --layout-marquee-timing: ease-in-out;

    /* --- NON-CONFIGURABLE VARS --- */
    /* These can be derived or are fixed */
    --font-body: var(--font-details);
    /* Body font defaults to details font */
    --color-body-text: var(--color-font-details);
}

/* General Body & Font Styling - Earthy and Rustic */
body {
    background-color: var(--color-page-bg);
    color: var(--color-body-text);
    font-family: var(--font-body);
    padding: 1vh 1vw;
    box-sizing: border-box;
}

/* Page Container for Flexbox Layout */
.page-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
}

h1,
h2,
h3,
p {
    margin: 0;
}

/* Header: Adjusted for fluid layout */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5vw;
    background-color: var(--color-header-bg);
    padding: 1vh 1.5vw;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
    border-bottom: 5px solid var(--color-item-border);
    flex-shrink: 0;
    z-index: 10;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* NEW: Rule to hide header from config */
body.live-header-hidden .main-header {
    display: none;
}


.logo {
    max-height: 8vh;
    /* Adjusted slightly if needed */
    width: auto;
    filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.4));
}

.controls-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.next-up-container {
    border: 2px solid #6E8B63;
    padding: 0.8vh 1.2vw;
    /* Slightly smaller padding */
    border-radius: 10px;
    background-color: var(--color-page-bg);
    text-align: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.next-up-container h2 {
    font-size: 1.6rem;
    /* Reduced */
    font-family: 'Oswald', sans-serif;
    color: var(--color-header-text);
}

.next-up-container p {
    font-size: 1.3rem;
    /* Reduced */
    color: var(--color-header-text);
    font-family: var(--font-body);
}

/* Main content area will fill remaining space */
.main-content {
    flex-grow: 1;
    min-height: 0;
    padding-top: 1vh;
}

/* Main Grid for Taps */
.tap-list-grid {
    display: grid;
    height: 100%;
    grid-auto-flow: column;
    gap: 0.8vh 0.8vw;
}

/* Individual Menu Item Styling */
.tap-item {
    background-color: var(--color-item-bg);
    border-radius: 10px;
    padding: 1vh 0.8vw;
    display: flex;
    align-items: stretch;
    gap: var(--layout-item-gap);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    border: 2px solid var(--color-item-border);
    border-left: 10px solid var(--type-color, var(--color-item-border));
    /* Slightly thinner border */
}

.tap-item-number {
    font-family: var(--font-number);
    /* Reduced base font size */
    font-size: calc(2.5rem * var(--font-scale-number));
    color: var(--color-font-number);
    border-right: 2px solid var(--color-item-border);
    padding-right: var(--layout-tap-number-padding);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--layout-tap-number-width);
    min-width: 15px;
    /* Adjusted min-width */
}

.tap-item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2vh;
    /* Slightly reduced gap */
    padding: 0;
    overflow: hidden;
    min-width: 0;
}

/* Drink Info Rows */
.detail-row-1 {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    overflow: hidden;
}

.drink-name {
    font-family: var(--font-drink-name);
    /* Reduced base font size */
    font-size: calc(1.5rem * var(--font-scale-drink-name));
    color: var(--color-font-drink-name);
    white-space: nowrap;
    flex-shrink: 0;
}

.name-separator {
    font-family: var(--font-drink-name);
    /* Reduced base font size */
    font-size: calc(1.5rem * var(--font-scale-drink-name));
    color: var(--color-separator);
    margin: 0 0.4vw;
    flex-shrink: 0;
}

.brewery-marquee-window {
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
}

.brewery-name {
    font-family: var(--font-brewery);
    color: var(--color-font-brewery);
    /* Reduced base font size */
    font-size: calc(1.5rem * var(--font-scale-brewery));
    white-space: nowrap;
    transform: translateX(0);
    display: inline-block;
}

.brewery-marquee-window.is-overflowing .brewery-name {
    animation: scrollTitle var(--layout-marquee-duration) var(--layout-marquee-timing) infinite alternate;
}

/* NEW: Rule to disable marquee */
body.marquee-disabled .brewery-marquee-window.is-overflowing .brewery-name {
    animation: none !important;
}


.detail-row-2 {
    font-family: var(--font-details);
    /* Reduced base font size */
    font-size: calc(1.1rem * var(--font-scale-details));
    color: var(--color-font-details);
    font-weight: bold;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0;
}

.detail-row-2 .abv {
    margin-left: 0.4em;
}

.detail-row-2 .location {
    font-style: italic;
    color: #B5A79E;
    font-weight: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    padding-right: 0.2em;
}

.location-separator {
    font-family: var(--font-details);
    color: var(--color-separator);
    margin: 0 0.8em;
    flex-shrink: 0;
    font-weight: normal;
}


/* Right Column Container */
.tap-item-right-column {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.8vw;
    /* Slightly reduced gap */
    flex-shrink: 0;
    margin-left: auto;
}

.price-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-family: var(--font-price);
    white-space: nowrap;
    flex-shrink: 0;
    text-align: center;
}

.price-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1vh;
}

.price-size {
    /* Reduced base font size */
    font-size: calc(1.3rem * var(--font-scale-price));
    font-weight: bold;
    color: var(--color-font-price);
}

.price-amount {
    /* Reduced base font size */
    font-size: calc(1.1rem * var(--font-scale-price));
    color: var(--color-font-price-amount);
}


.keg-level-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 0.8vw;
    /* Slightly narrower */
    min-width: 12px;
    /* Adjusted min-width */
}

.keg-level-label {
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    /* Reduced */
    color: var(--color-font-details);
    margin-bottom: 0.3vh;
    white-space: nowrap;
}

.keg-level-bar {
    width: 100%;
    height: 75%;
    /* Slightly shorter */
    background-color: var(--color-header-bg);
    border: 1px solid var(--color-item-border);
    /* Thinner border */
    border-radius: 6px;
    /* Adjusted radius */
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.keg-level-fill {
    width: 100%;
    background: linear-gradient(to top, #6E8B63, #4E6941);
    transition: height 0.5s ease-in-out, background-color 0.5s ease-in-out;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keg-level-fill.medium {
    background: linear-gradient(to top, #D3B99E, #B99C7E);
}

.keg-level-fill.low {
    background: linear-gradient(to top, #B25F4C, #8C4436);
}

.unavailable-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(47, 36, 32, 1.0);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--color-header-text);
    font-family: 'Oswald', sans-serif;
    font-size: 1.8rem;
    /* Reduced */
    text-align: center;
    z-index: 10;
}


/* Keyframe animation for scrolling */
@keyframes scrollTitle {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(var(--scroll-amount));
    }
}

/* --- Responsive Scrolling for Mobile/Tablet or Non-Signage Web --- */
@media (max-width: 1200px) {

    html:has(body.is-signage),
    body.is-signage {
        height: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

body:not(.is-signage) .page-container {
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

body:not(.is-signage) .tap-list-grid {
    height: auto;
}

body:not(.is-signage) .tap-item {
    min-height: 110px;
}

@media (max-width: 1200px) {
    .page-container {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .tap-list-grid {
        height: auto;
        /* Allow grid to grow */
    }

    /* Ensure items have a minimum height so they don't get crushed */
    .tap-item {
        min-height: 110px;
    }
}

/* ========================================= */
/* WEB DISPLAY / NON-SIGNAGE CONSISTENT SIZING */
/* ========================================= */
body:not(.is-signage) {
    /* Fluid Layout Geometry: clamp(MIN, FLUID_RATE, MAX) */
    /* Smoothly expands the column widths & gaps as the screen grows */
    --layout-tap-number-width: clamp(35px, 6vw, 60px);
    --layout-tap-number-padding: clamp(8px, 1.5vw, 15px);
    --layout-item-gap: clamp(8px, 1.5vw, 15px);
}

/* Fluid Typography overrides for Web Views */
body:not(.is-signage) .tap-item-number {
    font-size: clamp(1.5rem, 1rem + 2.5vw, 2.5rem);
}

body:not(.is-signage) .drink-name,
body:not(.is-signage) .name-separator,
body:not(.is-signage) .brewery-name {
    font-size: clamp(1rem, 0.5rem + 1.5vw, 1.5rem);
}

body:not(.is-signage) .detail-row-2 {
    font-size: clamp(0.75rem, 0.4rem + 1vw, 1.1rem);
}

body:not(.is-signage) .price-size {
    font-size: clamp(0.9rem, 0.5rem + 1.2vw, 1.3rem);
}

body:not(.is-signage) .price-amount {
    font-size: clamp(0.8rem, 0.5rem + 1vw, 1.1rem);
}