/* style.css — shared look of the whole site.
   1. THEMES      each theme is one block of variables
   2. BASE        page, links
   3. COMPONENTS  card, panel, buttons, track, modal — written once, themed by the variables
   4. SHELL       header, settings + sound popovers
   5. PAGES       home, blog/media feed, store
   6. THEME EXTRAS  the few things a theme does beyond colours (header + nav shape, glass gloss)
   Secret modules bring their own stylesheet (modules/<name>/) and use the same variables,
   so they pick up every theme for free. */


/* ============================================================
   1. THEMES — to add a theme, copy a block and change the values
   ============================================================ */
:root, [data-theme="aero"] {
    --font: 'Segoe UI', 'Helvetica Neue', 'Lucida Grande', Arial, sans-serif;
    --text: #082c38;
    --page-color: transparent;
    /* barely-there aqua wash so the actual photo shows through */
    --page-bg:
        linear-gradient(180deg, rgba(200, 245, 255, 0.08) 0%, rgba(130, 215, 245, 0.06) 50%, rgba(200, 250, 255, 0.12) 100%),
        url('../assets/background.webp');

    --link: #0a5c4a;
    --link-hover: #12907a;
    --link-visited: #4c6b3a;
    --link-decoration: none;

    --accent: #0a5c4a;
    --accent-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
    --heading-weight: 400;
    --rule: linear-gradient(90deg, transparent, rgba(30, 130, 100, 0.4), transparent);
    --rule-height: 1px;

    /* card: the main content box */
    --card-bg: linear-gradient(165deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.20) 45%, rgba(210, 245, 255, 0.18) 70%, rgba(255, 255, 255, 0.28) 100%);
    --card-blur: blur(16px) saturate(1.6);
    --card-border: 1px solid rgba(255, 255, 255, 0.6);
    --card-radius: 12px;
    --card-shadow: 0 10px 36px rgba(0, 50, 80, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -1px 0 rgba(255, 255, 255, 0.18);
    --card-heading: #0a5c4a;

    /* panel: anything floating above the page (popovers, modals, command panel) */
    --panel-bg: linear-gradient(180deg, rgba(230, 250, 240, 0.7) 0%, rgba(180, 230, 210, 0.6) 100%);
    --panel-blur: blur(35px) saturate(1.8);
    --panel-border: 1px solid rgba(255, 255, 255, 0.65);
    --panel-radius: 14px;
    --panel-shadow: 0 24px 70px rgba(0, 60, 45, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    --panel-text: #0a2e2a;
    --panel-rule: rgba(100, 150, 130, 0.4);
    --backdrop-bg: rgba(10, 50, 40, 0.4);
    --backdrop-blur: blur(4px);

    /* buttons */
    --btn-bg: linear-gradient(180deg, #d5f5e3 0%, #66c9a5 48%, #2a8f75 52%, #52b788 100%);
    --btn-bg-hover: var(--btn-bg);
    --btn-hover-filter: brightness(1.1);
    --btn-border: 1px solid #1e6b57;
    --btn-radius: 6px;
    --btn-text: #ffffff;
    --btn-text-shadow: 0 1px 1px rgba(0, 40, 30, 0.5);
    --btn-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 1px 3px rgba(0, 60, 45, 0.3);
    --btn-disabled-bg: linear-gradient(180deg, #d5d5d5, #a5a5a5);
    --btn-disabled-text: #f0f0f0;
    --btn-disabled-border: #888;
    --close-bg: linear-gradient(180deg, #ff9a8b, #d34d3d 50%, #b53222 51%, #e96a58 100%);
    --close-bg-hover: var(--close-bg);
    --close-border: 1px solid #7a1a0e;
    --close-text: #ffffff;
    --go-bg: linear-gradient(180deg, #b8ecc0 0%, #52b775 48%, #2a8548 52%, #6cbf88 100%);
    --go-border: 1px solid #1a601a;
    --icon-btn-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, rgba(210, 245, 230, 0.3) 100%);
    --icon-btn-bg-hover: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(210, 245, 230, 0.45) 100%);
    --icon-btn-blur: blur(20px) saturate(1.6);
    --icon-btn-border: 1px solid rgba(255, 255, 255, 0.65);
    --icon-btn-text: #0a5c4a;
    --icon-btn-shadow: 0 4px 12px rgba(0, 70, 50, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.8);

    /* track + fill: gauges, progress bars */
    --track-bg: linear-gradient(180deg, rgba(180, 210, 200, 0.55), rgba(220, 245, 235, 0.65));
    --track-border: 1px solid rgba(100, 150, 130, 0.5);
    --track-radius: 5px;
    --track-shadow: inset 0 1px 3px rgba(0, 60, 45, 0.18);
    --fill-bg: linear-gradient(180deg, #b3f5e1 0%, #3ec9a7 48%, #10827a 52%, #4de8c5 100%);
    --fill-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
    --slider-accent: #2a8f75;

    /* content images */
    --img-border: 1px solid rgba(255, 255, 255, 0.7);
    --img-radius: 8px;
    --img-shadow: 0 3px 10px rgba(0, 60, 45, 0.2);
}

[data-theme="90s"] {
    --font: 'Times New Roman', serif;
    --text: #ddd;
    --page-color: #222;
    --page-bg: url('../assets/background.webp');

    --link: #8ab4f8;
    --link-hover: #8ab4f8;
    --link-visited: #c58af9;
    --link-decoration: underline;

    --accent: #d4b450;
    --accent-shadow: none;
    --heading-weight: bold;
    --rule: #555;
    --rule-height: 2px;

    --card-bg: #333;
    --card-blur: none;
    --card-border: 2px solid #555;
    --card-radius: 0;
    --card-shadow: none;
    --card-heading: inherit;

    --panel-bg: #333;
    --panel-blur: none;
    --panel-border: 2px solid #555;
    --panel-radius: 0;
    --panel-shadow: 4px 4px 0 #111;
    --panel-text: #ddd;
    --panel-rule: #555;
    --backdrop-bg: rgba(0, 0, 0, 0.6);
    --backdrop-blur: none;

    --btn-bg: #d4b450;
    --btn-bg-hover: #a98f40;
    --btn-hover-filter: none;
    --btn-border: 1px solid #a98f40;
    --btn-radius: 0;
    --btn-text: #222;
    --btn-text-shadow: none;
    --btn-shadow: none;
    --btn-disabled-bg: #555;
    --btn-disabled-text: #888;
    --btn-disabled-border: #a98f40;
    --close-bg: #555;
    --close-bg-hover: #a98f40;
    --close-border: 1px solid #a98f40;
    --close-text: #ddd;
    --go-bg: #4CAF50;
    --go-border: 1px solid #4CAF50;
    --icon-btn-bg: #d4b450;
    --icon-btn-bg-hover: #a98f40;
    --icon-btn-blur: none;
    --icon-btn-border: 2px solid #a98f40;
    --icon-btn-text: #222;
    --icon-btn-shadow: 1px 1px 0 #222;

    --track-bg: #555;
    --track-border: 2px solid #a98f40;
    --track-radius: 0;
    --track-shadow: none;
    --fill-bg: #008080;
    --fill-shadow: none;
    --slider-accent: #d4b450;

    --img-border: 2px solid #555;
    --img-radius: 0;
    --img-shadow: none;
}


/* ============================================================
   2. BASE
   ============================================================ */
* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background-color: var(--page-color);
    background-image: var(--page-bg);
    background-size: cover;
    background-attachment: fixed;
    background-position: center center;
}

img { max-width: 100%; height: auto; }
iframe { max-width: 100%; }
button, input { font-family: inherit; }

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

/* Keyboard focus */
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }


/* ============================================================
   3. COMPONENTS
   ============================================================ */

/* Card */
.text-box {
    padding: 2em;
    margin-bottom: 2em;
    background: var(--card-bg);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border: var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}
.text-box h1, .text-box h2, .text-box h3 {
    color: var(--card-heading);
    font-weight: var(--heading-weight);
    text-shadow: var(--accent-shadow);
}
.text-box hr, .panel hr {
    border: 0;
    height: var(--rule-height);
    background: var(--rule);
}

/* Panel */
.panel {
    background: var(--panel-bg);
    backdrop-filter: var(--panel-blur);
    -webkit-backdrop-filter: var(--panel-blur);
    border: var(--panel-border);
    border-radius: var(--panel-radius);
    box-shadow: var(--panel-shadow);
    color: var(--panel-text);
}
.panel h2, .panel h3 {
    color: var(--accent);
    font-weight: var(--heading-weight);
    text-shadow: var(--accent-shadow);
}
/* bare "×" in a panel corner */
.panel-x {
    float: right;
    padding: 0;
    background: none;
    border: none;
    color: inherit;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

/* Buttons */
.btn {
    cursor: pointer;
    padding: 10px 20px;
    font-size: 1rem;
    background: var(--btn-bg);
    border: var(--btn-border);
    border-radius: var(--btn-radius);
    color: var(--btn-text);
    text-shadow: var(--btn-text-shadow);
    box-shadow: var(--btn-shadow);
}
.btn:hover:not(:disabled) { background: var(--btn-bg-hover); filter: var(--btn-hover-filter); }
.btn:disabled {
    cursor: not-allowed;
    background: var(--btn-disabled-bg);
    border-color: var(--btn-disabled-border);
    color: var(--btn-disabled-text);
    text-shadow: none;
}
.btn-close { background: var(--close-bg); border: var(--close-border); color: var(--close-text); }
.btn-close:hover:not(:disabled) { background: var(--close-bg-hover); }
.btn-go { background: var(--go-bg); border: var(--go-border); color: #ffffff; }
.btn-go:hover:not(:disabled) { background: var(--go-bg); filter: brightness(1.1); }

/* round icon button */
.icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    font-size: 1.1rem;
    background: var(--icon-btn-bg);
    backdrop-filter: var(--icon-btn-blur);
    -webkit-backdrop-filter: var(--icon-btn-blur);
    border: var(--icon-btn-border);
    border-radius: 50%;
    box-shadow: var(--icon-btn-shadow);
    color: var(--icon-btn-text);
    text-shadow: var(--accent-shadow);
}
.icon-btn:hover { background: var(--icon-btn-bg-hover); }

/* Track + fill */
.track {
    background: var(--track-bg);
    border: var(--track-border);
    border-radius: var(--track-radius);
    box-shadow: var(--track-shadow);
}
.fill {
    width: 0%;
    height: 100%;
    background: var(--fill-bg);
    border-radius: inherit;
    box-shadow: var(--fill-shadow);
}

/* Content images */
.content-img {
    border: var(--img-border);
    border-radius: var(--img-radius);
    box-shadow: var(--img-shadow);
}

/* YouTube (and other) embeds — fluid width, correct aspect ratio */
.media-embed {
    display: block;
    width: 100%;
    max-width: 900px;
    aspect-ratio: 16 / 9;
    height: auto;
    border: 0;
}

/* Modal (js/modal.js) */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10002;
    background: var(--backdrop-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
}
.modal.open { display: block; }
.modal-content {
    margin: 20% auto;
    padding: 20px;
    width: 80%;
    max-width: 400px;
    text-align: center;
}
.modal-x { font-size: 28px; font-weight: bold; }
.modal-buttons .btn { margin: 0.5em; }


/* ============================================================
   4. SHELL — header, settings + sound popovers (js/shell.js)
   ============================================================ */
.site-header { padding: 0.5em 2em; }
.site-header h1 { margin: 0.3em 0; }
.site-header h3 { margin: 0.3em 0; font-weight: normal; }
.site-nav { margin: 0.6em 0; }
.site-nav a { text-decoration: none; }
#motd { font-size: 1rem; font-style: italic; font-weight: normal; }

#settings-btn, #sound-btn { position: fixed; top: 12px; z-index: 10003; }
#settings-btn { right: 15px; }
#sound-btn { right: 62px; }

.popover {
    display: none;
    position: fixed;
    top: 60px;
    z-index: 10002;
}
.popover.open { display: block; }

#settings-panel { right: 15px; width: 240px; padding: 1.5em; }
#settings-panel h2 { margin-top: 0; font-size: 1.1rem; }
#settings-panel hr { margin-bottom: 1em; opacity: 0.6; }
#settings-panel p { margin: 0 0 0.5em; font-size: 0.85em; opacity: 0.7; }
#settings-panel .btn {
    display: block;
    width: 100%;
    padding: 8px 16px;
    font-size: 0.95rem;
    margin-bottom: 0.6em;
}

/* vertical volume rocker */
#sound-panel { right: 58px; width: 62px; padding: 0.9em 0.5em; }
#sound-panel.open {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7em;
}
.volume-wrap { position: relative; width: 28px; height: 110px; }
#bgm-volume {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110px;
    margin: 0;
    transform: translate(-50%, -50%) rotate(-90deg);
    cursor: pointer;
    accent-color: var(--slider-accent);
}
#mute-btn { width: 100%; padding: 5px 6px; font-size: 0.78rem; }


