/* ==========================================================================
   HER GÜN KİTAP - DÜNYANIN OKUMA ARŞİVİ (GLOBAL READING PULSE)
   Modern Luxury White Theme, Alternating Directional Marquee & Typographic Tag Cloud
   ========================================================================== */

.global-archive-slot {
    width: 100%;
    margin: clamp(40px, 5vw, 72px) 0 0;
}

/* Master Container - Clean Luxury White */
.global-archive-fallback,
.global-reading-pulse {
    position: relative;
    width: 100%;
    margin: 0;
    padding: clamp(24px, 4vw, 48px);
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 28px;
    box-shadow: 0 16px 48px -12px rgba(15, 23, 42, 0.07), 0 0 0 1px rgba(241, 90, 36, 0.04);
    color: #0f172a;
    overflow: visible; /* Popovers must never be clipped */
}

/* Subtle Ambient Glow Background */
.global-archive-fallback::before,
.global-reading-pulse::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: 
        radial-gradient(circle at 92% 10%, rgba(241, 90, 36, 0.04) 0%, transparent 45%),
        radial-gradient(circle at 8% 90%, rgba(99, 102, 241, 0.04) 0%, transparent 40%);
    z-index: 0;
}

.global-archive-fallback > *,
.global-reading-pulse > * {
    position: relative;
    z-index: 1;
}

/* Top Accent Line */
.global-archive-fallback::after,
.global-reading-pulse::after {
    content: "";
    position: absolute;
    top: 0;
    left: 36px;
    right: 36px;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, #f15a24 30%, #ff8a50 70%, transparent 100%);
    border-radius: 999px;
}

/* Header Section */
.pulse-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f1f5f9;
}

.pulse-heading .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #ea580c;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.pulse-heading h2 {
    max-width: 680px;
    margin: 6px 0 10px;
    color: #0f172a !important;
    font-size: clamp(1.9rem, 3.4vw, 2.9rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.04em;
}

.pulse-heading h2 em {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-weight: 400;
    background: linear-gradient(135deg, #f15a24 0%, #c2410c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding-right: 4px;
}

.pulse-heading p {
    max-width: 620px;
    margin: 0;
    color: #475569;
    font-size: 0.98rem;
    line-height: 1.6;
}

/* Live Pulse Badge */
.pulse-live {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff7ed;
    border: 1px solid #ffedd5;
    border-radius: 999px;
    color: #c2410c;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.pulse-live::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
    animation: pulse-dot-glow 2s infinite ease-in-out;
}

@keyframes pulse-dot-glow {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.75;
    }
}

/* Metric Cards Grid */
.pulse-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin: 28px 0;
}

.pulse-metric {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pulse-metric:hover {
    transform: translateY(-2px);
    border-color: #f15a24;
    box-shadow: 0 10px 24px -4px rgba(241, 90, 36, 0.12);
}
.pulse-metric-link { color: inherit; text-decoration: none; }
.pulse-metric-link:focus-visible { outline: 3px solid #e6531d; outline-offset: 3px; }

.pulse-metric > span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #fff7ed;
    color: #ea580c;
    font-size: 1.15rem;
    flex: none;
}

.pulse-metric strong {
    display: block;
    font-size: 1.65rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.pulse-metric small {
    display: block;
    margin-top: 3px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Section Containers */
.pulse-full-section {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 24px;
    padding: 24px 28px;
    margin-top: 28px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);
    position: relative;
    overflow: visible;
}

.pulse-section-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f8fafc;
}

.pulse-section-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: none;
}

.pulse-refresh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 7px 13px;
    border: 1px solid #f3c8b4;
    border-radius: 11px;
    background: linear-gradient(145deg, #fffaf6, #fff1e8);
    color: #c64b18;
    font: inherit;
    font-size: .78rem;
    font-weight: 750;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(195, 85, 38, .07);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.pulse-refresh-button:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: #f15a24;
    background: #fff;
    box-shadow: 0 7px 16px rgba(195, 85, 38, .14);
}

