/* =============================================
   BookLens — Washington Post-inspired design
   ============================================= */

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

:root {
    --bg: #ffffff;
    --bg-alt: #f4f4f4;
    --text: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #888888;
    --accent: #c41230;
    --accent-hover: #9b0e24;
    --rule: #d6d6d6;
    --rule-dark: #aaaaaa;
    --label-politics: #c41e3a;
    --label-economics: #2e7d32;
    --label-culture: #8e24aa;
    --label-history: #bf6900;
    --label-sociology: #1565c0;
    --label-debate: #6a1b9a;
    --label-technology: #00695c;
    --persp-left: #1a56a0;
    --persp-center: #5a5a5a;
    --persp-right: #b71c1c;
    --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    border-top: 4px solid #000;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Masthead ---------- */

.masthead {
    text-align: center;
    padding: 1.25rem 1rem 0.75rem;
    border-bottom: 3px solid var(--text);
}

.masthead-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.masthead-date {
    font-family: var(--sans);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.masthead-title {
    font-family: var(--serif);
    font-size: 2.6rem;
    font-weight: 900;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.masthead-title a {
    color: var(--text);
    text-decoration: none;
}

.masthead-title a:hover {
    text-decoration: none;
}

.masthead-tagline {
    font-family: var(--sans);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 0.3rem;
}

/* ---------- Section Navigation ---------- */

.section-nav {
    border-bottom: 1px solid #333;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #111;
}

.section-nav-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    gap: 0;
}

.section-nav a {
    display: inline-block;
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.80);
    text-decoration: none;
    padding: 0.65rem 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.15s, background 0.15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}

.section-nav a:hover {
    color: #fff;
    text-decoration: none;
}

.section-nav a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: #fff;
}

.nav-toggle svg { display: block; }

/* ---------- Newspaper Grid (Homepage) ---------- */

.newspaper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Featured / Hero row */
.featured-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 0;
    border-bottom: 1px solid var(--rule);
}

.featured-row > * {
    padding: 1.5rem 1.25rem;
}

.featured-row > *:not(:last-child) {
    border-right: 1px solid var(--rule);
}

.featured-center {
    padding: 1.5rem 1.5rem;
}

