:root[data-theme="paper"] {
  --bg: #F6F4F0; --bg-elevated: #EFECE6; --ink: #121212; --ink-muted: #5A5751;
  --accent: #8B261D; --rule: #D6D1C7; --rule-strong: #121212; --card-hover: #EAE6DF;
}
:root[data-theme="ink"] {
  --bg: #0E0E0E; --bg-elevated: #161616; --ink: #EAE6DF; --ink-muted: #949087;
  --accent: #D45B4E; --rule: #2A2927; --rule-strong: #EAE6DF; --card-hover: #1B1B1B;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { background-color: var(--bg); color: var(--ink); font-family: 'Newsreader', Georgia, serif; line-height: 1.65; transition: background-color 0.25s ease, color 0.25s ease; -webkit-font-smoothing: antialiased; overflow-x: hidden; }

*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip-link:focus-visible { position: fixed; top: 16px; left: 16px; width: auto; height: auto; clip: auto; z-index: 1000; background: var(--accent); color: #FFF; padding: 12px 24px; text-decoration: none; border-radius: 4px; }
a.action-reset { text-decoration: none; color: inherit; display: block; }
button.action-reset { background: none; border: none; font: inherit; color: inherit; text-align: left; cursor: pointer; display: block; width: 100%; padding: 0; }

.container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
h1, h2, h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; line-height: 1.12; letter-spacing: -0.02em; }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 0.74rem; letter-spacing: 0.04em; text-transform: uppercase; }
.urdu-script { font-family: 'Noto Nastaliq Urdu', serif; font-size: 1.5rem; line-height: 2.3; direction: rtl; white-space: pre-line; }

.tag-chip { display: inline-block; font-size: 0.65rem; border: 1px solid var(--rule-strong); padding: 2px 8px; border-radius: 99px; cursor: pointer; color: var(--ink); margin-right: 6px; margin-bottom: 6px; text-decoration: none; transition: background 0.15s; }
.tag-chip:hover { background: var(--ink); color: var(--bg); }

.telemetry-bar { border-bottom: 1px solid var(--rule); padding: 10px 0; display: flex; justify-content: space-between; align-items: center; color: var(--ink-muted); }
.theme-btn { background: transparent; border: 1px solid var(--rule-strong); color: var(--ink); padding: 6px 12px; cursor: pointer; transition: all 0.15s ease; min-height: 34px; text-decoration: none; display: inline-flex; align-items: center; }
.theme-btn:hover { background: var(--ink); color: var(--bg); }

.now-strip { display: flex; flex-wrap: wrap; gap: 12px 24px; padding: 14px 0; border-bottom: 1px solid var(--rule-strong); font-size: 0.7rem; color: var(--ink-muted); align-items: center; justify-content: space-between; }
.now-strip-items { display: flex; flex-wrap: wrap; gap: 12px 24px; flex: 1; }
.now-item span { color: var(--ink); font-weight: 500; margin-left: 4px; }

#search-palette { margin: auto; padding: 0; border: none; background: transparent; max-width: 600px; width: 100%; border-radius: 12px; }
#search-palette::backdrop { background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.sp-container { background: var(--bg); border: 1px solid var(--rule-strong); border-radius: 12px; display: flex; flex-direction: column; max-height: 80vh; overflow: hidden; box-shadow: 0 24px 48px rgba(0,0,0,0.2); }
.sp-input-wrap { padding: 16px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; }
.sp-input-wrap input { flex: 1; border: none; background: transparent; font-size: 1.2rem; color: var(--ink); outline: none; font-family: inherit; }
.sp-results { padding: 12px; overflow-y: auto; flex: 1; }
.sp-result-item { display: block; padding: 12px; border-radius: 6px; text-decoration: none; color: inherit; cursor: pointer; transition: background 0.1s; }
.sp-result-item:hover, .sp-result-item:focus-visible { background: var(--bg-elevated); outline: none; }
.sp-result-meta { font-size: 0.7rem; color: var(--accent); margin-bottom: 4px; }

