/**
 * shell.css - split-screen page shell (thailandfilm.events)
 *
 * Layout only: a fixed left panel and a scrolling right column. Colours and
 * type come from the active theme's tokens (pavilion.css by default).
 *
 * @version 1.1.0 - 2026-10-19: portrait key art shown whole, flush to the top of
 *                  the panel; indigo header bar on phones when it is present
 * @version 1.0.0 - 2026-10-19
 */

body.has-shell { margin: 0; }

.shell {
    display: grid;
    grid-template-columns: clamp(270px, 30vw, 390px) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---------- Panel ---------- */
.shell-panel {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--panel-bg, var(--accent-color));
    color: var(--panel-ink, var(--text-color));
    border-right: 1px solid var(--border-color);
    padding: 1.4rem 1.5rem calc(1.3rem + env(safe-area-inset-bottom, 0px));
    padding-left: max(1.5rem, env(safe-area-inset-left, 0px));
    gap: 1.1rem;
    scrollbar-width: thin;
}

.shell-panel-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.shell-brand {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.shell-brand-kicker {
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted-color);
}

.shell-brand-name {
    font-family: var(--display-font, Georgia, serif);
    font-size: clamp(1.25rem, 1.9vw, 1.7rem);
    font-weight: 500;
    line-height: 1.08;
    text-wrap: balance;
}

.shell-menu-toggle {
    display: none;
    background: none;
    color: inherit; /* buttons default to black text, not the bar's ink */
    border: 0;
    padding: 0.4rem;
    cursor: pointer;
    flex: 0 0 auto;
}

.shell-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    margin: 5px 0;
    transition: transform 0.25s, opacity 0.25s;
}

.shell-panel-body {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    flex: 1;
    min-height: 0;
}

/* Sized to the screen height, not the panel width, so the menu below it is
   always in view on a laptop (720-800px tall) without scrolling the panel. */
.shell-art {
    height: clamp(120px, 30vh, 440px);
    max-width: 100%;
    overflow: hidden;
    border-radius: 2px;
    background: var(--secondary-color);
    flex: 0 0 auto;
}

.shell-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.shell-art-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    background:
        linear-gradient(160deg, rgba(255,255,255,0.06), transparent 50%),
        linear-gradient(200deg, var(--primary-color), var(--secondary-color) 70%);
    color: var(--accent-color);
    font-family: var(--display-font, Georgia, serif);
    font-size: 1.1rem;
    line-height: 1.15;
}

.shell-meta {
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--muted-color);
}

.shell-meta-dates {
    color: var(--panel-ink, var(--text-color));
    font-weight: 600;
}

.shell-nav {
    display: flex;
    flex-direction: column;
    margin-top: auto;
}

.shell-nav a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.42rem 0;
    border-top: 1px solid var(--border-color);
    color: var(--panel-ink, var(--text-color));
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s, padding-left 0.2s;
}

.shell-nav a:last-child { border-bottom: 1px solid var(--border-color); }

.shell-nav a small {
    font-weight: 500;
    font-size: 0.78rem;
    color: var(--muted-color);
    font-variant-numeric: tabular-nums;
}

.shell-nav a:hover,
.shell-nav a.active { color: var(--primary-color); }
.shell-nav a.active { padding-left: 0.4rem; }

.shell-cta {
    display: block;
    text-align: center;
    padding: 0.85rem 1rem;
    text-decoration: none;
    font-weight: 700;
}

/* ---------- Right column ---------- */
.shell-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.shell-main > .main-content {
    flex: 1;
    min-height: 0;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.shell-footer {
    padding: 1.2rem max(16px, env(safe-area-inset-right, 0px)) calc(1.2rem + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    border-top: 1px solid var(--border-color);
    font-size: 0.78rem;
    color: var(--muted-color);
}

.shell-footer-line {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.8rem;
}

.shell-social { display: flex; gap: 0.9rem; }
.shell-social a { color: var(--muted-color); text-decoration: none; }
.shell-social a:hover { color: var(--primary-color); }

.admin-preview-strip {
    position: relative;
    z-index: 10000;
    background: #FFB300;
    color: #1A1A1A;
    font: 600 0.85rem/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-align: center;
    padding: 0.45rem 1rem;
}
.admin-preview-strip a { color: #1A1A1A; }

/* The stock pages wrap content at 1400px and give themselves padding;
   inside the shell they sit flush left. */
.shell-main .page-header { padding-top: 2rem; }

/* ---------- Phone ---------- */
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }

    .shell-panel {
        position: sticky;
        top: 0;
        z-index: 1000;
        height: auto;
        max-height: 100vh;
        overflow-y: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        padding: 0.9rem max(16px, env(safe-area-inset-right, 0px)) 0.9rem max(16px, env(safe-area-inset-left, 0px));
        gap: 1rem;
    }

    .shell-brand-name { font-size: 1.1rem; }
    .shell-menu-toggle { display: block; }

    .shell-panel-body { display: none; }
    .shell-panel.is-open .shell-panel-body { display: flex; padding-bottom: 0.5rem; }

    .shell-panel.is-open .shell-menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .shell-panel.is-open .shell-menu-toggle span:nth-child(2) { opacity: 0; }
    .shell-panel.is-open .shell-menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .shell-art { height: auto; aspect-ratio: 16 / 9; }
    .shell-nav { margin-top: 0; }
    .shell-main { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .shell-nav a, .shell-menu-toggle span { transition: none; }
}

/* ---------- Portrait key art (artwork with its own lettering) ---------- */
/* Never cropped. Flush to the panel's top and sides at its natural 2:3 shape;
   on a short screen it scales down (whole) so the menu stays in view. */
@media (min-width: 901px) {
    .shell-panel.has-poster { padding-top: 0; }
    .shell-panel.has-poster .shell-panel-top { display: none; }
    .shell-panel.has-poster .shell-meta-dates,
    .shell-panel.has-poster .shell-meta-where { display: none; }

    .shell-art--poster {
        flex: 1 1 0;
        min-height: 180px;
        height: auto;
        max-height: calc(clamp(270px, 30vw, 390px) * 1.5);
        margin-left: calc(-1 * max(1.5rem, env(safe-area-inset-left, 0px)));
        margin-right: -1.5rem;
        max-width: none;
        background: transparent;
        border-radius: 0;
    }
    .shell-art--poster a { display: block; height: 100%; }
    .shell-art--poster img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center top;
    }
    .shell-panel.has-poster .shell-nav { margin-top: 0; }
}

.shell-menu-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* Phones: the bar takes the artwork's indigo; the portrait stays out of the
   menu (the home page shows the wide banner instead). */
@media (max-width: 900px) {
    .shell-panel.has-poster {
        --panel-bg: #262262;
        --panel-ink: #FFFFF2;
        --border-color: rgba(255, 255, 242, 0.22);
        --muted-color: rgba(255, 255, 242, 0.68);
        --primary-color: #FFFFF2;
    }
    .shell-panel.has-poster .shell-art { display: none; }
    .shell-panel.has-poster .shell-cta {
        background: #FFFFF2;
        border-color: #FFFFF2;
        color: #262262 !important;
    }
}

/* ---------- Organiser credit and logos (footer of every page) ---------- */
.shell-footer-org {
    max-width: 1400px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    color: var(--text-color);
    font-size: 0.82rem;
    line-height: 1.45;
}
.shell-footer-logos { display: flex; align-items: center; gap: 0.8rem; }
.shell-footer-logos img { height: 60px; width: auto; display: block; }
