/* Framework magazine reader (reader.js). Dark stage like a print viewer; uses the about.css tokens. */

/* StPageFlip 2.0.7 base styles (MIT, page-flip.LICENSE.txt) */
.stf__parent { position: relative; display: block; box-sizing: border-box; transform: translateZ(0); touch-action: pan-y; }
.stf__wrapper { position: relative; width: 100%; box-sizing: border-box; }
.stf__parent canvas { position: absolute; width: 100%; height: 100%; left: 0; top: 0; }
.stf__block { position: absolute; width: 100%; height: 100%; box-sizing: border-box; perspective: 2000px; }
.stf__item { display: none; position: absolute; transform-style: preserve-3d; }
.stf__outerShadow, .stf__innerShadow, .stf__hardShadow, .stf__hardInnerShadow { position: absolute; left: 0; top: 0; }

.mag { scroll-margin-top: 73px; --mag-bg: #11151b; --mag-bar: #0b0f14; --mag-fg: #f2f2f0; --mag-dim: #9aa3ae; background: var(--mag-bg); color: var(--mag-fg); position: relative; }
.mag:focus-visible, .mag__stage:focus-visible { outline: 2px solid var(--k-red, #E4022D); outline-offset: -2px; }

/* without JS (or before it runs): every page as a picture, one under another */
.mag__fallback { list-style: none; margin: 0 auto; padding: 32px 16px; display: grid; gap: 24px; max-width: 760px; }
.mag__fallback img { display: block; width: 100%; height: auto; background: #1b2028; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
.mag__fallback figcaption { font: 12px/1.4 var(--font-mono, monospace); color: var(--mag-dim); margin-top: 8px; }
.mag--ready .mag__fallback { display: none; }

.mag__stage { position: relative; height: min(calc(100vh - 73px - 61px), 980px); height: min(calc(100svh - 73px - 61px), 980px); min-height: 360px; display: flex; align-items: center; justify-content: center; overflow: hidden; outline: none; }
.mag__book { position: relative; }
/* autoSize is off, so the library leaves its wrapper 0 px high: give it the book's height */
.mag__book .stf__wrapper { height: 100%; }
.mag__page { background: #fff; overflow: hidden; }
.mag__page > img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; pointer-events: none; }
/* HTML pages: laid out at design size (1000 px wide) in a shadow root, scaled down by reader.js */
.mag__html { display: block; transform-origin: 0 0; position: relative; overflow: hidden; background: #fff; }
.mag__probe { position: absolute; left: -99999px; top: 0; width: 1000px; visibility: hidden; pointer-events: none; contain: layout paint; }
.mag__probe .mag__html { width: 1000px; height: 1414px; }
.mag__page--blank { background: transparent; }
.mag__book .stf__item { box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); }

/* plain view (reduced motion, or if the flip library can't start) */
.mag__plain { display: flex; justify-content: center; align-items: center; gap: 0; }
.mag__plain .mag__page { box-shadow: 0 10px 40px rgba(0, 0, 0, .45); }
.mag__plain--anim .mag__page { animation: magIn .22s ease-out; }
@keyframes magIn { from { opacity: .3; transform: translateX(var(--mag-dir, 12px)); } to { opacity: 1; transform: none; } }

/* edge arrows */
.mag__edge { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; width: 48px; height: 96px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, .06); color: var(--mag-fg); display: grid; place-items: center; cursor: pointer; transition: background .15s; }
.mag__edge:hover { background: rgba(255, 255, 255, .16); }
.mag__edge:disabled { opacity: 0; pointer-events: none; }
.mag__edge--prev { left: 12px; }
.mag__edge--next { right: 12px; }
.mag svg { width: 20px; height: 20px; flex: none; }

/* bottom bar */
.mag__bar { display: flex; align-items: center; gap: 6px; padding: 10px 16px; background: var(--mag-bar); border-top: 1px solid rgba(255, 255, 255, .06); flex-wrap: wrap; }
.mag__btn { appearance: none; border: 0; background: transparent; color: var(--mag-fg); height: 40px; min-width: 40px; padding: 0 10px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font: 500 13px/1 var(--font-sans, system-ui); text-decoration: none; }
.mag__btn:hover { background: rgba(255, 255, 255, .1); }
.mag__btn:focus-visible { outline: 2px solid var(--k-red, #E4022D); outline-offset: 1px; }
.mag__btn[aria-pressed="true"] { background: rgba(255, 255, 255, .14); }
.mag__count { font: 500 13px/1 var(--font-mono, monospace); color: var(--mag-fg); min-width: 84px; text-align: center; white-space: nowrap; }
.mag__scrub { flex: 1 1 160px; min-width: 120px; accent-color: var(--k-red, #E4022D); height: 40px; margin: 0 8px; cursor: pointer; }
.mag__sep { width: 1px; height: 24px; background: rgba(255, 255, 255, .12); margin: 0 4px; }
.mag__label { white-space: nowrap; }

/* thumbnails drawer */
.mag__thumbs { position: absolute; inset: 0 0 auto 0; bottom: 61px; z-index: 20; background: rgba(11, 15, 20, .97); overflow: auto; padding: 20px 16px 32px; }
.mag__thumbs[hidden] { display: none; }
.mag__thumbs-head { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto 16px; font: 500 13px/1 var(--font-mono, monospace); color: var(--mag-dim); }
.mag__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 16px; max-width: 1200px; margin: 0 auto; }
.mag__thumb { appearance: none; border: 0; padding: 0; background: none; color: var(--mag-dim); cursor: pointer; font: 12px/1 var(--font-mono, monospace); text-align: center; }
.mag__thumb img { display: block; width: 100%; aspect-ratio: var(--mag-ratio, .707); object-fit: cover; background: #1b2028; margin-bottom: 6px; outline: 2px solid transparent; outline-offset: 2px; }
.mag__thumb[aria-current="true"] img { outline-color: var(--k-red, #E4022D); }
.mag__thumb:hover img, .mag__thumb:focus-visible img { outline-color: rgba(255, 255, 255, .6); }
.mag__thumb:focus-visible { outline: none; }

/* zoom */
.mag__zoom { position: fixed; inset: 0; z-index: 1000; background: #0b0f14; display: flex; flex-direction: column; }
.mag__zoom[hidden] { display: none; }
.mag__zoom-view { flex: 1; overflow: hidden; position: relative; touch-action: none; cursor: grab; }
.mag__zoom-view.is-drag { cursor: grabbing; }
.mag__zoom-inner { position: absolute; left: 0; top: 0; display: flex; transform-origin: 0 0; will-change: transform; }
.mag__zoom-inner img { display: block; height: 100%; width: auto; background: #fff; user-select: none; -webkit-user-drag: none; }
.mag__zoom-bar { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 10px 16px; background: var(--mag-bar); color: var(--mag-fg); }

/* toast ("Link copied") */
.mag__toast { position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 30; background: #fff; color: #0b0f14; padding: 10px 16px; border-radius: 6px; font: 500 13px/1.2 var(--font-sans, system-ui); box-shadow: 0 8px 30px rgba(0, 0, 0, .3); }
.mag__toast[hidden] { display: none; }

.mag__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* full screen */
.mag:fullscreen { scroll-margin-top: 0; display: flex; flex-direction: column; width: 100%; height: 100%; }
.mag:fullscreen .mag__stage { height: auto; flex: 1; max-height: none; }
.mag:fullscreen .mag__thumbs { bottom: 61px; }

/* phones: tighter bar, labels hidden, scrubber on its own row */
@media (max-width: 760px) {
  .mag__stage { height: min(calc(100svh - 64px - 92px), 760px); min-height: 300px; }
  .mag { scroll-margin-top: 64px; }
  .mag__edge { width: 36px; height: 72px; background: rgba(0, 0, 0, .25); }
  .mag__edge--prev { left: 4px; }
  .mag__edge--next { right: 4px; }
  .mag__bar { padding: 6px 8px; gap: 2px; justify-content: space-between; }
  .mag__scrub { order: -1; flex-basis: 100%; margin: 0 4px; height: 32px; }
  .mag__label, .mag__sep { display: none; }
  .mag__btn { min-width: 40px; padding: 0 8px; }
  .mag__count { min-width: 64px; }
  .mag__thumbs { bottom: 92px; }
  .mag__grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .mag__plain--anim .mag__page { animation: none; }
  .mag__edge { transition: none; }
}

/* ---- text version and article list on the edition page ---- */
.mag-toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; margin-top: 32px; }
.mag-toc a { display: grid; grid-template-columns: 84px 1fr; gap: 16px; text-decoration: none; color: inherit; align-items: start; }
.mag-toc img { width: 84px; height: 119px; max-width: none; aspect-ratio: auto; object-fit: cover; background: #eee; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.mag-toc h3 { font-size: 17px; line-height: 1.3; margin: 4px 0 6px; }
.mag-toc a:hover h3 { text-decoration: underline; text-underline-offset: 3px; }
.mag-toc .mono { display: block; font-size: 11px; line-height: 1.6; color: var(--k-muted, #5B6573); }
.mag-text { border-top: 1px solid var(--rule, #E2DED6); border-bottom: 1px solid var(--rule, #E2DED6); }
.mag-text > summary { cursor: pointer; padding: 20px 0; font: 600 17px/1.3 var(--font-sans, system-ui); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.mag-text > summary::-webkit-details-marker { display: none; }
.mag-text > summary::after { content: "+"; font: 400 24px/1 var(--font-mono, monospace); }
.mag-text[open] > summary::after { content: "–"; }
.mag-text__page { padding: 24px 0; border-top: 1px solid var(--rule, #E2DED6); max-width: 72ch; }
.mag-text__page h3 { font: 500 12px/1 var(--font-mono, monospace); letter-spacing: .06em; text-transform: uppercase; color: var(--k-muted, #5B6573); margin: 0 0 12px; display: flex; gap: 16px; align-items: baseline; }
.mag-text__page h3 a { color: inherit; }
.mag-text__page p { margin: 0 0 12px; line-height: 1.6; }
.mag-article__hero { display: block; max-width: 420px; margin-top: 40px; }
.mag-article__hero img { width: 100%; height: auto; display: block; box-shadow: 0 10px 40px rgba(0, 0, 0, .18); }
.mag-article__who { margin-top: 20px; font: 500 13px/1.5 var(--font-mono, monospace); color: var(--k-muted, #5B6573); }
.mag-article__who b { color: var(--fg, #0B0F14); font-weight: 600; }
