/* =============================================================
   Book Vault — Visual System ("Clinic Fresh")
   A light clinical gallery theme: airy near-white surfaces,
   soft teal/sky ambient washes, refined frosted-glass cards,
   and a teal -> sky signature gradient.
   Category language: medical = teal, literature = amber, science = blue.

   Class names mirror the markup in index.html and the nodes that
   app.js injects at runtime. If you rename something here, rename
   it there too.
   ============================================================= */

/* ---------- Design tokens ---------- */
:root {
    /* Surfaces */
    --bg: #f4f9fa;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-hover: rgba(255, 255, 255, 0.92);
    --hairline: rgba(15, 42, 50, 0.10);
    --hairline-strong: rgba(15, 42, 50, 0.20);

    /* Signature gradient + its stops */
    --brand-1: #14b8a6;
    --brand-2: #06b6d4;
    --brand-3: #38bdf8;
    --brand: linear-gradient(120deg, #14b8a6 0%, #06b6d4 50%, #38bdf8 100%);

    /* Category accents */
    --cat-medical: #0d9488;
    --cat-literature: #d97706;
    --cat-science: #2563eb;

    /* Text */
    --text: #0f2a32;
    --text-dim: #4a5d66;
    --text-faint: #7c8a92;

    /* Motion + shape */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --t: 0.28s var(--ease);
    --r-lg: 16px;
    --r-md: 11px;
    --r-sm: 7px;

    /* Category hover glows */
    --glow-medical: 0 14px 34px -12px rgba(13, 148, 136, 0.45);
    --glow-literature: 0 14px 34px -12px rgba(217, 119, 6, 0.40);
    --glow-science: 0 14px 34px -12px rgba(37, 99, 235, 0.42);
}

/* ---------- Reset + base ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background-color: var(--bg);
    /* Three soft clinical washes anchored to the corners for depth */
    background-image:
        radial-gradient(55rem 55rem at 10% -12%, rgba(20, 184, 166, 0.12), transparent 60%),
        radial-gradient(50rem 50rem at 105% 2%, rgba(56, 189, 248, 0.11), transparent 55%),
        radial-gradient(48rem 48rem at 50% 118%, rgba(6, 182, 212, 0.08), transparent 55%);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem 4rem;
}

/* ---------- Niceties: selection, scrollbar, focus ---------- */
::selection {
    background: rgba(20, 184, 166, 0.22);
    color: var(--text);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(15, 42, 50, 0.18);
    border: 2px solid transparent;
    border-radius: 99px;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 42, 50, 0.30);
    background-clip: padding-box;
}

:focus-visible {
    outline: 2px solid var(--brand-1);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Ambient background layers ---------- */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(rgba(15, 42, 50, 0.035) 1px, transparent 0),
        radial-gradient(rgba(15, 42, 50, 0.035) 1px, transparent 0);
    background-size: 32px 32px;
    background-position: 0 0, 16px 16px;
    mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 80%);
    z-index: -2;
}

.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(110px);
    opacity: 0.16;
    z-index: -1;
    animation: drift 16s infinite alternate ease-in-out;
}
.blob-1 { width: 420px; height: 420px; background: var(--brand-1); top: -12%; left: -8%; }
.blob-2 { width: 520px; height: 520px; background: var(--brand-3); bottom: -16%; right: -10%; animation-delay: -5s; }
.blob-3 { width: 320px; height: 320px; background: var(--brand-2); top: 42%; left: 50%; transform: translate(-50%, -50%); animation-delay: -10s; }

@keyframes drift {
    from { transform: scale(1) translate(0, 0); }
    to   { transform: scale(1.12) translate(28px, 22px); }
}

/* ---------- Typography ---------- */
h1 {
    font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.2rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    background: var(--brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

p {
    color: var(--text-dim);
    font-size: 0.92rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.05rem;
    border: none;
    border-radius: var(--r-md);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--t);
}

a.btn { text-decoration: none; }

.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 6px 18px -6px rgba(13, 148, 136, 0.55);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 24px -6px rgba(13, 148, 136, 0.7);
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--hairline);
}
.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--hairline-strong);
}

