/* Explain: Styles for UI components like headers, buttons, cards, forms, and account menus. */
/* Members-only gate: nothing behind the sign-in card may scroll while it is up */
html.auth-gate-locked,
html.auth-gate-locked body {
    overflow: hidden !important;
    height: 100%;
    overscroll-behavior: none;
}

.site-header {
    background: linear-gradient(180deg, rgba(250, 249, 246, 0.86), rgba(250, 249, 246, 0.52));
    backdrop-filter: blur(18px);
}

.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--sage-dark);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.section-kicker::before {
    display: inline-block;
    width: 2.4rem;
    height: 1px;
    background: var(--accent-color);
    content: "";
}

.glass-panel {
    border: 1px solid var(--glass-border);
    background: linear-gradient(145deg, rgba(250, 249, 246, 0.78), rgba(255, 255, 255, 0.48));
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.arch-frame {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(88, 129, 87, 0.38);
    background: var(--surface-color);
    box-shadow: var(--shadow-soft);
}

.arch-frame::after {
    position: absolute;
    inset: 1.1rem;
    border: 1px solid rgba(250, 249, 246, 0.62);
    border-radius: inherit;
    content: "";
    pointer-events: none;
}

.arch-frame-large {
    height: min(74vh, 720px);
    min-height: 500px;
    border-radius: 999px 999px 2.5rem 2.5rem;
}

.arch-frame-medium {
    height: 620px;
    max-width: 450px;
    border-radius: 999px 999px 2.1rem 2.1rem;
}

.floating-note {
    position: absolute;
    right: -1.5rem;
    bottom: 4rem;
    display: flex;
    max-width: 250px;
    align-items: center;
    gap: 0.85rem;
    border-radius: 999px;
    padding: 1rem 1.2rem;
    color: var(--text-color);
    font-size: 0.82rem;
    font-weight: 600;
}

.story-card {
    position: absolute;
    right: 0;
    bottom: 2.5rem;
    max-width: 290px;
    border-radius: 2rem;
    padding: 1.5rem;
}

.quiet-detail,
.amenity-row,
.contact-note {
    border: 1px solid var(--glass-border);
    border-radius: 1.6rem;
    background: rgba(250, 249, 246, 0.58);
    padding: 1.25rem;
}

.quiet-detail span {
    display: inline-flex;
    margin-bottom: 0.9rem;
    color: var(--accent-color);
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 600;
}

.quiet-detail p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.75;
}

.class-card {
    min-height: 360px;
    border-radius: 2.2rem;
    padding: 2rem;
    transition: transform 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}

.class-card:hover {
    border-color: rgba(88, 129, 87, 0.58);
    box-shadow: 0 26px 80px rgba(31, 46, 35, 0.11);
    transform: translateY(-6px);
}

.amenity-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
}

.amenity-dot {
    width: 0.8rem;
    height: 0.8rem;
    margin-top: 0.4rem;
    border-radius: 999px;
    background: var(--accent-color);
    box-shadow: 0 0 0 0.45rem var(--terracotta-soft);
}

.amenity-image-wrap {
    height: 660px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-radius: 3rem 999px 999px 3rem;
    box-shadow: var(--shadow-soft);
}

.booking-form,
.booking-overlay-panel {
    border-radius: 2.4rem;
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.form-label {
    display: block;
    margin-bottom: 0.55rem;
    color: var(--text-color);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.form-status.success {
    color: #4A6B53;
}

.form-status.error {
    color: #9B4A3D;
}

details[data-mystery-dropdown] > summary {
    list-style: none;
}

details[data-mystery-dropdown] > summary::-webkit-details-marker {
    display: none;
}

details[data-mystery-dropdown][open] > summary {
    border-color: var(--accent-color);
}

.mobile-book-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    border-top: 1px solid var(--glass-border);
    background: rgba(250, 249, 246, 0.86);
    padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
    backdrop-filter: blur(18px);
}

.booking-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    overflow-y: auto;
    background: rgba(31, 46, 35, 0.32);
    padding: 1rem;
}

