/* ==========================================================================
   Boocu — Editorial Design System v2
   Aesthetic: modern literary magazine. Warm paper, ink type, persimmon accent.
   Display: Fraunces (optical serif) · Text/UI: Schibsted Grotesk
   ========================================================================== */

:root {
    --paper: #f6f1e7;
    --paper-raised: #fdfaf3;
    --paper-dim: #efe8d9;
    --ink: #221e17;
    --ink-soft: #6b6254;
    --ink-faint: #9a9081;
    --line: rgba(34, 30, 23, 0.16);
    --line-strong: rgba(34, 30, 23, 0.55);
    --accent: #c2491d;
    --accent-deep: #993812;
    --accent-wash: rgba(194, 73, 29, 0.08);
    --moss: #3d6b58;
    --moss-wash: rgba(61, 107, 88, 0.1);
    --gold: #a87f1f;
    --gold-wash: rgba(168, 127, 31, 0.12);
    --shadow-book: 0 1px 2px rgba(34, 30, 23, 0.18), 0 8px 24px -8px rgba(34, 30, 23, 0.35);
    --shadow-book-hover: 0 2px 4px rgba(34, 30, 23, 0.18), 0 18px 36px -10px rgba(34, 30, 23, 0.4);
    --font-display: "Fraunces", "Georgia", serif;
    --font-text: "Schibsted Grotesk", "Helvetica Neue", sans-serif;
}

[data-theme="dark"] {
    --paper: #16120d;
    --paper-raised: #201b14;
    --paper-dim: #1b1610;
    --ink: #ece3d2;
    --ink-soft: #a89d8a;
    --ink-faint: #7d7363;
    --line: rgba(236, 227, 210, 0.16);
    --line-strong: rgba(236, 227, 210, 0.6);
    --accent: #e9764a;
    --accent-deep: #f0936f;
    --accent-wash: rgba(233, 118, 74, 0.12);
    --moss: #7fb8a1;
    --moss-wash: rgba(127, 184, 161, 0.12);
    --gold: #d4a93c;
    --gold-wash: rgba(212, 169, 60, 0.14);
    --shadow-book: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px -8px rgba(0, 0, 0, 0.7);
    --shadow-book-hover: 0 2px 4px rgba(0, 0, 0, 0.5), 0 18px 36px -10px rgba(0, 0, 0, 0.8);
}

/* ---------- Base ---------- */

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-text);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--paper);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Paper grain */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.45;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.05'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme="dark"] body::before { opacity: 0.3; }

body > * { position: relative; z-index: 1; }

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

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

::selection { background: var(--accent); color: var(--paper); }

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

header.masthead {
    border-top: 4px solid var(--ink);
    padding: 28px 0 0;
}

.masthead-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line-strong);
    position: relative;
}

/* double-rule flourish under the masthead */
.masthead-row::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    border-bottom: 1px solid var(--line-strong);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-brand .logo {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
}

.brand-text h1 {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.brand-text h1 .brand-dot { color: var(--accent); }

.brand-text .subtitle {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--ink-soft);
    margin-top: 2px;
}

.masthead-edition {
    text-align: right;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-soft);
    line-height: 1.8;
    white-space: nowrap;
}

.masthead-edition strong {
    display: block;
    color: var(--ink);
    font-weight: 600;
}

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

.main-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.main-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
}

.nav-links {
    display: flex;
    gap: 4px;
    list-style: none;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-links a { white-space: nowrap; }

.nav-actions { flex-shrink: 0; }

.nav-links a {
    display: inline-block;
    padding: 14px 14px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-decoration: none;
    color: var(--ink-soft);
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-links a:hover { color: var(--ink); }

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

.nav-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle,
.share-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    border-radius: 50%;
    background: none;
    color: var(--ink-soft);
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover,
.share-icon:hover {
    border-color: var(--line);
    background-color: var(--paper-raised);
    color: var(--ink);
}

.share-menu {
    position: relative;
}

.dropdown-content {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 170px;
    background-color: var(--paper-raised);
    border: 1px solid var(--line);
    box-shadow: 0 12px 32px -8px rgba(34, 30, 23, 0.25);
    padding: 6px 0;
    display: none;
    z-index: 60;
}

.share-menu.open .share-dropdown {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 8px 16px;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--ink);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.dropdown-content a:hover {
    background-color: var(--accent-wash);
    color: var(--accent);
}

/* ---------- Today's edition / stats ---------- */

main { padding-bottom: 40px; }

.highlights {
    padding: 40px 0 8px;
    animation: rise-in 0.6s ease both;
}

.section-heading {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 22px;
}

.section-heading h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.5rem, 3.4vw, 2.1rem);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.section-heading::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid var(--line-strong);
    transform: translateY(-6px);
}

