/* ==========================================================================
   Article Hub — Halftone Design Language & Global Continuity Motion System
   Palette & Glass: Halftone Aurora (Light / Dark)
   Surfaces: 1%–3% tonal layering, no harsh borders; tabular numerals; lighter
   font weight in dark mode.
   Motion: cubic-bezier(.32,.72,0,1) glide, Halftone spring & reveal curves,
   View Transitions card continuity, FLIP reflow, full reduced-motion support.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("/fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Light — Halftone Aurora */
  --ht-bg: #F6F6FA;
  --ht-surface-1: rgba(255, 255, 255, 0.72);
  --ht-surface-2: rgba(255, 255, 255, 0.88);
  --ht-surface-hover: rgba(255, 255, 255, 0.98);
  --ht-surface-recessed: rgba(11, 20, 48, 0.045);
  --ht-surface-recessed-hi: rgba(11, 20, 48, 0.075);
  --ht-surface-tint: rgba(11, 20, 48, 0.028);

  --ht-ink: #0B1430;
  --ht-ink-2: #454C69;
  --ht-ink-3: #68708A;

  --ht-accent: #007AFF;
  --ht-accent-strong: #0060DF;
  --ht-accent-soft: rgba(0, 122, 255, 0.11);
  --ht-violet: #6A4FE0;
  --ht-violet-soft: rgba(106, 79, 224, 0.11);
  --ht-rose: #E11D48;
  --ht-rose-soft: rgba(225, 29, 72, 0.10);
  --ht-gold: #B45309;
  --ht-gold-soft: rgba(217, 119, 6, 0.12);
  --ht-mint: #0D9488;
  --ht-mint-soft: rgba(13, 148, 136, 0.11);

  --ht-thumb-bg: #FFFFFF;
  --ht-thumb-shadow: 0 2px 8px rgba(11, 20, 48, 0.10), 0 0.5px 1px rgba(11, 20, 48, 0.06);
  --ht-card-shadow: 0 10px 30px -22px rgba(45, 30, 90, 0.22), 0 1px 2px rgba(11, 20, 48, 0.035);
  --ht-card-shadow-hover: 0 18px 40px -22px rgba(45, 30, 90, 0.28), 0 2px 6px rgba(11, 20, 48, 0.045);
  --ht-panel-shadow: 0 14px 36px -24px rgba(40, 28, 78, 0.20), 0 1px 2px rgba(11, 20, 48, 0.03);
  --ht-modal-shadow: 0 28px 64px -20px rgba(11, 20, 48, 0.28), 0 2px 8px rgba(11, 20, 48, 0.06);
  --ht-spot-fill: rgba(0, 122, 255, 0.045);
  --ht-spot-ring: rgba(106, 79, 224, 0.22);

  /* Typography — light weights */
  --ht-sans: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --ht-w-reg: 400;
  --ht-w-med: 500;
  --ht-w-semi: 600;
  --ht-w-bold: 680;

  /* Radii — continuous Apple/Halftone geometry */
  --ht-r-card: 22px;
  --ht-r-panel: 20px;
  --ht-r-inner: 14px;
  --ht-r-pill: 999px;

  /* Motion — Halftone + Global Continuity Standard */
  --ht-glide: cubic-bezier(0.32, 0.72, 0, 1);
  --ht-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ht-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ht-ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Desktop durations (2/3 of mobile) */
  --ht-dur-expand: 320ms;
  --ht-dur-panel: 260ms;
  --ht-dur-pill: 290ms;
  --ht-dur-fade: 180ms;
}

:root[data-theme="dark"] {
  /* Dark — Halftone Dark Aurora (1%–3% tonal layering, lighter text weights) */
  --ht-bg: #08060D;
  --ht-surface-1: rgba(255, 255, 255, 0.036);
  --ht-surface-2: rgba(255, 255, 255, 0.056);
  --ht-surface-hover: rgba(255, 255, 255, 0.082);
  --ht-surface-recessed: rgba(255, 255, 255, 0.062);
  --ht-surface-recessed-hi: rgba(255, 255, 255, 0.098);
  --ht-surface-tint: rgba(255, 255, 255, 0.034);

  --ht-ink: #F2F4FF;
  --ht-ink-2: rgba(235, 239, 255, 0.72);
  --ht-ink-3: rgba(220, 226, 255, 0.48);

  --ht-accent: #3B9BFF;
  --ht-accent-strong: #68B2FF;
  --ht-accent-soft: rgba(59, 155, 255, 0.16);
  --ht-violet: #C9B8FF;
  --ht-violet-soft: rgba(201, 184, 255, 0.14);
  --ht-rose: #FB7185;
  --ht-rose-soft: rgba(251, 113, 133, 0.15);
  --ht-gold: #FBBF24;
  --ht-gold-soft: rgba(251, 191, 36, 0.15);
  --ht-mint: #5EEAD4;
  --ht-mint-soft: rgba(94, 234, 212, 0.14);

  --ht-thumb-bg: rgba(255, 255, 255, 0.14);
  --ht-thumb-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  --ht-card-shadow: 0 14px 36px -22px rgba(0, 0, 0, 0.65);
  --ht-card-shadow-hover: 0 20px 44px -20px rgba(0, 0, 0, 0.78);
  --ht-panel-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.65);
  --ht-modal-shadow: 0 32px 72px -18px rgba(0, 0, 0, 0.85);
  --ht-spot-fill: rgba(201, 184, 255, 0.075);
  --ht-spot-ring: rgba(214, 200, 255, 0.36);

  /* Dark mode font weights one step lighter */
  --ht-w-reg: 380;
  --ht-w-med: 450;
  --ht-w-semi: 520;
  --ht-w-bold: 600;
}