.booking-overlay.is-open {
    display: block;
}

.booking-overlay-panel {
    min-height: calc(100vh - 2rem);
    background: var(--background-color);
    box-shadow: 0 30px 90px rgba(31, 46, 35, 0.22);
}

@media (max-width: 767px) {
    .section-kicker::before {
        width: 1.6rem;
    }

    .arch-frame-large,
    .arch-frame-medium,
    .amenity-image-wrap {
        height: 510px;
        min-height: 0;
    }

    .arch-frame-large {
        margin-right: auto;
        margin-left: auto;
        width: min(100%, 450px);
    }

    .floating-note,
    .story-card {
        position: relative;
        right: auto;
        bottom: auto;
        margin: -2.5rem auto 0;
    }

    .amenity-image-wrap {
        border-radius: 999px 999px 2rem 2rem;
    }
}

.decal-option {
    position: relative;
    cursor: pointer;
    transition: transform 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}

.decal-option:hover {
    transform: translateY(-3px);
}

.decal-option:focus-within {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
}

.decal-option:has(input:checked) {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color), var(--shadow-soft);
}

.decal-check {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    color: var(--accent-color);
    font-size: 1.3rem;
    opacity: 0;
    transition: opacity 250ms ease;
}

.decal-option:has(input:checked) .decal-check {
    opacity: 1;
}

.decal-swatch {
    display: flex;
    height: 6rem;
    width: 6rem;
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 1.1rem;
    background: #050505;
    color: #ffffff;
    text-align: center;
}

.decal-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
    opacity: 0.45;
    transition: opacity 300ms ease;
}

.decal-stage.is-active {
    opacity: 1;
}

.decal-stage-icon {
    display: inline-flex;
    height: 3rem;
    width: 3rem;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--glass-border);
    border-radius: 999px;
    background: var(--surface-color);
    color: var(--text-muted);
    font-size: 1.15rem;
    transition: border-color 300ms ease, background 300ms ease, color 300ms ease, box-shadow 300ms ease;
}

.decal-stage.is-active .decal-stage-icon {
    border-color: var(--accent-color);
    background: var(--button-color);
    color: var(--text-color);
    box-shadow: 0 0 0 3px var(--sage-soft);
}

.decal-stage-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.puzzle-option {
    position: relative;
    cursor: pointer;
    transition: transform 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}

.puzzle-option:hover {
    transform: translateY(-3px);
}

.puzzle-option:focus-within {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
}

.puzzle-option:has(input:checked) {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color), var(--shadow-soft);
}

.puzzle-icon {
    display: inline-flex;
    height: 2.75rem;
    width: 2.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--sage-soft);
    color: var(--sage-dark);
    font-size: 1.1rem;
}

.puzzle-preview-item {
    margin: 0;
    border: 1px solid var(--glass-border);
    border-radius: 0.9rem;
    padding: 0.35rem;
    background: rgba(250, 249, 246, 0.58);
    transition: border-color 250ms ease, box-shadow 250ms ease, transform 250ms ease;
}

.puzzle-preview-item.is-selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color);
    transform: translateY(-2px);
}

.comic-panel {
    position: relative;
    overflow: hidden;
    border: 3px solid var(--text-color);
    border-radius: 0.9rem;
    background: #ffffff;
    box-shadow: 4px 4px 0 rgba(15, 23, 42, 0.18);
}

.comic-panel-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.comic-caption {
    border-top: 3px solid var(--text-color);
    padding: 0.45rem 0.6rem;
    color: var(--text-color);
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.3;
}

.comic-badge {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 38%, #FEF9C3, #FDE68A 58%, #FCD34D);
}

.comic-badge .fa-lightbulb {
    font-size: 4.75rem;
    color: var(--button-color);
    filter: drop-shadow(0 2px 0 rgba(15, 23, 42, 0.22));
}

.comic-badge-level {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #B45309;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.filter-chip {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 0.95rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 250ms ease, background 250ms ease, color 250ms ease;
}