.masthead { padding: 28px 0; border-bottom: 2px solid var(--rule-strong); display: flex; justify-content: space-between; align-items: flex-end; }
.masthead-title { font-size: clamp(2.6rem, 6vw, 4.75rem); font-weight: 700; line-height: 0.95; }

.nav-bar-wrapper { position: sticky; top: 0; z-index: 30; background: var(--bg); }
.nav-bar { border-bottom: 1px solid var(--rule-strong); display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.nav-bar::-webkit-scrollbar { display: none; }
.nav-tab { background: none; border: none; border-right: 1px solid var(--rule); padding: 14px 20px; color: var(--ink-muted); cursor: pointer; white-space: nowrap; transition: all 0.15s ease; flex-shrink: 0; text-decoration: none; }
.nav-tab:hover, .nav-tab:focus-visible { color: var(--ink); background: var(--card-hover); }
.nav-tab.active { color: var(--bg); background: var(--ink); font-weight: 500; }

.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-elevated); border-top: 2px solid var(--rule-strong); z-index: 50; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom, 0px); }
.mobile-nav a, .mobile-nav button { background: none; border: none; color: var(--ink-muted); padding: 12px 8px; min-height: 56px; flex: 1; text-align: center; text-decoration: none; display: flex; flex-direction: column; justify-content: center; align-items: center; font-size: 0.65rem; }
.mobile-nav .active { color: var(--accent); font-weight: bold; }
.mobile-sheet { margin: auto 0 0 0; width: 100%; border: none; border-top: 2px solid var(--rule-strong); background: var(--bg); color: var(--ink); padding: 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); border-radius: 16px 16px 0 0; max-width: 100%; }
.mobile-sheet::backdrop { background: rgba(0,0,0,0.7); }
.mobile-sheet a, .mobile-sheet button { display: block; width: 100%; text-align: left; padding: 16px 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-size: 1.1rem; background: none; cursor: pointer; }

.bento-grid { display: grid; grid-template-columns: repeat(12, 1fr); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule-strong); }
.bento-cell { padding: 28px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; justify-content: space-between; }
.col-7 { grid-column: span 7; } .col-5 { grid-column: span 5; } .col-4 { grid-column: span 4; } .col-12 { grid-column: span 12; }

.kicker { color: var(--accent); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pin-badge { background: var(--accent); color: #FFF; padding: 2px 7px; font-size: 0.68rem; letter-spacing: 0.06em; }
.action-link { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ink); padding-bottom: 3px; cursor: pointer; }
.action-link:hover, .action-link:focus-visible { color: var(--accent); border-color: var(--accent); }

.section-header { padding: 28px 0 14px; border-bottom: 1px solid var(--rule-strong); display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.section-view { display: none; padding-bottom: 64px; }
.section-view.active { display: block; }

.writing-row { padding: 24px 14px; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 180px 1fr auto; gap: 20px; align-items: baseline; transition: background 0.15s; }
.writing-row:hover, .writing-row:focus-visible { background: var(--card-hover); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 22px; padding: 24px 0; }
.photo-card { border: 1px solid var(--rule); background: var(--bg-elevated); padding: 14px; cursor: zoom-in; }
.photo-card img { width: 100%; height: 240px; object-fit: cover; filter: grayscale(100%) contrast(1.08); transition: filter 0.3s; margin-bottom: 12px; }
.photo-card.color-mode img { filter: grayscale(0%) contrast(1); }

#frames-lightbox { margin: auto; padding: 0; background: var(--bg); border: none; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; display: none; flex-direction: column; }
#frames-lightbox[open] { display: flex; }
.lb-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--rule); }
.lb-content { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; touch-action: none; background: #0E0E0E; }
#lb-img { max-width: 100%; max-height: 100%; object-fit: contain; transition: filter 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s; transform-origin: center; }
.lb-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.5); color: #FFF; border: 1px solid rgba(255,255,255,0.2); width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; font-size: 1.2rem; }
.lb-btn:hover { background: rgba(0,0,0,0.8); }
#lb-prev { left: 20px; } #lb-prev::before { content: "←"; }
#lb-next { right: 20px; } #lb-next::before { content: "→"; }