@media (max-width: 820px) {
  :root {
    --ht-dur-expand: 480ms;
    --ht-dur-panel: 380ms;
    --ht-dur-pill: 420ms;
  }
}

* { box-sizing: border-box; }
html {
  background: var(--ht-bg);
  color: var(--ht-ink);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  color: var(--ht-ink);
  font-family: var(--ht-sans);
  font-weight: var(--ht-w-reg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--ht-accent-strong); text-underline-offset: 0.2em; }
.hidden { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2.5px solid var(--ht-accent);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ==========================================================================
   Halftone Ambient Aurora Canvas
   ========================================================================== */
.aurora-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background: linear-gradient(180deg, #F3EBFF 0%, #FAF1F7 18%, #FBF7F5 36%, var(--ht-bg) 62%);
  transition: opacity 450ms var(--ht-ease);
}
:root[data-theme="dark"] .aurora-canvas {
  background: radial-gradient(ellipse 100% 55% at 50% -10%, rgba(76, 36, 168, 0.28), transparent 72%), #08060D;
}
.aurora-canvas .orb {
  position: absolute;
  width: 58vmax;
  height: 58vmax;
  border-radius: 50%;
  will-change: transform;
  opacity: 0.72;
}
.aurora-canvas .o1 {
  left: -18vmax;
  top: -32vmax;
  background: radial-gradient(closest-side, #D6BDFA, rgba(214, 189, 250, 0));
  animation: htDrift1 38s ease-in-out infinite alternate;
}
.aurora-canvas .o2 {
  left: 22vmax;
  top: -38vmax;
  background: radial-gradient(closest-side, #FAB8E0, rgba(250, 184, 224, 0));
  animation: htDrift2 44s ease-in-out infinite alternate;
}
.aurora-canvas .o3 {
  right: -20vmax;
  top: -26vmax;
  background: radial-gradient(closest-side, #FFC794, rgba(255, 199, 148, 0));
  animation: htDrift3 34s ease-in-out infinite alternate;
}
:root[data-theme="dark"] .aurora-canvas .o1 {
  background: radial-gradient(closest-side, rgba(88, 44, 196, 0.52), rgba(41, 15, 97, 0));
}
:root[data-theme="dark"] .aurora-canvas .o2 {
  background: radial-gradient(closest-side, rgba(150, 34, 104, 0.40), rgba(71, 13, 51, 0));
}
:root[data-theme="dark"] .aurora-canvas .o3 {
  background: radial-gradient(closest-side, rgba(160, 78, 26, 0.32), rgba(69, 23, 5, 0));
}

.aurora-canvas .halftone-dots {
  position: absolute;
  inset: 0 0 auto;
  height: 360px;
  background: radial-gradient(circle, rgba(0, 122, 255, 0.22) 0 1.4px, transparent 1.7px) 0 0 / 16px 16px;
  opacity: 0.22;
  -webkit-mask: radial-gradient(ellipse 65% 85% at 88% 0%, #000 0, transparent 72%);
  mask: radial-gradient(ellipse 65% 85% at 88% 0%, #000 0, transparent 72%);
}
:root[data-theme="dark"] .aurora-canvas .halftone-dots {
  background: radial-gradient(circle, rgba(201, 184, 255, 0.26) 0 1.3px, transparent 1.6px) 0 0 / 16px 16px;
  opacity: 0.16;
}

@keyframes htDrift1 {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(6vmax, 4vmax, 0) scale(1.08); }
}
@keyframes htDrift2 {
  from { transform: translate3d(0, 0, 0) scale(1.04); }
  to { transform: translate3d(-6vmax, 5vmax, 0) scale(0.95); }
}
@keyframes htDrift3 {
  from { transform: translate3d(0, 0, 0) scale(0.96); }
  to { transform: translate3d(-7vmax, 3.5vmax, 0) scale(1.08); }
}

/* ==========================================================================
   Halftone Micro-Feedback (.press, elastic pop, View Transitions)
   ========================================================================== */
.press {
  transition:
    background-color var(--ht-dur-fade) var(--ht-ease),
    color var(--ht-dur-fade) var(--ht-ease),
    opacity var(--ht-dur-fade) var(--ht-ease),
    scale 420ms var(--ht-spring);
}
.press:active {
  scale: 0.965;
  transition: scale 95ms var(--ht-ease);
}

@keyframes htPop {
  0% { transform: scale(1); }
  32% { transform: scale(0.86); }
  68% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.is-popping {
  animation: htPop 420ms var(--ht-spring);
}

/* View Transitions API — Card <-> Reader Continuity (mode b) */
::view-transition-group(ah-card-surface),
::view-transition-group(ah-card-title) {
  animation-duration: var(--ht-dur-expand);
  animation-timing-function: var(--ht-glide);
}
::view-transition-old(ah-card-surface) {
  animation: htVtFadeOut calc(var(--ht-dur-expand) * 0.35) var(--ht-ease) both;
}
::view-transition-new(ah-card-surface) {
  animation: htVtFadeIn calc(var(--ht-dur-expand) * 0.55) var(--ht-ease) calc(var(--ht-dur-expand) * 0.38) both;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--ht-dur-fade);
  animation-timing-function: var(--ht-ease);
}
@keyframes htVtFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes htVtFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Staggered reveal for newly entering cards (Motion.reveal) */
@keyframes htRevealIn {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}
.reveal-in {
  animation: htRevealIn 420ms var(--ht-out) both;
  animation-delay: var(--stagger, 0ms);
}

/* ==========================================================================
   Login Screen
   ========================================================================== */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  padding: 32px 28px;
  border-radius: 28px;
  background: var(--ht-surface-2);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--ht-modal-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.login-card h1 {
  font-size: 24px;
  font-weight: var(--ht-w-bold);
  letter-spacing: -0.02em;
}
.login-host {
  font-size: 13px;
  color: var(--ht-ink-3);
  margin-top: -6px;
  margin-bottom: 6px;
}
.login-card input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 0;
  background: var(--ht-surface-recessed);
  color: var(--ht-ink);
  font-size: 15px;
  transition: background-color 180ms var(--ht-ease);
}
.login-card input:focus {
  background: var(--ht-surface-recessed-hi);
}
.login-error {
  color: var(--ht-rose);
  font-size: 13px;
}

.btn-primary {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: var(--ht-accent);
  color: #FFFFFF;
  font-weight: var(--ht-w-semi);
  font-size: 14.5px;
  padding: 11px 18px;
  cursor: pointer;
}
.btn-primary:hover {
  background: var(--ht-accent-strong);
}

/* ==========================================================================
   3-Column Shell (AI HOT Structure + Halftone Floating Surfaces)
   ========================================================================== */
.shell {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 316px;
  gap: 20px;
  padding: 18px 20px 64px;
  min-height: 100vh;
  align-items: start;
}

/* Left Rail — frosted floating sidebar */
.left-rail {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px 14px;
  border-radius: var(--ht-r-panel);
  background: var(--ht-surface-1);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--ht-panel-shadow);
  scrollbar-width: none;
}
.left-rail::-webkit-scrollbar { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 14px;
}
.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 22.37%;
  background: linear-gradient(180deg, #1E90FF 0%, #007AFF 62%, #0060DF 100%);
  box-shadow: 0 6px 16px -6px rgba(0, 122, 255, 0.55);
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
}
.brand-mark.lg {
  width: 48px;
  height: 48px;
}
/* Halftone dot-wave glyph inside brand mark */
.brand-mark span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 26% 50%, #fff 0 2.3px, transparent 2.6px),
    radial-gradient(circle at 50% 28%, #fff 0 2.8px, transparent 3.1px),
    radial-gradient(circle at 50% 72%, rgba(255,255,255,.78) 0 2.1px, transparent 2.4px),
    radial-gradient(circle at 74% 50%, #fff 0 2.3px, transparent 2.6px);
}
.brand-name {
  font-weight: var(--ht-w-bold);
  font-size: 16px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.brand-host {
  font-size: 12px;
  color: var(--ht-ink-3);
  letter-spacing: -0.005em;
}

.rail-section {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rail-heading {
  font-size: 11.5px;
  font-weight: var(--ht-w-semi);
  color: var(--ht-ink-3);
  padding: 14px 10px 4px;
  letter-spacing: 0.02em;
}
.rail-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
}
.rail-heading-row .rail-heading {
  padding-top: 4px;
}
.rail-add-btn {
  border: 0;
  background: transparent;
  color: var(--ht-accent);
  font-size: 12.5px;
  font-weight: var(--ht-w-semi);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.rail-add-btn:hover {
  background: var(--ht-accent-soft);
}

/* Shared sliding capsule for primary nav (mode g) */
.rail-primary .nav-thumb {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 36px;
  border-radius: 12px;
  background: var(--ht-thumb-bg);
  box-shadow: var(--ht-thumb-shadow);
  pointer-events: none;
  opacity: 0;
  z-index: 0;
  transition:
    transform var(--ht-dur-pill) var(--ht-glide),
    height var(--ht-dur-pill) var(--ht-glide),
    opacity var(--ht-dur-fade) var(--ht-ease);
}
.rail-primary .nav-thumb.snap {
  transition: opacity var(--ht-dur-fade) var(--ht-ease);
}

.rail-item {
  position: relative;
  z-index: 1;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ht-ink-2);
  padding: 8px 11px;
  border-radius: 12px;
  font-size: 13.8px;
  font-weight: var(--ht-w-med);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rail-item:hover {
  color: var(--ht-ink);
  background: var(--ht-surface-tint);
}
.rail-primary .rail-item.active {
  color: var(--ht-ink);
  font-weight: var(--ht-w-semi);
  background: transparent;
}
.rail-section:not(.rail-primary) .rail-item.active {
  background: var(--ht-accent-soft);
  color: var(--ht-accent-strong);
  font-weight: var(--ht-w-semi);
}
.rail-count {
  font-size: 12px;
  color: var(--ht-ink-3);
  font-weight: var(--ht-w-med);
}
.rail-item.active .rail-count {
  color: var(--ht-accent);
}

.lib-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.lib-row .rail-item {
  flex: 1;
  min-width: 0;
}
.lib-row .rail-item > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-del {
  border: 0;
  background: transparent;
  color: var(--ht-ink-3);
  cursor: pointer;
  padding: 6px 7px;
  border-radius: 8px;
  font-size: 11px;
  opacity: 0;
  transition: opacity 160ms var(--ht-ease), color 160ms var(--ht-ease), background-color 160ms var(--ht-ease);
}
.lib-row:hover .lib-del,
.lib-row:focus-within .lib-del {
  opacity: 1;
}
.lib-del:hover {
  color: var(--ht-rose);
  background: var(--ht-rose-soft);
}
.rail-empty {
  padding: 6px 11px;
  font-size: 12.5px;
  color: var(--ht-ink-3);
}

.rail-footer {
  margin-top: 14px;
  padding-top: 10px;
}

/* Segmented Control (Halftone iOS pill with sliding thumb) */
.theme-seg,
.seg-group,
.audio-seg {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--ht-r-pill);
  background: var(--ht-surface-recessed);
}
.theme-seg {
  width: 100%;
}
.theme-seg button {
  flex: 1;
}
.seg-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: var(--ht-r-pill);
  background: var(--ht-thumb-bg);
  box-shadow: var(--ht-thumb-shadow);
  pointer-events: none;
  z-index: 0;
  transition:
    transform var(--ht-dur-pill) var(--ht-glide),
    width var(--ht-dur-pill) var(--ht-glide);
}
.seg-thumb.snap {
  transition: none;
}
.theme-seg button,
.seg-group .seg,
.audio-seg button {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--ht-ink-2);
  font-size: 12.8px;
  font-weight: var(--ht-w-med);
  padding: 6px 12px;
  border-radius: var(--ht-r-pill);
  cursor: pointer;
  white-space: nowrap;
}
.seg-group.compact .seg {
  padding: 6px 11px;
}
.theme-seg button[aria-pressed="true"],
.seg-group .seg.active,
.audio-seg button.on {
  color: var(--ht-ink);
  font-weight: var(--ht-w-semi);
}

/* ==========================================================================
   Middle Column — Search, Category Pills & Feed Cards
   ========================================================================== */
.main-col {
  min-width: 0;
}

.top-bar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 12px;
  border-radius: var(--ht-r-pill);
  background: var(--ht-surface-1);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--ht-panel-shadow);
}
.search-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}
.search-ico {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  stroke: var(--ht-ink-3);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 8px 34px 8px 36px;
  border-radius: var(--ht-r-pill);
  border: 0;
  background: var(--ht-surface-recessed);
  color: var(--ht-ink);
  font-size: 14px;
  transition: background-color 180ms var(--ht-ease);
}
.search-wrap input::placeholder {
  color: var(--ht-ink-3);
}
.search-wrap input:focus {
  outline: none;
  background: var(--ht-surface-recessed-hi);
}
.search-kbd {
  position: absolute;
  right: 11px;
  font-family: var(--ht-sans);
  font-size: 11px;
  font-weight: var(--ht-w-semi);
  color: var(--ht-ink-3);
  background: var(--ht-surface-2);
  padding: 1px 6px;
  border-radius: 6px;
  pointer-events: none;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.chip-toggle {
  border: 0;
  background: var(--ht-surface-recessed);
  color: var(--ht-ink-2);
  font-size: 12.8px;
  font-weight: var(--ht-w-med);
  padding: 7px 13px;
  border-radius: var(--ht-r-pill);
  cursor: pointer;
}
.chip-toggle:hover {
  color: var(--ht-ink);
  background: var(--ht-surface-recessed-hi);
}
.chip-toggle[aria-pressed="true"] {
  background: var(--ht-accent-soft);
  color: var(--ht-accent-strong);
  font-weight: var(--ht-w-semi);
}

/* Mobile quick nav */
.mobile-nav {
  position: relative;
  display: none;
  padding: 3px;
  margin-bottom: 12px;
  border-radius: var(--ht-r-pill);
  background: var(--ht-surface-recessed);
}
.mobile-nav .pill {
  position: relative;
  z-index: 1;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ht-ink-2);
  padding: 7px 10px;
  border-radius: var(--ht-r-pill);
  font-size: 13px;
  font-weight: var(--ht-w-med);
  cursor: pointer;
}
.mobile-nav .pill.active {
  color: var(--ht-ink);
  font-weight: var(--ht-w-semi);
}

