/* ============================================================
   HUB 静 A — 开卷页框
   背景是门页静底 + 0.85 墨罩。顶栏、侧栏槽、主卡走金框方言。
   ============================================================ */

body.hub-body {
  --topbar-h: 52px;
  background: #0a0a12;
}

.hub-still {
  background: #0a0a12;
  container-type: size;
}

.hub-still__base {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(1920px, 100cqw, calc(100cqh * 1920 / 1080));
  height: min(1080px, 100cqh, calc(100cqw * 1080 / 1920));
  max-width: none;
  transform: translate(-50%, -50%);
  object-fit: contain;
  object-position: center;
}

.hub-still__ink {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 18, 0.85);
}

/* .lib-frame is position:relative and loads after .topbar, which was unpinning the header. */
.topbar.lib-frame,
.topbar.lib-frame--plain {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

/* 顶栏：plain 框只留底边双线，不做成四边盒子 */
.topbar.lib-frame--plain {
  --frame-bg: rgba(11, 11, 18, 0.94);
  height: var(--topbar-h);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: rgba(11, 11, 18, 0.94);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.topbar.lib-frame--plain::before {
  content: none;
}

.topbar.lib-frame--plain::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  width: auto;
  height: 3px;
  opacity: 1;
  pointer-events: none;
  background: transparent;
  border-top: 1px solid var(--accent-dim);
  border-bottom: 1px solid rgba(0, 0, 0, 0.6);
}

.logo-mark {
  width: 32px;
  height: 32px;
  max-width: none;
  flex-shrink: 0;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.logo-text,
.view-header h1,
.hub-card__title,
.dash-section-title {
  font-family: var(--font-cjk-pixel);
  font-weight: 400;
  font-synthesis: none;
  -webkit-font-smoothing: none;
  letter-spacing: 0;
  color: var(--accent-bright);
}

.view-header h1 {
  font-size: 24px;
  line-height: 36px;
}

.hub-card__title {
  font-size: var(--fs-pixel-sub);
  line-height: 24px;
  margin: 0 0 8px;
}

.view-header .lib-rule,
.dash-section .lib-rule {
  margin-top: 8px;
}

.logo:hover .logo-text {
  text-shadow: none;
}

.logout-btn.lib-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: rgba(0, 0, 0, 0.42);
  border-radius: var(--radius);
}

.logout-btn.lib-btn:hover {
  color: var(--accent-bright);
  background: rgba(0, 0, 0, 0.62);
}

.search-box input[type="text"]:focus {
  animation: none;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.55);
  border-color: var(--accent);
}

.sidebar {
  background: rgba(12, 12, 18, 0.94);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-right: 0;
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.6), inset -2px 0 0 var(--accent-dim);
}