.filter-chip:hover {
    border-color: var(--accent-color);
    color: var(--text-color);
}

.filter-chip.is-active {
    border-color: var(--accent-color);
    background: var(--sage-soft);
    color: var(--sage-dark);
}

.nav-tab {
    position: relative;
}

.nav-tab.is-active {
    color: var(--primary-color);
    font-weight: 800;
}

.nav-tab-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    color: var(--accent-color);
    font-size: 6rem;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    filter: drop-shadow(0 0 4px var(--background-color)) drop-shadow(0 0 4px var(--background-color)) drop-shadow(0 0 8px var(--background-color));
    transition: opacity 250ms ease, transform 250ms ease;
}

.nav-tab.is-active .nav-tab-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.member-comic-panel {
    position: relative;
}

.member-comic-step {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 2;
    display: inline-flex;
    height: 1.9rem;
    width: 1.9rem;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--text-color);
    border-radius: 999px;
    background: var(--button-color);
    color: var(--text-color);
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1;
}

.member-comic-panel .comic-caption {
    font-size: 0.78rem;
    line-height: 1.35;
}

.contact-error {
    color: #9B4A3D;
}

.contact-error .fa-arrow-up {
    color: #DC2626;
}

.contact-input-error {
    border-color: #DC2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25);
}

.read-aloud-board {
    max-width: min(92vw, 24rem);
}

.read-aloud-board .read-aloud-icon-stop {
    display: none;
}

.read-aloud-board.is-reading {
    background: var(--primary-color);
    color: #ffffff;
}

.read-aloud-board.is-reading .read-aloud-icon-play {
    display: none;
}

.read-aloud-board.is-reading .read-aloud-icon-stop {
    display: inline-block;
}

.logout-avatar img {
    display: block;
    height: 100%;
    width: 100%;
    border-radius: 999px;
    object-fit: cover;
}

.account-menu-wrap {
    position: relative;
}

.account-menu-wrap > summary {
    list-style: none;
}

.account-menu-wrap > summary::-webkit-details-marker {
    display: none;
}

.account-menu-wrap > summary::marker {
    content: "";
}

.account-menu-panel {
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    z-index: 70;
    display: grid;
    gap: 0.15rem;
    width: 14rem;
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    background: var(--background-color);
    box-shadow: var(--shadow-soft);
    padding: 0.5rem;
}

/* Responsive guardrails: keep every page fitting phones, tablets, and narrow laptops. */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

main,
section,
footer,
header,
.glass-panel,
.booking-form,
.booking-overlay-panel,
.class-card,
.comic-panel,
.quiet-detail,
.contact-note,
.amenity-row {
    max-width: 100%;
}

h1,
h2,
h3,
p,
span,
a,
button,
label,
input,
textarea,
select,
figcaption {
    overflow-wrap: anywhere;
}

button.btn:not(.btn-circle),
a.btn:not(.btn-circle) {
    height: auto;
    min-height: 2.75rem;
    white-space: normal;
    line-height: 1.2;
}

.comic-panel-image {
    width: 100%;
    min-height: 12rem;
    object-fit: cover;
    object-position: center;
}

.member-comic-panel {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.member-comic-panel .comic-caption {
    flex: 1;
}

@media (max-width: 1023px) {
    .site-header nav {
        min-width: 0;
    }

    .site-header a[aria-label="Investigation Station Home"] {
        min-width: 0;
        max-width: calc(100vw - 6rem);
    }

    .site-header a[aria-label="Investigation Station Home"] span:first-child {
        max-width: 100%;
        font-size: clamp(1.05rem, 5vw, 1.8rem);
        line-height: 1.05;
        white-space: normal;
    }

    .booking-overlay-panel {
        min-height: auto;
        width: min(100%, 42rem);
        margin: 0 auto;
    }

    #isaiContainer {
        right: 1rem;
        bottom: calc(1rem + env(safe-area-inset-bottom));
        max-width: calc(100vw - 2rem);
    }

    #isaiWindow {
        width: min(20rem, calc(100vw - 2rem));
        max-height: min(72vh, 34rem);
    }
}

