:root {
    --ink: #050a11;
    --navy: #07111c;
    --navy-2: #0b1624;
    --panel: rgba(8, 15, 25, 0.94);
    --panel-soft: rgba(15, 25, 39, 0.86);
    --cream: #f4ead8;
    --cream-soft: #d9cfbf;
    --muted: #a9a397;
    --gold: #d6ac61;
    --gold-bright: #efcc82;
    --gold-dark: #8c6838;
    --line: rgba(218, 176, 101, 0.38);
    --line-soft: rgba(244, 234, 216, 0.12);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
    background: var(--ink);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--cream);
    background:
        radial-gradient(circle at 50% 0%, rgba(30, 56, 82, 0.25), transparent 42rem),
        linear-gradient(180deg, #07111c 0%, #050a11 62%, #03070c 100%);
    font-family: Georgia, "Times New Roman", serif;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------------------------------------------------------
   Header / temporary hero artwork
   --------------------------------------------------------- */

.hero {
    --hero-art-height: 25vw;
    --tagline-strip-height: 92.5px;

    position: relative;
    height: calc(var(--hero-art-height) + var(--tagline-strip-height));
    min-height: 350px;
    overflow: hidden;
    background-color: #03070c;
    border-bottom: 1px solid rgba(218, 176, 101, 0.16);
}


/* Complete hero artwork on top */
.hero::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: var(--hero-art-height);

    background-image: url("/static/prescillium-hero.webp");
    background-position: center top;
    background-repeat: no-repeat;
    background-size: 100% auto;
}

.hero::after {
    content: "";
    position: absolute;
    z-index: 1;
    left: 0;
    right: 0;
    top: calc(var(--hero-art-height) - 42px);
    height: 42px;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        rgba(3, 7, 12, 0),
        #03070c
    );
}

.hero-tagline {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: min(92%, 900px);
    text-align: center;
    color: var(--gold-bright);
    font-size: clamp(1.05rem, 1.8vw, 1.65rem);
    font-style: italic;
    letter-spacing: 0.035em;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.9);
}

/* ---------------------------------------------------------
   Main page shell
   --------------------------------------------------------- */

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 26px auto 0;
    position: relative;
    z-index: 2;
}

.how-it-works-button {
    position: absolute;
    z-index: 3;
    top: 18px;
    right: 20px;

    padding: 5px 8px;
    border: 0;
    background: transparent;

    color: var(--muted);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.78rem;

    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;

    transition: color 120ms ease;
}

.how-it-works-button:hover,
.how-it-works-button:focus-visible {
    color: var(--gold-bright);
}

.how-it-works-modal {
    position: fixed;
    z-index: 1000;
    inset: 0;

    display: grid;
    place-items: center;

    padding: 20px;

    background: rgba(1, 5, 10, 0.78);
    backdrop-filter: blur(6px);
}

.how-it-works-modal[hidden] {
    display: none;
}

.how-it-works-dialog {
    position: relative;

    width: min(560px, 100%);
    max-height: min(700px, calc(100vh - 40px));
    overflow-y: auto;

    padding: 34px 36px 32px;

    color: var(--cream);

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(214, 172, 97, 0.10),
            transparent 42%
        ),
        linear-gradient(
            180deg,
            #0c1826,
            #060c14
        );

    border: 1px solid rgba(214, 172, 97, 0.48);
    border-radius: 18px;

    box-shadow:
        0 28px 90px rgba(0, 0, 0, 0.72),
        inset 0 1px rgba(255, 255, 255, 0.035);
}

.how-it-works-dialog h3 {
    margin: 0 40px 22px 0;

    color: var(--gold-bright);
    font-size: 1.5rem;
    font-weight: 500;
}

.how-it-works-dialog p {
    margin: 0 0 16px;

    color: var(--cream-soft);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.96rem;
    line-height: 1.65;
}

.how-it-works-dialog p:last-child {
    margin-bottom: 0;
}