/* ============================================================
   5. PAGES
   ============================================================ */

/* Home */
.home { display: flex; padding: 2em; }
.column { flex: 1; padding: 1em; }
.home-side { display: flex; flex-direction: column; align-items: center; }
.home-icon {
    border-width: 3px;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

/* Blog + media */
.feed {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2em;
    padding: 2em;
}
.feed > .text-box { flex: 0 1 700px; }

/* Store */
.store-container { display: flex; padding: 2em; }
.products {
    flex: 3;
    padding-right: 2em;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2em;
    align-content: start;
}
@media (min-width: 900px) {
    .products { grid-template-columns: repeat(2, 1fr); }
}
.products > .text-box:first-child { grid-column: 1 / -1; }
.add-to-cart-btn { padding: 6px 14px; font-size: 0.85rem; }
.cart { flex: 1; padding: 1em; }
#cart-items { list-style: none; padding: 0; }
#cart-items li { margin-bottom: 0.5em; }
.cart-remove-btn {
    width: 22px;
    height: 22px;
    margin-right: 0.5em;
    padding: 0;
    line-height: 1;
    font-size: 0.9rem;
}
#checkout-btn { width: 100%; padding: 10px; margin-top: 1em; }

@media (max-width: 768px) {
    .home { flex-direction: column; }
    .column { padding: 0; }
    .store-container { flex-direction: column; }
    .products { padding-right: 0; }
    .cart { margin-top: 2em; }
}


/* ============================================================
   6. THEME EXTRAS — shape, not colour
   ============================================================ */

/* 90s: flat gold banner, bracketed text nav */
[data-theme="90s"] .site-header {
    background-color: #d4b450;
    border-bottom: 2px solid #a98f40;
    color: #222;
}
[data-theme="90s"] .site-nav { font-weight: bold; color: #111; }
[data-theme="90s"] .site-nav a { color: #111; text-decoration: underline; }
[data-theme="90s"] .site-nav a.nav-current {
    background-color: #222;
    color: #d4b450;
    text-decoration: none;
    padding: 0 6px;
}

/* Aero: sticky teal glass strip with a top gloss, nav as glass pills */
[data-theme="aero"] .site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    overflow: hidden;
    background: linear-gradient(180deg,
        rgba(45, 140, 130, 0.42) 0%,
        rgba(25, 105, 100, 0.36) 50%,
        rgba(40, 125, 115, 0.38) 51%,
        rgba(70, 165, 150, 0.42) 100%);
    backdrop-filter: blur(16px) saturate(1.7);
    -webkit-backdrop-filter: blur(16px) saturate(1.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow:
        0 6px 24px rgba(0, 60, 45, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        inset 0 -1px 0 rgba(0, 40, 30, 0.2);
    color: #e8fff5;
    text-shadow: 0 1px 2px rgba(0, 40, 30, 0.5);
}
[data-theme="aero"] .site-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}
[data-theme="aero"] .site-header > * { position: relative; z-index: 1; }
[data-theme="aero"] .site-header h1 {
    color: #ffffff;
    font-weight: 300;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 40, 30, 0.6), 0 0 24px rgba(255, 255, 255, 0.4);
}
[data-theme="aero"] .site-nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
[data-theme="aero"] .site-nav .nav-bracket,
[data-theme="aero"] .site-nav .nav-sep { display: none; }
[data-theme="aero"] .site-nav a {
    display: inline-block;
    padding: 5px 16px;
    color: #ffffff;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.05) 51%,
        rgba(255, 255, 255, 0.3) 100%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 4px;
    text-shadow: 0 1px 1px rgba(0, 40, 30, 0.5);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 40, 30, 0.2);
    transition: all 0.15s ease;
}
[data-theme="aero"] .site-nav a:hover {
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.6) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.2) 51%,
        rgba(255, 255, 255, 0.45) 100%);
}
[data-theme="aero"] .site-nav a.nav-current {
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.7) 0%,
        rgba(255, 255, 255, 0.5) 50%,
        rgba(255, 255, 255, 0.4) 51%,
        rgba(255, 255, 255, 0.6) 100%);
    color: #0a5c4a;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
    box-shadow: inset 0 1px 3px rgba(0, 40, 30, 0.25), 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Aero cards: soft top gloss, plus a diagonal specular streak that sweeps
   across on hover like light on glass */
[data-theme="aero"] .text-box {
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
[data-theme="aero"] .text-box > * { position: relative; z-index: 1; }
[data-theme="aero"] .text-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 42%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.02) 100%);
    pointer-events: none;
}
[data-theme="aero"] .text-box::after {
    content: '';
    position: absolute;
    top: -80%;
    left: -35%;
    width: 55%;
    height: 260%;
    background: linear-gradient(100deg,
        transparent 20%,
        rgba(255, 255, 255, 0.22) 44%,
        rgba(255, 255, 255, 0.38) 50%,
        rgba(255, 255, 255, 0.08) 58%,
        transparent 80%);
    transform: rotate(10deg);
    pointer-events: none;
    transition: left 0.7s ease;
}
[data-theme="aero"] .text-box:hover::after { left: 115%; }
[data-theme="aero"] .text-box:hover {
    transform: translateY(-2px);
    box-shadow:
        0 14px 42px rgba(0, 50, 80, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 rgba(255, 255, 255, 0.18);
}
@media (prefers-reduced-motion: reduce) {
    [data-theme="aero"] .text-box,
    [data-theme="aero"] .text-box:hover,
    [data-theme="aero"] .text-box::after { transition: none; transform: none; }
}