/* Bookstore / rating-source buttons (priority: Amazon > 博客來 > 豆瓣 > Goodreads) */
.btn-amazon {
    background: #ff9900;
    color: #111;
    box-shadow: 0 6px 18px -6px rgba(255, 153, 0, 0.55);
}
.btn-amazon:hover { transform: translateY(-1px); box-shadow: 0 9px 24px -6px rgba(255, 153, 0, 0.7); }

.btn-books {
    background: #1aa3d6;
    color: #fff;
    box-shadow: 0 6px 18px -6px rgba(26, 163, 214, 0.55);
}
.btn-books:hover { transform: translateY(-1px); box-shadow: 0 9px 24px -6px rgba(26, 163, 214, 0.7); }

.btn-douban {
    background: #2e963f;
    color: #fff;
    box-shadow: 0 6px 18px -6px rgba(46, 150, 63, 0.55);
}
.btn-douban:hover { transform: translateY(-1px); box-shadow: 0 9px 24px -6px rgba(46, 150, 63, 0.7); }

.btn-goodreads {
    background: #382110;
    color: #f4f1ea;
    box-shadow: 0 6px 18px -6px rgba(56, 33, 16, 0.6);
}
.btn-goodreads:hover { transform: translateY(-1px); box-shadow: 0 9px 24px -6px rgba(56, 33, 16, 0.8); }

.btn-youtube {
    background: #ff0033;
    color: #fff;
    box-shadow: 0 6px 18px -6px rgba(255, 0, 51, 0.55);
}
.btn-youtube:hover { transform: translateY(-1px); box-shadow: 0 9px 24px -6px rgba(255, 0, 51, 0.7); }

.btn-wikipedia {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--hairline);
}
.btn-wikipedia:hover {
    transform: translateY(-1px);
    background: var(--surface-hover);
    border-color: var(--hairline-strong);
}

/* ---------- Navbar ---------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid var(--hairline);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.55rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.3px;
}

.brand span span {
    background: var(--brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-spin {
    font-size: 1.45rem;
    background: var(--brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: spin 12s linear infinite;
}

.nav-subtitle {
    font-size: 0.85rem;
    color: var(--text-faint);
    font-weight: 600;
}

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

/* ---------- Hero ---------- */
.hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1.75rem;
    align-items: center;
    margin: 0.75rem 0 1.5rem;
    padding: 1.3rem 1.85rem;
    border-radius: var(--r-lg);
    background: var(--surface);
    border: 1px solid var(--hairline);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 18px 40px -24px rgba(15, 42, 50, 0.30);
    position: relative;
    overflow: hidden;
}

/* Soft gradient wash + a thin top highlight line */
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(56, 189, 248, 0.06));
    pointer-events: none;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(20, 184, 166, 0.45), transparent);
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    z-index: 1;
}

.badge {
    background: rgba(20, 184, 166, 0.12);
    border: 1px solid rgba(20, 184, 166, 0.30);
    color: #0d9488;
    padding: 0.25rem 0.7rem;
    border-radius: 50px;
    font-size: 0.74rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.hero-content p {
    font-size: 0.96rem;
    max-width: 580px;
}

/* Stats dashboard */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    position: relative;
    z-index: 1;
}

.stat-card {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    padding: 0.65rem 0.55rem;
    text-align: center;
    cursor: pointer;
    transition: var(--t);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--brand);
    opacity: 0;
    transition: var(--t);
}

.stat-card:hover {
    border-color: var(--hairline-strong);
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -16px rgba(15, 42, 50, 0.35);
}
.stat-card:hover::before { opacity: 0.09; }