/* Category horizontal pills with shared sliding capsule */
.cat-pills {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: var(--ht-r-pill);
  background: var(--ht-surface-1);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  scrollbar-width: none;
}
.cat-pills::-webkit-scrollbar { display: none; }
.cat-pills .seg-thumb {
  top: 4px;
  bottom: 4px;
}
.cat-pills .pill {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--ht-ink-2);
  padding: 6px 13px;
  border-radius: var(--ht-r-pill);
  font-size: 13px;
  font-weight: var(--ht-w-med);
  cursor: pointer;
}
.cat-pills .pill:hover {
  color: var(--ht-ink);
}
.cat-pills .pill.active {
  color: var(--ht-ink);
  font-weight: var(--ht-w-semi);
}

.view-banner {
  padding: 16px 20px;
  margin-bottom: 16px;
  border-radius: var(--ht-r-panel);
  background: var(--ht-surface-2);
  box-shadow: var(--ht-card-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.view-banner h2 {
  font-size: 17px;
  font-weight: var(--ht-w-bold);
  letter-spacing: -0.015em;
}
.view-banner p {
  font-size: 13px;
  color: var(--ht-ink-3);
  margin-top: 2px;
}

/* Date groups & Article Cards (Halftone borderless tonal cards + Spotlight) */
.date-group {
  margin-bottom: 24px;
}
.date-heading {
  font-size: 12.5px;
  font-weight: var(--ht-w-semi);
  color: var(--ht-ink-3);
  padding: 4px 8px 10px;
  letter-spacing: 0.01em;
}
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-row {
  position: relative;
  isolation: isolate;
  padding: 19px 21px 17px;
  border-radius: var(--ht-r-card);
  background: var(--ht-surface-2);
  box-shadow: var(--ht-card-shadow);
  cursor: pointer;
  transition:
    background-color 220ms var(--ht-ease),
    box-shadow 260ms var(--ht-ease),
    opacity 200ms var(--ht-ease);
}
/* Halftone pointer spotlight (no layout shift on hover!) */
.article-row::before,
.article-row::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 380ms var(--ht-ease);
}
.article-row::before {
  z-index: -1;
  background: radial-gradient(320px circle at var(--sx, 50%) var(--sy, 50%), var(--ht-spot-fill), transparent 70%);
}
.article-row::after {
  padding: 1px;
  background: radial-gradient(240px circle at var(--sx, 50%) var(--sy, 50%), var(--ht-spot-ring), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
@media (hover: hover) and (pointer: fine) {
  .article-row:hover {
    background: var(--ht-surface-hover);
    box-shadow: var(--ht-card-shadow-hover);
  }
  .article-row.lit::before,
  .article-row.lit::after {
    opacity: 1;
  }
}
.article-row.is-read {
  opacity: 0.66;
}
.article-row.is-read:hover {
  opacity: 0.94;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 9px;
  font-size: 12.2px;
  color: var(--ht-ink-3);
  margin-bottom: 8px;
}
.score-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--ht-r-pill);
  font-weight: var(--ht-w-semi);
  font-size: 11.8px;
  background: var(--ht-accent-soft);
  color: var(--ht-accent-strong);
}
.score-badge.high {
  background: var(--ht-gold-soft);
  color: var(--ht-gold);
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--ht-r-pill);
  background: var(--ht-surface-recessed);
  color: var(--ht-ink-2);
  font-size: 11.8px;
  font-weight: var(--ht-w-med);
}
.tag-chip.fulltext {
  background: var(--ht-violet-soft);
  color: var(--ht-violet);
}
.tag-chip.audio-ready {
  background: var(--ht-mint-soft);
  color: var(--ht-mint);
}

