/* Ernest Bluff — Base structural CSS with custom properties */

:root {
    --color-bg: #fff;
    --color-body-bg: #fff;
    --color-header-bg: #b3c6e7;
    --color-header-text: #fff;
    --header-image: url('/images/bluff_title_1.jpg');
    --header-height: 325px;
    --color-title-bar-bg: #728a75;
    --color-title-bar-text: #fff;
    --color-menu-bg: #728a75;
    --color-menu-text: #fff;
    --color-menu-hover: #526a55;
    --color-menu-hover-text: #ee4;
    --color-container-border: #728a75;
    --color-footer-bg: #af6c21;
    --color-footer-text: #fff;
    --color-helper-footer-bg: #453117;
    --color-helper-footer-text: #fff;
}

@font-face {
    font-family: 'Alegreya';
    src: url('/fonts/Alegreya/Alegreya-VariableFont_wght.ttf') format('truetype'),
        url('/fonts/Alegreya/Alegreya-Italic-VariableFont_wght.ttf') format('truetype');
}
@font-face {
    font-family: 'Alegreya SC';
    src: url('/fonts/Alegreya_SC/AlegreyaSC-Regular.ttf') format('truetype'),
        url('/fonts/Alegreya_SC/AlegreyaSC-Black.ttf') format('truetype'),
        url('/fonts/Alegreya_SC/AlegreyaSC-Bold.ttf') format('truetype'),
        url('/fonts/Alegreya_SC/AlegreyaSC-Italic.ttf') format('truetype'),
        url('/fonts/Alegreya_SC/AlegreyaSC-REgular.ttf') format('truetype');
}

html {
    background-color: var(--color-bg);
}

body {
    font-family: 'Alegreya', Times, serif, sans-serif;
    margin: 0 auto;
    max-width: 1250px;
    padding-bottom: 90px;
    box-sizing: border-box;
    background-color: var(--color-body-bg);
}

/* Header wrapper link — no default link decoration or color */
a:has(> header) {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Header — flex column to stack title bar above image */
header {
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

/* Title bar — sits above the header image */
.site-title-bar {
    width: 100%;
    padding: 0.6em 1rem;
    background-color: var(--color-title-bar-bg);
    color: var(--color-title-bar-text);
    text-align: center;
    box-sizing: border-box;
}

.site-title-bar .title {
    font-size: clamp(1.2rem, 4vw, 2rem);
    margin: 0;
    padding: 0;
    word-break: break-word;
}

.site-title-bar .subtitle {
    font-size: clamp(0.75rem, 2vw, 1rem);
    margin: 0.25em 0 0;
    padding: 0;
}

/* Header image — purely visual, no text */
.header-image {
    width: 100%;
    height: clamp(120px, 25vw, var(--header-height));
    background-image: var(--header-image);
    background-color: var(--color-header-bg);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    box-sizing: border-box;
}

/* Menu styles */
.menu {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background: var(--color-menu-bg);
    min-height: 48px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}

/* Hamburger toggle button */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 48px;
    height: 48px;
    padding: 8px;
    margin-left: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 2;
}

.menu-toggle__bar {
    display: block;
    width: 26px;
    height: 3px;
    background-color: var(--color-menu-text);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger to X animation */
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) {
    opacity: 0;
}
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Menu items container */
.menu-items {
    width: 100%;
    display: flex;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

/* Expand when menu is open */
.menu.menu-open .menu-items {
    max-height: 500px;
}

.menu-button {
    width: 100%;
    margin: 0;
    padding: 0.6em 1em;
    background: var(--color-menu-bg);
    color: var(--color-menu-text);
    border-radius: 0;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2em;
    text-align: left;
    transition: background 0.2s;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    box-sizing: border-box;
}

.menu-button:hover {
    background: var(--color-menu-hover);
    color: var(--color-menu-hover-text);
}

/* Container & Content */
#container {
    margin-top: 0;
    background-color: var(--color-body-bg);
    border: none;
    border-radius: 0;
    padding: 0;
}

#content {
    padding: 16px 12px;
}