@media (max-width: 767px) {
    .section-pad {
        padding-top: clamp(4rem, 13vw, 5.25rem);
        padding-bottom: clamp(4rem, 13vw, 5.25rem);
    }

    .hero-split {
        min-height: auto;
        padding-top: 7rem;
    }

    .glass-panel,
    .booking-form,
    .booking-overlay-panel,
    .class-card {
        border-radius: 1.5rem;
        padding: 1.25rem;
    }

    .floating-note {
        width: min(100%, 18rem);
        justify-content: center;
        text-align: center;
    }

    .decal-option {
        min-width: 0;
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 1rem;
    }

    .decal-swatch {
        height: 5.25rem;
        width: 5.25rem;
    }

    .ar-camera-btn {
        position: static !important;
        margin-top: 0.75rem;
    }

    .decal-stage {
        min-width: 0;
    }

    .decal-stage-label {
        font-size: 0.62rem;
        line-height: 1.25;
    }

    .member-comic-step {
        top: 0.45rem;
        left: 0.45rem;
    }

    #authOverlay {
        justify-content: flex-start;
        overflow-y: auto;
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    #authOverlay > .glass-panel,
    #profileSetupOverlay > .glass-panel,
    #profileCodeConfirmOverlay > .glass-panel,
    #leaveConfirmOverlay > .glass-panel,
    #reviewOverlay > .glass-panel,
    #cameraPermissionOverlay > .glass-panel {
        width: min(100%, 30rem);
        padding: 1.25rem;
    }

    #visionHelpBtn,
    #noVisionHelpBtn,
    #showLoginBtn,
    #showSignupBtn {
        font-size: clamp(1rem, 4.8vw, 1.2rem);
    }

    #arPreviewOverlay .absolute.top-0 {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    #arPreviewOverlay .absolute.top-0 p {
        max-width: 100%;
        font-size: 0.8rem;
        line-height: 1.35;
    }

    #arPreviewOverlay .absolute.top-0 .ml-4 {
        margin-left: 0;
        justify-content: flex-end;
    }

    footer {
        padding-bottom: calc(6.5rem + env(safe-area-inset-bottom));
    }
}