.stat-num {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.05;
    margin-bottom: 0.15rem;
    background: var(--brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.stat-label {
    font-size: 0.76rem;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: 0.5px;
    position: relative;
}

/* ---------- Gallery controls ---------- */
.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 0.2rem;
    padding: 0.3rem;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    backdrop-filter: blur(10px);
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 0.5rem 1rem;
    border-radius: var(--r-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--t);
}

.filter-btn:hover {
    color: var(--text);
    background: rgba(15, 42, 50, 0.05);
}

.filter-btn.active {
    color: #fff;
    background: var(--brand);
    box-shadow: 0 4px 14px -4px rgba(13, 148, 136, 0.6);
}

.sort-group {
    display: flex;
    gap: 0.2rem;
    padding: 0.3rem;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    backdrop-filter: blur(10px);
}

.sort-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 0.5rem 1rem;
    border-radius: var(--r-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--t);
}

.sort-btn:hover {
    color: var(--text);
    background: rgba(15, 42, 50, 0.05);
}

.sort-btn.active {
    color: #fff;
    background: var(--brand);
    box-shadow: 0 4px 14px -4px rgba(13, 148, 136, 0.6);
}

.sort-btn i {
    font-size: 0.78rem;
}

.search-bar {
    position: relative;
    flex: 1;
    max-width: 360px;
    min-width: 220px;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: 0.88rem;
    transition: var(--t);
    pointer-events: none;
}

.search-bar input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.3rem;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--t);
}

.search-bar input::placeholder { color: var(--text-faint); }

.search-bar input:focus {
    outline: none;
    border-color: rgba(20, 184, 166, 0.55);
    background: var(--surface-hover);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}

.search-bar input:focus + i { color: var(--brand-1); }

/* ---------- Media grid + cards ---------- */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.media-card {
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    overflow: hidden;
    cursor: pointer;
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 26px -20px rgba(15, 42, 50, 0.40);
    transition: var(--t);
    animation: card-in 0.45s var(--ease) both;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Hairline gradient frame (drawn with a masked border) */
.media-card::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: var(--r-lg);
    background: linear-gradient(to bottom, rgba(15, 42, 50, 0.09), rgba(15, 42, 50, 0.01));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.media-card:hover { transform: translateY(-5px); }

.media-card[data-category="medical"]:hover { box-shadow: var(--glow-medical); border-color: rgba(13, 148, 136, 0.35); }
.media-card[data-category="literature"]:hover { box-shadow: var(--glow-literature); border-color: rgba(217, 119, 6, 0.35); }
.media-card[data-category="science"]:hover { box-shadow: var(--glow-science); border-color: rgba(37, 99, 235, 0.35); }

.card-img-wrapper {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #e3eef0;
}

.card-img-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 42, 50, 0.45), transparent 45%);
    pointer-events: none;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--ease);
}

.media-card:hover .card-img-wrapper img { transform: scale(1.06); }

.card-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
    pointer-events: none;
}

.category-badge {
    padding: 0.25rem 0.6rem;
    border-radius: var(--r-sm);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 42, 50, 0.35);
}

.media-card[data-category="medical"] .category-badge { background: var(--cat-medical); }
.media-card[data-category="literature"] .category-badge { background: var(--cat-literature); }
.media-card[data-category="science"] .category-badge { background: var(--cat-science); }

.rating-badge {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(15, 42, 50, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffd866;
    padding: 0.25rem 0.55rem;
    border-radius: var(--r-sm);
    font-size: 0.74rem;
    font-weight: 700;
    backdrop-filter: blur(6px);
}

a.rating-badge {
    text-decoration: none;
    transition: var(--t);
}
a.rating-badge:hover {
    background: rgba(255, 216, 102, 0.25);
    border-color: #ffd866;
    transform: scale(1.05);
}

.status-flag {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    z-index: 2;
    padding: 0.2rem 0.55rem;
    border-radius: var(--r-sm);
    font-size: 0.66rem;
    font-weight: 700;
    color: #fde68a;
    background: rgba(15, 42, 50, 0.62);
    border: 1px solid rgba(217, 119, 6, 0.55);
    backdrop-filter: blur(6px);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
    padding: 0.6rem 0.7rem 0.7rem;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-tags {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.tag {
    background: rgba(15, 42, 50, 0.05);
    border: 1px solid rgba(15, 42, 50, 0.06);
    padding: 0.16rem 0.45rem;
    border-radius: 5px;
    font-size: 0.68rem;
    color: var(--text-dim);
}

.card-year {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    font-size: 0.72rem;
    color: var(--text-faint);
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 42, 50, 0.45);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    background: #ffffff;
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    box-shadow: 0 24px 60px -12px rgba(15, 42, 50, 0.35);
    transform: scale(0.96) translateY(8px);
    transition: transform 0.3s var(--ease);
}

.modal-overlay.active .modal-card { transform: scale(1) translateY(0); }

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    width: 2.1rem;
    height: 2.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 42, 50, 0.06);
    border: 1px solid var(--hairline);
    border-radius: 50%;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--t);
}
.modal-close:hover {
    background: rgba(15, 42, 50, 0.12);
    transform: rotate(90deg);
}

