/* SNU Magazine and E-paper (/magazine, /epaper). Uses the website's colour and type tokens from assets/css/style.css.
   Kept outside assets/ because tools/snu-site/export.py replaces that folder from the HTML Frontend. */

/* ---------- masthead ---------- */
.mag-masthead { background: var(--navy-900); color: #fff; padding: 1.25rem 0 2.25rem; border-bottom: 4px solid var(--gold); }
.mag-masthead .breadcrumbs, .mag-masthead .breadcrumbs a { color: rgba(255, 255, 255, .75); }
.mag-masthead-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-top: 1.25rem; }
.mag-masthead-kicker { margin: 0 0 .35rem; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-400); font-weight: 700; }
.mag-title { margin: 0; font-family: var(--font-serif); font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1; letter-spacing: -.02em; color: #fff; }
.mag-tagline { margin: .7rem 0 0; color: rgba(255, 255, 255, .82); max-width: 46ch; }
.mag-edition-note { margin: 0; display: grid; text-align: right; border-left: 1px solid rgba(255, 255, 255, .25); padding-left: 1.25rem; }
.mag-edition-note span { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(255, 255, 255, .65); }
.mag-edition-note strong { font-family: var(--font-serif); font-size: 1.15rem; }

/* ---------- lead: cover story + latest edition ---------- */
.mag-lead { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; margin: 1rem 0 2.5rem; align-items: start; }
.mag-cover-story { display: grid; gap: 1.1rem; }
.mag-cover-media { display: block; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10; background: var(--surface); }
.mag-cover-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.mag-cover-media:hover .mag-cover-img { transform: scale(1.03); }
.mag-cover-title { margin: 0; font-family: var(--font-serif); font-size: clamp(1.6rem, 3.2vw, 2.4rem); line-height: 1.15; }
.mag-cover-title a { color: var(--ink); text-decoration: none; }
.mag-cover-title a:hover { color: var(--blue-700); }
.mag-cover-excerpt { margin: 0; font-size: 1.08rem; color: var(--ink-2); }
.mag-kicker { margin: 0 0 .25rem; font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-700); }
.mag-byline { margin: .4rem 0 0; font-size: .85rem; color: var(--muted); }
.mag-byline span, .mag-byline strong { color: var(--ink-2); font-weight: 700; }
.mag-byline-lg { font-size: .95rem; margin: 0 0 1.25rem; }

.mag-edition { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; position: sticky; top: 90px; }
.mag-edition-label { margin: 0 0 .75rem; font-weight: 800; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--navy); }
.mag-edition .btn-row { margin: .9rem 0 0; }
.mag-contents { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: .9rem; }
.mag-contents-title { margin: 0 0 .5rem; font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.mag-contents ol { list-style: none; margin: 0; padding: 0; counter-reset: c; }
.mag-contents li { counter-increment: c; border-bottom: 1px dashed var(--line); }
.mag-contents li:last-child { border-bottom: 0; }
.mag-contents a { display: flex; gap: .6rem; align-items: baseline; padding: .45rem 0; color: var(--ink); text-decoration: none; font-size: .92rem; }
.mag-contents a::before { content: counter(c, decimal-leading-zero); font-family: var(--font-serif); color: var(--gold-700); font-weight: 700; min-width: 1.6em; }
.mag-contents a span { flex: 1; }
.mag-contents a em { font-style: normal; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.mag-contents a:hover span { color: var(--blue-700); text-decoration: underline; }
.mag-contents-lg a { font-size: 1rem; padding: .6rem 0; }

/* ---------- story grid ---------- */
.mag-section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 2rem 0 1rem; }
.mag-section-head .block-title { margin: 0; }
.mag-section-head .chip-row { margin: 0; }
.mag-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.mag-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mag-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: box-shadow .2s, transform .2s; }
.mag-card:hover { box-shadow: var(--shadow-sm), 0 10px 28px rgba(16, 58, 97, .1); transform: translateY(-2px); }
.mag-card[hidden] { display: none; }
.mag-card-media { display: block; aspect-ratio: 16 / 10; background: var(--surface); overflow: hidden; }
.mag-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mag-card-body { padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; flex: 1; }
.mag-card-title { margin: 0; font-family: var(--font-serif); font-size: 1.15rem; line-height: 1.3; }
.mag-card-title a { color: var(--ink); text-decoration: none; }
.mag-card-title a:hover { color: var(--blue-700); }
.mag-card-excerpt { margin: .5rem 0 0; color: var(--ink-2); font-size: .93rem; }
.mag-card .mag-byline { margin-top: auto; padding-top: .7rem; }