.sidebar-overlay {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.content {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar .nav-item.lib-slot {
  margin-bottom: 4px;
  background: var(--bg-well);
  color: var(--text-dim);
}

.sidebar .nav-item.lib-slot::before {
  content: none;
  box-shadow: none;
}

.sidebar .nav-item.lib-slot:hover,
.sidebar .nav-item.lib-slot.active {
  background: var(--bg-well);
  transform: none;
}

.sidebar .nav-item.lib-slot .nav-icon,
.sidebar .nav-item.lib-slot.active .nav-icon {
  text-shadow: none;
}

.sidebar-footer::before {
  animation: none;
}

.hub-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  margin-bottom: var(--space-5);
}

.hub-card {
  padding: var(--space-5);
  min-height: 160px;
}

.hub-card[data-state="placeholder"] {
  opacity: 0.72;
  pointer-events: none;
}

.hub-card[data-state="disabled"] {
  opacity: 0.45;
  pointer-events: none;
}

.hub-card[data-state="error"] .hub-card__body {
  color: var(--danger);
}

.hub-card__body,
.hub-card__text,
.hub-card__empty,
.hub-card__date,
.content-item-summary,
.content-item-title,
.view-subtitle {
  font-family: var(--font-sans);
}

.hub-card__date {
  font-family: "Fusion Pixel 12", var(--font-sans);
  font-size: 12px;
  line-height: 18px;
  font-synthesis: none;
  -webkit-font-smoothing: none;
  color: var(--accent-bright);
  margin-bottom: 8px;
}

.hub-card__text,
.hub-card__empty {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 8px;
}

.hub-card__empty {
  color: var(--text-dim);
}

.hub-card__mark {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 8px;
}

.hub-card__open {
  margin-top: 8px;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
}

.dash-card.lib-frame,
.content-item.lib-frame,
.accordion-group.lib-frame,
.file-upload-zone.lib-frame,
.links-grid.lib-frame {
  overflow: hidden;
}

.dash-card.lib-frame:hover,
.content-item.lib-frame:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.dash-card.lib-frame::after,
.content-item.lib-frame::after {
  content: none;
  animation: none;
}

.dash-card.lib-frame--plain::before,
.dash-gold.lib-frame--plain::before {
  width: auto;
  height: auto;
  inset: var(--gate-frame-gap);
  background: none;
  animation: none;
  border-radius: 0;
}

.dash-gold-left::after,
.modal-header h2::after {
  content: none;
  animation: none;
}

.dash-gold::before,
.dash-clock {
  background-image: none;
}

.modal.lib-frame {
  overflow: hidden;
}

.modal-overlay {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(0, 0, 0, 0.78);
}

.links-grid.lib-frame {
  gap: var(--space-4);
  padding: var(--space-5);
  min-height: 0;
  box-shadow: var(--shadow-hard);
  filter: none;
}

.links-grid.lib-frame::before,
.links-grid.lib-frame::after {
  content: none;
  filter: none;
}

.link-card,
.link-card:hover,
.link-card:nth-child(2n):hover {
  transform: none;
  filter: none;
}

.link-cover,
.link-youtube-logo,
.link-mag-art span,
.link-economist .link-mag-art span,
.link-tech .link-mag-art span,
.link-book-window span,
.link-tv-knobs span,
.link-card-delete,
.color-swatch,
.deprecated-badge,
.link-mag-art i {
  border-radius: var(--radius-px);
}

.link-cover,
.upload-drop-area,
.upload-drop-area:hover,
.upload-drop-area.drag-over,
.accordion-header,
.accordion-header:hover,
.accordion-group.open .accordion-header {
  box-shadow: none;
  filter: none;
}

.nav-item::before,
.nav-item.active::before {
  box-shadow: none;
}

@media (max-width: 900px) {
  .hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .hub-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .search-box {
    flex: 0 0 36px;
    max-width: 36px;
  }

  .search-box input[type="text"] {
    width: 36px;
    padding-left: 36px;
    color: transparent;
    caret-color: transparent;
  }

  .search-box:focus-within {
    flex: 1 1 120px;
    max-width: 46vw;
  }

  .search-box:focus-within input[type="text"] {
    width: 100%;
    color: var(--text-primary);
    caret-color: var(--text-primary);
  }
}

@media (max-width: 480px) {
  body.hub-body {
    --topbar-h: 88px;
  }

  .search-box,
  .search-box input[type="text"],
  .search-box:focus-within,
  .search-box:focus-within input[type="text"] {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
    color: var(--text-primary);
    caret-color: var(--text-primary);
  }
}

/* Topbar triggers stay one compact row. Hover is a candle wash plus a 1px rule. */
button.clock-widget,
button.weather-widget {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  box-shadow: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 2px 4px;
  line-height: inherit;
}

button.clock-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

button.clock-widget:hover,
button.clock-widget:focus-visible,
button.clock-widget[aria-expanded="true"],
button.weather-widget:hover,
button.weather-widget:focus-visible,
button.weather-widget[aria-expanded="true"] {
  background: var(--glow-candle);
  border-bottom-color: var(--accent);
}

button.clock-widget:focus-visible,
button.weather-widget:focus-visible,
.hub-overlay__panel:focus-visible,
.hub-overlay__close:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

html.hub-overlay-open,
html.hub-overlay-open body {
  overflow: hidden;
}

.hub-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.hub-overlay[hidden] {
  display: none;
}

.hub-overlay__mask {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 18, 0.72);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.hub-overlay__panel {
  --frame-bg: rgba(12, 12, 18, 0.92);
  position: relative;
  z-index: 1;
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: 20px;
  background: rgba(12, 12, 18, 0.92);
  border-radius: 2px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
  animation: hub-overlay-in 150ms linear;
}

.hub-overlay__panel--week {
  width: 480px;
  max-width: min(480px, calc(100vw - 24px));
  padding: 16px 16px 20px;
}

.hub-overlay__panel > :not(.hub-overlay__close) {
  position: relative;
  z-index: 3;
}

@keyframes hub-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hub-overlay__panel > .hub-overlay__close {
  position: absolute;
  top: 16px;
  right: 22px;
  z-index: 4;
  width: 28px;
  height: 28px;
  padding: 0;
  border-width: 1px;
  line-height: 26px;
  font-family: var(--font-sans);
  font-size: 16px;
}

.hub-overlay__title {
  margin: 0 36px 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-pixel);
  font-size: 16px;
  line-height: 1;
  font-weight: 400;
  font-synthesis: none;
  -webkit-font-smoothing: none;
  letter-spacing: 0;
  color: var(--accent-bright);
}

