/* Discover page (BP56): same paper + brand orange identity as the Library, laid out as stacked reading cards. */
:root {
    --bg: #f6f1e7;
    --card: #fffdf8;
    --ink: #1f2a2e;
    --muted: #5e6b6f;
    --line: #e4dccb;
    --soft: #efe8d9;
    --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0f1514;
    --card: #162120;
    --ink: #e8efec;
    --muted: #9db0ab;
    --line: #2a3a38;
    --soft: #1d2b29;
    color-scheme: dark;
}

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

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.d-top {
    align-items: center;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 10px 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.d-brand { align-items: center; display: inline-flex; font-family: var(--serif); font-size: 20px; font-weight: 600; gap: 10px; text-decoration: none; }
.d-brand img, .d-brand svg { border-radius: 9px; height: 32px; width: 32px; }
.d-rail { align-items: center; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; width: 100%; }
.d-rail::-webkit-scrollbar { display: none; }
.d-brand { flex: none; margin-right: 10px; }
.d-pill { align-items: center; border-radius: 999px; color: var(--muted); display: inline-flex; flex: none; font-size: 14px; font-weight: 600; gap: 7px; padding: 8px 14px; text-decoration: none; white-space: nowrap; }
.d-pill:hover, .d-pill:focus-visible { background: var(--soft); color: var(--ink); }
.d-pill[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); }
.d-pill[hidden] { display: none; }
.d-rail-right { align-items: center; display: inline-flex; flex: none; gap: 4px; margin-left: auto; }
.d-user { color: var(--ink); }
.support-button { color: var(--brand-strong); }

.d-main { margin: 0 auto; max-width: 1180px; padding: 20px 20px 8px; }

.d-intro, .d-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(60, 50, 30, .06);
}
.d-intro { align-items: center; display: flex; gap: 24px; justify-content: space-between; margin-bottom: 18px; padding: 22px 28px; }
.d-intro-text { flex: 1 1 auto; min-width: 0; }
.d-sketch { color: var(--ink); flex: none; height: auto; max-width: 340px; opacity: .9; width: 34%; }
.d-sketch .d-accent { color: var(--brand-text); }
.d-twinkle { animation: d-twinkle 3.6s ease-in-out infinite; color: var(--brand-text); }
@keyframes d-twinkle { 50% { opacity: .35; } }

/* Sketch animations: gentle, slow, and switched off for people who prefer reduced motion. */
.a-bob, .a-drift, .a-sway, .a-pulse, .a-flutter, .a-shoot { transform-box: fill-box; }
.a-bob { animation: a-bob 4.5s ease-in-out infinite; }
.a-slow { animation-duration: 7s; animation-delay: -2s; }
@keyframes a-bob { 50% { transform: translateY(-5px); } }
.a-drift { animation: a-drift 6s ease-in-out infinite; }
@keyframes a-drift { 50% { transform: translate(6px, -5px) rotate(3deg); } }
.a-march { animation: a-march 3s linear infinite; }
@keyframes a-march { to { stroke-dashoffset: -27; } }
.a-sway { animation: a-sway 5s ease-in-out infinite; transform-origin: 50% 0; }
.a-sway.a-low { transform-origin: 0 100%; animation-duration: 6s; }
@keyframes a-sway { 50% { transform: rotate(4deg); } }
.a-scan { animation: a-scan 9s ease-in-out infinite; transform-origin: 148px 130px; transform-box: view-box; }
@keyframes a-scan { 50% { transform: rotate(-5deg); } }
.a-pulse { animation: a-pulse 2.4s ease-in-out infinite; transform-origin: center; }
@keyframes a-pulse { 50% { transform: scale(1.18); opacity: .7; } }
.a-flutter { animation: a-flutter 2.2s ease-in-out infinite; transform-origin: 50% 50%; }
@keyframes a-flutter { 50% { transform: scaleX(.82) translateY(-2px); } }
.a-shoot { animation: a-shoot 5s ease-in infinite; }
@keyframes a-shoot { 0% { opacity: 0; transform: translate(14px, -8px); } 12% { opacity: 1; } 40%, 100% { opacity: 0; transform: translate(-40px, 22px); } }
.d-intro h1 { font-family: var(--serif); font-size: 32px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; margin-bottom: 6px; }
.d-intro p { color: var(--muted); max-width: 62ch; }
.d-meta { font-size: 13px; margin-top: 8px; }
.d-button {
    background: var(--brand-soft);
    border: 0;
    border-radius: 999px;
    color: var(--brand-strong);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    margin-top: 14px;
    padding: 8px 16px;
}
.d-button:hover { background: var(--brand); color: var(--on-brand); }
.d-button:disabled { cursor: progress; opacity: .6; }
a.d-button { display: inline-block; margin-left: 6px; text-decoration: none; }
a.d-button[hidden] { display: none; }