.mag-pitch { margin: 3rem 0 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding: 1.5rem 1.75rem; border-radius: var(--radius); background: var(--gold-50); border: 1px solid rgba(201, 163, 74, .35); }
.mag-pitch h2 { margin: 0 0 .25rem; font-family: var(--font-serif); font-size: 1.35rem; color: var(--navy); }
.mag-pitch p { margin: 0; color: var(--ink-2); }

/* ---------- edition covers ---------- */
.ep-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.5rem 1.25rem; }
.ep-shelf-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ep-cover { display: grid; gap: .55rem; text-decoration: none; color: var(--ink); }
.ep-cover[hidden] { display: none; }
.ep-cover-frame { display: block; aspect-ratio: 1 / 1.414; border-radius: 4px; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 8px 22px rgba(16, 58, 97, .16); transition: transform .25s, box-shadow .25s; position: relative; }
.ep-cover-frame::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 6%; background: linear-gradient(90deg, rgba(0, 0, 0, .16), transparent); }
.ep-cover:hover .ep-cover-frame { transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 2px 4px rgba(0, 0, 0, .1), 0 16px 34px rgba(16, 58, 97, .22); }
.ep-cover-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ep-cover-blank { display: grid; place-items: center; height: 100%; background: var(--navy); color: var(--gold-400); font-size: 2.5rem; }
.ep-cover-meta { display: grid; line-height: 1.3; }
.ep-cover-meta strong { font-size: .92rem; }
.ep-cover-meta span { font-size: .82rem; color: var(--muted); }
.mag-edition .ep-cover { max-width: 210px; margin: 0 auto; }
.side-card .ep-cover { max-width: 160px; margin: 0 auto .9rem; }

.ep-feature { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; align-items: start; padding: 1.5rem; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); margin-bottom: 1rem; }
.ep-feature .btn-row { margin-top: 1rem; }

