/* QM Prayag — a clean, SlideShare-style document site. */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --soft: #f5f6f7;
  --ink: #1d2226;
  --muted: #5f6b73;
  --line: #e3e6e8;
  --brand: #1d2226;
  --accent: #0a7d78;
  --accent-hover: #086863;
  --accent-soft: #e5f4f2;
  --accent-ink: #ffffff;
  --chip: #eef1f2;
  --stage: #2b2f33;
  --bar: #1d2226;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 34, 38, .06), 0 2px 10px rgba(29, 34, 38, .06);
  --shadow-pop: 0 6px 28px rgba(29, 34, 38, .18);
  --banner: #fff4ef;
  --banner-line: #f6cfc2;
  --danger: #c2361a;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121417;
  --surface: #1a1d21;
  --soft: #1f2327;
  --ink: #e8eaec;
  --muted: #9ba5ac;
  --line: #2d3237;
  --brand: #e8eaec;
  --accent: #34b8a9;
  --accent-hover: #4ccbbd;
  --accent-soft: #173331;
  --accent-ink: #06201d;
  --chip: #262b30;
  --stage: #0b0c0e;
  --bar: #000000;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 10px rgba(0, 0, 0, .25);
  --shadow-pop: 0 6px 28px rgba(0, 0, 0, .5);
  --banner: #2b2230;
  --banner-line: #5a3a38;
  --danger: #ff8a6e;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
a { color: inherit; }
img, canvas { display: block; max-width: 100%; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
svg { flex: none; }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.wrap-wide { width: min(1320px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 20; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 800; font-size: 1.12rem; white-space: nowrap; }
.brand-logo { width: 36px; height: 36px; display: block; flex: none; }
.logo-dark, :root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 900; }
.topsearch { flex: 1; max-width: 560px; position: relative; }
.topsearch svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.topsearch input {
  width: 100%; font: inherit; font-size: .95rem; padding: 9px 14px 9px 38px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--soft); color: var(--ink);
}
.topsearch input:focus { background: var(--surface); border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-link { text-decoration: none; padding: 7px 10px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .93rem; }
.nav-link:hover { color: var(--ink); background: var(--soft); }

/* Light / dark switch */
.theme-switch {
  position: relative; display: inline-flex; align-items: center; justify-content: space-between;
  width: 60px; height: 30px; padding: 0 7px; margin-left: 8px; flex: none;
  border-radius: 999px; border: 1px solid var(--line); background: var(--chip); color: var(--muted); cursor: pointer;
}
.theme-switch svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; position: relative; z-index: 1; transition: color .2s; }
.theme-switch .knob { position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s ease; }
.theme-switch[aria-checked="true"] .knob { transform: translateX(30px); }
.theme-switch[aria-checked="false"] .sun, .theme-switch[aria-checked="true"] .moon { color: var(--accent); }