.pulse-refresh-button:focus-visible {
    outline: 3px solid rgba(241, 90, 36, .24);
    outline-offset: 2px;
}

.pulse-refresh-button:disabled {
    opacity: .68;
    cursor: wait;
}

.pulse-refresh-button svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

.pulse-refresh-button.is-loading svg {
    animation: archive-refresh-spin .75s linear infinite;
}

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

.pulse-cloud-label {
    color: #475569;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* List Toggle Button */
.pulse-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: #334155;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pulse-view-toggle:hover {
    background: #fff7ed;
    border-color: #f15a24;
    color: #ea580c;
    transform: translateY(-1px);
}

.pulse-view-toggle.is-active {
    background: #f15a24;
    border-color: #ea580c;
    color: #ffffff;
}

/* ==========================================================================
   ACTIVE WORD INSPECTOR BAR (High-contrast definition panel above cloud)
   ========================================================================== */

.pulse-word-inspector {
    margin-bottom: 22px;
}

.inspector-prompt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: #fffaf5;
    border: 1.5px dashed #fbd5c0;
    border-radius: 14px;
    color: #9a3412;
    font-size: 0.88rem;
    font-weight: 500;
}

.inspector-icon {
    font-size: 1.15rem;
    color: #ea580c;
}

.inspector-card {
    padding: 18px 22px;
    background: #ffffff;
    border: 2px solid #f15a24;
    border-radius: 16px;
    box-shadow: 0 10px 30px -5px rgba(241, 90, 36, 0.14);
    animation: inspector-fade-in 0.22s ease-out;
}

@keyframes inspector-fade-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.inspector-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.inspector-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #fff7ed;
    border-radius: 999px;
    color: #ea580c;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.inspector-close {
    border: none;
    background: #f1f5f9;
    color: #64748b;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s, color 0.2s;
}

.inspector-close:hover {
    background: #fee2e2;
    color: #ef4444;
}

.inspector-card-body strong.inspector-word {
    display: block;
    color: #0f172a;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.inspector-card-body p.inspector-meaning {
    margin: 0;
    color: #334155;
    font-size: 1rem;
    line-height: 1.6;
}

/* ==========================================================================
   ALTERNATING DIRECTIONAL MARQUEE SYSTEM (LEFT <-> RIGHT ROWS)
   ========================================================================== */

@keyframes marquee-glide-left {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-50%, 0, 0); }
}

