/* =============================================================
   BEACH FIT - theme for the shared book-site shell (2026-11-23)
   Loaded after bf-main (the Heart Before Hustle shell, unchanged
   apart from its translator-widget rules). The colours come from the
   new logo: sun orange #F89D2F, sun yellow #FFC240, sea teal #148695,
   set on warm sand. Text colours are darkened versions so they read
   at 4.5:1 or better on the sand background.
   ============================================================= */

:root {
    /* shell tokens (names kept from the shell, values are Beach Fit) */
    --og-night: #FBF6EC;          /* page: warm sand */
    --og-night-soft: #F3EADA;     /* panel wash */
    --og-night-card: #FFFDF8;     /* cards */
    --og-night-border: #E8DCC6;   /* hairlines */
    --og-cream: #0E3B43;          /* ink: deep sea */
    --og-cream-dim: #3B5D63;
    --og-cream-muted: #577074;
    --og-gold: #A85406;           /* sun orange, text strength */
    --og-gold-bright: #F89D2F;    /* sun orange, logo */
    --og-gold-deep: #8A4506;
    --og-gold-glow: rgba(248, 157, 47, 0.30);
    --og-red: #A85406;
    --og-blue: #148695;
    --hbh-parchment: #FBF6EC;
    --hbh-ink: #0E3B43;
    --hbh-crimson: #0D6B75;       /* the shell's accent slot = sea teal */
    --hbh-crimson-deep: #0A535B;
    --hbh-gold: #A85406;
    --hbh-navy: #0E3B43;
    --font-serif: 'DM Serif Display', Georgia, serif;

    /* the book's own page styles use these names */
    --primary: #0D6B75;
    --primary-dark: #0E3B43;
    --secondary: #F89D2F;
    --text: #0E3B43;
    --text-light: #546E72;
    --bg: #FFFDF8;
    --bg-alt: #F3EADA;
    --border: #E8DCC6;
    --success: #2F7D6B;
    --warning: #F89D2F;
    --bf-ink: #0E3B43;
    --bf-deep: #0E3B43;
    --bf-gold: #F89D2F;
    --bf-gold-light: #FFD27A;
    --bf-gold-text: #A85406;
    --bf-link: #0D6B75;
    --bf-sun: #FFC240;
    --bf-teal: #148695;
}

html, body { background: var(--og-night); color: var(--og-cream); }
::selection { background: rgba(248, 157, 47, 0.28); }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.app-header { background: rgba(251, 246, 236, 0.92); border-bottom: 1px solid var(--og-night-border); }
.header-logo { gap: 0.45rem; line-height: 0; color: var(--hbh-ink); }
.header-logo img { display: block; width: auto; }
.header-logo .logo-mark { height: 40px; }
.header-logo .logo-word { height: 19px; }
.icon-btn { color: var(--hbh-ink); }
.icon-btn:hover { color: var(--hbh-crimson); background: var(--og-night-soft); }
.audio-toggle { color: var(--hbh-crimson); }
a.nav-btn { text-decoration: none; }
.nav-btn { color: var(--og-cream-dim); }
.nav-btn:hover { color: var(--hbh-crimson); background: var(--og-night-soft); }
.nav-btn.active { color: var(--hbh-crimson); }