.highlight-stats {
    display: flex;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.highlight-stats .stat {
    flex: 1 1 0;
    min-width: 120px;
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 14px 18px;
    border-right: 1px solid var(--line);
}

.highlight-stats .stat:last-child { border-right: none; }

.highlight-stats .number {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.7rem;
    line-height: 1;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.highlight-stats .label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-soft);
}

/* ---------- Category tabs ---------- */

.categories { padding-top: 36px; }

.category-tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--line-strong);
    margin-bottom: 6px;
}

.category-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    appearance: none;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 12px 16px 11px;
    font-family: var(--font-text);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--ink-soft);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.tab-btn:hover { color: var(--ink); }

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.category-panel { display: none; }
.category-panel.active { display: block; animation: rise-in 0.45s ease both; }

/* Per-category heading — only shown on phones where tabs are hidden */
.category-label { display: none; }

/* ---------- Book list (editorial rows) ---------- */

.books-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 56px;
}

.book-card {
    position: relative;
    display: flex;
    gap: 22px;
    padding: 30px 0 28px;
    border-bottom: 1px solid var(--line);
    animation: rise-in 0.55s ease both;
}

.book-card:nth-child(1) { animation-delay: 0.04s; }
.book-card:nth-child(2) { animation-delay: 0.1s; }
.book-card:nth-child(3) { animation-delay: 0.16s; }
.book-card:nth-child(4) { animation-delay: 0.22s; }
.book-card:nth-child(5) { animation-delay: 0.28s; }
.book-card:nth-child(6) { animation-delay: 0.34s; }
.book-card:nth-child(7) { animation-delay: 0.4s; }

.book-rank {
    position: absolute;
    top: 26px;
    left: -8px;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 2.6rem;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1.2px var(--ink-faint);
    opacity: 0.55;
    pointer-events: none;
    user-select: none;
}

/* Cover column */

.book-image-container {
    flex-shrink: 0;
    width: 132px;
    padding-top: 26px;
    display: block;
    cursor: pointer;
    text-decoration: none;
    perspective: 700px;
}

.book-cover {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 2px 6px 6px 2px; /* book spine */
    box-shadow: var(--shadow-book);
    background-color: var(--paper-dim);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s ease;
}

.book-card:hover .book-cover {
    transform: translateY(-6px) rotateY(-7deg) rotateZ(-0.5deg);
    box-shadow: var(--shadow-book-hover);
}

/* Content column */

.book-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.book-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    min-height: 20px;
}

.badge {
    display: inline-block;
    padding: 2px 8px 1px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    border: 1px solid currentColor;
    border-radius: 999px;
    line-height: 1.6;
}

.badge.new      { color: var(--accent); background-color: var(--accent-wash); }
.badge.rising,
.badge.trendup  { color: var(--moss); background-color: var(--moss-wash); }
.badge.highrank,
.badge.hot,
.badge.sponsored { color: var(--gold); background-color: var(--gold-wash); }
.badge.quality,
.badge.fresh,
.badge.recommended,
.badge.house    { color: var(--ink-soft); background-color: var(--paper-dim); }

.book-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.18rem;
    line-height: 1.3;
    letter-spacing: -0.005em;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-title a {
    color: inherit;
    text-decoration: none;
    background-image: linear-gradient(var(--accent), var(--accent));
    background-repeat: no-repeat;
    background-size: 0% 1.5px;
    background-position: 0 96%;
    transition: background-size 0.3s ease;
}