.row-title {
  font-size: 17px;
  font-weight: var(--ht-w-bold);
  line-height: 1.36;
  letter-spacing: -0.014em;
  color: var(--ht-ink);
  margin-bottom: 5px;
}
.row-title-sub {
  font-size: 13.5px;
  color: var(--ht-ink-3);
  margin-bottom: 8px;
  line-height: 1.4;
}
.row-summary {
  font-size: 14px;
  color: var(--ht-ink-2);
  line-height: 1.62;
  margin-bottom: 10px;
}
.row-reason {
  font-size: 13px;
  color: var(--ht-ink-2);
  background: var(--ht-surface-tint);
  padding: 9px 13px;
  border-radius: var(--ht-r-inner);
  line-height: 1.5;
  margin-bottom: 12px;
}
.row-reason strong {
  color: var(--ht-accent-strong);
  font-weight: var(--ht-w-semi);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.act-btn {
  border: 0;
  background: var(--ht-surface-recessed);
  color: var(--ht-ink-2);
  font-size: 12.5px;
  font-weight: var(--ht-w-med);
  padding: 5px 12px;
  border-radius: var(--ht-r-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.act-btn:hover {
  color: var(--ht-ink);
  background: var(--ht-surface-recessed-hi);
}
.act-btn.on {
  background: var(--ht-accent-soft);
  color: var(--ht-accent-strong);
  font-weight: var(--ht-w-semi);
}
.act-btn.on-like {
  background: var(--ht-rose-soft);
  color: var(--ht-rose);
  font-weight: var(--ht-w-semi);
}
.act-link {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: var(--ht-w-med);
  color: var(--ht-ink-3);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 160ms var(--ht-ease), background-color 160ms var(--ht-ease);
}
.act-link:hover {
  color: var(--ht-accent-strong);
  background: var(--ht-accent-soft);
}

.empty-state {
  text-align: center;
  padding: 56px 24px;
  border-radius: var(--ht-r-card);
  background: var(--ht-surface-1);
  color: var(--ht-ink-3);
  font-size: 14.5px;
}

/* ==========================================================================
   Right Rail — Sticky Top 10 Leaderboard (Halftone Glass Panel)
   ========================================================================== */
.right-rail {
  position: sticky;
  top: 18px;
}
.rank-panel {
  background: var(--ht-surface-1);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-radius: var(--ht-r-panel);
  padding: 16px 14px;
  box-shadow: var(--ht-panel-shadow);
}
.rank-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 6px 12px;
}
.rank-title {
  font-weight: var(--ht-w-bold);
  font-size: 15px;
  letter-spacing: -0.015em;
}
.date-select {
  border: 0;
  background: var(--ht-surface-recessed);
  color: var(--ht-ink-2);
  border-radius: var(--ht-r-pill);
  padding: 5px 11px;
  font-size: 12.2px;
  font-weight: var(--ht-w-med);
  cursor: pointer;
}
.date-select:hover {
  background: var(--ht-surface-recessed-hi);
  color: var(--ht-ink);
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.rank-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  padding: 9px 8px;
  border-radius: 14px;
  cursor: pointer;
  transition: background-color 180ms var(--ht-ease);
}
.rank-item:hover {
  background: var(--ht-surface-tint);
}
.rank-num {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  font-size: 11.8px;
  font-weight: var(--ht-w-bold);
  background: var(--ht-surface-recessed);
  color: var(--ht-ink-3);
  flex: none;
}
.rank-num.top3 {
  background: var(--ht-gold-soft);
  color: var(--ht-gold);
}
.rank-item-title {
  font-size: 13.2px;
  font-weight: var(--ht-w-med);
  line-height: 1.4;
  color: var(--ht-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rank-item-author {
  font-size: 11.8px;
  color: var(--ht-ink-3);
  margin-top: 2px;
}
.rank-item-score {
  font-size: 12px;
  font-weight: var(--ht-w-semi);
  color: var(--ht-accent-strong);
  padding-top: 1px;
}

/* ==========================================================================
   Bilingual Reader Pane + Scroll Progress + Audio Dock
   ========================================================================== */
.reader-pane {
  padding-bottom: 72px;
}
.reader-bar {
  position: sticky;
  top: 12px;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 16px;
  border-radius: var(--ht-r-pill);
  background: var(--ht-surface-1);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--ht-panel-shadow);
  overflow: hidden;
}
.reader-progress {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--ht-accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
  opacity: 0.85;
}
.bar-left,
.bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-ghost {
  border: 0;
  background: var(--ht-surface-recessed);
  color: var(--ht-ink-2);
  padding: 6px 12px;
  border-radius: var(--ht-r-pill);
  font-size: 12.8px;
  font-weight: var(--ht-w-med);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-ghost:hover {
  color: var(--ht-ink);
  background: var(--ht-surface-recessed-hi);
}
.btn-ghost.on {
  background: var(--ht-accent-soft);
  color: var(--ht-accent-strong);
  font-weight: var(--ht-w-semi);
}
.btn-ghost.on-like {
  background: var(--ht-rose-soft);
  color: var(--ht-rose);
  font-weight: var(--ht-w-semi);
}
.arr-back {
  font-size: 16px;
  line-height: 1;
  transition: translate 280ms var(--ht-out);
}
@media (hover: hover) and (pointer: fine) {
  #btn-back:hover .arr-back {
    translate: -2px 0;
  }
}

.reader-shell {
  padding: 28px 30px 36px;
  border-radius: 26px;
  background: var(--ht-surface-2);
  box-shadow: var(--ht-card-shadow);
}
.reader-head {
  margin-bottom: 20px;
}
.reader-head h1 {
  font-size: clamp(23px, 2.8vw, 31px);
  line-height: 1.24;
  letter-spacing: -0.025em;
  font-weight: var(--ht-w-bold);
  margin: 10px 0 8px;
}
.reader-sub {
  font-size: 17px;
  color: var(--ht-ink-2);
  font-weight: var(--ht-w-med);
  margin-bottom: 12px;
}
.reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
  color: var(--ht-ink-3);
}
.reader-meta a {
  text-decoration: none;
  font-weight: var(--ht-w-med);
}
.reader-meta a:hover {
  text-decoration: underline;
}

/* Dual-Track Audio Dock */
.audio-dock {
  background: var(--ht-surface-tint);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.audio-dock-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.audio-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ht-mint);
  margin-left: 4px;
  vertical-align: 1px;
}
.audio-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.audio-player-row audio {
  flex: 1;
  height: 36px;
}
.audio-empty {
  font-size: 13px;
  color: var(--ht-ink-3);
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--ht-surface-recessed);
}