.d-status { color: var(--muted); margin: 0 4px 14px; min-height: 1px; }
.d-status a { color: var(--brand-strong); }

/* Masonry-style columns: cards keep their natural height, like the stacked cards on the reference page. */
.d-grid { column-gap: 18px; column-width: 340px; }
.d-card { break-inside: avoid; display: inline-block; margin: 0 0 18px; padding: 18px 20px 16px; width: 100%; }
.d-card h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.d-blurb { color: var(--muted); font-size: 13px; margin: 3px 0 10px; }
.d-card ul { border-top: 1px solid var(--line); list-style: none; }
.d-item { align-items: flex-start; border-bottom: 1px solid var(--soft); display: flex; gap: 10px; justify-content: space-between; padding: 10px 0; }
.d-item:last-child { border-bottom: 0; }
.d-item-text { min-width: 0; }
.d-link { color: var(--ink); display: inline; font-weight: 600; overflow-wrap: anywhere; text-decoration-color: var(--line); text-underline-offset: 3px; }
.d-link:hover { color: var(--brand-strong); text-decoration-color: var(--brand); }
.d-by { color: var(--muted); display: block; font-size: 12.5px; margin-top: 2px; }
.d-save {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    cursor: pointer;
    flex: none;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    white-space: nowrap;
}
.d-save:hover { border-color: var(--brand); color: var(--brand-strong); }
.d-save[data-state="saving"] { cursor: progress; opacity: .6; }
.d-save[data-state="saved"] { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); cursor: default; }
.d-save[data-state="error"] { border-color: #b45309; color: #b45309; }
.d-card-picks { border-color: var(--brand); box-shadow: 0 1px 2px rgba(60, 50, 30, .06), inset 0 3px 0 var(--brand); }
.d-empty { color: var(--muted); font-style: italic; padding: 10px 0 4px; }
.d-input { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font: inherit; padding: 9px 12px; resize: vertical; width: 100%; }
.d-input:focus { border-color: var(--brand); outline: 2px solid var(--brand-soft); }
.d-from { color: var(--muted); font-size: 12.5px; margin-top: 10px; }
.d-more { color: var(--brand-strong); display: inline-block; font-size: 13px; font-weight: 600; margin-top: 10px; text-decoration: none; }
.d-more:hover { text-decoration: underline; }

.d-skeleton { animation: d-pulse 1.4s ease-in-out infinite; background: var(--soft); border-radius: 14px; height: 220px; margin-bottom: 18px; }
@keyframes d-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .d-skeleton, .d-twinkle, .d-sketch * { animation: none !important; } }

.d-footer { color: var(--muted); font-size: 12.5px; margin: 0 auto; max-width: 1180px; padding: 12px 24px 40px; }

@media (max-width: 720px) {
    .d-intro { flex-direction: column; }
    .d-sketch { margin: 6px auto 0; max-width: 260px; width: 70%; }
    .d-wordmark { display: none; }
}

@media (max-width: 600px) {
    .d-top { padding: 8px 14px; }
    .d-main { padding: 14px 12px 4px; }
    .d-intro { padding: 18px; }
    .d-intro h1 { font-size: 27px; }
    .d-footer { padding: 8px 16px 32px; }
}

@media (max-width: 900px) { .d-pill { padding: 8px 9px; } .d-brand { margin-right: 4px; } }
