/* WakeStory — plain CSS, no build step. Mobile first. */

:root {
    --paper: #faf9f6;          /* the card's paper, from carte.py */
    --ink: #1c1a18;
    --muted: #6b675f;
    --line: #e6e2da;
    --accent: var(--ghost-accent-color, #b026ff);
    --serif: "Charter", "Georgia", "Iowan Old Style", "Times New Roman", serif;
    --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --pad: 16px;
    --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

.ws-sr {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.ws-muted { color: var(--muted); }

/* ---- top bar ---- */
.ws-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px var(--pad);
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
}
.ws-logo {
    font-family: var(--serif); font-style: italic; font-weight: 600;
    font-size: 1.5rem; color: var(--accent); letter-spacing: -0.01em;
}
.ws-nav-actions { display: flex; align-items: center; gap: 10px; font-family: var(--ui); font-size: 0.9rem; }
.ws-icon {
    background: none; border: 0; padding: 6px; color: var(--ink); cursor: pointer; display: flex;
}
.ws-lang { color: var(--muted); padding: 6px 4px; }
.ws-btn {
    background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 999px;
    font-weight: 600; white-space: nowrap;
}

/* ---- layout ---- */
.ws-main { padding: 0 var(--pad) 48px; max-width: 1040px; margin: 0 auto; }
.ws-row-title {
    font-family: var(--serif); font-weight: 600; font-size: 1.35rem;
    margin: 28px 0 12px; letter-spacing: -0.01em;
}
.ws-page-title { font-size: 1.8rem; margin: 24px 0 12px; }

/* ---- card ---- */
.ws-card { display: flex; flex-direction: column; gap: 8px; }
.ws-card-img {
    width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
    border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
.ws-card-noimg {
    display: flex; align-items: center; justify-content: center; text-align: center;
    padding: 24px; font-style: italic; color: var(--muted);
}
.ws-card-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    font-family: var(--ui); font-size: 0.8rem; color: var(--muted);
}
.ws-tag { color: var(--accent); font-weight: 600; }
.ws-duration { margin-left: auto; white-space: nowrap; }

/* hero: one card, full width */
.ws-hero { margin-top: 16px; }

/* rows: horizontal scroll, one and a half cards visible */
.ws-row-scroll {
    display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad) 8px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.ws-row-scroll::-webkit-scrollbar { display: none; }
.ws-row-scroll .ws-card { flex: 0 0 62%; scroll-snap-align: start; }
.ws-row-scroll .ws-card-meta { font-size: 0.75rem; }

/* the full list */
.ws-list { display: grid; grid-template-columns: 1fr; gap: 28px; }

/* pagination */
.ws-pagination {
    display: flex; justify-content: center; align-items: center; gap: 18px;
    margin: 32px 0 0; font-family: var(--ui); color: var(--muted);
}
.ws-page-arrow { font-size: 1.8rem; line-height: 1; padding: 4px 10px; color: var(--ink); }
.ws-page-off { opacity: 0.3; }

/* ---- reading page ---- */
.ws-story-head { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 20px 0 8px; }
.ws-story-card {
    width: 62%; max-width: 320px; aspect-ratio: 3 / 4; object-fit: cover;
    border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
.ws-story-meta { justify-content: center; }
.ws-story-meta .ws-duration { margin-left: 0; }
.ws-text {
    max-width: 38em; margin: 24px auto 0;
    font-size: 1.15rem; line-height: 1.65;
}
.ws-text p { margin: 0 0 1.1em; }
.ws-text .kg-audio-card { margin: 0 0 28px; }

/* ---- desktop ---- */
@media (min-width: 640px) {
    :root { --pad: 24px; }
    body { font-size: 18px; }
    .ws-logo { font-size: 1.7rem; }
    .ws-hero .ws-card { max-width: 420px; margin: 0 auto; }
    .ws-row-scroll .ws-card { flex-basis: 220px; }
    .ws-list { grid-template-columns: repeat(3, 1fr); gap: 24px; }
    .ws-story-card { width: 40%; }
}

/* ---- editor cards: wide and full-bleed images, custom fonts from Ghost's design settings ---- */
body { font-family: var(--gh-font-body, var(--serif)); }
.ws-row-title, .ws-page-title, .ws-logo { font-family: var(--gh-font-heading, var(--serif)); }
.ws-text .kg-width-wide { max-width: 1040px; width: calc(100vw - 2 * var(--pad)); margin-left: 50%; transform: translateX(-50%); }
.ws-text .kg-width-full { width: 100vw; margin-left: 50%; transform: translateX(-50%); }
.ws-text .kg-width-wide img, .ws-text .kg-width-full img { width: 100%; }