/* ---------- reader ---------- */
.epaper { background: #1e2a36; border-radius: var(--radius); overflow: hidden; color: #fff; }
.epaper:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.ep-toolbar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .55rem .75rem; background: #16202a; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.ep-tool-group { display: flex; align-items: center; gap: .25rem; }
.ep-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; border: 0; background: transparent; color: #e6edf3; font-size: 1.05rem; cursor: pointer; text-decoration: none; }
.ep-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .1); color: #fff; }
.ep-btn:disabled { opacity: .35; cursor: default; }
.ep-btn[aria-pressed="true"] { background: rgba(201, 163, 74, .25); color: var(--gold-400); }
.ep-btn:focus-visible, .ep-thumb:focus-visible { outline: 2px solid var(--gold-400); outline-offset: 2px; }
.ep-page { display: inline-flex; align-items: center; gap: .35rem; margin: 0 .35rem; font-size: .9rem; color: #c8d3dd; }
.ep-page input { width: 3.6em; padding: .3rem .35rem; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .2); background: #0f1720; color: #fff; text-align: center; font: inherit; }
.ep-stage { position: relative; display: flex; justify-content: center; align-items: center; min-height: min(78vh, 900px); padding: 1.25rem 3.25rem; overflow: auto; background: radial-gradient(ellipse at center, #2b3a49 0%, #1e2a36 70%); }
.epaper:fullscreen .ep-stage { flex: 1; min-height: 0; }
.ep-spread { display: flex; justify-content: center; align-items: center; transform-origin: center top; transition: transform .25s ease; }
.ep-spread img { display: block; max-height: min(74vh, 860px); width: auto; max-width: 100%; background: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); user-select: none; -webkit-user-drag: none; }
.epaper:fullscreen .ep-spread img { max-height: calc(100vh - 110px); }
.ep-spread.is-double img { max-width: 50%; }
.ep-spread.is-double img:first-child { box-shadow: -6px 10px 30px rgba(0, 0, 0, .45); }
.ep-spread.is-double img:last-child:not(:first-child) { box-shadow: 6px 10px 30px rgba(0, 0, 0, .45); background-image: linear-gradient(90deg, rgba(0, 0, 0, .12), transparent 6%); }
.ep-spread.is-zoomed { cursor: grab; }
.ep-spread.turn-next { animation: ep-turn-next .35s ease; }
.ep-spread.turn-prev { animation: ep-turn-prev .35s ease; }
@keyframes ep-turn-next { from { opacity: .35; transform: translateX(24px) rotateY(-8deg); } to { opacity: 1; transform: none; } }
@keyframes ep-turn-prev { from { opacity: .35; transform: translateX(-24px) rotateY(8deg); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ep-spread.turn-next, .ep-spread.turn-prev { animation: none; } .ep-spread { transition: none; } }
.ep-edge { position: absolute; top: 0; bottom: 0; width: 3.25rem; border: 0; background: transparent; cursor: pointer; z-index: 2; }
.ep-edge-prev { left: 0; } .ep-edge-next { right: 0; }
.ep-edge::after { content: ""; position: absolute; top: 50%; width: 14px; height: 14px; border: solid rgba(255, 255, 255, .55); border-width: 0 3px 3px 0; }
.ep-edge-prev::after { left: 1.2rem; transform: translateY(-50%) rotate(135deg); }
.ep-edge-next::after { right: 1.2rem; transform: translateY(-50%) rotate(-45deg); }
.ep-edge:hover::after { border-color: var(--gold-400); }
.ep-edge:disabled { visibility: hidden; }
.ep-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .75rem; padding: 1rem; background: #16202a; max-height: 340px; overflow: auto; }
.ep-thumbs[hidden] { display: none; }
.ep-thumb { display: grid; gap: .25rem; padding: .3rem; border: 2px solid transparent; border-radius: 6px; background: transparent; color: #c8d3dd; cursor: pointer; font-size: .78rem; }
.ep-thumb img { width: 100%; aspect-ratio: 1 / 1.414; object-fit: cover; background: #fff; }
.ep-thumb.is-current { border-color: var(--gold); color: #fff; }
.ep-noscript { display: grid; gap: 1rem; padding: 1rem; }
.ep-noscript img { max-width: 100%; margin: 0 auto; }
.ep-pdf { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.ep-pdf iframe { display: block; width: 100%; height: min(85vh, 1000px); border: 0; }
.ep-after { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2.5rem; margin-top: 2rem; align-items: start; }
.page-epaper .page-hero { padding-bottom: 1.5rem; }

@media (max-width: 991px) {
  .mag-lead, .ep-after { grid-template-columns: 1fr; }
  .mag-edition { position: static; }
  .mag-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ep-only-wide { display: none; }
}
@media (max-width: 640px) {
  .mag-grid, .mag-grid-2 { grid-template-columns: 1fr; }
  .ep-feature { grid-template-columns: 1fr; }
  .ep-feature .ep-cover { max-width: 220px; }
  .mag-edition-note { text-align: left; border-left: 0; padding-left: 0; }
  .ep-stage { padding: .75rem 2.25rem; min-height: 60vh; }
  .ep-edge { width: 2.25rem; }
  .ep-edge-prev::after { left: .7rem; } .ep-edge-next::after { right: .7rem; }
  .ep-toolbar { justify-content: center; }
}