.how-it-works-note {
    padding-top: 15px;

    border-top: 1px solid rgba(214, 172, 97, 0.18);

    color: var(--muted) !important;
    font-size: 0.84rem !important;
}

.how-it-works-close {
    position: absolute;
    top: 14px;
    right: 16px;

    width: 32px;
    height: 32px;

    display: grid;
    place-items: center;

    padding: 0;

    border: 1px solid rgba(244, 234, 216, 0.13);
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.055);
    color: var(--cream-soft);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.05rem;

    cursor: pointer;
}

.how-it-works-close:hover,
.how-it-works-close:focus-visible {
    color: var(--gold-bright);
    border-color: rgba(239, 204, 130, 0.5);
}

body.modal-open {
    overflow: hidden;
}

.conjure-panel {
    position: relative;
    width: min(900px, 100%);
    margin: 0 auto;
    padding: clamp(28px, 4.5vw, 52px) clamp(22px, 5vw, 64px) 34px;
    text-align: center;
    background:
        radial-gradient(circle at 50% 0%, rgba(214, 172, 97, 0.08), transparent 40%),
        linear-gradient(180deg, rgba(11, 22, 36, 0.97), rgba(6, 12, 20, 0.97));
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(12px);
}

.conjure-panel:focus-within {
    z-index: 100;
}

.panel-ornament {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--gold);
    opacity: 0.9;
    font-size: 0.85rem;
}

.conjure-panel h2 {
    margin: 0;
    color: var(--cream);
    font-size: clamp(1.55rem, 3.2vw, 2.35rem);
    font-weight: 500;
    line-height: 1.2;
}

.panel-intro {
    max-width: 700px;
    margin: 12px auto 26px;
    color: var(--cream-soft);
    font-size: clamp(0.98rem, 1.6vw, 1.08rem);
    line-height: 1.65;
}

.search-wrap {
    position: relative;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    text-align: left;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 60px;
    padding: 0 18px;
    background: rgba(3, 8, 14, 0.68);
    border: 1px solid rgba(244, 234, 216, 0.34);
    border-radius: 14px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search-box:focus-within {
    border-color: rgba(239, 204, 130, 0.82);
    background: rgba(7, 14, 23, 0.95);
    box-shadow: 0 0 0 3px rgba(214, 172, 97, 0.1), 0 12px 34px rgba(0, 0, 0, 0.28);
}

.search-icon {
    position: relative;
    width: 18px;
    height: 18px;
    border: 2px solid var(--cream-soft);
    border-radius: 50%;
    flex: 0 0 auto;
    opacity: 0.82;
}

.search-icon::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 2px;
    background: var(--cream-soft);
    right: -6px;
    bottom: -3px;
    transform: rotate(45deg);
    border-radius: 2px;
}

#search {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--cream);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
}

#search::placeholder {
    color: #9e9b99;
}

.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 330px;
    overflow-y: auto;
    background: rgba(5, 11, 18, 0.985);
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.55);
    scrollbar-color: var(--gold-dark) transparent;
}

.search-result {
    padding: 13px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(244, 234, 216, 0.07);
    transition: background 120ms ease, padding-left 120ms ease;
}

.search-result:last-child {
    border-bottom: 0;
}

.search-result:hover,
.search-result:focus-visible {
    background: rgba(214, 172, 97, 0.09);
    padding-left: 20px;
    outline: none;
}

.search-result-title {
    color: var(--cream);
    font-size: 0.98rem;
}

.search-result-author {
    margin-top: 3px;
    color: var(--muted);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.82rem;
}

.selected-section {
    width: 100%;
    max-width: 760px;
    margin: 22px auto 0;
    text-align: left;
}

.selected-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}