.shelf-filter-wrap { padding: 20px 0 14px; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 12px; }
.shelf-filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cat-btn { background: transparent; border: 1px solid var(--ink); color: var(--ink); padding: 10px 24px; font-size: 0.95rem; cursor: pointer; }
.cat-btn.active { background: var(--ink); color: var(--bg); }
.pill-btn { background: transparent; border: 1px solid var(--rule); color: var(--ink-muted); padding: 7px 14px; cursor: pointer; text-decoration: none; display: inline-block; }
.pill-btn.active { border-color: var(--rule-strong); color: var(--ink); background: var(--bg-elevated); }

.shelf-controls { display: flex; gap: 12px; padding: 20px 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.shelf-controls input, .shelf-controls select { padding: 10px 14px; border: 1px solid var(--rule-strong); background: var(--bg); color: var(--ink); font-family: inherit; font-size: 0.9rem; flex: 1; min-width: min(100%, 200px); border-radius: 4px; }
.shelf-stats { display: flex; gap: 24px; padding: 12px 0; color: var(--ink-muted); border-bottom: 1px solid var(--rule); align-items: center; overflow-x: auto; white-space: nowrap; }

.shelf-grid { display: grid; gap: 20px; padding: 24px 0; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.shelf-grid.books-view { grid-template-columns: minmax(0, 1fr); gap: 8px; }

.book-spine { background: var(--bg-elevated); border: 1px solid var(--rule-strong); border-left: 8px solid var(--accent); border-radius: 2px 6px 6px 2px; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; transition: transform 0.2s, background 0.15s; }
.book-spine:hover { background: var(--card-hover); transform: translateX(6px); }
.book-spine .title { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 1.35rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.book-spine .meta { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: var(--ink-muted); white-space: nowrap; flex-shrink: 0; }

.film-ticket { border: 2px dashed var(--rule); background: radial-gradient(circle at 0 50%, transparent 10px, var(--bg-elevated) 11px), radial-gradient(circle at 100% 50%, transparent 10px, var(--bg-elevated) 11px); background-position: top left, top right; background-repeat: no-repeat; padding: 20px 24px; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; transition: filter 0.2s; content-visibility: auto; contain-intrinsic-size: 180px; }
.film-ticket:hover { filter: brightness(0.95); }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.72); z-index: 100; display: none; justify-content: flex-end; }
.drawer-backdrop.open { display: flex; }
.drawer-panel { background: var(--bg); color: var(--ink); width: min(820px, 100vw); height: 100dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; border-left: 2px solid var(--rule-strong); position: relative; }

.drawer-topbar { position: sticky; top: 0; background: var(--bg); border-bottom: 1px solid var(--rule); z-index: 10; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; }
.drawer-progress-container { position: absolute; bottom: -2px; left: 0; width: 100%; height: 2px; background: var(--rule); }
.drawer-progress-bar { height: 100%; background: var(--accent); width: 0%; transition: width 0.1s; }
.drawer-controls { display: flex; gap: 8px; }

.drawer-content-wrap { padding: 24px clamp(20px, 5vw, 60px) 64px; }
.drawer-content { font-size: 16px; transition: font-size 0.2s; }
.drawer-content p { line-height: 1.82; margin-bottom: 1.35em; }
.drawer-content h4 { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.5em; font-style: italic; margin: 1.8em 0 0.8em; color: var(--accent); }
.drawer-content blockquote { border-left: 2px solid var(--accent); padding-left: 18px; font-style: italic; color: var(--ink-muted); margin: 1.4em 0; }

.deck { border: 2px solid var(--rule-strong); background: var(--bg-elevated); padding: 20px; margin-bottom: 40px; display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 24px; }
.deck-frame iframe { width: 100%; height: 450px; border: none; display: block; background: transparent; }
.tape-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 28px 24px; }
.tape { background: var(--bg-elevated); border: 1px solid var(--rule-strong); border-top: 6px solid var(--accent); border-radius: 10px; padding: 12px 14px 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; transition: transform .2s; }
.tape:hover { transform: translateY(-6px); }
.tape-label { background: var(--bg); border: 1px solid var(--rule); border-radius: 4px; padding: 12px; display: flex; flex-direction: column; flex: 1; background-image: repeating-linear-gradient(transparent 0 23px, var(--rule) 23px 24px); background-position: 0 6px; }
.tape-title { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 1.35rem; line-height: 1.15; background: var(--bg); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tape-window { display: flex; align-items: center; justify-content: space-between; background: var(--bg); border: 1px solid var(--rule-strong); border-radius: 999px; padding: 6px 18px; }
.reel { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--ink); background: conic-gradient(var(--ink) 0 12%, transparent 12% 33%, var(--ink) 33% 45%, transparent 45% 66%, var(--ink) 66% 78%, transparent 78%); -webkit-mask: radial-gradient(circle, transparent 0 4px, #000 4.5px); mask: radial-gradient(circle, transparent 0 4px, #000 4.5px); }
.tape-strip { flex: 1; height: 2px; margin: 0 10px; background: var(--rule-strong); opacity: .5; }

.replay-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 340px)); gap: 28px; }
.replay-card { background: none; border: none; padding: 0; cursor: zoom-in; text-align: left; color: inherit; font: inherit; }
.replay-card img { width: 100%; display: block; border-radius: 14px; border: 1px solid var(--rule); box-shadow: 0 12px 30px rgba(0,0,0,.15); transition: transform .3s ease; }
.replay-card:hover img { transform: scale(1.02); }
dialog.lightbox-replay { border: none; background: transparent; max-width: 92vw; max-height: 92vh; padding: 0; margin: auto; }
dialog.lightbox-replay::backdrop { background: rgba(0,0,0,.8); }
dialog.lightbox-replay img { max-width: 92vw; max-height: 90vh; display: block; border-radius: 14px; }