.book-card:hover .book-title a { background-size: 100% 1.5px; }

.book-description {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--ink-soft);
    margin-bottom: 4px;
}

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

.book-description.expanded { display: block; }

.description-toggle-btn {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.85rem;
    color: var(--accent);
    cursor: pointer;
    margin-bottom: 10px;
}

.description-toggle-btn:hover { color: var(--accent-deep); text-decoration: underline; }

.book-scores {
    display: flex;
    gap: 14px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    margin: auto 0 12px;
    padding-top: 8px;
}

.book-scores.sponsored-tag {
    color: var(--gold);
    font-weight: 700;
}

.amazon-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    color: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    padding: 8px 18px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.amazon-link::after {
    content: "→";
    font-size: 0.95em;
    transition: transform 0.2s ease;
}

.amazon-link:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fdfaf3;
    transform: translateY(-1px);
}

.amazon-link:hover::after { transform: translateX(3px); }

/* ---------- Price notice ---------- */

.price-notice {
    margin-top: 26px;
    text-align: center;
}

.price-notice .notice-text {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.88rem;
    color: var(--ink-soft);
}

.price-notice .notice-icon { display: none; }

/* ---------- Loading / error ---------- */

.loading,
.error {
    grid-column: 1 / -1;
    padding: 64px 0;
    text-align: center;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--ink-soft);
}

.error { color: var(--accent-deep); }

/* ---------- Share section ---------- */

.share-section {
    margin-top: 64px;
    padding: 48px 24px;
    text-align: center;
    border-top: 1px solid var(--line-strong);
    position: relative;
}

.share-section::before {
    content: "❦";
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--paper);
    padding: 0 16px;
    color: var(--ink-soft);
    font-size: 1.1rem;
}

.share-section h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-style: italic;
    font-size: 1.6rem;
    margin-bottom: 6px;
}

.share-subtitle {
    color: var(--ink-soft);
    font-size: 0.92rem;
    margin-bottom: 24px;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.share-btn {
    appearance: none;
    background: none;
    display: inline-block;
    padding: 8px 20px;
    font-family: var(--font-text);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    color: var(--ink-soft);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.share-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background-color: var(--accent-wash);
}

.share-copy-feedback {
    display: inline-block;
    margin-top: 14px;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--moss);
}

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

footer {
    margin-top: 72px;
    background-color: var(--ink);
    color: var(--paper);
    border-top: 4px solid var(--accent);
}

[data-theme="dark"] footer {
    background-color: var(--paper-raised);
    color: var(--ink);
    border-top-color: var(--accent);
}

.footer-disclaimer {
    padding: 18px 0 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.85rem;
    opacity: 0.6;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap;
    padding: 28px 0 36px;
}

.footer-brand .footer-logo {
    width: auto;
    height: 38px;
    margin-bottom: 10px;
}

.footer-brand p {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.95rem;
    opacity: 0.7;
    max-width: 260px;
}

.footer-links {
    display: flex;
    gap: 64px;
}

.link-group h4 {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    opacity: 0.5;
    margin-bottom: 12px;
}

.link-group ul { list-style: none; }

.link-group li { margin-bottom: 8px; }

.link-group a {
    color: inherit;
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.link-group a:hover { opacity: 1; text-decoration: underline; }

.footer-bottom {
    border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent);
    padding: 16px 0 22px;
    font-size: 0.78rem;
    opacity: 0.55;
}

/* ---------- Animations ---------- */

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

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

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

@media (max-width: 960px) {
    .books-grid { column-gap: 40px; }
    .book-image-container { width: 116px; }
}