.hub-overlay__zh {
  margin-left: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

.hub-overlay__note,
.hub-clock__date,
.hub-week__summary,
.hub-slot__day {
  font-family: var(--font-sans);
}

.hub-clock__time {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: 48px;
  line-height: 1;
  font-weight: 400;
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: none;
  letter-spacing: 0;
  color: var(--text);
  white-space: nowrap;
}

.hub-clock__sec {
  color: var(--accent);
}

.hub-clock__date {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-dim);
}

.hub-overlay__note {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-faint);
}

.hub-dial {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 12px auto 0;
  box-sizing: border-box;
  border: 2px solid var(--rune);
  border-radius: 0;
}

.hub-dial__ticks {
  position: absolute;
  inset: 0;
}

.hub-dial__tick {
  position: absolute;
  width: 2px;
  background: var(--rune);
  transform-origin: 50% 50%;
}

.hub-dial__tick[data-major="true"] {
  background: var(--accent);
}

.hub-dial__hand {
  position: absolute;
  left: 58px;
  width: 2px;
  margin-left: -1px;
  background: var(--text);
  transform-origin: 50% 100%;
  transition: none;
  animation: none;
}

.hub-dial__hand--hour {
  top: 32px;
  height: 26px;
}

.hub-dial__hand--minute {
  top: 16px;
  height: 42px;
}

.hub-dial__hand--second {
  top: 12px;
  height: 46px;
  background: var(--accent);
}

.hub-dial__rivet {
  position: absolute;
  left: 55px;
  top: 55px;
  width: 6px;
  height: 6px;
  background: var(--accent);
}

.hub-week__summary {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}

.hub-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.hub-slot {
  min-height: 96px;
  padding: 8px 4px;
  border-radius: 2px;
  text-align: center;
}

.hub-slot[data-today="true"] {
  border: 1px solid var(--accent);
  background: var(--glow-candle);
}

.hub-slot__day {
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-dim);
}

.hub-slot__icon {
  width: 24px;
  height: 24px;
  margin: 6px auto;
  font-size: 24px;
  line-height: 24px;
}

.hub-slot__temp {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: 12px;
  line-height: 14px;
  font-weight: 400;
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: none;
  letter-spacing: 0;
  color: var(--text);
  white-space: nowrap;
}

.hub-slot[data-state="placeholder"] .hub-slot__day,
.hub-slot[data-state="placeholder"] .hub-slot__icon,
.hub-slot[data-state="placeholder"] .hub-slot__temp {
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 24px;
}

.hub-slot[data-state="placeholder"] .hub-slot__temp {
  line-height: 14px;
}

@media (max-width: 600px) {
  .hub-overlay__panel,
  .hub-overlay__panel--week {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    border-radius: 0;
  }

  .hub-week {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hub-clock__time {
    font-size: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .view,
  .content-item.animate-in,
  .link-card,
  .modal,
  .welcome-overlay,
  .welcome-text,
  .hub-overlay__panel,
  .hub-dial__hand {
    animation: none;
    transition: none;
  }
}
