/* ===================================
   Museum Audio Guide - xbit styles
   Mobile only (max 800px)
   =================================== */


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f8f9fa;
    color: #333;
    font-size: 1.15rem;
    line-height: 1.6;
    font-family: Lato, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1 {
    font-size: 48px;
    font-weight:700
}


h2 {
    font-size: 36px;
    -webkit-font-smoothing: subpixel-antialiased;
    -moz-osx-font-smoothing: auto;
    margin-bottom:15px
}

@media (min-width: 768px) {
    h2 {
        margin-bottom:16px
    }
}

@media (min-width: 1270px) {
    h2 {
        font-size: 42px;
        margin-bottom:22px
    }
}

h3 {
    font-size:28px
}

@media (min-width: 768px) {
    h3 {
        font-size: 18px;
        -webkit-font-smoothing: subpixel-antialiased;
        -moz-osx-font-smoothing: auto;
        line-height: 1.2;
        margin-bottom:16px
    }
}

@media (min-width: 1270px) {
    h3 {
        font-size:28px
    }
}

h1, h2, h3, h4, h5, h6 {
    font-weight:500;
    font-family: museo-slab, "Times New Roman", Times, serif;
    line-height: 1.1;
    color:#8e6a41
}

h2 {
    position: relative;
    padding-top: 30px;
    margin-top: 30px;
    padding-bottom: 15px;
    margin-bottom: 15px;
    text-transform:none
}

h2:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 14.2857142857rem;
    height: .5rem;
    background-color:#8e6a41
}

hr {
    margin-bottom: 3rem;
    margin-top: 3rem;
}

p {
    margin-bottom: 0.8rem;
}

a {
    color: #8e6a41;
    font-weight: 600;
}


/* ---- Main content ---- */
.guide-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1rem 0;
    flex: 1 0 auto;
    width: 100%;
}


/* ---- Header ---- */
.guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #38353c;
    padding: 0.75rem 1rem;
}

.header-logo {
    width: 176px;
    height: auto;
}

/* ---- Language switcher ---- */
.lang-switcher {
    position: relative;
}

.lang-switcher-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    color: #fff;
    font-family: Lato, Helvetica, Arial, sans-serif;
    font-size: 15px;
    cursor: pointer;
}

.lang-switcher-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
}

.lang-switcher-label {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.lang-switcher-caret {
    font-size: 10px;
    opacity: 0.7;
    margin-left: 2px;
}

.lang-switcher-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 212px;
    background: #fffdf8;
    border: 1px solid #d8d2c4;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(56, 53, 60, 0.28);
    overflow: hidden;
    padding: 4px 0;
    z-index: 10;
}

.lang-switcher-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 8px 14px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    font-family: Lato, Helvetica, Arial, sans-serif;
    font-size: 16px;
    color: #38353c;
    text-align: left;
    cursor: pointer;
}

.lang-switcher-option:hover {
    background: #f2eee4;
}

.lang-switcher-option[aria-current="true"] {
    border-left-color: #8e6a41;
    font-weight: 700;
}

/* ---- Footer ---- */
.guide-footer {
    margin-top: 6rem;

    display: flex;
    align-items: center;
    justify-content: flex-start;
    background-color: #38353c;
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.footer-logo {
    width: 176px;
    height: auto;
}

.footer-credit {
    margin: 0;
    margin-left: auto;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.62);
}

.footer-credit a {
    color: rgba(255, 255, 255, 0.85);
}

.footer-credit a:hover {
    color: #fff;
}

/* ---- Audio Player ---- */
.audio-player {
    display: flex;
    flex-direction: column;
    background-color: #ebebeb;
    border: 1px solid #d0d0d0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin: 1.5rem 0;
}

/* Controls row: play, replay, "Listen" + duration */
.audio-player-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.audio-player-play {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.audio-player-ring {
    display: block;
}

.audio-player-ring-bg {
    fill: none;
    stroke: #ccc;
    stroke-width: 4;
}

.audio-player-ring-fill {
    fill: none;
    stroke: #8e6a41;
    stroke-width: 4;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.25s linear;
}

/* Buffering arc: hidden unless waiting for audio to start (see audio_player.js) */
.audio-player-ring-spin {
    fill: none;
    stroke: #8e6a41;
    stroke-width: 4;
    stroke-linecap: round;
    opacity: 0;
    transform-box: view-box;
    transform-origin: center;
    transition: opacity 0.2s;
}

.audio-player[data-state="starting"] .audio-player-ring-spin,
.audio-player.is-loading .audio-player-ring-spin {
    opacity: 0.6;
    animation: audio-player-spin 1s linear infinite;
}

/* Loading look: the play button becomes a bare spinner, replay is hidden */
.audio-player.is-loading .audio-player-ring-spin {
    opacity: 1;
}

.audio-player.is-loading .audio-player-play {
    cursor: progress;
}

.audio-player.is-loading .audio-player-play:hover,
.audio-player.is-loading .audio-player-play:active {
    opacity: 1;
}

.audio-player.is-loading .audio-player-replay {
    display: none;
}

@keyframes audio-player-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .audio-player[data-state="starting"] .audio-player-ring-spin,
    .audio-player.is-loading .audio-player-ring-spin {
        animation-duration: 3s;
    }
}