@media (max-width: 820px) {
    .books-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .masthead-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .brand-text .subtitle { font-size: 0.85rem; }

    .nav-links a {
        padding: 12px 9px 10px;
        font-size: 0.7rem;
        letter-spacing: 0.07em;
        white-space: nowrap;
    }

    .main-nav .container { padding: 0 14px; gap: 8px; }

    .theme-toggle, .share-icon { width: 30px; height: 30px; font-size: 0.9rem; }

    .masthead-edition { text-align: left; white-space: normal; }

    .highlight-stats .stat {
        flex: 1 1 33%;
        border-bottom: 1px solid var(--line);
        padding: 12px 14px;
    }

    .book-card { gap: 16px; padding: 24px 0 22px; }
    .book-image-container { width: 96px; padding-top: 20px; }
    .book-rank { font-size: 2rem; left: -4px; top: 22px; }
    .book-title { font-size: 1.05rem; }
    .footer-links { gap: 36px; }

    /* Phones: drop the tabs and show every category stacked down the page */
    .category-tabs { display: none; }
    .category-panel { display: block; }
    .category-panel.no-data { display: none; }
    .category-panel.active { animation: none; }
    .category-panel + .category-panel { margin-top: 8px; }

    .category-label {
        display: block;
        font-family: var(--font-display);
        font-weight: 600;
        font-style: italic;
        font-size: 1.5rem;
        letter-spacing: -0.01em;
        margin: 28px 0 4px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--line-strong);
    }

    /* First category sits right under the tab bar's old position */
    .category-panel:first-child .category-label { margin-top: 4px; }
}

/* ---------- Author platform (forms, tools, dashboard, author sites) ---------- */

.ap-section { padding: 40px 0 24px; }

.ap-lede {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.5rem;
    line-height: 1.45;
    letter-spacing: -0.01em;
    max-width: 40ch;
    margin-bottom: 14px;
}

.ap-lede em { font-style: italic; color: var(--accent); }

.ap-sub {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--ink-soft);
    max-width: 62ch;
    margin-bottom: 22px;
}

/* Buttons — same vocabulary as .amazon-link */
.btn-pill,
.btn-pill-solid {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-text);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    border-radius: 999px;
    padding: 9px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn-pill {
    color: var(--ink);
    background: none;
    border: 1.5px solid var(--ink);
}

.btn-pill:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fdfaf3;
    transform: translateY(-1px);
}

.btn-pill-solid {
    color: var(--paper);
    background-color: var(--ink);
    border: 1.5px solid var(--ink);
}

.btn-pill-solid:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fdfaf3;
    transform: translateY(-1px);
}

.btn-pill:disabled, .btn-pill-solid:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-quiet {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.88rem;
    color: var(--accent);
    cursor: pointer;
}
.btn-quiet:hover { color: var(--accent-deep); text-decoration: underline; }

/* Forms */
.ap-form { max-width: 560px; }

.ap-form-wide { max-width: none; }

.ap-field { margin-bottom: 18px; }

.ap-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.ap-field .hint {
    font-size: 0.78rem;
    color: var(--ink-faint);
    margin-top: 5px;
    line-height: 1.5;
}

.ap-field input[type="text"],
.ap-field input[type="email"],
.ap-field input[type="password"],
.ap-field input[type="url"],
.ap-field input[type="number"],
.ap-field input[type="date"],
.ap-field select,
.ap-field textarea {
    width: 100%;
    font-family: var(--font-text);
    font-size: 0.95rem;
    color: var(--ink);
    background-color: var(--paper-raised);
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    padding: 10px 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ap-field textarea { min-height: 120px; resize: vertical; line-height: 1.6; }

.ap-field input:focus,
.ap-field select:focus,
.ap-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-wash);
}

.ap-form-row { display: flex; gap: 16px; }
.ap-form-row .ap-field { flex: 1; }

.ap-msg {
    padding: 12px 14px;
    border-left: 3px solid var(--moss);
    background-color: var(--moss-wash, rgba(61,107,88,0.08));
    font-size: 0.88rem;
    line-height: 1.55;
    margin-bottom: 18px;
}
.ap-msg.error { border-left-color: var(--accent-deep); background-color: var(--accent-wash); }

/* Ruled panel — hairline sections, no boxes */
.ap-panel { padding: 26px 0; border-bottom: 1px solid var(--line); }
.ap-panel:last-child { border-bottom: none; }

.ap-panel h3 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 1.3rem;
    margin-bottom: 14px;
}

/* Feature / tool listing rows */
.tool-list { border-top: 1px solid var(--line-strong); }

.tool-row {
    display: flex;
    align-items: baseline;
    gap: 22px;
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
}