.reader-summary {
  background: var(--ht-accent-soft);
  border-radius: 18px;
  padding: 15px 18px;
  margin-bottom: 18px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ht-ink);
}
.reader-summary-kicker {
  font-size: 12px;
  font-weight: var(--ht-w-semi);
  color: var(--ht-accent-strong);
  margin-bottom: 5px;
}
.reader-summary-reason {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--ht-ink-2);
}

.toc {
  background: var(--ht-surface-tint);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 22px;
}
.toc summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: var(--ht-w-semi);
  color: var(--ht-ink-2);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toc summary::before {
  content: "›";
  display: inline-block;
  font-size: 16px;
  line-height: 1;
  transition: transform 240ms var(--ht-glide);
}
.toc[open] summary::before {
  transform: rotate(90deg);
}
.toc ol {
  margin: 10px 0 2px;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.75;
}
.toc a {
  text-decoration: none;
  color: var(--ht-ink-2);
}
.toc a:hover {
  color: var(--ht-accent-strong);
}

.reader-article h2 {
  font-size: 20px;
  font-weight: var(--ht-w-bold);
  letter-spacing: -0.015em;
  margin: 30px 0 12px;
  line-height: 1.32;
}
.reader-article h2 .h2-zh {
  display: block;
  font-size: 15px;
  font-weight: var(--ht-w-med);
  color: var(--ht-ink-3);
  margin-top: 4px;
}