.audio-player-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.audio-player-replay {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-player-replay img {
    width: 28px;
    height: 28px;
    /* tint to brown via CSS filter — approximate #8e6a41 */
    filter: brightness(0) saturate(100%) invert(44%) sepia(30%) saturate(600%) hue-rotate(355deg) brightness(90%);
}

.audio-player-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.audio-player-label {
    font-size: 1.125rem;
    font-weight: 500;
    color: #333;
    line-height: 1.2;
}

.audio-player-duration {
    font-size: 0.875rem;
    color: #666;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.audio-player-play:hover,
.audio-player-replay:hover {
    opacity: 0.8;
}

.audio-player-play:active,
.audio-player-replay:active {
    opacity: 0.6;
}

.audio-player-play:disabled,
.audio-player-replay:disabled {
    opacity: 0.4;
    cursor: default;
}

.audio-player[data-state="error"] .audio-player-duration::after {
    content: " \26A0";
}

.audio-player-play:focus-visible,
.audio-player-replay:focus-visible {
    outline: 2px solid #8e6a41;
    outline-offset: 2px;
    border-radius: 50%;
}

.audio-player-replay:focus-visible {
    border-radius: 0.25rem;
}

/* ---- Transcript ---- */
.transcript {
    margin-top: 0.5rem;
}

.transcript-segment {
    margin-top: 1.5rem;
    font-size: 1.15rem;
    line-height: 1.7;
    color: #444;
}

.transcript-segment:first-child {
    margin-top: 0;
}

.transcript-segment strong {
    color: #8e6a41;
    display: block;
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
}


.transcript-segment p:last-child {
    margin-bottom: 0;
}

/* ---- Q&A Section ---- */
.qa-section {
    margin-top: 2rem;
}

.qa-item {
    border-bottom: 1px solid #d0d0d0;
}

.qa-item:first-of-type {
    border-top: 1px solid #d0d0d0;
}

.qa-item summary {
    list-style: none;
}

.qa-item summary::-webkit-details-marker {
    display: none;
}

.qa-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    min-height: 48px;
    font-family: museo-slab, "Times New Roman", Times, serif;
    font-size: 1.25rem;
    font-weight: 500;
    color: #38353c;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.qa-summary::after {
    content: "▸";
    flex-shrink: 0;
    margin-left: 1rem;
    color: #8e6a41;
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.qa-item[open] > .qa-summary::after {
    content: "▾";
}

.qa-summary:focus-visible {
    outline: 2px solid #8e6a41;
    outline-offset: 2px;
}

.qa-body {
    padding-bottom: 1.5rem;
}

.qa-description {
    font-size: 1rem;
    color: #555;
    margin-bottom: 0.5rem;
}

/* AI-narration note: its own row under the controls, so the "Listen" label
   keeps the full width of the card on narrow screens. */
.audio-player-note {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #d0d0d0;
    font-size: 0.875rem;
    line-height: 1.3;
    color: #666;
}

.audio-player-note-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.audio-player-note-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: #8e6a41;
    text-decoration: underline;
    cursor: pointer;
}

.audio-player-note-link:hover {
    opacity: 0.8;
}

.audio-player-note-link:focus-visible {
    outline: 2px solid #8e6a41;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

.audio-player-popup {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 10;
}

.audio-player-popup p {
    margin: 0;
    padding-right: 1.25rem;
}

.audio-player-popup a {
    color: #8e6a41;
}

.audio-player-popup-close {
    position: absolute;
    top: 0.4rem;
    right: 0.6rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 0;
}

/* ---- Big button links ---- */
a.big-button {
    display: block;
    background-color: #8e6a41;
    color: #fff;
    text-decoration: none;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    margin: 1.5rem 0;
    transition: opacity 0.15s ease;
}

a.big-button:hover {
    opacity: 0.88;
}

a.big-button:active {
    opacity: 0.75;
}