.verse-controls { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; align-items: center; font-size: 0.85rem; }
.verse-card { border: 1px solid var(--rule); padding: 22px; background: var(--bg); display: flex; flex-direction: column; justify-content: space-between; position: relative; content-visibility: auto; contain-intrinsic-size: 200px;}
.verse-share-btn { position: absolute; top: 16px; right: 16px; font-size: 1.2rem; cursor: pointer; background: transparent; border: none; color: var(--ink-muted); }
.verse-share-btn:hover { color: var(--accent); }

.proj-card { border: 1px solid var(--rule); padding: 28px; background: var(--bg-elevated); display: flex; flex-direction: column; height: 100%; border-radius: 8px; transition: transform 0.2s, background 0.15s; }
.proj-card:hover { transform: translateY(-4px); background: var(--card-hover); }
.proj-body { display: flex; flex-direction: column; flex: 1; }


/* ---------- Additions (previously unstyled classes + shared components) ---------- */
footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 28px 0 36px; border-top: 2px solid var(--rule-strong); color: var(--ink-muted); }
.filter-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 18px 0 6px; }
.kicker.flush { margin: 0; }
.pin-badge.live { background: #10B981; }
.page { padding-bottom: 64px; }
.mono-muted { color: var(--ink-muted); }
.accent { color: var(--accent); }

.telemetry-left { display: flex; align-items: center; gap: 12px; }
.masthead-kicker { color: var(--accent); margin-bottom: 6px; }
.now-clock { font-weight: 600; color: var(--accent); }

/* Home bento */
.lead-title { font-size: clamp(2rem, 3.6vw, 3.1rem); margin-bottom: 14px; }
.lead-excerpt { font-size: 1.1rem; color: var(--ink-muted); margin-bottom: 18px; }
.mini-dispatch-list { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mini-dispatch-card { padding: 14px; border: 1px solid var(--rule); background: var(--bg-elevated); transition: background .15s; }
.mini-dispatch-card:hover { background: var(--card-hover); }
.mini-dispatch-card h4 { font-family: 'Cormorant Garamond', serif; font-size: 1.35rem; margin-bottom: 4px; line-height: 1.15; }
.mini-dispatch-card p { font-size: .92rem; color: var(--ink-muted); }
.frame-thumb { width: 100%; height: 230px; object-fit: cover; filter: grayscale(100%); margin-bottom: 12px; background: var(--bg-elevated); }
.bento-actions { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tape-mini { margin-top: 14px; background: var(--bg-elevated); border: 1px solid var(--rule-strong); border-top: 6px solid var(--accent); border-radius: 10px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.tape-mini-label { background: var(--bg); border: 1px solid var(--rule); border-radius: 4px; padding: 12px; min-height: 80px; font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; font-size: 1.35rem; line-height: 1.15; overflow-wrap: anywhere; }
.pick-label { color: var(--ink-muted); }
.pick-value { font-size: 1.1rem; font-weight: 500; margin-bottom: 14px; overflow-wrap: anywhere; }
.proj-mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 32px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 20px; padding: 24px 0; }

/* Writings */
.writing-row h3 { font-size: 1.6rem; margin-bottom: 4px; }
.writing-row p { color: var(--ink-muted); font-style: italic; }

/* Tape deck */
.deck-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.deck-info h3 { font-size: 2rem; line-height: 1; overflow-wrap: anywhere; }
.deck-btn { background: transparent; border: 1px solid var(--rule-strong); color: var(--ink); padding: 8px 14px; min-height: 40px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; width: auto; }
.deck-btn:hover { background: var(--ink); color: var(--bg); }
.deck-empty { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.deck-frame { min-width: 0; }
.tape { text-decoration: none; color: inherit; }
.tape-top { display: flex; justify-content: space-between; color: var(--ink-muted); font-size: .65rem; }
.tape-note { font-size: .8rem; color: var(--ink-muted); margin-top: 6px; }
.tape.is-loaded { background: var(--card-hover); box-shadow: inset 0 0 0 2px var(--accent); }
.tape-label { min-height: 72px; }

/* Shelf / notebook */
.shelf-controls select { cursor: pointer; }
.verse-card .urdu-script { overflow-wrap: anywhere; }
.verse-poet-select { margin-left: auto; padding: 6px 8px; background: transparent; border: 1px solid var(--rule); color: var(--ink); font-family: inherit; max-width: 100%; }
.verse-controls label { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }

/* Drawer */
.drawer-topbar { gap: 8px; flex-wrap: wrap; }
.drawer-title { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 6px; outline: none; }
.drawer-subtitle { font-style: italic; font-size: 1.18rem; color: var(--ink-muted); margin-bottom: 12px; }
.drawer-tags { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.lb-btn-text { color: #FFF; border-color: rgba(255,255,255,.3); }
#lb-img { max-width: 100%; max-height: 100%; }

/* ---------- Tablet ---------- */
@media (max-width: 1000px) {
  .col-7, .col-5 { grid-column: span 12; }
  .col-4 { grid-column: span 6; }
  .col-4.tablet-full { grid-column: span 12; }
  .writing-row { grid-template-columns: 140px 1fr auto; }
}

/* ---------- Phone ---------- */
@media (max-width: 680px) {
  html { scroll-padding-top: 8px; }
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .container { padding: 0 16px; }
  .nav-bar-wrapper { display: none; }
  .mobile-nav { display: flex; }
  .mobile-nav a, .mobile-nav button { min-height: 56px; letter-spacing: .02em; font-size: .62rem; }

  .telemetry-bar { padding: 8px 0; gap: 8px; }
  .telemetry-loc .coords { display: none; }
  .theme-btn { min-height: 40px; padding: 6px 12px; }

  .masthead { padding: 20px 0; }
  .masthead-title { font-size: clamp(2.3rem, 12vw, 3.2rem); }
  .masthead-kicker { font-size: .66rem; line-height: 1.4; }

  .now-strip { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 10px 0; }
  .now-strip-items { gap: 4px 14px; }
  .now-item { white-space: normal; }

  /* Bento: one clean column on phones (this was the main layout bug) */
  .bento-grid { grid-template-columns: minmax(0, 1fr); border-left: none; border-right: none; }
  .bento-cell, .col-7, .col-5, .col-4, .col-12 { grid-column: 1 / -1; padding: 22px 0; border-right: none; }
  .mini-dispatch-list { grid-template-columns: minmax(0, 1fr); }
  .frame-thumb { height: 210px; }
  .lead-title { font-size: 2rem; }
  .urdu-script { font-size: 1.35rem; line-height: 2.2; }

  .section-header { padding: 22px 0 12px; }
  .section-header h1, .section-header h2 { font-size: 1.9rem !important; }
  .writing-row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 20px 4px; }
  .writing-row .mono:last-child { justify-self: start; }

  .deck { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .deck-frame iframe { height: 380px; }
  .tape-shelf { gap: 20px 16px; }
  .replay-row { grid-template-columns: 1fr 1fr; gap: 14px; }

  .photo-card img { height: 220px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  #frames-filters { flex-wrap: nowrap !important; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  #frames-filters::-webkit-scrollbar { display: none; }
  #frames-filters .pill-btn { white-space: nowrap; flex-shrink: 0; }
  .lb-header { padding: 12px 14px; }
  .lb-btn { width: 40px; height: 40px; }
  #lb-prev { left: 8px; } #lb-next { right: 8px; }

  .cat-btn { flex: 1; padding: 12px 10px; font-size: .85rem; }
  .shelf-filter-row .pill-btn { padding: 9px 12px; }
  .shelf-controls { gap: 8px; padding: 14px 0; }
  .shelf-controls input, .shelf-controls select { flex: 1 1 100%; font-size: 16px; min-height: 44px; }
  .shelf-grid, .shelf-grid.books-view { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 16px 0; }
  .shelf-grid.books-view { gap: 8px; padding-top: 16px; }
  .book-spine { padding: 13px 14px; gap: 10px; }
  .book-spine:hover { transform: none; }
  .book-spine .title { font-size: 1.15rem; }
  .book-spine .meta { font-size: .72rem; }
  .film-ticket { padding: 18px 18px; }

  .verse-controls { gap: 10px 16px; font-size: .78rem; }
  .verse-poet-select { margin-left: 0; width: 100%; min-height: 40px; font-size: 16px; }
  .verse-card { padding: 20px 16px; }
  .verse-share-btn { top: 8px; right: 8px; width: 44px; height: 44px; }
  .proj-grid { gap: 14px; }
  .proj-card { padding: 22px 18px; }

  .drawer-panel { width: 100vw; border-left: none; }
  .drawer-topbar { padding: 10px 12px; }
  .drawer-topbar .theme-btn { padding: 6px 10px; }
  .drawer-content-wrap { padding: 20px 18px 56px; }

  #search-palette { max-width: 100vw; height: 100vh; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .sp-container { max-height: 100dvh; height: 100%; border-radius: 0; border: none; }
  .sp-input-wrap input { font-size: 16px; }
  footer { padding-bottom: 28px; }
}

@media (max-width: 360px) {
  .replay-row { grid-template-columns: 1fr; }
  .mobile-nav a, .mobile-nav button { font-size: .56rem; padding: 12px 2px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Book spine: title takes the free space and truncates; rating stays pinned right */
.book-spine .title { flex: 1; min-width: 0; }

/* Verse cards: keep the share button clear of the Urdu text */
.verse-card { padding-top: 52px; }
@media (max-width: 680px) { .verse-card { padding-top: 48px; } .verse-card .urdu-script { font-size: 1.25rem; } }

/* Shelf: spines can always shrink; stats line wraps instead of clipping */
.book-spine { min-width: 0; max-width: 100%; }
.shelf-stats { flex-wrap: wrap; white-space: normal; gap: 4px 18px; overflow: visible; }
/* Mixtapes: scroll target for the deck */
#deck-anchor { scroll-margin-top: 12px; }

/* a.action-reset sets display:block and out-ranks single-class rules: restore real layouts */
a.book-spine { display: flex; }
a.deck-btn { display: inline-flex; }

@media (max-width: 680px) {
  /* column + wrap would size the filter row to its full content width */
  .filter-bar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  #frames-filters { min-width: 0; max-width: 100%; }
}


/* Photo viewer on phones: caption gets its own row, buttons below */
.photo-card img:last-child { margin-bottom: 0; }
#frames-lightbox :focus:not(:focus-visible) { outline: none; }
@media (max-width: 680px) {
  .lb-header { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
  .lb-header > div:first-child { flex: 1 1 100%; font-size: .68rem; overflow-wrap: anywhere; }
  .lb-header > div:last-child { width: 100%; justify-content: flex-end; }
}

/* essay media (editor images) */
#drawer-body img { max-width: 100%; height: auto; display: block; margin: 1.4em auto; }
#drawer-body figure { margin: 1.6em 0; }
#drawer-body figcaption { text-align: center; font-size: .85rem; color: var(--ink-muted); }
#drawer-body hr { border: 0; border-top: 1px solid var(--rule-strong); width: 40%; margin: 2em auto; }


/* ---------- nameplate header (small name + inline nav; the page title is the hero) ---------- */
:root { --np-h: 64px; }
.nameplate { position: sticky; top: 0; z-index: 30; background: var(--bg); display: flex; align-items: center; gap: 12px 28px; min-height: var(--np-h); padding: 8px 0; border-bottom: 1px solid var(--rule-strong); }
.np-name { display: inline-flex; align-items: baseline; gap: 14px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.np-latin { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.7rem; font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.np-urdu { font-family: 'Noto Nastaliq Urdu', serif; font-size: 1.05rem; color: var(--accent); line-height: 1.9; }
.np-nav { display: flex; gap: 4px; margin-right: auto; }
.np-nav .nav-tab { border: 0; padding: 8px 14px; }
.np-tools { display: flex; gap: 8px; }
.np-tag { letter-spacing: .06em; }
.section-header { padding-top: 44px; }
.section-header h1 { font-size: clamp(2.8rem, 6vw, 4.5rem) !important; line-height: .95; }
@media (max-width: 720px) {
  :root { --np-h: 0px; }
  .nameplate { position: static; justify-content: space-between; padding: 10px 0; }
  .np-nav { display: none; }
  .np-latin { font-size: 1.45rem; }
  .np-tools .theme-btn { padding: 4px 8px; min-height: 34px; font-size: .62rem; white-space: nowrap; }
  .np-tools { gap: 6px; }
  .np-name { gap: 8px; }
  .section-header { padding-top: 28px; }
  .section-header h1 { font-size: clamp(2.4rem, 11vw, 3rem) !important; }
  .np-tag { white-space: normal; }
}
.np-sep { flex: none; align-self: center; width: 1px; height: 1.6rem; margin: 0 2px; background: var(--ink-muted); opacity: .5; font-size: 0; color: transparent; overflow: hidden; }
@media (max-width: 720px) { .np-sep { height: 1.3rem; } }