.modal-detail-hero {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 1.5rem;
    padding: 1.75rem;
    background: linear-gradient(180deg, rgba(20, 184, 166, 0.08), transparent 70%);
    border-bottom: 1px solid var(--hairline);
}

.modal-detail-img {
    aspect-ratio: 3 / 4;
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: 0 12px 28px -8px rgba(15, 42, 50, 0.35);
}
.modal-detail-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-detail-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-type-badge {
    align-self: flex-start;
    padding: 0.28rem 0.65rem;
    border-radius: var(--r-sm);
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
}

.modal-detail-info h2 {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.modal-detail-creator {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.95rem;
    color: var(--text-dim);
    margin-bottom: 0.85rem;
}

.modal-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.85rem;
    background: rgba(15, 42, 50, 0.025);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
}

.meta-item { text-align: center; }

.meta-label {
    font-size: 0.68rem;
    color: var(--text-faint);
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.meta-val {
    font-size: 0.95rem;
    font-weight: 700;
}

.meta-val.rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: #d99e1e;
}

a.meta-val.rating {
    text-decoration: none;
    transition: var(--t);
    border-radius: var(--r-sm);
    padding: 0.1rem 0.4rem;
}

a.meta-val.rating:hover {
    background: rgba(217, 158, 30, 0.12);
    box-shadow: 0 0 0 1px rgba(217, 158, 30, 0.4);
}

.rating-link-icon {
    font-size: 0.65rem;
    color: rgba(217, 158, 30, 0.7);
    transition: var(--t);
}

a.meta-val.rating:hover .rating-link-icon {
    color: #d99e1e;
    transform: translate(1px, -1px);
}

.modal-detail-content { padding: 1.75rem; }

.modal-detail-section { margin-bottom: 1.75rem; }

.section-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: var(--text);
}

.section-title i {
    background: var(--brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-desc-box {
    background: rgba(20, 184, 166, 0.04);
    border: 1px solid var(--hairline);
    border-left: 3px solid var(--brand-1);
    padding: 1rem 1.25rem;
    border-radius: var(--r-md);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-dim);
}

/* Tracklist / cast list */
.extra-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.5rem;
}

.extra-list li {
    display: flex;
    overflow: hidden;
    background: rgba(15, 42, 50, 0.025);
    border: 1px solid var(--hairline);
    border-radius: var(--r-sm);
    font-size: 0.82rem;
    transition: var(--t);
}

.extra-list li:hover {
    background: rgba(20, 184, 166, 0.07);
    border-color: var(--hairline-strong);
    transform: translateX(3px);
}

.extra-list-link,
.extra-item-content {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.5rem 0.7rem;
}

.extra-list-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.extra-list li i { font-size: 0.75rem; color: var(--text-faint); }

.extra-link-icon {
    margin-left: auto;
    font-size: 0.65rem !important;
    transition: var(--t);
}
.extra-list-link:hover .extra-link-icon {
    color: var(--text);
    transform: scale(1.15);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--hairline);
}