.featured-center .article-image {
    width: 100%;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.featured-center .article-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.featured-center .article-headline {
    font-family: var(--serif);
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.featured-center .article-deck {
    font-family: var(--sans);
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 0.5rem;
}

/* Side columns */
.side-column .article-item {
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--rule);
}

.side-column .article-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.side-column .article-image {
    width: 100%;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.side-column .article-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Article elements */
.article-label {
    font-family: var(--sans);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    display: block;
}

.article-label.politics    { color: var(--label-politics); }
.article-label.economics   { color: var(--label-economics); }
.article-label.culture     { color: var(--label-culture); }
.article-label.history     { color: var(--label-history); }
.article-label.sociology   { color: var(--label-sociology); }
.article-label.debate      { color: var(--label-debate); }
.article-label.technology  { color: var(--label-technology); }

.article-headline {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    letter-spacing: -0.01em;
    margin-bottom: 0.3rem;
}

.article-headline a {
    color: var(--text);
    text-decoration: none;
}

.article-headline a:hover {
    text-decoration: underline;
}

.article-deck {
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.35rem;
}

.article-byline {
    font-family: var(--sans);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.article-byline span {
    font-weight: 600;
    color: var(--text-secondary);
}

/* Mid-section grid */
.mid-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-bottom: 1px solid var(--rule);
}

.mid-section > * {
    padding: 1.25rem;
}

.mid-section > *:not(:last-child) {
    border-right: 1px solid var(--rule);
}

.mid-section .article-image {
    width: 100%;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.mid-section .article-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.mid-section .article-headline {
    font-size: 1.1rem;
}

/* Bottom section */
.bottom-section {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 0;
    border-bottom: 1px solid var(--rule);
}

.bottom-section > * {
    padding: 1.25rem;
}

.bottom-section > *:first-child {
    border-right: 1px solid var(--rule);
}

.bottom-section .article-image {
    width: 100%;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.bottom-section .article-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.bottom-section .article-headline {
    font-size: 1.3rem;
}

/* ---------- Perspectives layout (Homepage) ---------- */

.perspectives-key {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-top: 2px solid var(--text);
    border-bottom: 1px solid var(--rule);
}

.perspectives-key > div {
    padding: 0.5rem 1.25rem;
    font-family: var(--sans);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.perspectives-key > div:not(:last-child) {
    border-right: 1px solid var(--rule);
}

.key-left   { color: var(--persp-left); }
.key-center { color: var(--persp-center); justify-content: center; }
.key-right  { color: var(--persp-right); justify-content: flex-end; }

.story-row {
    border-bottom: 2px solid var(--text);
}

.story-topic-bar {
    padding: 0.55rem 1.25rem;
    border-bottom: 1px solid var(--rule);
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.story-topic-title {
    font-family: var(--serif);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.perspectives-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
}

.perspective-col {
    padding: 1.25rem;
    border-top: 3px solid transparent;
}

.perspective-col:not(:last-child) {
    border-right: 1px solid var(--rule);
}

.perspective-col.persp-left   { border-top-color: var(--persp-left); }
.perspective-col.persp-center { border-top-color: var(--persp-center); }
.perspective-col.persp-right  { border-top-color: var(--persp-right); }

.persp-badge {
    font-family: var(--sans);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.persp-badge.left   { color: var(--persp-left); }
.persp-badge.center { color: var(--persp-center); }
.persp-badge.right  { color: var(--persp-right); }

/* ---------- Per-article viewpoint sources ---------- */

.persp-sources {
    margin-top: 0.85rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--rule);
}

.persp-sources-label {
    font-family: var(--sans);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.persp-sources-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.persp-sources-list li a {
    font-family: var(--sans);
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    line-height: 1.4;
    transition: color 0.15s;
}

.persp-sources-list li a::before {
    content: '›';
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.5;
}

.perspective-col.persp-left   .persp-sources-list li a:hover { color: var(--persp-left); }
.perspective-col.persp-center .persp-sources-list li a:hover { color: var(--persp-center); }
.perspective-col.persp-right  .persp-sources-list li a:hover { color: var(--persp-right); }

.perspective-col .article-image {
    width: 100%;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.perspective-col .article-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* ── Story Supplements: History & Debate ── */
.story-supplements {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-top: 1px solid var(--rule);
}

.story-history,
.story-debate {
    padding: 1.1rem 1.25rem 1.2rem;
}

.story-history {
    border-right: 1px solid var(--rule);
}

.story-supplements-label {
    font-family: var(--sans);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-bottom: 0.45rem;
    margin-bottom: 0.55rem;
    border-bottom: 1px solid var(--rule);
}

.story-supplements-body {
    font-family: var(--serif);
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0;
}

/* Section divider */
.section-divider {
    border: none;
    border-top: 2px solid var(--text);
    margin: 0;
}

.section-title-bar {
    font-family: var(--serif);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--rule);
    letter-spacing: -0.01em;
}

/* ---------- Category page header ---------- */

.category-header {
    text-align: center;
    padding: 2.5rem 1rem 1.75rem;
    border-bottom: 2px solid var(--text);
}

.category-header h1 {
    font-family: var(--serif);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 0.35rem;
}

.category-header p {
    font-family: var(--sans);
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 660px;
    margin: 0 auto;
}

/* ---------- API key bar ---------- */

.api-key-bar {
    max-width: 760px;
    margin: 1.5rem auto 0;
    padding: 0 1rem;
}

.api-key-inner {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--rule);
    padding: 8px 14px;
    transition: border-color 0.2s;
}

.api-key-inner:focus-within {
    border-color: var(--accent);
}

.api-key-inner label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.api-key-inner input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
    background: transparent;
    color: var(--text);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.api-key-inner input::placeholder { color: var(--text-muted); }

.key-status {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    white-space: nowrap;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.key-status.saved { background: #d4edda; color: #155724; }
.key-status.missing { background: #f8d7da; color: #721c24; }

.api-key-help {
    text-align: center;
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.api-key-help a {
    color: var(--accent);
    font-weight: 500;
}

/* ---------- Search ---------- */

.search-container {
    max-width: 760px;
    margin: 1.25rem auto 1.5rem;
    padding: 0 1rem;
}

.search-box {
    display: flex;
    gap: 0;
    align-items: center;
    border: 2px solid var(--text);
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--accent);
}

.search-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    margin-left: 0.85rem;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 0.75rem;
    background: transparent;
    color: var(--text);
    font-family: var(--sans);
}

.search-box input::placeholder { color: var(--text-muted); }

.search-box button {
    background: var(--text);
    color: var(--bg);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
    font-family: var(--sans);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.search-box button:hover {
    background: #333;
}

.search-box button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ---------- Status ---------- */

.status-message {
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.status-message.error { color: #c41e3a; }

.results-container {
    max-width: 960px;
    margin: 0 auto 3rem;
    padding: 0 1rem;
}

/* ---------- Book list items ---------- */

.book-list-item {
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
    transition: background 0.15s;
    animation: fadeIn 0.3s ease both;
}

.book-list-item:hover {
    background: var(--bg-alt);
}

.book-list-item:last-child {
    border-bottom: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.book-list-inner {
    display: flex;
    gap: 1.25rem;
    padding: 1.25rem 0.5rem;
    align-items: center;
}

.book-list-cover { flex-shrink: 0; width: 64px; }

.book-list-cover img {
    width: 64px;
    height: auto;
    box-shadow: var(--shadow-sm);
}

.book-list-cover .no-cover {
    width: 64px;
    height: 90px;
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid var(--rule);
}

.book-list-info { flex: 1; min-width: 0; }

.book-list-title {
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.book-list-author {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.book-list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.meta-tag {
    background: var(--bg-alt);
    color: var(--text-secondary);
    padding: 0.15rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid var(--rule);
}

.select-arrow {
    flex-shrink: 0;
    font-size: 1.3rem;
    color: var(--text-muted);
    padding-right: 0.5rem;
    transition: color 0.15s;
}

.book-list-item:hover .select-arrow {
    color: var(--accent);
}

.book-list-item:nth-child(1)  { animation-delay: 0s; }
.book-list-item:nth-child(2)  { animation-delay: 0.04s; }
.book-list-item:nth-child(3)  { animation-delay: 0.08s; }
.book-list-item:nth-child(4)  { animation-delay: 0.12s; }
.book-list-item:nth-child(5)  { animation-delay: 0.16s; }
.book-list-item:nth-child(6)  { animation-delay: 0.2s; }
.book-list-item:nth-child(7)  { animation-delay: 0.24s; }
.book-list-item:nth-child(8)  { animation-delay: 0.28s; }
.book-list-item:nth-child(9)  { animation-delay: 0.32s; }
.book-list-item:nth-child(10) { animation-delay: 0.36s; }

/* ---------- Detail view ---------- */

.detail-view { display: none; }
.detail-view.active {
    display: block;
    animation: fadeIn 0.25s ease both;
}

.back-btn {
    background: none;
    border: 1px solid var(--rule);
    color: var(--text-secondary);
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1.25rem;
    transition: all 0.15s;
    font-family: var(--sans);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    letter-spacing: 0.02em;
}

.back-btn:hover {
    background: var(--bg-alt);
    border-color: var(--text-secondary);
    color: var(--text);
}

.detail-card {
    border: 1px solid var(--rule);
    margin-bottom: 1.25rem;
}

.detail-card-inner {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
}

.detail-cover { flex-shrink: 0; width: 150px; }

.detail-cover img {
    width: 150px;
    height: auto;
    box-shadow: var(--shadow-sm);
}

.detail-cover .no-cover {
    width: 150px;
    height: 210px;
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid var(--rule);
}

.detail-info { flex: 1; min-width: 0; }

.detail-title {
    font-family: var(--serif);
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.detail-author {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.detail-meta .meta-tag {
    font-size: 0.72rem;
    padding: 0.2rem 0.6rem;
}

.rating { color: #d4a017; font-weight: 700; }

.detail-description {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
}

.detail-description.truncated {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.toggle-desc {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0;
    margin-bottom: 0.4rem;
    font-family: var(--sans);
}

.toggle-desc:hover { text-decoration: underline; }

.external-links {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.external-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    border: 1px solid var(--rule);
    padding: 0.3rem 0.7rem;
    letter-spacing: 0.02em;
    transition: all 0.15s;
}

.external-links a:hover {
    background: var(--bg-alt);
    border-color: var(--accent);
}

/* ---------- Pros / Cons ---------- */

.pros-cons-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-bottom: 1.25rem;
    border: 1px solid var(--rule);
}

.pros-card {
    border-right: 1px solid var(--rule);
}

.cons-card {}

.pros-card .section-header,
.cons-card .section-header {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--rule);
    font-family: var(--sans);
}

.pros-card .section-header {
    background: #f0faf0;
    color: #155724;
}

.cons-card .section-header {
    background: #fdf0f0;
    color: #721c24;
}

.pros-list, .cons-list {
    list-style: none;
    padding: 0.5rem 1rem;
}

.pros-list li, .cons-list li {
    padding: 0.55rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.pros-list li:last-child, .cons-list li:last-child { border-bottom: none; }

.pros-list li::before {
    content: '+';
    color: #155724;
    font-weight: 800;
    flex-shrink: 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.cons-list li::before {
    content: '\2013';
    color: #721c24;
    font-weight: 800;
    flex-shrink: 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.empty-list-msg {
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: italic;
}

/* ---------- AI badge ---------- */

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.55rem;
    padding: 0.1rem 0.4rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    opacity: 0.6;
}

/* ---------- Reviews ---------- */

.reviews-section {
    border: 1px solid var(--rule);
    margin-bottom: 1.25rem;
}

.reviews-section .section-header {
    background: var(--bg-alt);
    color: var(--text);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: var(--sans);
    border-bottom: 1px solid var(--rule);
}

.review-item {
    border-left: 3px solid var(--accent);
    padding: 0.75rem 1rem;
    margin: 0.75rem 1rem;
    background: var(--bg-alt);
}

.review-item:last-child { margin-bottom: 1rem; }

.review-author { font-weight: 600; font-size: 0.82rem; color: var(--text); margin-bottom: 0.2rem; }
.review-rating { font-size: 0.82rem; color: #d4a017; margin-bottom: 0.3rem; }
.review-text   { font-size: 0.82rem; line-height: 1.55; color: var(--text-secondary); }
.review-date   { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ---------- Spinner ---------- */

.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--rule);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 0.4rem;
}

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

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

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 2px solid var(--text);
    margin-top: 0;
}

footer a {
    color: var(--text-secondary);
    font-weight: 600;
}

footer a:hover { color: var(--accent); }

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

@media (max-width: 900px) {
    .perspectives-grid {
        grid-template-columns: 1fr 1fr;
    }
    .perspective-col.persp-center {
        grid-column: 1 / -1;
        border-right: none;
        border-bottom: 1px solid var(--rule);
        border-top: none;
        border-left: 3px solid var(--persp-center);
        padding-left: 1rem;
    }
    .key-center { justify-content: flex-start; }
    .key-right  { justify-content: flex-start; }

    .featured-row {
        grid-template-columns: 1fr 1fr;
    }
    .featured-row > *:nth-child(3) {
        grid-column: 1 / -1;
        border-right: none;
        border-top: 1px solid var(--rule);
    }
    .featured-row > *:nth-child(2) {
        border-right: none;
    }
    .mid-section {
        grid-template-columns: 1fr 1fr;
    }
    .mid-section > *:nth-child(3) {
        grid-column: 1 / -1;
        border-right: none;
        border-top: 1px solid var(--rule);
    }
    .mid-section > *:nth-child(2) {
        border-right: none;
    }
}

@media (max-width: 640px) {
    .masthead-title { font-size: 1.9rem; }

    .section-nav-inner {
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .section-nav-inner::-webkit-scrollbar { display: none; }
    .section-nav a { font-size: 0.72rem; padding: 0.55rem 0.7rem; }

    .nav-toggle { display: block; }
    .section-nav-inner.collapsed {
        display: none;
    }
    .section-nav-inner.collapsed.open {
        display: flex;
        flex-wrap: wrap;
    }

    .featured-row {
        grid-template-columns: 1fr;
    }
    .featured-row > * {
        border-right: none !important;
        border-bottom: 1px solid var(--rule);
    }
    .featured-row > *:last-child {
        border-bottom: none;
    }
    .featured-center .article-headline { font-size: 1.4rem; }

    .mid-section {
        grid-template-columns: 1fr;
    }
    .mid-section > * {
        border-right: none !important;
        border-bottom: 1px solid var(--rule);
    }
    .mid-section > *:last-child { border-bottom: none; }

    .bottom-section {
        grid-template-columns: 1fr;
    }
    .bottom-section > *:first-child {
        border-right: none;
        border-bottom: 1px solid var(--rule);
    }

    .perspectives-grid {
        grid-template-columns: 1fr;
    }
    .perspective-col,
    .perspective-col.persp-center {
        border-right: none;
        border-bottom: 1px solid var(--rule);
        border-top: none;
        border-left: 3px solid transparent;
        padding-left: 1rem;
        grid-column: auto;
    }
    .perspective-col.persp-left   { border-left-color: var(--persp-left); }
    .perspective-col.persp-center { border-left-color: var(--persp-center); }
    .perspective-col.persp-right  { border-left-color: var(--persp-right); border-bottom: none; }

    .story-supplements {
        grid-template-columns: 1fr;
    }
    .story-history {
        border-right: none;
        border-bottom: 1px solid var(--rule);
    }

    .perspectives-key > div { justify-content: flex-start; }

    .category-header h1 { font-size: 1.7rem; }
    .category-header { padding: 1.75rem 1rem 1.25rem; }

    .pros-cons-container { grid-template-columns: 1fr; }
    .pros-card { border-right: none; border-bottom: 1px solid var(--rule); }

    .detail-card-inner { flex-direction: column; align-items: center; text-align: center; }
    .detail-cover { width: 120px; }
    .detail-cover img { width: 120px; }
    .detail-cover .no-cover { width: 120px; height: 168px; }
    .detail-meta { justify-content: center; }
    .detail-description { text-align: left; }
    .external-links { justify-content: center; }

    .api-key-inner { flex-wrap: wrap; }
    .book-list-inner { padding: 1rem 0.25rem; gap: 1rem; }
}

@media (max-width: 380px) {
    .masthead-title { font-size: 1.6rem; }
    .search-box button { padding: 0.65rem 1rem; font-size: 0.78rem; }
}