@keyframes marquee-glide-right {
    0% { transform: translate3d(-50%, 0, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

.pulse-visual-wrap {
    position: relative;
    width: 100%;
    overflow: visible;
}

.pulse-marquee-row {
    position: relative;
    width: 100%;
    overflow: visible;
    padding: 10px 0;
    margin: 2px 0;
}

.pulse-marquee-track {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 26px;
    width: 100%;
}

.pulse-marquee-row.direction-left .pulse-marquee-track {
    animation: none;
}

.pulse-marquee-row.direction-right .pulse-marquee-track {
    animation: none;
}

/* Discovered words drift in alternating directions; each track contains two identical groups. */
.pulse-collection-section[data-pulse-section="words"] .pulse-marquee-row {
    overflow-x: clip;
    overflow-y: visible;
    z-index: 1;
}
.pulse-collection-section[data-pulse-section="words"] .pulse-marquee-row:has(.archive-votable-item.is-expanded) {
    z-index: 20;
}
.pulse-collection-section[data-pulse-section="words"] .pulse-marquee-track {
    display: flex;
    width: max-content;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0;
    will-change: transform;
}
.pulse-collection-section[data-pulse-section="words"] .pulse-marquee-group {
    display: flex;
    width: max-content;
    flex: none;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    padding-right: 18px;
}
.pulse-collection-section[data-pulse-section="words"] .pulse-marquee-row.direction-left .pulse-marquee-track {
    animation: marquee-glide-left var(--row-speed, 420s) linear infinite;
}
.pulse-collection-section[data-pulse-section="words"] .pulse-marquee-row.direction-right .pulse-marquee-track {
    animation: marquee-glide-right var(--row-speed, 460s) linear infinite;
}
.pulse-collection-section[data-pulse-section="words"] .pulse-marquee-row.is-static .pulse-marquee-track {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    animation: none !important;
    transform: none !important;
}
.pulse-collection-section[data-pulse-section="words"] .pulse-marquee-group .archive-votable-item { margin-inline: 5px; }
.pulse-collection-section[data-pulse-section="words"] .archive-votable-item.is-expanded {
    z-index: 21;
}

/* Dashboard books and authors use the same three-line, slow typographic cloud. */
.global-reading-pulse .pulse-collection-section[data-pulse-section="books"] .pulse-marquee-row,
.global-reading-pulse .pulse-collection-section[data-pulse-section="authors"] .pulse-marquee-row { overflow-x: clip; overflow-y: visible; z-index: 1; }
.global-reading-pulse .pulse-collection-section[data-pulse-section="books"] .pulse-marquee-track,
.global-reading-pulse .pulse-collection-section[data-pulse-section="authors"] .pulse-marquee-track { display:flex; width:max-content; flex-wrap:nowrap; justify-content:flex-start; gap:0; will-change:transform; }
.global-reading-pulse .pulse-collection-section[data-pulse-section="books"] .pulse-marquee-group,
.global-reading-pulse .pulse-collection-section[data-pulse-section="authors"] .pulse-marquee-group { display:flex; width:max-content; flex:none; flex-wrap:nowrap; align-items:center; gap:0; padding-right:18px; }
.global-reading-pulse .pulse-collection-section[data-pulse-section="books"] .pulse-marquee-row.direction-left .pulse-marquee-track,
.global-reading-pulse .pulse-collection-section[data-pulse-section="authors"] .pulse-marquee-row.direction-left .pulse-marquee-track { animation:marquee-glide-left var(--row-speed,420s) linear infinite; }
.global-reading-pulse .pulse-collection-section[data-pulse-section="books"] .pulse-marquee-row.direction-right .pulse-marquee-track,
.global-reading-pulse .pulse-collection-section[data-pulse-section="authors"] .pulse-marquee-row.direction-right .pulse-marquee-track { animation:marquee-glide-right var(--row-speed,460s) linear infinite; }
.global-reading-pulse .pulse-collection-section[data-pulse-section="books"] .pulse-marquee-row.is-static .pulse-marquee-track,
.global-reading-pulse .pulse-collection-section[data-pulse-section="authors"] .pulse-marquee-row.is-static .pulse-marquee-track { width:100%; flex-wrap:wrap; justify-content:center; animation:none!important; transform:none!important; }
.global-reading-pulse .pulse-collection-section[data-pulse-section="books"] .archive-votable-item,
.global-reading-pulse .pulse-collection-section[data-pulse-section="authors"] .archive-votable-item { margin-inline:5px; }

/* Hover pauses for reading; JS eases the marquee back into motion on pointer exit. */
.pulse-marquee-row:hover .pulse-marquee-track {
    animation-play-state: paused !important;
}
.pulse-marquee-row.is-detail-open .pulse-marquee-track {
    animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
    .pulse-collection-section[data-pulse-section="words"] .pulse-marquee-track,
    .global-reading-pulse .pulse-collection-section[data-pulse-section="books"] .pulse-marquee-track,
    .global-reading-pulse .pulse-collection-section[data-pulse-section="authors"] .pulse-marquee-track { animation: none !important; transform: none !important; }
}

/* ==========================================================================
   ORGANIC TYPOGRAPHIC TAG CLOUD (JUST LIKE REFERENCE IMAGE, ON WHITE)
   ========================================================================== */

.pulse-word-tag {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
    outline: none;
}

.pulse-word-tag:hover {
    background: #fff7ed;
    border-color: #fed7aa;
    transform: scale(1.12);
    box-shadow: 0 4px 16px rgba(241, 90, 36, 0.12);
    z-index: 50;
}

.pulse-word-tag:focus-visible {
    outline: 2px solid #f15a24;
    outline-offset: 2px;
}

/* Hierarchy Tiers */
.pulse-word-tag.tier-hero .pulse-word-text {
    font-size: clamp(1.8rem, 2.5vw, 2.45rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.pulse-word-tag.tier-major .pulse-word-text {
    font-size: clamp(1.35rem, 1.8vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.pulse-word-tag.tier-medium .pulse-word-text {
    font-size: clamp(1.05rem, 1.35vw, 1.3rem);
    font-weight: 600;
    line-height: 1.2;
}

.pulse-word-tag.tier-small .pulse-word-text {
    font-size: clamp(0.9rem, 1.05vw, 1.05rem);
    font-weight: 500;
    line-height: 1.2;
}

.pulse-word-tag.tier-xs .pulse-word-text {
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.2;
}

/* Typographic Colors on White Background */
.pulse-word-tag.color-orange .pulse-word-text {
    color: #ea580c;
}
.pulse-word-tag.color-ink .pulse-word-text {
    color: #0f172a;
}
.pulse-word-tag.color-slate .pulse-word-text {
    color: #334155;
}
.pulse-word-tag.color-muted .pulse-word-text {
    color: #64748b;
}
.pulse-word-tag.color-purple .pulse-word-text {
    color: #7c3aed;
}

/* ==========================================================================
   CRYSTAL-CLEAR FLOATING DEFINITION POPOVER
   ========================================================================== */

.pulse-word-meaning {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    min-width: 250px;
    max-width: 320px;
    padding: 14px 18px;
    background: #ffffff !important;
    border: 2px solid #f15a24 !important;
    border-radius: 16px;
    box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(241, 90, 36, 0.15) !important;
    color: #0f172a !important;
    font-size: 14px !important;
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 99999;
    white-space: normal;
    text-shadow: none !important;
    box-sizing: border-box;
}
.pulse-word-meaning .archive-reaction-controls { margin-top: 10px; padding-top: 9px; border-top: 1px solid #f1e4da; }

/* Upward pointer arrow */
.pulse-word-meaning::after {
    content: "";
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-right: 2px solid #f15a24;
    border-bottom: 2px solid #f15a24;
}

/* Downward opening when tag is near top of screen */
.pulse-word-meaning.open-down {
    bottom: auto;
    top: calc(100% + 14px);
    transform: translateX(-50%) translateY(-6px);
}

.pulse-word-meaning.open-down::after {
    bottom: auto;
    top: -7px;
    border-right: none;
    border-bottom: none;
    border-left: 2px solid #f15a24;
    border-top: 2px solid #f15a24;
}

.archive-votable-item.is-expanded .pulse-word-meaning {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.popover-tag {
    display: inline-block;
    padding: 2px 7px;
    margin-bottom: 6px;
    background: #fff7ed;
    color: #ea580c;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.popover-word {
    display: block;
    color: #0f172a !important;
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 4px;
}

.popover-desc {
    display: block;
    color: #334155 !important;
    font-size: 13.5px;
    line-height: 1.5;
}

/* ==========================================================================
   BOOKS & AUTHORS PILL CARDS IN MULTI-ROW MARQUEE
   ========================================================================== */

.pulse-flight-tag {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}

button.pulse-flight-tag { font: inherit; cursor: pointer; }

.pulse-flight-tag.book {
    padding: 10px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.pulse-flight-tag.book::before {
    content: "▤";
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    background: #fff7ed;
    color: #ea580c;
    border-radius: 50%;
    font-size: 0.85rem;
    flex: none;
}

.pulse-flight-tag.book:hover {
    transform: translateY(-2px);
    border-color: #f15a24;
    box-shadow: 0 8px 20px rgba(241, 90, 36, 0.12);
}

.pulse-flight-tag.author {
    padding: 9px 18px;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 999px;
    color: #581c87;
    font-size: 0.92rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.pulse-flight-tag.author::before {
    content: "✒";
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    background: #f3e8ff;
    color: #9333ea;
    border-radius: 50%;
    font-size: 0.8rem;
    flex: none;
}

.pulse-flight-tag.author:hover {
    transform: translateY(-2px);
    border-color: #a855f7;
    box-shadow: 0 8px 20px rgba(168, 85, 247, 0.15);
}

.archive-votable-item {
    position: relative;
    display: inline-flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 5px 8px;
    vertical-align: middle;
}

.archive-votable-item .pulse-flight-tag { margin: 0; }

.archive-reaction-controls {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    white-space: nowrap;
}

.archive-reaction-button {
    display: inline-flex;
    min-width: 42px;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 3px 8px;
    border: 1px solid #eadfd5;
    border-radius: 999px;
    background: #fffdfa;
    color: #6c6864;
    font: inherit;
    font-size: .78rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}

.archive-reaction-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.archive-reaction-button:hover { transform: translateY(-1px); border-color: #f0a47e; color: #df4c18; }
.archive-reaction-button.archive-like.is-selected { border-color: #f47745; background: #fff0e8; color: #d84917; }
.archive-reaction-button.archive-dislike.is-selected { border-color: #8b929b; background: #f1f3f5; color: #4c5560; }
.archive-reaction-button:disabled { opacity: .55; cursor: wait; transform: none; }
.archive-reaction-feedback { flex-basis: 100%; color: #b42318; font-size: .72rem; line-height: 1.3; white-space: normal; }
.pulse-list-row .archive-reaction-controls { margin-top: 12px; }
.pulse-quote-table td:last-child { text-align: center; }
.pulse-quote-table td:last-child .archive-reaction-controls { justify-content: center; }
.pulse-quote-table .archive-reaction-button { min-width: 38px; padding-inline: 6px; }

/* ==========================================================================
   QUOTES TABLE
   ========================================================================== */

.pulse-quote-table-wrap {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.pulse-quote-table {
    width: 100%;
    border-collapse: collapse;
}

.pulse-quote-table th {
    background: #f8fafc;
    padding: 14px 20px;
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.pulse-quote-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    color: #0f172a;
    font-size: 0.92rem;
}

.pulse-quote-table tr:last-child td {
    border-bottom: none;
}

.pulse-quote-text {
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    color: #1e293b;
    font-size: 1.05rem;
    line-height: 1.6;
}

.pulse-quote-time {
    color: #64748b;
    font-size: 0.85rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Reader quotes carousel */
.pulse-quotes-carousel {
    padding: 18px;
    overflow: hidden;
    border: 1px solid #f1e5dc;
    border-radius: 22px;
    background: linear-gradient(145deg, #fffaf6 0%, #fff 58%, #fff7f0 100%);
}

.pulse-quotes-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 2px 14px;
}

.pulse-quotes-controls > span {
    color: #81766f;
    font-size: .82rem;
    font-weight: 650;
}

.pulse-quotes-arrows {
    display: flex;
    gap: 8px;
}

.pulse-quote-arrow {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid #f2cdb9;
    border-radius: 13px;
    background: #fff;
    color: #d94d19;
    font: inherit;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(116, 59, 32, .07);
    transition: transform .18s ease, background .18s ease, color .18s ease, opacity .18s ease;
}

.pulse-quote-arrow:hover:not(:disabled) {
    transform: translateY(-2px);
    background: #f15a24;
    color: #fff;
}

.pulse-quote-arrow:disabled {
    opacity: .38;
    cursor: default;
}

.pulse-quote-arrow:focus-visible,
.pulse-quotes-track:focus-visible {
    outline: 3px solid rgba(241, 90, 36, .28);
    outline-offset: 3px;
}

.pulse-quotes-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 2px 2px 13px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #e7b49a transparent;
    touch-action: pan-x pan-y;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
}

.pulse-quotes-track::-webkit-scrollbar { height: 7px; }
.pulse-quotes-track::-webkit-scrollbar-track { background: transparent; }
.pulse-quotes-track::-webkit-scrollbar-thumb { border-radius: 8px; background: #e7b49a; }
.pulse-quotes-track.is-dragging { cursor: grabbing; user-select: none; scroll-behavior: auto; }
.pulse-quotes-track.is-pointer-down { cursor: grabbing; }

.pulse-quote-card {
    position: relative;
    display: flex;
    flex: 0 0 min(700px, 72%);
    flex-direction: column;
    min-height: 235px;
    padding: 21px 22px 18px;
    overflow: hidden;
    scroll-snap-align: start;
    border: 1px solid #eee3dc;
    border-radius: 19px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 7px 22px rgba(53, 39, 30, .055);
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.pulse-quote-card::after {
    position: absolute;
    right: -30px;
    bottom: -45px;
    width: 125px;
    height: 125px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 113, 60, .09), rgba(255, 113, 60, 0) 70%);
    content: "";
    pointer-events: none;
}

.pulse-quote-card:hover {
    transform: translateY(-4px);
    border-color: #efc3ac;
    box-shadow: 0 14px 30px rgba(94, 57, 38, .11);
}

.pulse-quote-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 31px;
}

.pulse-quote-card-mark {
    height: 37px;
    color: #f15a24;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 3.4rem;
    font-weight: 700;
    line-height: 1;
}

.pulse-quote-card-top time {
    padding: 6px 10px;
    border-radius: 999px;
    background: #fff4ed;
    color: #9a5534;
    font-size: .72rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.pulse-quote-card .pulse-quote-text {
    display: block;
    margin: 12px 0 20px;
    overflow: visible;
    color: #292522;
    font-size: 1.02rem;
    font-weight: 500;
    line-height: 1.68;
    overflow-wrap: anywhere;
}

.pulse-quote-card-book {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: auto;
    padding-top: 13px;
    border-top: 1px solid #f1ece8;
    color: #d65321;
    font-size: .82rem;
}

.pulse-quote-card-book > span {
    display: grid;
    width: 29px;
    height: 29px;
    flex: none;
    place-items: center;
    border-radius: 9px;
    background: #fff0e7;
}

.pulse-quote-card-book strong {
    overflow: hidden;
    color: #57504b;
    font-size: .79rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pulse-quote-card > .archive-reaction-controls {
    position: relative;
    z-index: 1;
    justify-content: flex-end;
    width: 100%;
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid #f4e9e1;
}

.archive-list-item-trigger {
    justify-self: start;
    padding: 0;
    border: 0;
    background: transparent;
    color: #34251d;
    font: inherit;
    font-weight: 750;
    text-align: left;
    cursor: pointer;
}
.archive-list-item-trigger:hover { color: #e6531d; text-decoration: underline; text-underline-offset: 3px; }
.archive-word-list-row { position: relative; }
.archive-word-list-vote { display: none; margin-top: 10px; }
.archive-word-list-row.is-expanded .archive-word-list-vote { display: block; }
.archive-word-list-row.is-expanded { border-color: #f1b28e; box-shadow: 0 8px 22px rgba(104, 55, 31, .08); }
.archive-list-word-trigger { font-size: 1.08rem; }

.archive-detail-backdrop {
    position: fixed;
    z-index: 100000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(36, 27, 21, .48);
    backdrop-filter: blur(5px);
}
.archive-dialog-open { overflow: hidden; }
.archive-detail-dialog {
    width: min(590px, 100%);
    max-height: min(82vh, 760px);
    overflow: auto;
    padding: 25px;
    border: 1px solid #f0d7c8;
    border-radius: 24px;
    background: #fffdfa;
    box-shadow: 0 24px 80px rgba(37, 24, 15, .25);
}
.archive-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.archive-detail-header small { color: #e6531d; font-size: .7rem; font-weight: 850; letter-spacing: .12em; }
.archive-detail-header h3 { margin: 5px 0 0; color: #211914; font-size: clamp(1.35rem, 4vw, 1.8rem); line-height: 1.2; }
.archive-detail-header h3 a,
.archive-detail-byline a,
.archive-author-book-row a { color: inherit; text-decoration: none; text-underline-offset: .18em; }
.archive-detail-header h3 a:hover,
.archive-detail-header h3 a:focus-visible,
.archive-detail-byline a:hover,
.archive-detail-byline a:focus-visible,
.archive-author-book-row a:hover,
.archive-author-book-row a:focus-visible { color: #e6531d; text-decoration: underline; }
.archive-detail-close { width: 38px; height: 38px; flex: none; border: 1px solid #f0ded3; border-radius: 13px; background: #fff5ee; color: #9c3a13; font-size: 1.5rem; cursor: pointer; }
.archive-detail-byline { margin: 16px 0 20px; color: #74665d; }
.archive-detail-word-meaning { margin: 18px 0 20px; padding: 16px 18px; border: 1px solid #f1e4da; border-radius: 15px; background: #fff8f3; color: #40342d; font-size: 1rem; line-height: 1.7; overflow-wrap: anywhere; }
.archive-detail-dialog > .archive-reaction-controls { margin-top: 20px; padding: 12px; border: 1px solid #f1e4da; border-radius: 16px; background: #fff8f3; }
.archive-author-vote { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 20px 0; padding: 13px 15px; border: 1px solid #f1e4da; border-radius: 16px; background: #fff8f3; color: #74665d; font-size: .88rem; font-weight: 700; }
.archive-detail-list-title { margin: 20px 0 10px; color: #211914; font-size: 1rem; }
.archive-author-book-list { display: grid; gap: 9px; color: #756a63; }
.archive-author-book-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 6px 14px; padding: 13px 14px; border: 1px solid #f0e5dc; border-radius: 15px; background: #fff; }
.archive-author-book-row strong { color: #30241e; }
.archive-author-book-row small { grid-column: 1; color: #81766f; }
.archive-author-book-row .archive-reaction-controls { grid-column: 2; grid-row: 1 / span 2; }

.pulse-quote-carousel-empty {
    display: grid;
    min-height: 165px;
    flex: 1 0 100%;
    place-items: center;
    border: 1px dashed #e8cdbd;
    border-radius: 16px;
    color: #766a62;
    font-size: .95rem;
}

.pulse-quotes-carousel.is-empty .pulse-quotes-controls { display: none; }

/* Keep long quotes readable without letting mobile cards grow past the viewport. */
@media (max-width: 600px) {
    .pulse-quote-card {
        min-height: 0;
        max-height: min(390px, 62vh);
    }

    .pulse-quote-card .pulse-quote-text {
        flex: 0 1 auto;
        max-height: min(155px, 27vh);
        margin: 10px 0 12px;
        padding-right: 8px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: #e7b49a transparent;
        -webkit-overflow-scrolling: touch;
    }

    .pulse-quote-card .pulse-quote-text::-webkit-scrollbar { width: 4px; }
    .pulse-quote-card .pulse-quote-text::-webkit-scrollbar-track { background: transparent; }
    .pulse-quote-card .pulse-quote-text::-webkit-scrollbar-thumb { border-radius: 8px; background: #e7b49a; }
}

@media (max-width: 900px) {
    .pulse-quote-card { flex-basis: min(520px, 72%); }
}

@media (max-width: 600px) {
    .pulse-quotes-carousel { padding: 13px 10px 10px; border-radius: 18px; }
    .pulse-quotes-controls { margin: 0 3px 10px; }
    .pulse-quotes-controls > span { max-width: 190px; font-size: .75rem; }
    .pulse-quote-arrow { width: 36px; height: 36px; border-radius: 12px; }
    .pulse-quotes-track { gap: 12px; padding-right: 10px; }
    .pulse-quote-card { flex-basis: 86%; min-height: 225px; padding: 18px; }
    .pulse-quote-card .pulse-quote-text { font-size: .98rem; }
    .archive-detail-backdrop { padding: 12px; }
    .archive-detail-dialog { max-height: 88vh; padding: 19px; border-radius: 20px; }
    .archive-author-book-row { grid-template-columns: 1fr; }
    .archive-author-book-row .archive-reaction-controls { grid-column: 1; grid-row: auto; }
}

/* ==========================================================================
   LIST VIEW & BULLETPROOF TOGGLE SYSTEM (OVERRIDE SPECIFICITY)
   ========================================================================== */

[hidden],
.pulse-visual-wrap[hidden],
.pulse-list-view[hidden],
.pulse-word-cloud[hidden],
.pulse-marquee[hidden],
.pulse-quote-table-wrap[hidden] {
    display: none !important;
}

.pulse-visual-wrap:not([hidden]) {
    display: block !important;
}

.pulse-list-view:not([hidden]) {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.pulse-list-row {
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    color: #0f172a;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.pulse-list-row:hover {
    transform: translateY(-2px);
    border-color: #f15a24;
    box-shadow: 0 8px 20px rgba(241, 90, 36, 0.1);
}

.pulse-list-row strong {
    display: block;
    color: #0f172a;
    font-size: 1.05rem;
    font-weight: 700;
}

.pulse-list-row small {
    display: block;
    margin-top: 6px;
    color: #64748b;
    font-size: 0.88rem;
    line-height: 1.5;
}

.pulse-list-row .archive-reaction-controls { display: flex; }

/* Pager wrappers are layout-transparent on larger screens. */
.pulse-list-page { display: contents; }

/* Empty state */
.pulse-empty {
    padding: 32px;
    text-align: center;
    color: #64748b;
    font-size: 0.95rem;
}

/* ==========================================================================
   RESPONSIVE ADAPTATIONS
   ========================================================================== */

@media (max-width: 900px) {
    .pulse-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .pulse-heading {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .global-archive-fallback,
    .global-reading-pulse {
        padding: 20px 16px;
        border-radius: 20px;
    }
    .pulse-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .pulse-metric {
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr);
        grid-template-rows: auto auto;
        align-content: center;
        column-gap: 9px;
        row-gap: 3px;
        min-width: 0;
        padding: 11px 10px;
    }
    .pulse-metric > span {
        grid-column: 1;
        grid-row: 1 / span 2;
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 1rem;
    }
    .pulse-metric strong,
    .pulse-metric small {
        grid-column: 2;
        min-width: 0;
    }
    .pulse-metric strong {
        font-size: clamp(1.1rem, 5vw, 1.3rem);
        white-space: nowrap;
    }
    .pulse-metric small {
        margin-top: 0;
        font-size: .61rem;
        line-height: 1.25;
        letter-spacing: .035em;
        overflow-wrap: anywhere;
    }
    .pulse-full-section {
        padding: 18px 14px;
        border-radius: 18px;
    }
    .pulse-section-bar {
        align-items: flex-start;
        flex-direction: column;
        gap: 11px;
    }
    .pulse-section-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
        gap: 8px;
    }
    .pulse-section-actions .pulse-refresh-button,
    .pulse-section-actions .pulse-view-toggle {
        width: 100%;
        min-width: 0;
        min-height: 42px;
        padding: 8px 9px;
        font-size: .74rem;
    }
    .pulse-list-view:not([hidden]) {
        grid-template-columns: 1fr;
    }
    .pulse-full-section[data-pulse-section="books"].is-list [data-pulse-list][data-mobile-pages="1"],
    .pulse-full-section[data-pulse-section="authors"].is-list [data-pulse-list][data-mobile-pages="1"] {
        display: flex !important;
        grid-template-columns: none;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scrollbar-width: thin;
        scrollbar-color: #f15a24 #fff1e9;
        margin: 16px -2px 0;
        padding: 0 2px 8px;
        -webkit-overflow-scrolling: touch;
    }
    .pulse-list-page {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-content: start;
        gap: 8px;
        flex: 0 0 100%;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        scroll-snap-align: start;
    }
    .pulse-list-page .pulse-list-row {
        min-width: 0;
        padding: 11px 14px;
        border-radius: 13px;
        overflow-wrap: anywhere;
    }
}

/* Keep archive view switching deterministic even when other styles set display. */
.pulse-full-section:not(.is-list) [data-pulse-list] {
    display: none !important;
}

.pulse-full-section.is-list [data-pulse-visual] {
    display: none !important;
}

.pulse-full-section.is-list [data-pulse-list]:not([hidden]) {
    display: grid !important;
}