/* ---------- Footer ---------- */
footer {
    position: relative;
    z-index: 10;
    margin-top: 3rem;
    padding: 1.75rem 0;
    border-top: 1px solid var(--hairline);
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(10px);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-content p { font-size: 0.82rem; }

.footer-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    color: var(--text-faint);
    font-size: 1.1rem;
    text-decoration: none;
    transition: var(--t);
}
.footer-links a:hover { color: var(--brand-1); transform: translateY(-2px); }

/* ---------- View switch (藏書 / 語錄) ---------- */
.view-switch {
    display: flex;
    gap: 0.25rem;
    width: fit-content;
    margin: 0.4rem auto 1.6rem;
    padding: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 999px;
    backdrop-filter: blur(10px);
}

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.5rem 1.2rem;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--t);
}

.view-btn:hover { color: var(--text); }

.view-btn.active {
    color: #fff;
    background: var(--brand);
    box-shadow: 0 4px 14px -4px rgba(13, 148, 136, 0.6);
}

.view-btn .count {
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.7;
}
.view-btn.active .count { opacity: 0.9; }

/* Views are mutually exclusive panels toggled by the switch above. */
.view { display: none; }
.view.active {
    display: block;
    animation: card-in 0.4s var(--ease) both;
}

/* ---------- Quotes section ("經典語錄") ---------- */
.section-heading {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin: 0.4rem 0 0.35rem;
}

.section-heading h2 {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.4rem;
}

.section-heading h2 i {
    font-size: 1.05rem;
    background: var(--brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-count {
    font-size: 0.85rem;
    color: var(--text-faint);
    font-weight: 700;
}

.section-intro {
    margin-bottom: 1.5rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.quotes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.quote-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem 1.4rem 1.2rem 1.7rem;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 26px -20px rgba(15, 42, 50, 0.40);
    cursor: pointer;
    overflow: hidden;
    transition: var(--t);
    animation: card-in 0.45s var(--ease) both;
}

/* Brand accent rail on the left edge */
.quote-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--brand);
    opacity: 0.85;
}

.quote-card:hover {
    transform: translateY(-5px);
    border-color: rgba(20, 184, 166, 0.35);
    box-shadow: 0 14px 34px -12px rgba(20, 184, 166, 0.40);
}

.quote-mark {
    font-size: 1.5rem;
    background: var(--brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.9;
}

.quote-text {
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.6;
    letter-spacing: -0.01em;
    color: var(--text);
}

.quote-attr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: auto;
    font-size: 0.85rem;
}

.quote-author { color: var(--text-dim); font-weight: 700; }
.quote-source { color: var(--text-faint); }

.quote-more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--brand-1);
    transition: var(--t);
}
.quote-card:hover .quote-more { gap: 0.6rem; }

/* Quote detail modal (shares .modal-card / .modal-detail-content) */
.modal-quote-hero {
    position: relative;
    padding: 2.25rem 1.95rem 1.75rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(20, 184, 166, 0.08), transparent 75%);
    border-bottom: 1px solid var(--hairline);
}

.modal-quote-mark {
    display: inline-block;
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
    background: var(--brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-quote-text {
    max-width: 36ch;
    margin: 0 auto;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: -0.01em;
    color: var(--text);
}

.modal-quote-attr {
    margin-top: 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dim);
}

/* ---------- Empty state ---------- */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    padding: 3.5rem 1rem;
    color: var(--text-faint);
}

.empty-state i { font-size: 2.5rem; }
.empty-state p { margin-bottom: 0.5rem; }
.empty-state .help-text { font-size: 0.82rem; max-width: 420px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.75rem;
    }
    .hero-stats { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
    .gallery-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .search-bar { max-width: 100%; }
    .modal-detail-hero {
        grid-template-columns: 1fr;
        padding: 1.35rem;
    }
    .modal-detail-img { max-width: 190px; margin: 0 auto; }
    .modal-detail-content { padding: 1.35rem; }
    .hero-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .nav-subtitle { display: none; }
    .hero-stats { grid-template-columns: repeat(2, 1fr); }
    .filter-group {
        overflow-x: auto;
        white-space: nowrap;
    }
    .filter-btn { padding: 0.4rem 0.8rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