.selected-label {
    margin: 0;
    color: var(--gold-bright);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.selected-books {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.selected-book {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    gap: 9px;
    padding: 8px 10px 8px 13px;
    background: linear-gradient(180deg, rgba(33, 42, 55, 0.94), rgba(19, 28, 40, 0.94));
    border: 1px solid rgba(214, 172, 97, 0.35);
    border-radius: 999px;
    color: var(--cream);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.18);
}

.selected-book-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 260px;
    font-size: 0.92rem;
}

.selected-book button {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--cream-soft);
    cursor: pointer;
    line-height: 1;
    transition: background 120ms ease, color 120ms ease;
}

.selected-book button:hover {
    background: rgba(214, 172, 97, 0.16);
    color: var(--gold-bright);
}

.cauldron-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 25px;
}

.series-filter-button {
    padding: 11px 18px;
    border: 1px solid rgba(214, 172, 97, 0.48);
    border-radius: 999px;
    background: rgba(9, 17, 27, 0.74);
    color: var(--cream-soft);
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.series-filter-button:hover {
    transform: translateY(-1px);
    border-color: rgba(239, 202, 128, 0.8);
    color: var(--gold-bright);
}

.series-filter-button.active,
.series-filter-button[aria-pressed="true"] {
    border-color: #efca80;
    background: rgba(214, 172, 97, 0.16);
    color: var(--gold-bright);
}

.filter-check {
    display: inline-block;
    margin-right: 7px;
    opacity: 0.35;
}

.series-filter-button.active .filter-check,
.series-filter-button[aria-pressed="true"] .filter-check {
    opacity: 1;
}

.conjure-button {
    min-width: 190px;
    margin-top: 0;
    padding: 13px 28px;
    border: 1px solid #efca80;
    border-radius: 999px;
    color: #21170b;
    background: linear-gradient(180deg, #efca80 0%, #c99643 100%);
    box-shadow: 0 10px 28px rgba(203, 148, 61, 0.2), inset 0 1px rgba(255, 255, 255, 0.45);
    font-size: 1.08rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.conjure-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 14px 34px rgba(203, 148, 61, 0.27), inset 0 1px rgba(255, 255, 255, 0.45);
}

.conjure-button:active {
    transform: translateY(0);
}

.conjure-button:disabled {
    cursor: wait;
    opacity: 0.72;
    transform: none;
}

.button-star {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.75em;
}

.panel-note {
    margin: 15px 0 0;
    color: #888a8d;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.78rem;
}

.remove-all-button {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.78rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 120ms ease;
}

.remove-all-button:hover {
    color: var(--gold-bright);
}

/* ---------------------------------------------------------
   Recommendation cards
   --------------------------------------------------------- */

.recommendations {
    margin: 70px auto 80px;
}

.recommendations-header {
    text-align: center;
    margin-bottom: 55px;
}

.recommendations-header h2 {
    margin: 0;
    color: var(--cream);
    font-size: clamp(1.7rem, 3.2vw, 2.4rem);
    font-weight: 500;
}

.recommendations-header p {
    margin: 9px 0 0;
    color: var(--muted);
    font-family: Arial, Helvetica, sans-serif;
}

.recommendation-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 210px));
    justify-content: center;
    gap: 24px;
}

.recommendation {
    position: relative;
    min-width: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(19, 30, 43, 0.9), rgba(7, 14, 23, 0.96));
    border: 1px solid rgba(214, 172, 97, 0.22);
    border-radius: 15px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.26);
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.recommendation:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 4px;
}

.recommendation:hover {
    transform: translateY(-5px);
    border-color: rgba(239, 204, 130, 0.46);
    box-shadow: 0 21px 55px rgba(0, 0, 0, 0.4);
}

.cover-wrap {
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 30%, rgba(214, 172, 97, 0.16), transparent 45%),
        #101925;
    border-bottom: 1px solid rgba(244, 234, 216, 0.08);
}

.book-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.book-cover-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    padding: 24px;
    text-align: center;
    color: var(--gold);
}

.placeholder-symbol {
    display: block;
    font-size: 2rem;
    margin-bottom: 9px;
}

