/* assets/reading-room.css — the Reading Room (articles.php), rebuilt 11 Nov 2026.
   Owner: "redesigned, relevant and functional … enjoyable with motions and animations".
   The idea: the front page of a magazine. A serif headline, a cover story that turns by itself, cards that rise as you
   scroll and lean a little under the finger. Colours come from assets/site-ui.css (day and night); each topic has its
   own colour (--c on the card). Only transform / opacity move. With "reduce motion", or on a weak phone (html.lk-lite),
   nothing moves by itself. */

.rm { max-width: 1240px; margin: 0 auto; padding: 84px 20px 70px; color: var(--ink); font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
.rm *, .rm *::before, .rm *::after { box-sizing: border-box; }
.rm [hidden] { display: none !important; }
.rm :focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 6px; }
.rm h2 { margin: 0 0 12px; font: 800 14px Inter, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }

/* ── the cover ── */
.rm-top { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 34px; align-items: center; padding: 18px 0 30px; }
.rm-kick { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--brand-ink); }
.rm-kick i { width: 26px; height: 2px; background: currentColor; border-radius: 2px; }
.rm-top h1 { margin: 0; font: 800 clamp(38px, 5.6vw, 68px)/1.02 'Playfair Display', Georgia, serif; letter-spacing: -.02em; color: var(--ink); }
.rm-top h1 em { font-style: italic; font-weight: 700; color: var(--brand-ink); background: linear-gradient(transparent 62%, rgba(240,180,41,.45) 62% 92%, transparent 92%); }
.rm-lede { margin: 16px 0 0; max-width: 46ch; font-size: 16.5px; line-height: 1.55; color: var(--body); }
.rm-nums { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.rm-nums span { min-width: 104px; padding: 12px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.rm-nums b { display: block; font: 400 34px/1 var(--num-font); color: var(--ink); font-variant-numeric: tabular-nums; }
.rm-nums small { display: block; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--mute); }
.rm-you { display: flex; align-items: center; gap: 12px; margin-top: 16px; max-width: 420px; font-size: 13px; font-weight: 700; color: var(--body); }
.rm-you-bar { flex: 1; height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.rm-you-bar i { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, #f0b429, #db2777); transition: width 1.1s cubic-bezier(.2,.8,.2,1); }

.rm-cover { position: relative; aspect-ratio: 16 / 11; border-radius: 28px; overflow: hidden; background: #12102e; box-shadow: 0 30px 60px -30px rgba(18,16,46,.55), 0 0 0 1px var(--line); isolation: isolate; }
.rm-slide { position: absolute; inset: 0; display: block; color: #fff; text-decoration: none; opacity: 0; visibility: hidden; transition: opacity .7s ease, visibility 0s linear .7s; }
.rm-slide.on { opacity: 1; visibility: visible; transition: opacity .7s ease; z-index: 1; }
.rm-slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rm-slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,8,30,0) 30%, rgba(10,8,30,.55) 62%, rgba(10,8,30,.92) 100%); }
.rm-slide-tx { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; flex-direction: column; gap: 8px; padding: 24px 26px 46px; }
.rm-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-tags i, .rm-ph i { font-style: normal; padding: 4px 10px; border-radius: 99px; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.rm-tags .cat { background: var(--c); color: #fff; } .rm-tags .lv { background: rgba(255,255,255,.2); color: #fff; }
.rm .new { background: #f0b429; color: #1a1400; position: relative; overflow: hidden; }
.rm-slide strong { font: 800 clamp(24px, 3.2vw, 38px)/1.08 'Playfair Display', Georgia, serif; letter-spacing: -.01em; text-wrap: balance; }
.rm-slide-ds { max-width: 60ch; font-size: 14.5px; line-height: 1.45; color: rgba(255,255,255,.86); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rm-slide-go { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13.5px; font-weight: 800; color: #ffd66b; }
.rm-dots { position: absolute; left: 26px; right: 26px; bottom: 18px; z-index: 3; display: flex; gap: 6px; }
.rm-dots button { flex: 1; height: 18px; padding: 7px 0; border: 0; background: none; cursor: pointer; }
.rm-dots i { display: block; height: 4px; border-radius: 4px; background: rgba(255,255,255,.3); overflow: hidden; position: relative; }
.rm-dots i::after { content: ""; position: absolute; inset: 0; background: #fff; transform: scaleX(0); transform-origin: left; }
.rm-dots .on i::after { transform: scaleX(1); }

/* ── continue reading ── */
.rm-cont { margin: 4px 0 26px; }
.rm-cont-row { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; scroll-snap-type: x proximity; }
.rm-cont-row::-webkit-scrollbar { display: none; }
.rm-go { flex: 0 0 min(320px, 82vw); display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 14px 10px 10px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); color: inherit; text-decoration: none; scroll-snap-align: start; transition: transform .2s; }
.rm-go:hover { transform: translateY(-3px); }
.rm-go img { width: 64px; height: 64px; border-radius: 13px; object-fit: cover; }
.rm-go b { display: block; font-size: 14.5px; font-weight: 800; line-height: 1.25; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rm-go span { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--mute); }
.rm-go span i { flex: 1; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.rm-go span i u { display: block; height: 100%; border-radius: 6px; background: var(--c, var(--brand)); }

/* ── the tools ── */
.rm-bar { position: sticky; top: 64px; z-index: 30; margin: 0 -8px; padding: 10px 8px; border-radius: 20px; background: var(--glass-solid, var(--card)); border: 1px solid var(--line); box-shadow: 0 14px 30px -24px rgba(18,16,46,.55); }
.rm-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.rm-chips::-webkit-scrollbar { display: none; }
.rm-chips button { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 13px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); color: var(--body); font: 700 13.5px Inter, sans-serif; cursor: pointer; white-space: nowrap; transition: background-color .15s, color .15s, border-color .15s, transform .15s; }
.rm-chips button i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.rm-chips button small { font-size: 11px; font-weight: 800; opacity: .6; }
.rm-chips button:active { transform: scale(.95); }
.rm-chips button.on { background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); color: #fff; } .rm-chips button.on i { background: #fff; }
html.dark .rm-chips button.on:not([style]) { background: var(--brand); border-color: var(--brand); color: #120f2e; }
.rm-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rm-search { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 13px; border: 1.5px solid var(--line); background: var(--card); color: var(--mute); }
.rm-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.rm-search input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; color: var(--ink); font: 600 15px Inter, sans-serif; }
.rm-tools select, .rm-tog, .rm-lucky { min-height: 44px; padding: 0 14px; border-radius: 13px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: 700 13.5px Inter, sans-serif; cursor: pointer; }
.rm-tog[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.rm-lucky { display: inline-flex; align-items: center; gap: 8px; border: 0; background: #f0b429; color: #1a1400; font-weight: 800; box-shadow: 0 4px 0 #c98f0a; transition: transform .12s, box-shadow .12s; }
.rm-lucky:active { transform: translateY(3px); box-shadow: 0 1px 0 #c98f0a; }
.rm-count { margin: 18px 2px 12px; font-size: 13px; font-weight: 700; color: var(--mute); }

/* ── the cards ── */
.rm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.rm-card { position: relative; display: flex; flex-direction: column; min-width: 0; border-radius: 20px; overflow: hidden; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: transform .28s cubic-bezier(.2,.8,.2,1), box-shadow .28s; -webkit-tap-highlight-color: transparent; }
.rm-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--c); transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.rm-card:hover { transform: translateY(-6px); box-shadow: 0 24px 40px -26px rgba(18,16,46,.55), 0 0 0 1px var(--line); }
.rm-card:hover::after, .rm-card:focus-visible::after { transform: scaleX(1); }
.rm-card:active { transform: scale(.985); }
.rm-ph { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--line); }
.rm-ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .7s cubic-bezier(.2,.8,.2,1); }
.rm-card:hover .rm-ph img { transform: scale(1.07); }
.rm-ph i { position: absolute; top: 10px; }
.rm-ph .cat { left: 10px; background: var(--c); color: #fff; }
.rm-ph .new { position: absolute; right: 10px; }
.rm-ph .done { right: 10px; top: auto; bottom: 10px; background: #16a34a; color: #fff; letter-spacing: .04em; }
.rm-tx { display: flex; flex-direction: column; flex: 1; gap: 7px; padding: 14px 16px 16px; }
.rm-tx strong { font: 800 18.5px/1.2 'Playfair Display', Georgia, serif; color: var(--ink); text-wrap: balance; }
.rm-ds { font-size: 13.5px; line-height: 1.5; color: var(--body); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rm-mt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; }
.rm-mt i { font-style: normal; padding: 4px 9px; border-radius: 8px; background: var(--sub, rgba(127,127,160,.12)); font-size: 11.5px; font-weight: 800; color: var(--body); }
html.dark .rm-mt i { background: rgba(255,255,255,.07); }
.rm-mt .l { background: var(--brand-soft); color: var(--brand-ink); }
.rm-mt .rm-ar { margin-left: auto; flex: none; width: 30px; height: 30px; padding: 0; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-size: 15px; transition: transform .2s; } html.dark .rm-mt .rm-ar { background: var(--c); color: #fff; }
.rm-card:hover .rm-mt .rm-ar { transform: translateX(4px); }
.rm-pg { display: block; height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; margin-top: 4px; }
.rm-pg i { display: block; height: 100%; border-radius: 5px; background: var(--c); }
.rm-card.is-done .rm-ph img { filter: saturate(.75); }
.rm-card.out { display: none; }
.rm-none { display: grid; justify-items: center; gap: 6px; padding: 60px 16px; text-align: center; color: var(--mute); }
.rm-none b { font: 800 24px 'Playfair Display', Georgia, serif; color: var(--ink); }
.rm-none button { margin-top: 10px; min-height: 44px; padding: 0 18px; border-radius: 13px; border: 0; background: var(--brand); color: #fff; font: 800 14px Inter, sans-serif; cursor: pointer; }
html.dark .rm-none button { color: #120f2e; }

/* ── motion (only when the student has not asked for less, and the phone is not weak) ── */
@media (prefers-reduced-motion: no-preference) {
  html:not(.lk-lite) .rm-slide.on img { animation: rm-ken 9s ease-out both; }
  html:not(.lk-lite) .rm-slide.on .rm-slide-tx > * { animation: rm-up .7s cubic-bezier(.2,.8,.2,1) both; }
  html:not(.lk-lite) .rm-slide.on .rm-slide-tx > :nth-child(2) { animation-delay: .08s; } html:not(.lk-lite) .rm-slide.on .rm-slide-tx > :nth-child(3) { animation-delay: .16s; } html:not(.lk-lite) .rm-slide.on .rm-slide-tx > :nth-child(4) { animation-delay: .24s; }
  html:not(.lk-lite) .rm-cover.rm-run .rm-dots .on i::after { animation: rm-fill var(--rm-t, 6s) linear both; }
  html:not(.lk-lite) .rm-cover.rm-run.hold .rm-dots .on i::after { animation-play-state: paused; }
  html:not(.lk-lite) .rm-top-tx > * { animation: rm-up .7s cubic-bezier(.2,.8,.2,1) both; }
  html:not(.lk-lite) .rm-top-tx > :nth-child(2) { animation-delay: .06s; } html:not(.lk-lite) .rm-top-tx > :nth-child(3) { animation-delay: .12s; } html:not(.lk-lite) .rm-top-tx > :nth-child(4) { animation-delay: .18s; }
  html:not(.lk-lite) .rm-cover { animation: rm-in .8s cubic-bezier(.2,.8,.2,1) .1s both; }
  html:not(.lk-lite) .rm.js .rm-card.wait { opacity: 0; transform: translateY(26px) scale(.98); }
  html:not(.lk-lite) .rm.js .rm-card.show { animation: rm-card .6s cubic-bezier(.2,.8,.2,1) both; animation-delay: var(--d, 0s); }
  html:not(.lk-lite) .rm .new::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.75) 50%, transparent 70%); transform: translateX(-120%); animation: rm-shine 3.2s ease-in-out infinite; }
  html:not(.lk-lite) .rm-lucky.roll svg { animation: rm-dice .6s cubic-bezier(.3,1.6,.5,1); }
  html:not(.lk-lite) .rm-card.pick { animation: rm-pick .9s cubic-bezier(.3,1.5,.5,1); z-index: 2; }
  html.lk-hidden .rm-slide.on img, html.lk-hidden .rm .new::after { animation-play-state: paused; }
}
@keyframes rm-ken { from { transform: scale(1.02); } to { transform: scale(1.14) translate(-1.5%, -1.5%); } }
@keyframes rm-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes rm-in { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes rm-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rm-card { from { opacity: 0; transform: translateY(26px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes rm-shine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@keyframes rm-dice { from { transform: rotate(-200deg) scale(.7); } to { transform: none; } }
@keyframes rm-pick { 0% { transform: none; } 35% { transform: scale(1.06) rotate(-1.5deg); box-shadow: 0 0 0 4px #f0b429, 0 30px 50px -24px rgba(18,16,46,.6); } 100% { transform: none; box-shadow: 0 0 0 4px #f0b429; } }

/* ── my words (the button and the drawer) ── */
.rm-fab { position: fixed; right: 18px; bottom: 22px; z-index: 60; width: 54px; height: 54px; border-radius: 50%; border: 0; display: grid; place-items: center; background: #12102e; color: #fff; cursor: pointer; box-shadow: 0 14px 28px -12px rgba(18,16,46,.7); }
html.dark .rm-fab { background: var(--brand); color: #120f2e; }
.rm-fab span { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #f0b429; color: #1a1400; font: 800 12px/22px Inter, sans-serif; }
.rm-fab [hidden], .rm-shade[hidden], .rm-words[hidden] { display: none !important; }
.rm-shade { position: fixed; inset: 0; z-index: 70; background: rgba(10,8,30,.5); }
.rm-words { position: fixed; top: 0; right: 0; bottom: 0; z-index: 71; width: min(380px, 92vw); display: flex; flex-direction: column; background: var(--card); color: var(--ink); border-left: 1px solid var(--line); box-shadow: -30px 0 60px -30px rgba(18,16,46,.6); font-family: Inter, system-ui, sans-serif; animation: rm-drawer .28s cubic-bezier(.2,.8,.2,1); }
@keyframes rm-drawer { from { transform: translateX(100%); } to { transform: none; } }
.rm-words-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.rm-words-h h2 { margin: 0; font: 800 22px 'Playfair Display', Georgia, serif; color: var(--ink); }
.rm-words-h button { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--sub, rgba(127,127,160,.12)); color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; }
.rm-words-b { flex: 1; overflow-y: auto; padding: 12px 18px; }
.rm-words-b .w { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 15px; font-weight: 700; }
.rm-words-b .w button { border: 0; background: none; color: var(--mute); font-size: 20px; cursor: pointer; padding: 4px 8px; }
.rm-words-b .none { padding: 40px 10px; text-align: center; color: var(--mute); font-size: 14px; line-height: 1.6; }
.rm-words-f { padding: 12px 18px 18px; border-top: 1px solid var(--line); }
.rm-words-f button { width: 100%; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: none; color: var(--body); font: 700 13.5px Inter, sans-serif; cursor: pointer; }

/* ── smaller screens ── */
@media (max-width: 1100px) { .rm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .rm-top { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 8px; }
  .rm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 640px) {
  .rm { padding: 70px 12px 90px; }
  .rm-lede { font-size: 15px; } .rm-nums span { min-width: 0; flex: 1; padding: 10px 12px; } .rm-nums b { font-size: 26px; } .rm-nums small { font-size: 11px; }
  .rm-cover { aspect-ratio: 4 / 3.6; border-radius: 22px; } .rm-slide-tx { padding: 16px 16px 40px; } .rm-dots { left: 16px; right: 16px; bottom: 12px; }
  .rm-bar { top: 56px; margin: 0 -4px; padding: 8px 6px; border-radius: 16px; }
  .rm-tools select, .rm-tog { flex: 1 1 auto; padding: 0 10px; font-size: 13px; } .rm-lucky { flex: 1 1 100%; justify-content: center; }
  .rm-tx { padding: 10px 11px 12px; gap: 5px; } .rm-tx strong { font-size: 15.5px; } .rm-ds { font-size: 12.5px; -webkit-line-clamp: 2; }
  .rm-mt i { font-size: 10.5px; padding: 3px 7px; } .rm-mt .rm-ar { display: none; } .rm-ph i { font-size: 9.5px; padding: 3px 8px; top: 8px; } .rm-ph .cat { left: 8px; } .rm-ph .new { right: 8px; }
  .rm-fab { bottom: 84px; right: 14px; }
}
@media (max-width: 380px) { .rm-grid { grid-template-columns: minmax(0, 1fr); } }
@media print { .rm-bar, .rm-fab, .rm-cover { display: none; } }