.para {
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--ht-surface-tint);
  margin-bottom: 12px;
}
.para.bullet {
  background: var(--ht-accent-soft);
}
.para.quote {
  background: var(--ht-violet-soft);
}
.pair {
  padding: 7px 0;
}
.pair + .pair {
  margin-top: 4px;
  padding-top: 11px;
  border-top: 1px solid var(--ht-surface-recessed);
}
.pair p.en {
  font-size: 15.2px;
  line-height: 1.65;
  color: var(--ht-ink);
  margin-bottom: 4px;
}
.pair p.zh {
  font-size: 14.8px;
  line-height: 1.72;
  color: var(--ht-ink-2);
}
.pair p.zh-only-text {
  font-size: 15.2px;
  line-height: 1.78;
  color: var(--ht-ink);
}

/* Mode toggles inside reader */
.reader-pane.mode-en .pair p.zh,
.reader-pane.mode-en .h2-zh { display: none; }
.reader-pane.mode-zh .pair p.en { display: none; }
.reader-pane.mode-zh .pair p.zh { color: var(--ht-ink); font-size: 15.2px; }

/* ==========================================================================
   Control-Anchored Modals (mode f: grows from trigger button's corner)
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 13, 0.36);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity var(--ht-dur-fade) var(--ht-ease);
}
.modal.open .modal-backdrop {
  opacity: 1;
}
.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--ht-surface-hover);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  backdrop-filter: saturate(180%) blur(28px);
  border-radius: 24px;
  padding: 20px 22px 22px;
  box-shadow: var(--ht-modal-shadow);
  transform-origin: var(--ox, 50%) var(--oy, 50%);
  transform: scale(0.90) translateY(8px);
  opacity: 0;
  transition:
    transform var(--ht-dur-panel) var(--ht-glide),
    opacity var(--ht-dur-fade) var(--ht-ease);
}
:root[data-theme="dark"] .modal-card {
  background: rgba(24, 20, 36, 0.94);
}
.modal.open .modal-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.modal-head h3 {
  font-size: 16.5px;
  font-weight: var(--ht-w-bold);
  letter-spacing: -0.015em;
}
.btn-icon {
  width: 30px;
  height: 30px;
  border: 0;
  background: var(--ht-surface-recessed);
  color: var(--ht-ink-2);
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 12px;
}
.btn-icon:hover {
  background: var(--ht-surface-recessed-hi);
  color: var(--ht-ink);
}

.lib-modal-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  max-height: 260px;
  overflow-y: auto;
}
.lib-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border-radius: 14px;
  background: var(--ht-surface-recessed);
  cursor: pointer;
  font-size: 14px;
  font-weight: var(--ht-w-med);
  transition: background-color 160ms var(--ht-ease);
  animation: htModalItem 240ms var(--ht-out) both;
  animation-delay: var(--item-delay, 0ms);
}
.lib-check-row:hover {
  background: var(--ht-surface-recessed-hi);
}
.lib-check-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--ht-accent);
  cursor: pointer;
}
@keyframes htModalItem {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.quick-lib-form {
  display: flex;
  gap: 8px;
}
.quick-lib-form input,
.stack-form input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 13px;
  border: 0;
  background: var(--ht-surface-recessed);
  color: var(--ht-ink);
  font-size: 14px;
}
.quick-lib-form input:focus,
.stack-form input:focus {
  outline: none;
  background: var(--ht-surface-recessed-hi);
}
.quick-lib-form .btn-primary {
  width: auto;
  padding: 10px 15px;
  white-space: nowrap;
}
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==========================================================================
   Responsive Breakpoints (Static — no transitions on resize)
   ========================================================================== */
@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }
  .right-rail {
    display: none;
  }
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 14px 48px;
  }
  .left-rail {
    display: none;
  }
  .mobile-nav {
    display: flex;
  }
  .top-bar {
    flex-wrap: wrap;
    border-radius: 20px;
  }
  .search-wrap {
    width: 100%;
    flex-basis: 100%;
  }
  .search-kbd {
    display: none;
  }
  .reader-shell {
    padding: 20px 18px 28px;
    border-radius: 22px;
  }
}

/* ==========================================================================
   Strict Accessibility: prefers-reduced-motion
   Remove all movement, scale, blur & ambient drift; keep <=150ms fade only.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .aurora-canvas .orb {
    animation: none !important;
  }
  .press,
  .press:active,
  .is-popping,
  .reveal-in,
  .lib-check-row,
  .rail-primary .nav-thumb,
  .seg-thumb,
  .modal-card,
  .arr-back,
  .toc summary::before {
    animation: none !important;
    transition: opacity 150ms ease, background-color 150ms ease, color 150ms ease !important;
    transform: none !important;
    scale: 1 !important;
    filter: none !important;
  }
  .modal-backdrop {
    transition: opacity 150ms ease !important;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 150ms !important;
    animation-name: none !important;
  }
}