.rank-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    min-width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #22180b;
    background: rgba(239, 204, 130, 0.95);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
}

.book-info {
    display: flex;
    flex-direction: column;
    flex: 1;

    min-height: 165px;
    padding: 16px 16px 18px;
}



.series-info {
    margin-top: 3px;
}

.book-title {
    display: block;
    color: var(--cream);
    font-size: 1.08rem;
    font-weight: 600;
    line-height: 1.27;
}

.author {
    margin-top: 6px;
    color: var(--gold);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.82rem;
}

.description {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 5.6em;
    margin: 13px 0 4px;
    color: #bbb7af;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.86rem;
    line-height: 1.4;
}

.similarity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;

    margin-top: auto;

    padding: 5px 9px;
    color: var(--gold-bright);
    background: rgba(214, 172, 97, 0.10);
    border: 1px solid rgba(214, 172, 97, 0.30);
    border-radius: 999px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.82rem;
    font-weight: 650;
    letter-spacing: 0.01em;
}

.similarity::before {
    content: "✦";
    color: var(--gold);
    font-family: Georgia, "Times New Roman", serif;
}

/* One recommendation can open over its existing grid row without
   reflowing or pushing the surrounding recommendations around. */
.recommendation-expanded {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: minmax(145px, 190px) 1fr;
    gap: 26px;
    padding: 22px;
    overflow: hidden;
    cursor: pointer;
    background:
        radial-gradient(circle at 16% 18%, rgba(214, 172, 97, 0.12), transparent 31%),
        linear-gradient(135deg, rgba(17, 29, 43, 0.995), rgba(5, 11, 18, 0.995));
    border: 1px solid rgba(239, 204, 130, 0.62);
    border-radius: 17px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.68), inset 0 1px rgba(255, 255, 255, 0.04);
    opacity: 0;
    transform: scale(0.988);
    transform-origin: center;
    transition: opacity 130ms ease, transform 130ms ease;
}

.recommendation-expanded.is-visible {
    opacity: 1;
    transform: scale(1);
}

.expanded-cover-wrap {
    position: relative;
    align-self: stretch;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 11px;
    background: rgba(4, 9, 15, 0.58);
    border: 1px solid rgba(244, 234, 216, 0.10);
}

.expanded-cover {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
}

.expanded-info {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.expanded-title {
    margin: 0;
    padding-right: 42px;
    color: var(--cream);
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    font-weight: 500;
    line-height: 1.15;
}

.expanded-author {
    margin-top: 7px;
    color: var(--gold);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.92rem;
}

.expanded-similarity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    margin-top: 13px;
    padding: 6px 10px;
    color: var(--gold-bright);
    background: rgba(214, 172, 97, 0.12);
    border: 1px solid rgba(214, 172, 97, 0.38);
    border-radius: 999px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.86rem;
    font-weight: 700;
}

.expanded-similarity::before {
    content: "✦";
    font-family: Georgia, "Times New Roman", serif;
}

.expanded-description {
    min-height: 0;
    overflow-y: auto;
    margin: 17px 3px 0 0;
    padding-right: 14px;
    color: #d0cbc1;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.94rem;
    line-height: 1.62;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-dark) transparent;
}

.expanded-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--cream-soft);
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(244, 234, 216, 0.13);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.05rem;
}

.expanded-hint {
    margin-top: 12px;
    color: #85898e;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.74rem;
}

.loading-state,
.error-state,
.empty-state {
    max-width: 700px;
    margin: 0 auto;
    padding: 26px;
    text-align: center;
    color: var(--cream-soft);
    background: rgba(9, 17, 27, 0.7);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
}

/* ---------------------------------------------------------
   Footer
   --------------------------------------------------------- */

.site-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 28px 20px 34px;
    border-top: 1px solid rgba(244, 234, 216, 0.07);
    color: #817e79;
    font-size: 0.8rem;
}

.footer-star {
    color: var(--gold-dark);
}