.tool-row:hover .tool-row-title { color: var(--accent); }

.tool-row-num {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.5rem;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px var(--ink-faint);
    flex-shrink: 0;
    width: 44px;
}

.tool-row-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.15rem;
    transition: color 0.2s ease;
}

.tool-row-desc {
    font-size: 0.88rem;
    color: var(--ink-soft);
    line-height: 1.6;
    margin-top: 4px;
}

.tool-row-tag {
    margin-left: auto;
    flex-shrink: 0;
    align-self: center;
}

/* Tool page: result strip */
.tool-result {
    margin-top: 24px;
    padding: 20px 0;
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--line);
}

.tool-result .big-number {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2.6rem;
    letter-spacing: -0.02em;
    color: var(--accent);
}

.tool-result .result-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-faint);
    margin-top: 2px;
}

.tool-result-grid { display: flex; flex-wrap: wrap; gap: 36px; }

.tool-output {
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    background-color: var(--paper-raised);
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    padding: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Dashboard */
.dash-tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line-strong);
    margin-bottom: 10px;
}

.dash-panel { display: none; }
.dash-panel.active { display: block; animation: rise-in 0.45s ease both; }

.dash-book-row {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
}

.dash-book-row .cover {
    width: 56px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 2px 4px 4px 2px;
    box-shadow: var(--shadow-book);
    background-color: var(--paper-dim);
    flex-shrink: 0;
}

.dash-book-main { flex: 1; min-width: 0; }

.dash-book-title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }

.dash-book-meta {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    margin-top: 4px;
}

.badge.status-pending  { color: var(--gold); background-color: var(--gold-wash); }
.badge.status-approved { color: var(--moss); background-color: var(--moss-wash); }
.badge.status-rejected { color: var(--accent-deep); background-color: var(--accent-wash); }

.credit-count {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2rem;
    color: var(--accent);
}

/* Audit report rendering */
.audit-score {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 3.4rem;
    line-height: 1;
    letter-spacing: -0.03em;
}

.audit-issue {
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
    line-height: 1.65;
}

.audit-issue .where {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-soft);
}

.audit-issue .fix { color: var(--moss); }

.sev { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.13em;
       border: 1px solid currentColor; border-radius: 999px; padding: 2px 8px 1px; margin-right: 8px; }
.sev.high   { color: var(--accent-deep); }
.sev.medium { color: var(--gold); }
.sev.low    { color: var(--ink-faint); }

/* Author public site */
.author-hero {
    display: flex;
    gap: 34px;
    align-items: center;
    padding: 44px 0 36px;
    border-bottom: 1px solid var(--line-strong);
}

.author-photo {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--shadow-book);
    background-color: var(--paper-dim);
    flex-shrink: 0;
}

.author-hero h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2.3rem;
    letter-spacing: -0.02em;
}

.author-hero .tagline {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--ink-soft);
    margin-top: 6px;
}

.author-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.author-bio {
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--ink-soft);
    max-width: 66ch;
    padding: 26px 0;
    border-bottom: 1px solid var(--line);
    white-space: pre-line;
}

/* Pricing strip on authors landing */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 44px; border-top: 1px solid var(--line-strong); }

.plan-col { padding: 24px 0; border-bottom: 1px solid var(--line); }

.plan-col .price {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.9rem;
    color: var(--accent);
}

.plan-col ul { list-style: none; margin-top: 12px; }
.plan-col li { font-size: 0.88rem; line-height: 1.55; color: var(--ink-soft); padding: 5px 0; border-bottom: 1px dotted var(--line); }

@media (max-width: 720px) {
    .ap-form-row { flex-direction: column; gap: 0; }
    .author-hero { flex-direction: column; text-align: center; gap: 20px; }
    .author-links { justify-content: center; }
    .tool-row { flex-wrap: wrap; }
    .tool-row-tag { margin-left: 64px; }
}