/* ---------- Buttons, chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 650 .9rem/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--soft); }
.btn svg, .tb-btn svg, .card-stat svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { padding: 7px 12px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn-danger { background: none; border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: none; border-color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none; font: 600 .86rem/1.3 var(--font); cursor: pointer;
}
.chip:hover { border-color: var(--muted); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip-n { opacity: .6; font-weight: 500; }
.tag-cloud { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Home ---------- */
.banner { background: var(--soft); border-bottom: 1px solid var(--line); padding: 28px 0 20px; }
.banner-inner { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 24px; margin-bottom: 18px; }
.banner h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 850; }
.lede { margin: 4px 0 0; color: var(--muted); font-size: 1.05rem; }
.banner-stats { margin: 0; color: var(--muted); }
.banner-stats b { color: var(--ink); }
.explore { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.shelf { padding: 28px 0 8px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.shelf-head h2 { margin: 0; font-size: 1.3rem; font-weight: 800; }
.see-all { color: var(--accent); font-weight: 650; text-decoration: none; font-size: .92rem; }
.see-all:hover { text-decoration: underline; }
.empty { padding: 32px 0 56px; color: var(--muted); }

/* Hero: Milky Way photo under frosted glass */
.hero {
  position: relative; padding: 44px 0 26px; border-bottom: 0; color: #fff; isolation: isolate;
  background: #0b1022 url("hero-milkyway.jpg") center 30% / cover no-repeat;
  background-image: image-set(url("hero-milkyway.webp") type("image/webp"), url("hero-milkyway.jpg") type("image/jpeg"));
}
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(8, 11, 30, .15) 0%, rgba(8, 11, 30, .55) 100%); }
.hero-glass {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; padding: 22px 26px; margin-bottom: 18px;
  border-radius: 20px; border: 1px solid rgba(255, 255, 255, .22);
  background: linear-gradient(135deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .06));
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.hero-logo { width: 76px; height: 76px; flex: none; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .35)); }
.hero-text { flex: 1; min-width: 240px; }
.hero h1 { color: #fff; text-shadow: 0 2px 18px rgba(0, 0, 0, .35); }
.hero .lede { color: rgba(255, 255, 255, .86); }
.hero .banner-stats { color: rgba(255, 255, 255, .8); align-self: flex-end; }
.hero .banner-stats b { color: #fff; }
.hero .chip { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .28); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hero .chip:hover { background: rgba(255, 255, 255, .22); }
.hero .chip.is-active { background: #fff; border-color: #fff; color: #11163a; }
@media (max-width: 700px) {
  .hero { padding: 24px 0 18px; }
  .hero-glass { padding: 18px; gap: 12px 16px; }
  .hero-logo { width: 56px; height: 56px; }
}

/* ---------- Cards ---------- */
.grid { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 28px 20px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card-link { text-decoration: none; display: flex; flex-direction: column; gap: 10px; }
.card-thumb { display: block; aspect-ratio: 16 / 9; background: var(--chip); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: box-shadow .15s ease; }
.card-thumb img { width: 100%; height: 100%; object-fit: contain; transition: transform .25s ease; }
.card-link:hover .card-thumb { box-shadow: var(--shadow); }
.card-link:hover .card-thumb img { transform: scale(1.02); }
.card-link:hover .card-title { color: var(--accent); }
.card-title { font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-author { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; }
.card-stat { display: inline-flex; align-items: center; gap: 5px; }
.card-stat svg { width: 15px; height: 15px; }

/* ---------- Quiz (document) page ---------- */
.doc { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; padding: 24px 0 56px; align-items: start; }
.doc-head h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 18px 0 6px; font-weight: 800; }
.doc-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: var(--muted); font-size: .9rem; margin: 0; }
.doc-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; margin-top: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.author { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; flex: none; }
.author-text { display: grid; min-width: 0; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.owner-edit { color: var(--accent); text-decoration: none; font-weight: 600; }

/* Dropdown menus */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.caret { font-size: .7rem; opacity: .8; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 15; min-width: 220px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop);
  display: grid; gap: 4px;
}
.menu-pop > a { display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px; border-radius: 8px; text-decoration: none; }
.menu-pop > a:hover { background: var(--soft); }
.share-pop { width: min(340px, calc(100vw - 32px)); gap: 12px; padding: 14px; }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.share-grid a { text-align: center; padding: 10px 4px; border-radius: 8px; background: var(--soft); text-decoration: none; font-weight: 600; font-size: .85rem; }
.share-grid a:hover { background: var(--accent-soft); color: var(--accent); }
.share-pop label { display: grid; gap: 4px; }
.copy-row { display: flex; gap: 6px; }
.copy-row input { flex: 1; min-width: 0; font: .82rem/1.2 ui-monospace, monospace; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); }

.doc-about { padding: 16px 0 4px; }
.doc-about .desc { margin: 0 0 12px; }
.chip-inline { padding: 3px 11px; font-size: .8rem; }

/* Transcript */
.transcript { position: relative; margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--line); }
.transcript h2 { font-size: 1.15rem; margin: 12px 0 2px; }
.slides-text { list-style: none; padding: 0; margin: 12px 0 0; }
.slides-text li { display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.slides-text li:first-child { border-top: 0; }
.slide-no { color: var(--accent); font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; }
.slides-text p { margin: 0; overflow-wrap: anywhere; }
.transcript.is-collapsed .slides-text { max-height: 340px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.transcript-more { margin: 12px 0 0; }

/* Sidebar */
.doc-side { position: sticky; top: 76px; }
.doc-side h2 { font-size: 1.05rem; margin: 0 0 12px; }
.side-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.side-list a { display: grid; grid-template-columns: 128px 1fr; gap: 12px; text-decoration: none; align-items: start; }
.side-list img { width: 128px; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: var(--chip); }
.side-list b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .92rem; line-height: 1.3; margin-bottom: 2px; }
.side-list span { display: grid; }
.side-list a:hover b { color: var(--accent); }

/* ---------- Viewer ---------- */
.viewer { background: var(--stage); border-radius: var(--radius); overflow: hidden; }
.stage { position: relative; aspect-ratio: var(--aspect, 1.7778); max-height: 76vh; margin-inline: auto; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; user-select: none; }
.stage-cover, .stage-canvas { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; grid-area: 1 / 1; }
.stage-status { position: absolute; inset: auto 0 12px; text-align: center; color: #cfd4d8; font-size: .85rem; pointer-events: none; }
.stage-nav { position: absolute; top: 0; bottom: 0; width: 30%; background: none; border: 0; cursor: pointer; }
.stage-prev { left: 0; cursor: w-resize; }
.stage-next { right: 0; cursor: e-resize; }
.vprogress { height: 3px; background: rgba(255, 255, 255, .12); }
.vprogress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }
.toolbar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: var(--bar); color: #fff; }
.tb-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; border: 0; background: none; color: inherit; cursor: pointer; text-decoration: none; }
.tb-btn:hover { background: rgba(255, 255, 255, .12); }
.tb-btn:disabled { opacity: .35; cursor: default; background: none; }
.tb-count { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; font-size: .95rem; }
.tb-count input { width: 3.6em; font: inherit; text-align: center; background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 6px; padding: 4px; -moz-appearance: textfield; }
.tb-count input::-webkit-inner-spin-button { -webkit-appearance: none; }
.tb-spacer { flex: 1; }
.tb-brand { color: #fff; font-size: .85rem; font-weight: 700; text-decoration: none; padding: 0 8px; opacity: .85; }
.viewer:fullscreen { display: flex; flex-direction: column; border-radius: 0; }
.viewer:fullscreen .stage { flex: 1 1 0; min-height: 0; max-height: none; width: 100%; aspect-ratio: auto; }
.noscript { color: #fff; padding: 12px 16px; margin: 0; }

/* Audio / video on slides */
.stage-nav { z-index: 1; }
.stage-layer { position: absolute; z-index: 2; pointer-events: none; container-type: size; }
.stage-layer > * { pointer-events: auto; }
.hot-link { position: absolute; border-radius: 4px; }
.hot-link:hover, .hot-link:focus-visible { background: rgba(10, 125, 120, .12); outline: 2px solid rgba(10, 125, 120, .6); }
.hot-media { position: absolute; display: grid; place-items: center; padding: 0; border: 0; background: rgba(0, 0, 0, .12); border-radius: 6px; cursor: pointer; }
.hot-media:hover { background: rgba(0, 0, 0, .25); }
.hot-badge {
  display: grid; place-items: center; width: clamp(40px, 12cqmin, 72px); aspect-ratio: 1; min-width: 36px;
  border-radius: 50%; background: rgba(10, 125, 120, .92); color: #fff; box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
  transition: transform .15s ease; animation: av-pulse 2.2s ease-in-out 3;
}
.hot-media:hover .hot-badge { transform: scale(1.08); }
.hot-badge svg { width: 55%; height: 55%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hot-media:not(.is-audio) .hot-badge svg { margin-left: 8%; }
@keyframes av-pulse { 0%, 100% { box-shadow: 0 4px 18px rgba(0, 0, 0, .35), 0 0 0 0 rgba(10, 125, 120, .55); } 50% { box-shadow: 0 4px 18px rgba(0, 0, 0, .35), 0 0 0 12px rgba(10, 125, 120, 0); } }
.media-pills { position: absolute; left: 10px; top: 10px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 20px); }
.media-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 7px 9px; border: 0; border-radius: 999px;
  background: rgba(10, 125, 120, .95); color: #fff; font: 650 .82rem/1 var(--font); cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}
.media-pill:hover { background: #086863; }
.media-pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.media-player { position: absolute; background: #000; border-radius: 8px; box-shadow: 0 8px 36px rgba(0, 0, 0, .55); overflow: hidden; }
.media-player.centered { left: 12%; top: 50%; width: 76%; aspect-ratio: 16 / 9; max-height: 92%; transform: translateY(-50%); }
.media-player.at-bottom { left: 50%; bottom: 4%; width: min(440px, 92%); transform: translateX(-50%); background: rgba(20, 22, 25, .92); padding: 10px 40px 10px 10px; }
.media-player.is-spotify.at-bottom { height: 172px; padding: 10px 40px 10px 10px; }
.media-player.is-soundcloud.at-bottom { height: 186px; }
.media-player video, .media-player iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.media-player audio { display: block; width: 100%; }
.media-player.at-bottom iframe { background: transparent; }
.media-close {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, .6); color: #fff; font: 700 18px/28px var(--font); padding: 0;
}
.media-close:hover { background: rgba(0, 0, 0, .85); }
.card-av { color: var(--accent); font-weight: 700; }
.av-badge { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: 650; }
.av-badge svg { width: 15px; height: 15px; fill: currentColor; }
.slides-text .av-note { margin-top: 4px; color: var(--accent); font-size: .85rem; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .hot-badge { animation: none; } }

/* ---------- Simple pages ---------- */
.page { padding: 32px 0 64px; }
.crumbs { font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.prose { max-width: 720px; }
.social { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.prose h1 { font-size: 2.1rem; }

/* ---------- Manage page ---------- */
.upload { max-width: 760px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 16px 0; }
.panel h2 { font-size: 1.15rem; margin-top: 0; }
.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 6px; font-weight: 650; font-size: .92rem; }
.stack label .muted { font-weight: 400; }
.stack input:not([type=file]):not([type=checkbox]), .stack textarea {
  font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--soft); color: var(--ink); width: 100%;
}
.stack .btn { padding: 12px 16px; }
.row { display: grid; gap: 14px; grid-template-columns: 1fr 2fr; }
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 24px; text-align: center; cursor: pointer; justify-items: center; }
.drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop input[type=file] { max-width: 100%; }
.file-list { display: grid; gap: 2px; font-weight: 500; font-size: .88rem; }
.file-list .bad { color: var(--danger); }
.bar { height: 8px; background: var(--chip); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
#progress-text a { color: var(--accent); overflow-wrap: anywhere; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 8px 0 4px; }
.tab { font: 650 .95rem/1 var(--font); padding: 12px 14px; border: 0; background: none; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.filter { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); margin: 16px 0 8px; }
.manage-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.manage-list > li.muted { padding: 16px 0; }
.manage-item { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.manage-item img, .manage-ph { width: 96px; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 6px; background: var(--chip); flex: none; }
.manage-ph { display: grid; place-items: center; font-size: .75rem; color: var(--muted); }
.manage-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.manage-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-actions { display: flex; gap: 6px; flex: none; }
.edit-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--banner); border: 1px solid var(--banner-line); border-radius: 10px; font-size: .92rem; }
.edit-banner a { color: var(--accent); }
.current-files { display: grid; gap: 6px; font-size: .92rem; }
.stack label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.clips { display: grid; gap: 8px; }
.clip-list { display: grid; gap: 6px; }
.clip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); font-size: .9rem; }
.clip-name { flex: 1; min-width: 160px; overflow-wrap: anywhere; }
.stack label.clip-slide { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.stack .clip-slide input[type=number] { width: 5.5em; padding: 6px 8px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--bg); padding: 20px 0; font-size: .9rem; margin-top: 24px; }
.footer-inner { display: flex; justify-content: center; }
.footer p { margin: 4px 0; }
.footer .brand { font-size: 1rem; }
.footer .brand-mark { width: 26px; height: 26px; border-radius: 7px; font-size: .85rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Embed ---------- */
body.embed { background: var(--stage); }
body.embed .viewer { border-radius: 0; min-height: 100vh; display: flex; flex-direction: column; }
body.embed .stage { flex: 1; width: 100%; max-height: calc(100vh - 55px); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .doc { grid-template-columns: 1fr; }
  .doc-side { position: static; }
  .side-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
@media (max-width: 700px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px 12px; padding: 8px 0; }
  .topsearch { order: 3; flex-basis: 100%; max-width: none; }
  .nav-link { padding: 6px 7px; font-size: .88rem; }
  .theme-switch { margin-left: 4px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 14px; }
  .doc { padding-top: 0; }
  .doc .viewer { margin-inline: -16px; border-radius: 0; }
  .doc-actions { width: 100%; }
  .doc-actions > * { flex: 1; }
  .doc-actions .btn { width: 100%; }
  .menu-pop { left: 0; right: auto; }
  .doc-actions .menu:last-child .menu-pop { left: auto; right: 0; }
  .row { grid-template-columns: 1fr; }
  .manage-item { flex-wrap: wrap; }
  .manage-actions { width: 100%; justify-content: flex-end; }
  .tb-btn { width: 36px; }
}
@media (max-width: 359px) {
  .brand { font-size: .98rem; gap: 6px; }
  .brand-mark { width: 28px; height: 28px; }
  .nav-link { font-size: .82rem; padding: 6px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .card-thumb, .card-thumb img, .theme-switch .knob, .theme-switch svg, .vprogress span { transition: none; }
}

/* ---------- About: photos ---------- */
.about-intro { max-width: 1100px; margin: 0 auto; }
.about-intro:not(.has-photo) .prose { margin-inline: auto; }
.about-intro.has-photo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 400px); gap: 48px; align-items: start; }
.about-intro .prose { max-width: 680px; }
.about-intro .prose > :first-child { margin-top: 0; }
.about-h { max-width: 1100px; margin: 0 auto 20px; font-size: 2.1rem; }
.photo-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 14px; overflow: hidden; }
.photo-open img { display: block; width: 100%; height: auto; }
.photo-open:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.about-hero { margin: 4px 0 0; position: sticky; top: 84px; }
.about-hero .photo-open { box-shadow: var(--shadow-pop); background: var(--soft); }
/* Cropped to a portrait frame; "focus" in gallery.json moves the crop (default: centre, upper third). */
.about-hero img { aspect-ratio: 4 / 5; height: auto; object-fit: cover; object-position: var(--focus, 50% 30%); }
.about-hero figcaption { margin-top: 12px; text-align: center; font-weight: 600; color: var(--ink); }
@media (max-width: 860px) {
  .about-intro.has-photo { grid-template-columns: 1fr; gap: 20px; }
  .about-hero { order: -1; position: static; margin: 0 0 4px; }
  .about-hero img { aspect-ratio: 4 / 3; }
}
.about figcaption { font-size: .92rem; line-height: 1.4; }
.memories { max-width: 1100px; margin: 40px auto 8px; padding-top: 28px; border-top: 1px solid var(--line); }
.memories h2 { margin: 0 0 18px; }
.memory-grid { list-style: none; margin: 0; padding: 0; columns: 3 260px; column-gap: 20px; }
.memory-grid li { break-inside: avoid; margin-bottom: 22px; }
.memory { margin: 0; }
.memory .photo-open { background: var(--soft); border: 1px solid var(--line); transition: box-shadow .15s ease, transform .15s ease; }
.memory .photo-open:hover { box-shadow: var(--shadow-pop); transform: translateY(-2px); }
.memory figcaption { margin-top: 8px; color: var(--muted); }
.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0b0d0f; color: #fff; }
.lightbox::backdrop { background: rgba(8, 10, 12, .6); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox figure { margin: 0; width: 100%; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; padding: 56px 64px 20px; gap: 14px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox figcaption { text-align: center; max-width: 820px; font-size: 1rem; color: #e8eaec; }
.lb-btn { position: absolute; border: 0; background: rgba(255, 255, 255, .12); color: #fff; width: 48px; height: 48px; border-radius: 50%; font: 600 1.6rem/1 var(--font); cursor: pointer; display: grid; place-items: center; }
.lb-btn:hover { background: rgba(255, 255, 255, .24); }
.lb-close { top: 12px; right: 12px; font-size: 1.1rem; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) {
  .lightbox figure { padding: 64px 8px 76px; }
  .lb-prev, .lb-next { top: auto; bottom: 12px; transform: none; }
  .memory-grid { columns: 2 150px; column-gap: 12px; }
  .memory-grid li { margin-bottom: 16px; }
  .about figcaption { font-size: .85rem; }
}

/* ---------- Manage: About photos ---------- */
.photo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.photo-row { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.photo-row.is-main { border-color: var(--accent); background: var(--accent-soft); }
.photo-row > img, .photo-row > .manage-ph { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; background: var(--chip); }
.photo-row > .manage-ph { display: grid; place-items: center; font-size: .75rem; }
.photo-fields { display: grid; gap: 8px; min-width: 0; }
.photo-fields textarea { width: 100%; font: .92rem/1.4 var(--font); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); resize: vertical; }
.photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.photo-actions .check { margin-right: auto; font-weight: 600; font-size: .88rem; white-space: nowrap; display: flex; grid-auto-flow: column; gap: 6px; }
@media (max-width: 520px) { .photo-row { grid-template-columns: 1fr; } .photo-row > img, .photo-row > .manage-ph { width: 100%; height: 160px; } }