.footer-links {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.site-footer a {
    color: #aaa49a;
    text-decoration: none;
    text-underline-offset: 3px;
}

.site-footer a:hover,
.site-footer a:focus-visible {
    color: var(--gold-bright);
    text-decoration: underline;
}

/* ---------------------------------------------------------
   Responsive layout
   --------------------------------------------------------- */

@media (max-width: 900px) {
    .recommendation-grid {
        grid-template-columns: repeat(3, minmax(0, 210px));
        gap: 18px;
    }
}

@media (max-width: 680px) {
    .hero {
        --hero-art-height: 270px;
        --tagline-strip-height: 82px;
        height: calc(var(--hero-art-height) + var(--tagline-strip-height));
        min-height: 352px;
    }

    .hero::before {
        height: var(--hero-art-height);
        background-position: center center;
        background-size: cover;
    }

    .hero::after {
        top: calc(var(--hero-art-height) - 34px);
        height: 34px;
    }

    .hero-tagline {
        bottom: 17px;
        font-size: 1rem;
    }

    .page-shell {
        width: min(100% - 20px, 1120px);
        margin-top: 18px;
    }

    .how-it-works-button {
	top: 13px;
	right: 13px;
	font-size: 0.72rem;
    }

    .how-it-works-dialog {
	padding: 30px 22px 26px;
    }

    .how-it-works-dialog h3 {
	font-size: 1.3rem;
    }

    .how-it-works-dialog p {
	font-size: 0.9rem;
    }

    .conjure-panel {
        border-radius: 17px;
        padding: 30px 16px 26px;
    }

    .search-box {
        height: 56px;
    }

    .recommendations {
        margin-top: 52px;
    }

    .recommendation-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .book-info {
        padding: 13px;
    }

    .book-title {
        font-size: 0.97rem;
    }

    .description {
        display: none;
    }

    .recommendation-expanded {
        grid-template-columns: 110px 1fr;
        gap: 14px;
        padding: 14px;
        border-radius: 14px;
    }

    .expanded-title {
        padding-right: 34px;
        font-size: 1.2rem;
    }

    .expanded-author {
        font-size: 0.8rem;
    }

    .expanded-similarity {
        margin-top: 9px;
        padding: 4px 8px;
        font-size: 0.76rem;
    }

    .expanded-description {
        margin-top: 10px;
        font-size: 0.82rem;
        line-height: 1.48;
    }

    .expanded-hint {
        display: none;
    }

}

@media (max-width: 420px) {
    .recommendation-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .selected-book-title {
        max-width: 210px;
    }

    .book-info {
        padding: 11px;
    }

    .author {
        font-size: 0.75rem;
    }

    .similarity {
        font-size: 0.7rem;
    }
}

/* ---------------------------------------------------------
   Expanded-book reading profile
   --------------------------------------------------------- */

.book-metadata {
    flex: 0 0 auto;
    margin-top: 14px;
    padding-top: 13px;
    padding-right: 14px;
    border-top: 1px solid rgba(214, 172, 97, 0.22);
}

.metadata-heading {
    margin-bottom: 8px;
    color: rgba(239, 204, 130, 0.76);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.trait-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.trait-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    color: var(--gold-bright);
    background: rgba(214, 172, 97, 0.09);
    border: 1px solid rgba(214, 172, 97, 0.32);
    border-radius: 999px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.76rem;
    line-height: 1;
    white-space: nowrap;
}

.metadata-scales {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-top: 13px;
}

.metadata-scale {
    min-width: 0;
}

.scale-title {
    margin-bottom: 4px;
    color: var(--cream-soft);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
    color: #85898e;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.64rem;
}

.scale-track {
    position: relative;
    height: 3px;
    margin: 0 5px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        rgba(140, 104, 56, 0.34),
        rgba(239, 204, 130, 0.68)
    );
}