/* ---------- Audit report visualizations ---------- */
:root {
    --sev-high: #7f2c0d;
    --sev-med: #c2491d;
    --sev-low: #dd9670;
    --viz-track: rgba(34,30,23,0.08);
}
[data-theme="dark"] {
    --sev-high: #e9764a;
    --sev-med: #b25526;
    --sev-low: #6f3f22;
    --viz-track: rgba(236,227,210,0.08);
}
.viz-block { margin: 22px 0 6px; }
.viz-row { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.viz-title {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.13em; color: var(--ink-faint); margin-bottom: 10px;
}
.viz-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px;
    font-size: 0.72rem; color: var(--ink-soft); }
.viz-legend .swatch { display: inline-block; width: 10px; height: 10px;
    border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.viz-clean { font-family: var(--font-display); font-style: italic;
    font-size: 0.88rem; color: var(--moss); margin-top: 8px; }

/* ---------- Author ribbon (reader homepage -> author door) ---------- */
.author-ribbon {
    background-color: var(--ink);
    color: var(--paper);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}
.author-ribbon .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 9px;
    padding-bottom: 9px;
}
.author-ribbon a {
    color: var(--accent);
    filter: brightness(1.35);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
    text-decoration: none;
    white-space: nowrap;
}
.author-ribbon a:hover { text-decoration: underline; }
[data-theme="dark"] .author-ribbon { background-color: var(--paper-dim); color: var(--ink); }
[data-theme="dark"] .author-ribbon a { filter: none; }

/* ---------- Nav dropdown (Tools menu) ---------- */
.nav-dropdown { position: relative; }
.nav-dropdown > a::after {
    content: " ▾";
    font-size: 0.7em;
    opacity: 0.6;
}
.nav-drop {
    display: none;
    position: absolute;
    top: 100%;
    left: -6px;
    z-index: 60;
    min-width: 250px;
    background-color: var(--paper-raised);
    border: 1px solid var(--line-strong);
    border-top: 2px solid var(--accent);
    box-shadow: 0 10px 28px -8px rgba(0, 0, 0, 0.25);
    padding: 6px 0;
    list-style: none;
    margin: 0;
}
.nav-dropdown:hover .nav-drop,
.nav-dropdown:focus-within .nav-drop { display: block; }
.nav-drop li { display: block; }
.nav-drop a {
    display: block;
    padding: 8px 16px !important;
    border-bottom: none !important;
    font-size: 0.78rem;
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 500;
    white-space: nowrap;
}
.nav-drop a:hover { color: var(--accent); background-color: var(--accent-wash); }
.nav-drop .drop-all {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.68rem;
    border-top: 1px solid var(--line) !important;
    margin-top: 4px;
}
/* touch devices: tap goes to tools.html, no hover dropdown */
@media (hover: none) { .nav-drop { display: none !important; } }

/* Dashboard tabs: hide the overflow scrollbar (same treatment as category tabs) */
.dash-tabs { scrollbar-width: none; }
.dash-tabs::-webkit-scrollbar { display: none; }

/* Hover-capable devices: let the Tools dropdown escape the nav (items fit on
   desktop; the horizontal nav scroll is only needed on touch/narrow screens,
   where the dropdown is disabled anyway) */
@media (hover: hover) {
    .nav-links { overflow: visible; }
}

/* ---------- USP spotlight (dismissible, frequency-capped nudge) ---------- */
.usp-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 90;
    max-width: 360px;
    background-color: var(--paper-raised);
    border: 1px solid var(--line-strong);
    border-top: 3px solid var(--accent);
    box-shadow: 0 14px 40px -10px rgba(0, 0, 0, 0.35);
    padding: 18px 20px;
    animation: rise-in 0.5s ease both;
}
.usp-toast h4 {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.05rem;
    margin-bottom: 6px;
}
.usp-toast p { font-size: 0.85rem; line-height: 1.6; color: var(--ink-soft); margin-bottom: 12px; }
.usp-toast .usp-close {
    position: absolute;
    top: 8px; right: 12px;
    appearance: none; background: none; border: none;
    font-size: 1rem; color: var(--ink-faint); cursor: pointer;
}
.usp-toast .usp-close:hover { color: var(--ink); }
@media (max-width: 600px) { .usp-toast { left: 16px; right: 16px; max-width: none; } }