@media (max-width: 420px) {
    .section-kicker {
        letter-spacing: 0.14em;
    }

    .site-header nav {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .arch-frame-large,
    .arch-frame-medium,
    .amenity-image-wrap {
        height: 390px;
    }

    .comic-panel-image {
        min-height: 10rem;
    }

    .mobile-book-bar {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }
}

/* Smart fit layer: keeps the full site inside phone and tablet screens. */
@media (max-width: 1023px) {
    .hero-split {
        padding-right: clamp(1rem, 5vw, 2rem);
        padding-left: clamp(1rem, 5vw, 2rem);
    }

    .hero-split > .mx-auto {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-split h1 {
        font-size: clamp(2.55rem, 11vw, 4.6rem);
        line-height: 0.96;
    }

    .hero-split p {
        max-width: 100%;
        font-size: clamp(1rem, 3.8vw, 1.15rem);
        line-height: 1.65;
    }

    .hero-split .btn {
        max-width: 100%;
        justify-content: center;
        text-align: center;
    }

    .arch-frame-large,
    .arch-frame-medium {
        width: min(100%, 34rem);
        height: auto;
        min-height: 0;
        aspect-ratio: 3 / 4;
    }

    .floating-note {
        max-width: calc(100% - 2rem);
    }

    .booking-overlay-panel,
    .booking-form,
    #overlayBookingForm,
    #fanClubForm,
    #profileSetupForm,
    #profileCodeConfirmForm,
    .decal-option,
    .comic-panel,
    .member-comic-panel {
        min-width: 0;
    }

    .decal-option > span.flex {
        width: 100%;
        min-width: 0;
    }

    .comic-panel-image {
        height: auto;
        min-height: 0;
        aspect-ratio: 4 / 3;
    }

    #fanClubMember .grid,
    #join .grid,
    #contact .grid,
    #reviewsGrid {
        min-width: 0;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .hero-split {
        min-height: auto;
        padding-top: 8.5rem;
    }

    .hero-split .btn {
        width: auto;
    }

    .arch-frame-large,
    .arch-frame-medium {
        max-width: 30rem;
    }

    .section-pad {
        padding-top: clamp(4.75rem, 8vw, 6.5rem);
        padding-bottom: clamp(4.75rem, 8vw, 6.5rem);
    }
}

@media (max-width: 640px) {
    .site-header nav {
        gap: 0.75rem;
    }

    .site-header a[aria-label="Investigation Station Home"] span:first-child {
        font-size: clamp(1rem, 6vw, 1.55rem);
    }

    .hero-split {
        padding-top: 7rem;
        padding-bottom: 3.5rem;
    }

    .hero-split .btn,
    #visionHelpBtn,
    #noVisionHelpBtn,
    #showLoginBtn,
    #showSignupBtn,
    #authEmailForm .btn,
    #authSignupForm .btn,
    #authCodeForm .btn,
    #staffCodeForm .btn {
        width: 100%;
        white-space: normal;
    }

    #visionHelpBtn,
    #noVisionHelpBtn,
    #showLoginBtn,
    #showSignupBtn {
        padding: 1rem;
        font-size: clamp(1rem, 5vw, 1.2rem);
        line-height: 1.15;
    }

    #authOverlay > .glass-panel,
    #profileSetupOverlay > .glass-panel,
    #profileCodeConfirmOverlay > .glass-panel,
    #leaveConfirmOverlay > .glass-panel,
    #reviewOverlay > .glass-panel,
    #cameraPermissionOverlay > .glass-panel {
        max-height: calc(100dvh - 2rem);
        overflow-y: auto;
    }

    .booking-overlay {
        padding: 0.5rem;
    }

    .booking-overlay-panel {
        width: 100%;
        border-radius: 1.25rem;
    }

    .decal-option {
        gap: 0.85rem;
    }

    .comic-caption {
        font-size: 0.72rem;
        line-height: 1.45;
    }

    #isaiContainer {
        bottom: calc(5.5rem + env(safe-area-inset-bottom));
    }
}

@media (max-width: 360px) {
    .hero-split h1 {
        font-size: clamp(2.25rem, 13vw, 2.8rem);
    }

    .section-kicker {
        gap: 0.45rem;
        font-size: 0.68rem;
        letter-spacing: 0.1em;
    }

    .section-kicker::before {
        width: 1.15rem;
    }

    .glass-panel,
    .booking-form,
    .booking-overlay-panel,
    .class-card {
        padding: 1rem;
    }
}

.staff-gate {
    display: none;
}

.staff-gate.is-open {
    display: flex;
}

#staffSitePreview > summary {
    list-style: none;
}

#staffSitePreview > summary::-webkit-details-marker {
    display: none;
}

#authOverlay.preview-open {
    justify-content: flex-start;
}

/* I-S-A-I logo: a real 3D badge that spins on its vertical axis and always faces forward */
.isai-coin {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    transform-style: preserve-3d;
    animation: isai-coin-spin 3.6s linear infinite;
    will-change: transform;
}

.isai-coin.hidden {
    display: none;
}

.isai-coin > img {
    position: absolute;
    inset: 0;
    height: 100%;
    width: 100%;
    border-radius: 999px;
    object-fit: cover;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(var(--coin-half, 2px));
}

.isai-coin-edge {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 0;
    background: #000000;
    pointer-events: none;
}

.isai-coin > img.isai-coin-back {
    transform: rotateY(180deg) translateZ(var(--coin-half, 2px));
}

@keyframes isai-coin-spin {
    from {
        transform: perspective(220px) rotateX(-10deg) rotateY(0deg);
    }
    to {
        transform: perspective(220px) rotateX(-10deg) rotateY(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .isai-coin {
        animation: none;
    }
}