.scale-marker {
    position: absolute;
    top: 50%;
    width: 9px;
    height: 9px;
    border: 1px solid rgba(255, 235, 190, 0.92);
    border-radius: 50%;
    background: var(--gold);
    box-shadow:
        0 0 0 2px rgba(214, 172, 97, 0.10),
        0 0 8px rgba(214, 172, 97, 0.34);
    transform: translate(-50%, -50%);
}

/* The description gets the flexible/scrollable part of the fixed-height
   expanded panel; the reading profile remains visible underneath it. */
.expanded-description {
    flex: 1 1 auto;
}

@media (max-width: 680px) {
    .book-metadata {
        margin-top: 10px;
        padding-top: 9px;
        padding-right: 8px;
    }

    .metadata-heading {
        margin-bottom: 6px;
        font-size: 0.61rem;
    }

    .trait-list {
        gap: 5px;
    }

    .trait-chip {
        padding: 4px 7px;
        font-size: 0.66rem;
    }

    .metadata-scales {
        gap: 12px;
        margin-top: 10px;
    }

    .scale-title {
        font-size: 0.66rem;
    }

    .scale-labels {
        font-size: 0.56rem;
    }
}

@media (max-width: 420px) {
    .metadata-scales {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}


/* ---------------------------------------------------------
   Legal / contact pages
   --------------------------------------------------------- */

.legal-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.legal-site-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(218, 176, 101, 0.16);
    background:
        radial-gradient(circle at 50% 0%, rgba(214, 172, 97, 0.09), transparent 34rem),
        #050a11;
}

.legal-brand {
    color: var(--gold-bright);
    font-size: clamp(1.35rem, 3vw, 2rem);
    letter-spacing: 0.055em;
    text-decoration: none;
}

.legal-brand:hover,
.legal-brand:focus-visible {
    text-decoration: underline;
    text-underline-offset: 5px;
}

.legal-shell {
    width: min(900px, calc(100% - 32px));
    margin: 42px auto 60px;
    flex: 1;
}

.legal-card {
    padding: clamp(26px, 5vw, 54px);
    background:
        radial-gradient(circle at 50% 0%, rgba(214, 172, 97, 0.07), transparent 34rem),
        linear-gradient(180deg, rgba(11, 22, 36, 0.97), rgba(6, 12, 20, 0.97));
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.legal-kicker {
    margin: 0 0 8px;
    color: var(--gold);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.legal-card h1 {
    margin: 0 0 24px;
    color: var(--cream);
    font-size: clamp(2rem, 5vw, 3.1rem);
    font-weight: 500;
}

.legal-card h2 {
    margin: 32px 0 10px;
    color: var(--gold-bright);
    font-size: 1.18rem;
    font-weight: 600;
}

.legal-card p,
.legal-card address {
    color: var(--cream-soft);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.98rem;
    line-height: 1.68;
}

.legal-card a {
    color: var(--gold-bright);
    overflow-wrap: anywhere;
}

.legal-address {
    font-style: normal;
}

.legal-updated {
    margin-top: -12px;
    color: var(--muted) !important;
    font-size: 0.82rem !important;
}

.legal-contact-box,
.legal-placeholder-block,
.legal-placeholder-note {
    margin-top: 20px;
    padding: 16px 18px;
    border: 1px solid rgba(214, 172, 97, 0.28);
    border-radius: 12px;
    background: rgba(3, 8, 14, 0.48);
}

.legal-contact-box {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 18px;
}

.legal-placeholder-block strong,
.legal-placeholder-note strong {
    color: var(--gold-bright);
}

.legal-placeholder-block p:last-child,
.legal-placeholder-note:last-child {
    margin-bottom: 0;
}

.legal-card code {
    color: #f1d59c;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.9em;
}

.legal-footer {
    margin-top: auto;
}

@media (max-width: 680px) {
    .legal-shell {
        width: min(100% - 20px, 900px);
        margin-top: 20px;
        margin-bottom: 34px;
    }

    .legal-card {
        padding: 24px 18px;
        border-radius: 16px;
    }

    .site-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}
