/*
 * Issue Reader styles. Mobile first: the base rules are the phone layout; larger screens are
 * enhancements behind min-width queries. Cool slate and Age blue only (no warm tones).
 * Class prefix: rd-
 */
:root {
    --rd-blue: #096DD2;
    --rd-blue-dark: #0B4FA8;
    --rd-tint: #E8F1FB;
    --rd-navy: #0A1633;
    --rd-ink: #1F2937;
    --rd-soft: #475569;
    --rd-faint: #64748B;
    --rd-rule: #E2E8F0;
    --rd-surface: #F4F5F7;
    --rd-serif: 'Playfair Display', Georgia, serif;
    --rd-sans: 'PT Sans', system-ui, -apple-system, sans-serif;
    --rd-bar-h: 48px;
    --rd-bottom-h: 64px;
    --rd-safe-b: env(safe-area-inset-bottom, 0px);
    --rd-z-bar: 300;
    --rd-z-sheet: 400;
    --rd-z-toast: 450;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.rd { margin: 0; background: #fff; color: var(--rd-ink); font: 400 1.0625rem/1.6 var(--rd-sans); padding-bottom: calc(var(--rd-bottom-h) + var(--rd-safe-b)); }
body.rd-noscroll { overflow: hidden; }
a { color: var(--rd-blue); }
:focus-visible { outline: 2px solid var(--rd-blue); outline-offset: 2px; }

.rd-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rd-skip { position: absolute; left: -999px; top: 0; z-index: 999; padding: .6rem 1rem; background: #fff; }
.rd-skip:focus { left: 0; }

/* ── Top bar ── */
.rd-top { position: sticky; top: 0; z-index: var(--rd-z-bar); display: flex; align-items: center; gap: .25rem; height: var(--rd-bar-h); padding: 0 .25rem; background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--rd-rule); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.rd-top__title { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 .95rem/1.2 var(--rd-sans); }
.rd-top__count { margin: 0; padding: 0 .5rem; font: 700 .8rem var(--rd-sans); color: var(--rd-faint); white-space: nowrap; }
.rd-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; background: none; color: var(--rd-ink); cursor: pointer; border-radius: 8px; }
.rd-iconbtn:hover { background: var(--rd-surface); }

/* ── Bottom bar (thumb zone): Previous | Contents | Next ── */
.rd-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--rd-z-bar); display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .5rem; padding: .5rem .75rem calc(.5rem + var(--rd-safe-b)); background: #fff; border-top: 1px solid var(--rd-rule); }
.rd-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .4rem .9rem; border: 1px solid var(--rd-rule); border-radius: 999px; background: #fff; color: var(--rd-ink); font: 700 .95rem var(--rd-sans); text-decoration: none; cursor: pointer; }
.rd-btn:hover:not(:disabled) { border-color: var(--rd-blue); color: var(--rd-blue); }
.rd-btn:disabled { opacity: .4; cursor: default; }
.rd-btn--primary { background: var(--rd-blue); border-color: var(--rd-blue); color: #fff; }
.rd-btn--primary:hover:not(:disabled) { background: var(--rd-blue-dark); border-color: var(--rd-blue-dark); color: #fff; }

/* ── Stage ── */
.rd-stage { min-height: calc(100dvh - var(--rd-bar-h) - var(--rd-bottom-h) - var(--rd-safe-b)); outline: none; }

/* ── Piece frame: every kind of piece shares this header, ground and skeleton ── */
.rd-piece { max-width: 960px; margin: 0 auto; padding: .9rem 1rem .5rem; }
.rd-piece__kicker { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .75rem; margin: 0; font: 700 .75rem/1.4 var(--rd-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--rd-faint); }
.rd-piece__out { text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 700; }
.rd-piece__title { margin: .35rem 0 .15rem; font: 700 1.6rem/1.2 var(--rd-serif); color: var(--rd-navy); }
.rd-piece__by { margin: 0; font-size: .95rem; color: var(--rd-soft); }
.rd-piece__body { background: #fff; animation: rd-fade .15s ease both; }
.rd-item--pdf { background: var(--rd-surface); }
.rd-item--youtube, .rd-item--facebook, .rd-item--instagram, .rd-item--external { max-width: 960px; margin: 0 auto; }
.rd-piece__stage { position: relative; min-height: 40dvh; }
.rd-skeleton { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; margin: 0; padding: 1rem; background: var(--rd-surface); color: var(--rd-faint); text-align: center; }
.rd-skeleton[hidden] { display: none; }
@keyframes rd-fade { from { opacity: 0; } to { opacity: 1; } }
.rd-frame { display: block; width: 100%; border: 0; background: #fff; }
.rd-frame--flow { height: 70dvh; }
.rd-frame--fill { height: calc(100dvh - var(--rd-bar-h) - var(--rd-bottom-h) - var(--rd-safe-b) - 3rem); min-height: 420px; }
.rd-sentinel { height: 1px; }
.rd-loading { margin: 0; padding: 1rem; text-align: center; color: var(--rd-faint); }
.rd-video { max-width: 960px; margin: 0 auto; padding: 1rem; }
.rd-video__target, .rd-video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: var(--rd-navy); }
.rd-social { max-width: 560px; margin: 0 auto; padding: 1rem; overflow-x: auto; }
.rd-card { display: flex; flex-direction: column; align-items: flex-start; gap: .75rem; max-width: 560px; margin: 1rem auto; padding: 1rem; border: 1px solid var(--rd-rule); border-radius: 10px; background: var(--rd-surface); }
.rd-card--media { text-decoration: none; }
.rd-card img, .rd-card__img { width: 100%; height: auto; border-radius: 6px; }
.rd-card__text { margin: 0; }
.rd-card__host { margin: 0; font-size: .9rem; color: var(--rd-faint); }
.rd-message { padding: 2rem 1rem; max-width: 560px; margin: 0 auto; }

/* ── Cover ── */
.rd-kicker { margin: 0 0 .25rem; font: 700 .75rem var(--rd-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--rd-blue); }

/* ── Front cover: the cover and one action ── */
.rd-front { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; min-height: calc(100dvh - var(--rd-bar-h) - var(--rd-bottom-h) - var(--rd-safe-b)); padding: 1rem; background: var(--rd-surface); }
.rd-front__art { display: block; padding: 0; border: 0; background: none; cursor: pointer; }
.rd-front__img { display: block; width: auto; max-width: 100%; max-height: calc(100dvh - var(--rd-bar-h) - var(--rd-bottom-h) - var(--rd-safe-b) - 7rem); aspect-ratio: 3 / 4; object-fit: cover; border-radius: 4px; box-shadow: 0 10px 32px rgba(10, 22, 51, .22); background: var(--rd-navy); }
.rd-front__plate { display: flex; align-items: center; justify-content: center; width: min(22rem, 80vw); aspect-ratio: 3 / 4; border-radius: 4px; background: var(--rd-navy); }
.rd-front__title { margin: 0; font: 700 1.35rem/1.1 var(--rd-serif); color: var(--rd-navy); }

/* ── Contents page: editor's note, then the numbered pieces (a spread on tablet) ── */
.rd-kicker { margin: 0 0 .25rem; font: 700 .75rem var(--rd-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--rd-blue); }
.rd-toc { max-width: 1040px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.rd-toc__issue { margin: 0 0 .75rem; font: 700 2rem/1.1 var(--rd-serif); color: var(--rd-navy); }
.rd-toc__intro { margin: 0 0 .75rem; font-size: 1.05rem; }
.rd-toc__start { margin: 0 0 .75rem; padding: .6rem .8rem; background: var(--rd-tint); border-left: 3px solid var(--rd-blue); font-size: .98rem; }
.rd-toc__facts { margin: 0 0 1rem; color: var(--rd-faint); font-weight: 700; font-size: .9rem; }
.rd-toc__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.75rem; }
.rd-toc__heading { margin: 0 0 .25rem; padding-bottom: .4rem; border-bottom: 2px solid var(--rd-navy); font: 700 .8rem var(--rd-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--rd-navy); }
.rd-toc__list { list-style: none; margin: 0; padding: 0; }
.rd-toc__list li { border-bottom: 1px solid var(--rd-rule); }
.rd-toc__item { display: grid; grid-template-columns: 2.6rem 1fr; gap: .75rem; width: 100%; min-height: 56px; padding: .85rem .25rem; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.rd-toc__folio { font: 700 1.3rem/1.2 var(--rd-serif); color: var(--rd-blue); }
.rd-toc__kind { display: block; font: 700 .7rem var(--rd-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--rd-faint); }
.rd-toc__title { display: block; margin: .1rem 0; font: 700 1.1rem/1.3 var(--rd-serif); color: var(--rd-navy); }
.rd-toc__item--lead .rd-toc__title { font-size: 1.35rem; }
.rd-toc__item:hover .rd-toc__title { color: var(--rd-blue); }
.rd-toc__meta { display: block; font-size: .85rem; color: var(--rd-faint); }
.rd-toc__list .is-done .rd-toc__title::after { content: '  \2713'; color: var(--rd-blue); }
.rd-toc__issues { display: flex; flex-direction: column; gap: .25rem; margin-top: 1.25rem; }
.rd-toc__issues a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }

/* ── Foot of a web article: the next piece is already there ── */
.rd-peek { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; width: 100%; min-height: 6rem; margin: 0; padding: 1.5rem 1rem 2rem; border-top: 1px solid var(--rd-rule); background: var(--rd-surface); }
.rd-peek__lead { font: 700 .72rem var(--rd-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--rd-blue); }
.rd-peek__title { font: 700 1.35rem/1.25 var(--rd-serif); color: var(--rd-navy); }

/* ── PDF books: one layer for the session, laid over the place the current piece reserves ── */
.rd-pdfslot { background: var(--rd-surface); }
.rd-pdfstack { position: absolute; top: 0; left: 0; width: 100%; height: 100dvh; z-index: 1; pointer-events: none; }
.rd-pdfstack__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: .01; pointer-events: none; }
.rd-pdfstack__frame.is-active { opacity: 1; pointer-events: auto; }

/* ── Turning the page: the incoming page slides in from the side it comes from ── */
.rd-stage.is-turn-next > * { animation: rd-turn-next .22s ease-out both; }
.rd-stage.is-turn-prev > * { animation: rd-turn-prev .22s ease-out both; }
@keyframes rd-turn-next { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes rd-turn-prev { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

/* ── Ad ── */
.rd-ad { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 1rem; max-width: 640px; margin: 0 auto; }
.rd-ad__label { align-self: stretch; margin: 0; padding: .3rem .6rem; background: var(--rd-navy); color: #fff; font: 700 .7rem var(--rd-sans); letter-spacing: .14em; text-transform: uppercase; }
.rd-ad__link { display: block; }
.rd-ad__img { display: block; width: 100%; height: auto; max-height: calc(100dvh - var(--rd-bar-h) - var(--rd-bottom-h) - 9rem); object-fit: contain; background: #fff; }

/* ── End ── */
.rd-end { max-width: 960px; margin: 0 auto; padding: 0 1rem 2rem; }
.rd-back { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem; min-height: min(55dvh, 26rem); margin: 0 -1rem 1.5rem; padding: 2.5rem 1.5rem; background: var(--rd-navy); color: #fff; text-align: center; }
.rd-back__mark { display: block; width: min(15rem, 62%); height: auto; }
.rd-back__issue { margin: .5rem 0 0; font: 700 2rem/1.1 var(--rd-serif); }
.rd-back__since { margin: 0; font: 700 .75rem var(--rd-sans); letter-spacing: .18em; text-transform: uppercase; color: rgba(255, 255, 255, .72); }
.rd-end__issues, .rd-end__related { display: grid; gap: .6rem; margin: 0 0 1.25rem; }
.rd-tile { display: block; padding: .8rem 1rem; border: 1px solid var(--rd-rule); border-radius: 10px; text-decoration: none; color: inherit; background: #fff; min-height: 44px; }
.rd-tile:hover { border-color: var(--rd-blue); }
.rd-tile__label { display: block; font: 700 .72rem var(--rd-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--rd-blue); }
.rd-tile__title { display: block; font: 700 1.05rem/1.3 var(--rd-sans); }
.rd-end__links { list-style: none; margin: 0; padding: 0; }
.rd-end__links li { border-top: 1px solid var(--rd-rule); }
.rd-end__links a { display: flex; align-items: center; min-height: 48px; font-weight: 700; }

/* ── Sheets (contents, share): a bottom sheet on phones ── */
.rd-sheet { position: fixed; inset: 0; z-index: var(--rd-z-sheet); display: flex; align-items: flex-end; background: rgba(10, 22, 51, .5); overscroll-behavior: contain; }
.rd-sheet[hidden] { display: none; }
.rd-sheet__panel { width: 100%; max-height: 82dvh; overflow-y: auto; padding: 0 1rem calc(1rem + var(--rd-safe-b)); background: #fff; border-radius: 16px 16px 0 0; overscroll-behavior: contain; }
.rd-sheet__head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: .5rem 0; background: #fff; }
.rd-sheet__head h2 { margin: 0; font: 700 1.2rem var(--rd-serif); }
.rd-share__title { margin: .25rem 0 .75rem; font-weight: 700; }
.rd-share__channels { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.rd-share__native { width: 100%; }
.rd-share__channels .rd-btn { width: 100%; justify-content: flex-start; border-radius: 10px; }
.rd-toast { position: fixed; left: 50%; bottom: calc(var(--rd-bottom-h) + var(--rd-safe-b) + .75rem); z-index: var(--rd-z-toast); margin: 0; padding: .55rem 1rem; transform: translateX(-50%); background: var(--rd-navy); color: #fff; border-radius: 999px; font: 700 .9rem var(--rd-sans); opacity: 0; pointer-events: none; transition: opacity .2s; }
.rd-toast.is-on { opacity: 1; }

@media (prefers-reduced-motion: reduce) { .rd-toast { transition: none; } .rd-piece__body, .rd-stage > * { animation: none !important; } }

/* ── Tablet and desktop enhancements ── */
@media (min-width: 768px) {
    /* Tablet and up: the contents page is a spread, the editor's note on the left page. */
    .rd-toc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 2.5rem; padding-top: 2rem; }
    .rd-toc__note { position: sticky; top: calc(var(--rd-bar-h) + 1.5rem); align-self: start; padding-right: 2.5rem; border-right: 1px solid var(--rd-rule); }
    .rd-end__issues, .rd-end__related { grid-template-columns: repeat(2, 1fr); }
    /* Tablet and up: the back cover sits beside the exits like the front cover beside the contents (two pages). */
    .rd-end { display: grid; grid-template-columns: 300px 1fr; gap: 2rem; align-items: start; padding-top: 2rem; }
    .rd-back { position: sticky; top: calc(var(--rd-bar-h) + 1rem); aspect-ratio: 3 / 4; min-height: 0; margin: 0; border-radius: 4px; box-shadow: 0 6px 24px rgba(10, 22, 51, .18); }
    .rd-bottom { left: 50%; right: auto; bottom: 1rem; transform: translateX(-50%); width: min(520px, calc(100% - 2rem)); padding: .5rem; border: 1px solid var(--rd-rule); border-radius: 999px; box-shadow: 0 6px 24px rgba(10, 22, 51, .18); }
    body.rd { padding-bottom: 6rem; }
    .rd-sheet { align-items: stretch; justify-content: flex-end; }
    .rd-sheet__panel { width: min(420px, 100%); max-height: none; height: 100%; border-radius: 0; }
    .rd-frame--fill { height: calc(100dvh - var(--rd-bar-h) - 7rem); }
    .rd-toast { bottom: 5.5rem; }
}

/* Short landscape phones: give the content the height. */
@media (max-height: 480px) and (orientation: landscape) {
    :root { --rd-bar-h: 40px; --rd-bottom-h: 52px; }
}