.lang-switch { display: flex; gap: 3px; align-items: center; flex: 0 0 auto; }
.lang-switch a {
    display: inline-block; padding: 7px 10px; border-radius: 6px; font-weight: 700; font-size: 0.8rem;
    letter-spacing: 0.04em; text-decoration: none; line-height: 1; color: var(--og-cream-dim);
}
.lang-switch a[aria-current] { background: var(--hbh-crimson); color: #fff; }
.lang-switch a:not([aria-current]):hover { background: var(--og-night-soft); color: var(--hbh-crimson); }
.lang-switch a:focus-visible { outline: 2px solid var(--og-gold-bright); outline-offset: 2px; }

@media (max-width: 480px) {
    .header-inner { gap: 0.5rem; }
    .header-left, .header-right { gap: 0.35rem; }
    .header-logo { gap: 0.3rem; }
    .header-logo .logo-mark { height: 32px; }
    .header-logo .logo-word { height: 15px; }
    .icon-btn { padding: 0.35rem 0.45rem; font-size: 1.3rem; }
    .lang-switch a { padding: 6px 7px; font-size: 0.74rem; }
}
@media (max-width: 340px) { .header-logo .logo-word { height: 12px; } }

/* ---------- sidebar ---------- */
.sidebar { background: var(--og-night-card); border-right: 1px solid var(--og-night-border); }
.sidebar-overlay { background: rgba(14, 59, 67, 0.45); }
.sidebar .progress-label {
    color: var(--og-cream-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
}
.progress-ring-bar { stroke: var(--og-gold-bright); }
.progress-ring-bg { stroke: var(--og-night-border); }
.progress-count { color: var(--og-gold); }
.sidebar-toc .toc-part-header { color: var(--hbh-crimson); }
.sidebar-toc a.toc-item { text-decoration: none; box-sizing: border-box; }
.sidebar-toc .toc-item { color: var(--og-cream-dim); }
.sidebar-toc .toc-item:hover:not(:disabled) { background: var(--og-night-soft); color: var(--hbh-ink); }
.sidebar-toc .toc-item.active {
    background: linear-gradient(90deg, rgba(20, 134, 149, 0.14), transparent 70%);
    color: var(--hbh-crimson); border-left: 2px solid var(--hbh-crimson);
}
.sidebar-toc .toc-item.active .toc-title { color: var(--hbh-crimson); font-weight: 600; }
.sidebar-toc .toc-num { color: var(--og-gold); font-weight: 700; font-family: var(--font-sans); }
.sidebar-toc .toc-num-fm { color: var(--og-cream-muted); opacity: 0.8; }
.sidebar-toc .toc-check { color: var(--success); }
.search-input:focus { border-color: var(--hbh-crimson); }

/* the book's own pages also use .progress-label: keep the shell's sidebar look off them */
:where(.chapter-content) .progress-label { color: inherit; font-size: inherit; text-transform: none; letter-spacing: normal; }

/* ---------- buttons ---------- */
.btn-primary {
    background: var(--hbh-crimson); color: #fff; border: 1px solid var(--hbh-crimson);
    box-shadow: 0 6px 18px rgba(13, 107, 117, 0.22);
}
.btn-primary:hover { background: var(--hbh-crimson-deep); border-color: var(--hbh-crimson-deep); color: #fff; }
.btn-secondary { background: transparent; color: var(--og-gold); border: 1px solid var(--og-gold-bright); }
.btn-secondary:hover { background: rgba(248, 157, 47, 0.10); color: var(--og-gold-deep); border-color: var(--og-gold); }

/* ---------- home ---------- */
.hero-eyebrow {
    color: var(--hbh-crimson); letter-spacing: 0.08em; text-transform: uppercase;
    font-size: 0.78rem; font-weight: 700; line-height: 1.5;
}
.hero-title {
    background: none; -webkit-text-fill-color: currentColor; text-shadow: none;
    color: #11707C; font-size: clamp(3rem, 8vw, 5.4rem); letter-spacing: 0.03em;
}
.hero-subtitle { color: var(--og-gold); font-style: italic; }
.hero-byline { margin: -0.9rem 0 1.6rem; color: var(--og-cream-dim); font-size: 0.95rem; }
.hero-byline a { color: var(--hbh-crimson); }
.hero-welcome {
    font-family: var(--font-serif); font-weight: 400; color: var(--hbh-ink);
    font-size: clamp(1.45rem, 3vw, 1.9rem); line-height: 1.25; margin: 0 0 0.9rem;
}
.hero-promise { color: var(--og-cream-dim); }
.hero-promise strong { color: var(--hbh-ink); font-weight: 700; }
.hero-cover .bkv-wrap { max-width: 400px; }
.cover-image {
    border-radius: 10px;
    box-shadow: 0 22px 44px rgba(14, 59, 67, 0.22), 0 6px 16px rgba(248, 157, 47, 0.18);
}
.cover-glow { background: radial-gradient(circle at center, rgba(255, 194, 64, 0.40), transparent 62%); }
@media (max-width: 880px) {
    .hero.hero-cover-left .hero-cover { max-width: 250px; }
}

.method { padding: clamp(2rem, 5vw, 3.5rem) 0; }
.section-title { color: var(--hbh-ink); }
.section-sub { color: var(--og-cream-dim); }
a.stage-card { display: block; text-decoration: none; color: inherit; }
.stage-card { box-shadow: 0 10px 30px rgba(14, 59, 67, 0.08), 0 2px 6px rgba(14, 59, 67, 0.05); }
.stage-card:hover { border-color: var(--og-gold-bright); }
.stage-letter {
    width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; line-height: 1; margin-bottom: 0.9rem;
    background: var(--bf-teal); color: #fff !important; -webkit-text-fill-color: #fff; border: 3px solid var(--bf-sun);
}
.stage-card h3 { color: var(--hbh-ink); font-size: 1.25rem; }
.stage-card p:last-child { color: var(--og-cream-dim); }
.method-stages.is-fit { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .method-stages.is-fit { grid-template-columns: 1fr; } }

/* ---------- reading pages ---------- */
.book-shell.is-wide { max-width: 1000px; }
.book-toolbar-right { margin-left: auto; }
.book-part-label { color: var(--hbh-crimson); }
@media (min-width: 1080px) { [data-open-toc] { display: none !important; } }
body.has-chapter-nav .book-shell { padding-bottom: clamp(2rem, 5vw, 3rem); }
.es-note {
    margin: 0 0 1.8rem; padding: 0.85rem 1.1rem; border-radius: 8px; font-size: 0.95rem;
    background: rgba(248, 157, 47, 0.12); border: 1px solid rgba(248, 157, 47, 0.45); color: var(--hbh-ink);
}

.chapter-content { color: var(--hbh-ink); }
.chapter-content .content-container,
.chapter-content .tracker-container,
.chapter-content .resources-container,
.chapter-content .assessment-container {
    background: transparent; box-shadow: none; padding: 0; max-width: none; border-radius: 0; margin: 0;
}
.chapter-content h1 {
    background: none; -webkit-text-fill-color: currentColor; text-shadow: none;
    color: var(--hbh-ink); text-align: center;
}
.chapter-content h2 {
    color: var(--hbh-crimson); border-left: 4px solid var(--og-gold-bright); padding-left: 0.9rem;
    background: none; -webkit-text-fill-color: currentColor;
}
.chapter-content h3, .chapter-content h4 { color: var(--hbh-ink); }
.chapter-content p strong, .chapter-content li strong, .chapter-content strong { color: var(--hbh-ink); font-weight: 700; }
.chapter-content a { color: var(--bf-link); }
.chapter-content a:hover { color: var(--hbh-crimson-deep); }
.chapter-content img { height: auto; }
.chapter-content iframe { max-width: 100%; }
.chapter-content .subtitle {
    text-align: center; font-family: var(--font-serif); font-style: italic; font-size: 1.25rem;
    color: var(--og-gold); margin: -0.3rem 0 2.4rem;
}
.chapter-content .opening-quote {
    font-family: var(--font-serif); font-size: 1.3rem; font-style: italic; line-height: 1.5; color: var(--hbh-ink);
    border-left: 4px solid var(--og-gold-bright); padding: 1.3rem 1.5rem; margin: 2rem 0;
    background: var(--og-night-soft); border-radius: 0 10px 10px 0;
}
.chapter-content .story-box {
    background: linear-gradient(135deg, #FFF8EA 0%, #F6EBD3 100%); border: 1px solid var(--og-night-border);
    border-radius: 12px; padding: 1.5rem 1.6rem; margin: 2rem 0;
}
.chapter-content .story-box h3 { margin-top: 0; }
.chapter-content .callout {
    background: var(--og-night-soft); border-left: 4px solid var(--bf-teal);
    padding: 1.2rem 1.4rem; margin: 2rem 0; border-radius: 0 8px 8px 0;
}
.chapter-content .callout-warning { border-left-color: var(--og-gold-bright); }
.chapter-content .callout-success { border-left-color: var(--success); }
.chapter-content .emphasis {
    background: linear-gradient(135deg, #FFF1D6 0%, #FDE3B4 100%); padding: 0.15rem 0.45rem;
    border-radius: 4px; font-weight: 600;
}
.chapter-content .interactive-box {
    background: var(--og-night-card); border: 2px solid var(--bf-teal); border-radius: 12px;
    padding: 1.5rem; margin: 2rem 0; box-shadow: 0 10px 30px rgba(14, 59, 67, 0.08);
}
.chapter-content .interactive-box h3 { margin-top: 0; text-align: center; }
.chapter-content .question { margin: 1.2rem 0; padding: 1rem; background: var(--og-night-soft); border-radius: 8px; }
.chapter-content .question-text { font-weight: 600; color: var(--hbh-ink); margin-bottom: 0.5rem; }
.chapter-content .answer-options { display: flex; gap: 0.7rem; margin-top: 0.9rem; flex-wrap: wrap; }
.chapter-content .answer-btn {
    flex: 1; min-width: 92px; padding: 0.7rem 1rem; border: 2px solid var(--og-night-border);
    background: var(--og-night-card); color: var(--hbh-ink); border-radius: 8px; cursor: pointer;
    font: inherit; font-size: 0.98rem; line-height: 1.3; transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.chapter-content .answer-btn:hover { border-color: var(--bf-teal); background: #fff; }
.chapter-content .answer-btn.selected { background: var(--hbh-crimson); border-color: var(--hbh-crimson); color: #fff; }
.chapter-content blockquote { border-left-color: var(--og-gold-bright); }

/* The book's dark boxes (story boxes, opening quotes, a closing line, the resources banner) carry an inline dark
   gradient. Repaint them in the logo's sea colours and give everything inside light text. */
.chapter-content [style*="gradient"] {
    background: linear-gradient(135deg, #0E3B43 0%, #11707C 100%) !important; color: #F4F1E8 !important;
}
.chapter-content [style*="gradient"][style*="border-left"] { border-left-color: var(--og-gold-bright) !important; }
.chapter-content [style*="gradient"] :is(p, li, span, em) { color: #EEF4F2 !important; }
.chapter-content [style*="gradient"] strong { color: #FFFFFF !important; }
.chapter-content [style*="gradient"] :is(h2, h3, h4) {
    color: var(--bf-gold-light) !important; -webkit-text-fill-color: var(--bf-gold-light); border-left: 0; padding-left: 0;
}
.chapter-content [style*="gradient"] a { color: var(--bf-gold-light) !important; }
.chapter-content [style*="gradient"] :is(p, span)[style*="color"] { color: #FFD27A !important; }
.chapter-content a[style*="gradient"] { color: #FFFFFF !important; border: 0; }
/* sky-blue inline links from the old theme */
.chapter-content [style*="0EA5E9" i] { color: var(--bf-link) !important; }

/* ---------- bottom chapter bar (light, like the page) ---------- */
.chapter-nav {
    background: rgba(251, 246, 236, 0.95); border-top: 1px solid var(--og-night-border);
    box-shadow: 0 -10px 30px rgba(14, 59, 67, 0.10);
}
.chapter-nav-counter { color: var(--og-cream-dim); min-width: 0; }
.chapter-nav-counter-current { color: var(--hbh-crimson); }
.chapter-nav-counter-total { color: var(--og-cream-dim); }
.chapter-nav-counter::before { color: var(--og-cream-dim); }
html[lang="es"] .chapter-nav-counter::before { content: "Capítulo"; }
html .chapter-nav-counter.is-named::before, html[lang] .chapter-nav-counter.is-named::before { content: none !important; }
.chapter-nav-counter.is-named {
    display: block; text-align: center; text-transform: none; letter-spacing: 0.02em; font-size: 0.98rem;
    color: var(--hbh-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 560px) {
    html[lang="es"] .chapter-nav-counter::before { content: "Cap."; }
    .chapter-nav-counter.is-named { font-size: 0.88rem; }
}
/* the open contents drawer sits above the fixed chapter nav (both were z-index 90) */
@media (max-width: 1079px) {
    .sidebar-overlay { z-index: 96; }
    .sidebar { z-index: 97; }
}
/* the worksheets' long ____ answer lines wrap instead of pushing the page sideways (break-word leaves table sizing alone) */
.book-shell .content-container { overflow-wrap: break-word; }
/* phone: wide tables scroll inside the page instead of widening it; the 1-10 rating rows wrap to 2 rows of 5 */
@media (max-width: 760px) {
    .book-shell .content-container table {
        display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
    }
    body .book-shell .rating-scale { flex-wrap: wrap; }
    body .book-shell .rating-scale .rating-button { flex: 1 0 calc(20% - 0.5rem); padding: 0.65rem 0; min-width: 0; }
}

/* ---------- footer ---------- */
.site-footer { background: var(--og-night-soft); border-top: 1px solid var(--og-night-border); padding-left: 1.25rem; padding-right: 1.25rem; }
.footer-title { color: var(--hbh-ink); }
.footer-author, .footer-meta p { color: var(--og-cream-dim); }
.footer-links a { color: var(--hbh-crimson); }
.footer-meta .domain { color: var(--og-gold); font-weight: 700; letter-spacing: 0.06em; }
body.has-chapter-nav .site-footer { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }

/* ---------- install pill ---------- */
.install-pwa-btn {
    background: var(--hbh-crimson); color: #fff;
    box-shadow: 0 8px 24px rgba(14, 59, 67, 0.30), 0 0 24px rgba(248, 157, 47, 0.30);
}
.close-install-btn { background: var(--og-night-card); color: var(--hbh-ink); box-shadow: 0 2px 8px rgba(14, 59, 67, 0.3); }
.close-install-btn:hover { color: var(--hbh-crimson); }
body.has-chapter-nav .install-pwa-container { bottom: calc(env(safe-area-inset-bottom, 0px) + 5.4rem); }

/* ---------- audio playlist panel (the shared player draws for a dark panel) ---------- */
#playlistPanel {
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px)) !important;
    background: rgba(9, 38, 43, 0.97) !important; z-index: 1050 !important;
}
#playlistPanel, #playlistPanel .playlist-player { --text: #EEF2EE; --text-muted: #B5C6C4; }
#playlistPanel h2 { color: var(--bf-gold-light) !important; -webkit-text-fill-color: var(--bf-gold-light); background: none; }
#playlistPanel h2 + button {
    background: rgba(248, 157, 47, 0.16) !important; color: var(--bf-gold-light) !important;
    border-color: rgba(248, 157, 47, 0.45) !important;
}
#playlistPanel .playlist-player {
    background: linear-gradient(135deg, rgba(20, 134, 149, 0.30) 0%, rgba(9, 38, 43, 0.92) 100%) !important;
    border-color: rgba(248, 157, 47, 0.35) !important;
}
#playlistPanel [style*="#a78bfa"] { color: #FFC240 !important; }
#playlistPanel [style*="139, 92, 246"], #playlistPanel [style*="139,92,246"] { border-color: rgba(248, 157, 47, 0.3) !important; }
#playlistPanel button[style*="139, 92, 246"] { background: rgba(248, 157, 47, 0.15) !important; }
#playlistPanel .pl-lang-btn { border-color: rgba(248, 157, 47, 0.45) !important; color: #D7E2E0 !important; }
#playlistPanel .pl-lang-btn.active { background: rgba(248, 157, 47, 0.25) !important; color: var(--bf-gold-light) !important; }
#playlistPanel .pl-track[style*="139, 92, 246, 0.15"], #playlistPanel .pl-track[style*="139,92,246,0.15"] { background: rgba(248, 157, 47, 0.16) !important; }
#playlistPanel #plPlayBtn { background: linear-gradient(180deg, #FFC240 0%, #F89D2F 100%) !important; color: #0E3B43 !important; }
#playlistPanel #plProgress { background: rgba(248, 157, 47, 0.18) !important; }
#playlistPanel #plProgressBar { background: linear-gradient(90deg, #F89D2F, #FFC240) !important; }
#playlistPanel #plAutoplay { accent-color: #F89D2F; }