/* Footer styles */
#site-footer {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border-radius: 0;
    font-size: 0.9rem;
}

/* Helper footer styles */
#helper-footer {
    width: 100%;
    min-height: 50px;
    padding: 6px 12px;
    background: var(--color-helper-footer-bg);
    color: var(--color-helper-footer-text);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2px 12px;
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 100;
    box-sizing: border-box;
    font-size: 0.8rem;
}

#helper-footer .subtitle {
    margin: 0;
    font-size: inherit;
}

/* Dev footer styles */
.dev-footer {
    background: #ffd;
}

#dev-footer-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    width: 100%;
    padding: 4px 8px;
    box-sizing: border-box;
}

#dev-footer-form label {
    font-size: 0.85rem;
}

#dev-footer-form input[type="number"] {
    width: 50px;
}

#dev-footer-status {
    color: green;
}

/* First-time modal */
#first-time-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
}

#first-time-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 1.5em;
    border-radius: 10px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
    width: calc(100% - 32px);
    max-width: 400px;
    text-align: center;
    box-sizing: border-box;
}

#first-time-modal h2 {
    font-size: 1.4rem;
    margin: 0 0 0.5em;
}

#first-time-modal p {
    font-size: 1rem;
    margin: 0 0 1em;
}

#first-time-accept {
    padding: 0.6em 2em;
    font-size: 1.1em;
    cursor: pointer;
    border: 2px solid #333;
    border-radius: 5px;
    background: #fff;
    min-height: 44px;
    margin-top: 0;
}

/* Character picker overlay */
.chatbot-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-picker {
    background: #222;
    color: #fff;
    max-width: 360px;
    width: 90vw;
    border-radius: 12px;
    box-shadow: 0 4px 32px #000;
    padding: 20px;
    text-align: center;
}

.chatbot-picker__title {
    margin: 0 0 16px;
    font-size: 1.2em;
}

.chatbot-picker__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.chatbot-picker__character {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    background: #333;
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 1em;
    font-family: inherit;
    transition: background 0.2s;
}

.chatbot-picker__character:hover {
    background: #728a75;
}

.chatbot-picker__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #555;
}

.chatbot-picker__name {
    font-weight: bold;
}

.chatbot-picker__cancel {
    padding: 8px 24px;
    background: none;
    border: 1px solid #555;
    border-radius: 6px;
    color: #aaa;
    cursor: pointer;
    font-size: 0.9em;
    font-family: inherit;
}

.chatbot-picker__cancel:hover {
    background: #333;
    color: #fff;
}

/* Tablet & Desktop overrides */
@media (min-width: 768px) {
    body {
        padding-bottom: 125px;
    }

    .menu {
        flex-wrap: nowrap;
        justify-content: space-evenly;
        min-height: 60px;
    }

    .menu-toggle {
        display: none;
    }

    .menu-items {
        display: flex;
        flex-direction: row;
        justify-content: space-evenly;
        max-height: none;
        overflow: visible;
        transition: none;
    }

    .menu-button {
        flex: 1;
        margin: 0 10px;
        padding: 0.25em 0;
        font-size: 1.6em;
        text-align: center;
        border-radius: 5px;
        border-top: none;
        min-width: 100px;
        width: auto;
    }

    #container {
        margin-top: 8px;
        border: 5px solid var(--color-container-border);
        border-radius: 14px;
        padding: 3px;
    }

    #content {
        padding: 20px;
    }

    #site-footer {
        height: 50px;
        min-height: unset;
        padding: 0;
        border-radius: 0 0 10px 10px;
        font-size: 1rem;
    }

    #helper-footer {
        height: 75px;
        min-height: unset;
        padding: 0 16px;
        font-size: 1rem;
        flex-wrap: nowrap;
        gap: 0 16px;
    }

    #dev-footer-form {
        flex-wrap: nowrap;
        gap: 1em;
        height: 100%;
        padding: 0;
    }

    #dev-footer-form label {
        font-size: 1rem;
    }

    #dev-footer-form input[type="number"] {
        width: 60px;
    }
}
