/* ==========================================================================
   Current affairs — swipe feed (/current-affairs/feed) and the
   "Swipe mode" / web stories rail on the current affairs list.
   Uses the tokens from app.css (loaded first).
   ========================================================================== */

/* ── Feed page ─────────────────────────────────────────────────────────── */
.reel-page {
    --reel-bg: #0B1430;
    --reel-card: #FFFFFF;
    --reel-w: 100%;
    margin: 0;
    background: var(--reel-bg);
    background-image: radial-gradient(1200px 600px at 50% -10%, #1B2F6B 0%, rgba(11, 20, 48, 0) 60%);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

.reel {
    position: relative;
    width: var(--reel-w);
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    outline: none;
}
.reel::-webkit-scrollbar { display: none; }

/* One card = one screen */
.rc {
    position: relative;
    height: 100vh;
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    flex-direction: column;
    background: var(--reel-card);
    overflow: hidden;
}

/* Top bar over the cards */
.reel-top {
    position: fixed;
    z-index: 5;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--reel-w);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
    background: linear-gradient(to bottom, rgba(6, 12, 32, .72), rgba(6, 12, 32, 0));
    pointer-events: none;
}
.reel-top > * { pointer-events: auto; }
.reel-top__btn {
    flex: none;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, .16);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.reel-top__btn .ic { width: 20px; height: 20px; }
.reel-top__lang {
    flex: none;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, .16);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    text-decoration: none;
}
.reel-cats {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    mask-image: linear-gradient(to right, #000 85%, transparent);
}
.reel-cats::-webkit-scrollbar { display: none; }
.reel-cats a {
    flex: none;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: rgba(255, 255, 255, .9);
    background: rgba(255, 255, 255, .12);
    text-decoration: none;
    white-space: nowrap;
}
.reel-cats a[aria-current="true"] { background: #fff; color: var(--navy); font-weight: 600; }

/* Story card: photo on top, text below */
.rc__media {
    position: relative;
    flex: none;
    height: clamp(140px, 32dvh, 330px);
    background: linear-gradient(135deg, #1E3A8A, #1266F1);
    overflow: hidden;
}
.rc--green .rc__media { background: linear-gradient(135deg, #065F46, #0E9F6E); }
.rc--cyan .rc__media { background: linear-gradient(135deg, #0C4A6E, #08B8F5); }
.rc--amber .rc__media { background: linear-gradient(135deg, #92400E, #F59E0B); }
.rc--purple .rc__media { background: linear-gradient(135deg, #4C1D95, #B85CFF); }
.rc__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rc__media::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 40%;
    background: linear-gradient(to top, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0));
}
.rc__glyph {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: clamp(80px, 18dvh, 150px);
    font-weight: 700;
    color: rgba(255, 255, 255, .22);
    line-height: 1;
}

.rc__body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
    margin-top: -18px;
    position: relative;
}
.rc__top { flex: none; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.rc__title {
    margin: 0;
    font-size: clamp(1.12rem, 2.6dvh + .4rem, 1.5rem);
    line-height: 1.3;
    font-weight: 600;
    color: var(--ink);
    flex: none;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rc__sum {
    margin: 0;
    font-size: clamp(.95rem, 1.6dvh + .35rem, 1.06rem);
    line-height: 1.6;
    color: #2A3A5C;
    flex: none;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rc__points {
    flex: 0 1 auto;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    min-height: 64px;
    overflow: hidden;
    /* When the screen is short the list is cut softly, not mid-letter. */
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent);
}
.rc__points h3 { margin: 0 0 4px; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; color: var(--blue-dark); text-transform: uppercase; }
.rc__points ul { margin: 0; padding-left: 18px; list-style: disc; }
.rc__points li {
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rc__points li + li { margin-top: 2px; }
.rc__actions { flex: none; margin-top: auto; display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.rc__read {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 12px;
    font-weight: 600;
    color: #fff;
    background: var(--blue);
    text-decoration: none;
}
.rc__read:hover { background: var(--blue-dark); }
.rc__btn {
    flex: none;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}
.rc__btn .ic { width: 21px; height: 21px; }
.rc__btn[aria-pressed="true"] { color: var(--blue); border-color: #A9C5F3; background: var(--blue-soft); }
.rc__btn[aria-pressed="true"] .ic { fill: currentColor; }
.rc__btn:focus-visible, .rc__read:focus-visible, .rc__opt:focus-visible, .reel-cats a:focus-visible, .reel-top__btn:focus-visible { outline: 3px solid #FBBF24; outline-offset: 2px; }

/* Quiz card */
.rc--quiz, .rc--end { background: linear-gradient(160deg, #1E3A8A 0%, #172554 55%, #0B1430 100%); color: #fff; }
.rc__quiz {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: calc(env(safe-area-inset-top, 0px) + 70px) 20px calc(env(safe-area-inset-bottom, 0px) + 28px);
    overflow-y: auto;
}
/* Centred when it fits, scrolls from the top when it doesn't. */
.rc__quiz > :first-child { margin-top: auto; }
.rc__quiz > :last-child { margin-bottom: auto; }
.rc__kicker { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #FDE68A; background: rgba(251, 191, 36, .14); }
.rc__q { margin: 0; font-size: clamp(1.15rem, 2.4dvh + .5rem, 1.45rem); line-height: 1.4; font-weight: 600; color: #fff; }
.rc__pick { margin: 0; font-size: 14.5px; color: rgba(255, 255, 255, .75); }
.rc__pick strong { color: #fff; }
.rc__opts { display: grid; gap: 10px; }
.rc__opt {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid rgba(255, 255, 255, .22);
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font: inherit;
    font-size: 15.5px;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
}
.rc__opt:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.rc__opt:active:not(:disabled) { transform: scale(.99); }
.rc__opt:disabled { cursor: default; }
.rc__mark { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, .16); }
.rc__opt.is-right { border-color: #34D399; background: rgba(16, 185, 129, .22); }
.rc__opt.is-right .rc__mark { background: #10B981; color: #fff; }
.rc__opt.is-wrong { border-color: #F87171; background: rgba(239, 68, 68, .2); }
.rc__opt.is-wrong .rc__mark { background: #EF4444; color: #fff; }
.rc__opt.is-dim { opacity: .55; }
.rc__verdict { margin: 0; font-weight: 600; font-size: 15.5px; }
.rc__verdict.is-right { color: #6EE7B7; }
.rc__verdict.is-wrong { color: #FCA5A5; }
.rc__exp { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .08); font-size: 14.5px; line-height: 1.6; color: rgba(255, 255, 255, .9); }
.rc__more { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 14.5px; font-weight: 600; color: #BFD7FF; text-decoration: none; }
.rc__more:hover { color: #fff; text-decoration: underline; }
.rc__go { align-self: flex-start; display: inline-flex; gap: 8px; }
.rc__done { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(16, 185, 129, .2); color: #6EE7B7; }
.rc__done .ic { width: 32px; height: 32px; }

/* Loader, hint, toast, desktop arrows */
.reel-more { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 120px; color: rgba(255, 255, 255, .8); font-size: 14px; scroll-snap-align: end; }
.reel-more button { font: inherit; font-weight: 600; color: var(--navy); background: #fff; border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer; }
.reel-spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: reel-spin .8s linear infinite; }
@keyframes reel-spin { to { transform: rotate(360deg); } }
.reel-hint {
    position: fixed;
    z-index: 4;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    background: rgba(11, 20, 48, .78);
    pointer-events: none;
    animation: reel-bob 1.6s ease-in-out infinite;
    transition: opacity .3s;
}
.reel-hint.is-gone { opacity: 0; }
@keyframes reel-bob { 50% { transform: translate(-50%, -6px); } }
.reel-toast {
    position: fixed;
    z-index: 6;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
    transform: translateX(-50%);
    padding: 8px 16px;
    border-radius: 10px;
    background: #0F172A;
    color: #fff;
    font-size: 14px;
}
.reel-nav { display: none; }

/* Short phones: a little less text per card. */
@media (max-height: 720px) {
    .rc__sum { -webkit-line-clamp: 5; }
}
@media (max-height: 620px) {
    .rc__sum { -webkit-line-clamp: 4; }
    .rc__title { -webkit-line-clamp: 2; }
    .rc__body { gap: 8px; }
}
@media (max-height: 540px) {
    .rc__points { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .reel { scroll-behavior: auto; }
    .reel-hint { animation: none; }
}

/* Tablet / desktop: a phone-sized column in the middle */
@media (min-width: 700px) {
    .reel-page { --reel-w: 440px; }
    .rc { border-left: 1px solid rgba(255, 255, 255, .08); border-right: 1px solid rgba(255, 255, 255, .08); }
    .reel-nav {
        position: fixed;
        z-index: 4;
        top: 50%;
        left: calc(50% + 240px);
        transform: translateY(-50%);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        color: rgba(255, 255, 255, .6);
    }
    .reel-nav button { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; }
    .reel-nav button:hover { background: rgba(255, 255, 255, .18); }
    .reel-nav small { max-width: 90px; text-align: center; font-size: 12px; line-height: 1.4; }
}
@media (min-width: 700px) and (min-height: 900px) {
    .reel-page { --reel-w: 480px; }
}

/* ── Current affairs list: "Swipe mode" + web stories rail ─────────────── */
.ca-swipe {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--r);
    color: #fff;
    background: linear-gradient(120deg, #172554 0%, #1E3A8A 55%, #1266F1 100%);
    text-decoration: none;
    box-shadow: var(--shadow);
}
.ca-swipe:hover { color: #fff; filter: brightness(1.05); }
.ca-swipe h2 { margin: 0; font-size: 1.12rem; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 8px; }
.ca-swipe p { margin: 2px 0 0; font-size: 14.5px; color: rgba(255, 255, 255, .82); }
.ca-swipe__go { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: 14.5px; color: var(--navy); background: #fff; white-space: nowrap; }
.ca-swipe__phone { flex: none; width: 22px; height: 34px; border: 2px solid rgba(255, 255, 255, .9); border-radius: 6px; position: relative; }
.ca-swipe__phone::after { content: ""; position: absolute; left: 50%; top: 9px; width: 2px; height: 12px; margin-left: -1px; border-radius: 2px; background: #FBBF24; animation: reel-bob2 1.4s ease-in-out infinite; }
@keyframes reel-bob2 { 50% { transform: translateY(-5px); } }
@media (max-width: 520px) {
    .ca-swipe { grid-template-columns: minmax(0, 1fr); }
    .ca-swipe__go { justify-self: start; }
}

.ca-rail { margin-top: 14px; }
.ca-rail__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ca-rail__head h2 { margin: 0; font-size: 1rem; font-weight: 600; }
.ca-rail__list { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.ca-bub { flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); }
.ca-bub__ring { width: 68px; height: 68px; padding: 3px; border-radius: 50%; background: conic-gradient(#F59E0B, #E5486B, #B85CFF, #1266F1, #F59E0B); }
.ca-bub__ring span, .ca-bub__ring img { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; border: 2.5px solid #fff; object-fit: cover; background: var(--blue-soft); color: var(--blue-dark); font-weight: 700; font-size: 22px; }
.ca-bub small { width: 100%; text-align: center; font-size: 12.5px; line-height: 1.3; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-bub:hover small { color: var(--blue); }

.ws-cards { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.ws-card { flex: none; position: relative; width: 132px; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; color: #fff; text-decoration: none; background: linear-gradient(160deg, #1E3A8A, #0B1430); box-shadow: var(--shadow); }
.ws-grid .ws-card { width: auto; }
.ws-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ws-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(6, 12, 32, .88) 0%, rgba(6, 12, 32, .1) 60%); }
.ws-card__txt { position: absolute; z-index: 1; left: 10px; right: 10px; bottom: 10px; }
.ws-card__txt strong { display: block; font-size: 14px; line-height: 1.3; font-weight: 600; }
.ws-card__txt small { display: block; margin-top: 2px; font-size: 12px; color: rgba(255, 255, 255, .8); }
.ws-card__tag { position: absolute; z-index: 1; top: 8px; left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: rgba(255, 255, 255, .9); color: var(--navy); }
.ws-card:hover { transform: translateY(-2px); transition: transform .15s; }

.art-swipe { display: inline-flex; align-items: center; gap: 8px; }
