/* ============================================================
   library.css — Books TBR theme
   Mood: old-library, parchment, warm wood, serif gravitas
   ============================================================ */

:root {
    --bg: #f0e6d2;
    --paper: #f9f3e3;
    --ink: #2c1810;
    --ink-soft: #5a3e2b;
    --gold: #a8762e;
    --gold-bright: #d4a566;
    --wood: #3d2817;
    --rule: rgba(44, 24, 16, 0.18);
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Crimson Pro', 'Georgia', serif;
    background-image:
        radial-gradient(ellipse at top, rgba(212, 165, 102, 0.08), transparent 60%),
        repeating-linear-gradient(0deg,
            transparent 0,
            transparent 32px,
            rgba(168, 118, 46, 0.04) 32px,
            rgba(168, 118, 46, 0.04) 33px);
}

.theme-library .page-container { padding-top: 2rem; }

.theme-header {
    text-align: center;
    /* Extra top padding reserves a lane for the walking yeti so he
       doesn't overlap the "A Catalog of" pre-label. */
    padding: 7rem 2rem 2rem;
    border-bottom: 3px double var(--wood);
    margin-bottom: 3rem;
    position: relative;
    min-height: 320px;
}
/* Lift the title stack above the fantasy stage (stage uses z-index: 0). */
.theme-library .theme-header .pre-label,
.theme-library .theme-header h1,
.theme-library .theme-header .subtitle {
    position: relative;
    z-index: 2;
}

/* Decorative fantasy layer behind the title.
   overflow:hidden on the stage clips the yeti when he walks off-edge —
   not on .theme-header itself, since the ::before/::after ornaments
   sit below its bottom border and must stay visible. */
.fantasy-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* 🫈 Walking yeti — slowly traverses the header, turns around at the
   edge, and walks back. A tiny vertical bob simulates a walking gait. */
.fantasy-yeti {
    position: absolute;
    top: 0.6rem;
    left: -12%;
    font-size: clamp(3rem, 7vw, 5rem);
    line-height: 1;
    animation:
        yeti-walk 28s linear infinite,
        yeti-bob  0.55s ease-in-out infinite alternate;
}
/* The 🫈 glyph faces left at its default scaleX(1) on most fonts, so the
   "walking right" leg needs scaleX(-1) to flip him forward, and the
   "walking left" leg needs scaleX(1) (default) — the opposite of what
   you'd expect from intuition. */
@keyframes yeti-walk {
    0%   { left: -12%; transform: scaleX(-1); }
    49%  { left: 102%; transform: scaleX(-1); }
    50%  { left: 102%; transform: scaleX(1); }
    99%  { left: -12%; transform: scaleX(1); }
    100% { left: -12%; transform: scaleX(-1); }
}
/* `translate` is the standalone CSS property — it composes with the
   `transform` flip above without overwriting it. */
@keyframes yeti-bob {
    from { translate: 0 0; }
    to   { translate: 0 -5px; }
}

/* Side creatures — 🐉 dragon and 🧙 mage. Slow bob + tilt. */
.fantasy-emoji {
    position: absolute;
    font-size: clamp(2.4rem, 5vw, 3.8rem);
    line-height: 1;
    filter: drop-shadow(0 4px 8px rgba(60, 40, 23, 0.22));
    animation: fantasy-float 4.5s ease-in-out infinite alternate;
}
.fantasy-emoji-left  { left: 4%;  bottom: 1.5rem; animation-delay: -0.6s; }
.fantasy-emoji-right { right: 4%; bottom: 1.5rem; animation-delay: -2.4s; }
@keyframes fantasy-float {
    from { translate: 0 0;     rotate: -4deg; }
    to   { translate: 0 -12px; rotate:  4deg; }
}

@media (prefers-reduced-motion: reduce) {
    .fantasy-yeti, .fantasy-emoji { animation: none; }
}
.theme-header::before, .theme-header::after {
    content: "❦";
    position: absolute;
    bottom: -0.85rem;
    background: var(--bg);
    padding: 0 1rem;
    color: var(--gold);
    font-size: 1.2rem;
}
.theme-header::before { left: calc(50% - 1.5rem); }
.theme-header::after  { left: calc(50% + 0.5rem); }

.theme-header .pre-label {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 0.5rem;
}
.theme-header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(3rem, 6vw, 4.5rem);
    font-weight: 500;
    margin: 0;
    color: var(--wood);
    letter-spacing: -0.01em;
}
.theme-header .subtitle {
    margin-top: 0.75rem;
    font-style: italic;
    color: var(--ink-soft);
    font-size: 1.1rem;
}

/* Item cards as library catalog cards */
.item-card {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-left: 4px solid var(--wood);
    box-shadow:
        0 1px 0 var(--paper),
        0 2px 4px rgba(60, 40, 23, 0.06);
    color: var(--ink);
    position: relative;
    padding-left: 1.75rem;
}
.item-card::before {
    content: "";
    position: absolute;
    left: 0.75rem; top: 0; bottom: 0;
    width: 1px;
    background: rgba(168, 118, 46, 0.3);
}
.item-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    color: var(--wood);
}
.item-creator { font-style: italic; color: var(--ink-soft); }
.item-meta { color: var(--gold); font-family: 'Crimson Pro', serif; font-style: italic; text-transform: none; letter-spacing: 0; }

.item-actions .btn-icon {
    border-color: var(--wood);
    color: var(--wood);
    font-family: 'Crimson Pro', serif;
}
.item-actions .btn-icon:hover { background: var(--wood); color: var(--paper); }

.empty-state { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 1.3rem; color: var(--ink-soft); }
.empty-state::before { content: "❧"; display: block; font-size: 2rem; color: var(--gold); margin-bottom: 1rem; }

.theme-action-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}
.theme-action-bar a {
    background: var(--wood);
    color: var(--paper);
    padding: 0.7rem 1.5rem;
    text-decoration: none;
    font-family: 'Crimson Pro', serif;
    letter-spacing: 0.05em;
    border-radius: 2px;
}
.theme-action-bar a:hover { background: var(--gold); color: var(--ink); }
