/* ============================================================
   home-shell.css — the "Home Shell" for index.html
   (see home-layout-suggestion.md).

   Same skeleton family as .series-shell / .gs-shell / .st-shell /
   .sources-shell. Loaded AFTER main.css so it supersedes the old
   homepage section styling on this page only; no other page
   references .hm-shell, so nothing else moves.

   Zones: hm-spotlight -> hm-controlzone (sticky tabs + one notice)
          -> hm-panel (one at a time) with hm-grid | hm-rail | hm-ledger.

   Neutral --ss-* tokens only. No purple, no gradients, no shadows
   except --ss-shadow, no radius above 8px.
   Spacing scale: 4 / 8 / 12 / 16 / 24 / 32 / 48px only.
   ============================================================ */

/* ---------- Tokens ----------
   Identical values to css/series-shell.css so a theme change stays
   in one place conceptually; declared here because index.html does
   not load the series shell. */
:root {
  --ss-4: 4px;  --ss-8: 8px;   --ss-12: 12px;
  --ss-16: 16px; --ss-24: 24px; --ss-32: 32px; --ss-48: 48px;

  --ss-max: 1120px;
  --ss-radius: 8px;
  --ss-radius-chip: 6px;

  --ss-bg: #ffffff;
  --ss-surface: #f9fafb;
  --ss-surface-2: #f3f4f6;
  --ss-border: #e5e7eb;
  --ss-border-strong: #d1d5db;
  --ss-text: #111827;
  --ss-text-muted: #6b7280;

  --ss-primary-bg: #1f2937;
  --ss-primary-bg-hover: #111827;
  --ss-primary-fg: #ffffff;
  --ss-secondary-bg: #f3f4f6;
  --ss-secondary-bg-hover: #e5e7eb;
  --ss-secondary-fg: #111827;
  --ss-secondary-border: #d1d5db;
  --ss-ghost-fg: #4b5563;
  --ss-ghost-bg-hover: #f3f4f6;

  --ss-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  --ss-transition: 120ms ease;
}

[data-theme="dark"] {
  --ss-bg: #0f1115;
  --ss-surface: #14171d;
  --ss-surface-2: #1f2937;
  --ss-border: #262b33;
  --ss-border-strong: #374151;
  --ss-text: #f9fafb;
  --ss-text-muted: #9ca3af;

  --ss-primary-bg: #e5e7eb;
  --ss-primary-bg-hover: #f9fafb;
  --ss-primary-fg: #111827;
  --ss-secondary-bg: #1f2937;
  --ss-secondary-bg-hover: #273244;
  --ss-secondary-fg: #f9fafb;
  --ss-secondary-border: #374151;
  --ss-ghost-fg: #9ca3af;
  --ss-ghost-bg-hover: #1f2937;

  --ss-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ---------- Shell frame ---------- */
.hm-shell {
  max-width: var(--ss-max);
  margin: 0 auto;
  padding: var(--ss-24) var(--ss-16) var(--ss-48);
  color: var(--ss-text);
}
.hm-shell *,
.hm-shell *::before,
.hm-shell *::after { box-sizing: border-box; }

.hm-shell a { color: inherit; }

.hm-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Spotlight ----------
   The hero, reframed as a bordered strip. It is the only place on
   the page with a large image. */
.hm-spotlight {
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius);
  background: var(--ss-surface);
  box-shadow: var(--ss-shadow);
  overflow: hidden;
  margin-bottom: var(--ss-24);
}

.hm-spotlight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ss-12);
  padding: var(--ss-12) var(--ss-16);
  border-bottom: 1px solid var(--ss-border);
}
.hm-spotlight-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ss-text-muted);
}

/* Hero content-type tabs (All / Comics / Novels) as text tabs. */
.hm-shell .hero-tabs {
  display: flex;
  align-items: center;
  gap: var(--ss-16);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.hm-shell .hero-tabs::-webkit-scrollbar { display: none; }
.hm-shell .hero-tab {
  flex: 0 0 auto;
  min-height: 32px;
  padding: var(--ss-4) 0;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ss-text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--ss-transition), border-color var(--ss-transition);
}
.hm-shell .hero-tab:hover:not(:disabled) { color: var(--ss-text); }
.hm-shell .hero-tab.active,
.hm-shell .hero-tab[aria-selected="true"] {
  color: var(--ss-text);
  border-bottom-color: var(--ss-text);
}
.hm-shell .hero-tab:disabled { opacity: .45; cursor: default; }

.hm-spotlight-body { position: relative; }
.hm-shell .hero-section { margin: 0; padding: 0; max-width: none; }
.hm-shell .hero-slider {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* ---------- Control zone (sticky) ---------- */
.hm-controlzone {
  position: sticky;
  /* Docks directly beneath the sticky site header — same trick the
     Settings and Global Search shells use. */
  top: var(--header-height, 64px);
  z-index: 20;
  background: var(--ss-bg);
  border-bottom: 1px solid transparent;
  transition: border-color var(--ss-transition), box-shadow var(--ss-transition);
}
/* Hairline + shadow appear only once the zone has detached. */
.hm-controlzone.is-stuck {
  border-bottom-color: var(--ss-border);
  box-shadow: var(--ss-shadow);
}

.hm-tabs {
  display: flex;
  align-items: stretch;
  gap: var(--ss-24);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--ss-border);
  /* Fade edge on mobile, identical to the Settings / Global Search strips. */
  -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
          mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.hm-tabs::-webkit-scrollbar { display: none; }
@media (min-width: 720px) {
  .hm-tabs { -webkit-mask-image: none; mask-image: none; }
}

.hm-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: var(--ss-12) 0;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--ss-text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--ss-transition), border-color var(--ss-transition);
}
.hm-tab:hover { color: var(--ss-text); }
.hm-tab[aria-selected="true"] {
  color: var(--ss-text);
  font-weight: 600;
  border-bottom-color: var(--ss-text);
}
.hm-tab:focus-visible { outline: 2px solid var(--ss-border-strong); outline-offset: 2px; }

/* ---------- Notices ----------
   All announcements collapse into ONE dismissible line. Only the
   highest-priority visible notice is shown at a time. */
.hm-notices { display: block; }
.hm-notices:empty { display: none; }

.hm-notice {
  display: flex;
  align-items: center;
  gap: var(--ss-12);
  min-height: 40px;
  padding: var(--ss-8) 0;
  border-bottom: 1px solid var(--ss-border);
  font-size: 13px;
  color: var(--ss-text);
}
.hm-notice[hidden] { display: none; }
.hm-notice-text {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--ss-8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  color: inherit;
}
.hm-notice-tag {
  flex: 0 0 auto;
  padding: 2px var(--ss-8);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-chip);
  background: var(--ss-surface-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--ss-text-muted);
}
.hm-notice-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.hm-notice-text:hover .hm-notice-label { text-decoration: underline; }

.hm-notice-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--ss-8);
}

/* ---------- Buttons (neutral shell set) ---------- */
.hm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ss-8);
  min-height: 32px;
  padding: var(--ss-4) var(--ss-12);
  border-radius: var(--ss-radius-chip);
  border: 1px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--ss-transition), border-color var(--ss-transition), color var(--ss-transition);
}
.hm-btn-primary {
  background: var(--ss-primary-bg);
  color: var(--ss-primary-fg);
}
.hm-btn-primary:hover { background: var(--ss-primary-bg-hover); }
.hm-btn-secondary {
  background: var(--ss-secondary-bg);
  color: var(--ss-secondary-fg);
  border-color: var(--ss-secondary-border);
}
.hm-btn-secondary:hover { background: var(--ss-secondary-bg-hover); }
.hm-btn-ghost {
  background: none;
  color: var(--ss-ghost-fg);
}
.hm-btn-ghost:hover { background: var(--ss-ghost-bg-hover); color: var(--ss-text); }
.hm-btn:focus-visible { outline: 2px solid var(--ss-border-strong); outline-offset: 2px; }
.hm-btn:disabled { opacity: .55; cursor: default; }

/* ---------- Panels ---------- */
.hm-panel { padding-top: var(--ss-24); }
.hm-panel[hidden] { display: none; }

.hm-block + .hm-block { margin-top: var(--ss-32); }

.hm-sectionhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--ss-12);
  margin-bottom: var(--ss-24);
}
.hm-sectiontitle {
  display: flex;
  align-items: baseline;
  gap: var(--ss-8);
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ss-text);
}
@media (min-width: 720px) { .hm-sectiontitle { font-size: 18px; } }
.hm-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--ss-text-muted);
  font-variant-numeric: tabular-nums;
}
.hm-viewall {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--ss-text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--ss-transition);
}
.hm-viewall:hover { color: var(--ss-text); text-decoration: underline; }

.hm-note {
  margin: 0;
  font-size: 13px;
  color: var(--ss-text-muted);
}

.hm-more {
  display: flex;
  justify-content: center;
  margin-top: var(--ss-24);
}

/* ---------- Grid / rail (poster geometry shared with .gs-card) ---------- */
.hm-shell .series-grid,
.hm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--ss-12);
}
@media (min-width: 720px) {
  .hm-shell .series-grid,
  .hm-grid { gap: var(--ss-16); }
}

.hm-shell .series-carousel,
.hm-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 150px;
  gap: var(--ss-12);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: var(--ss-8);
}
.hm-shell .series-carousel > *,
.hm-rail > * { scroll-snap-align: start; }
@media (min-width: 720px) {
  .hm-shell .series-carousel,
  .hm-rail { grid-auto-columns: 170px; gap: var(--ss-16); }
}

/* Cards are re-skinned to the .gs-card shape so a poster on Home is
   pixel-identical to one in Global Search results. */
.hm-shell .series-card {
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius);
  box-shadow: none;
  overflow: hidden;
  transition: border-color var(--ss-transition), box-shadow var(--ss-transition);
}
.hm-shell .series-card:hover {
  transform: none;
  border-color: var(--ss-border-strong);
  box-shadow: var(--ss-shadow);
}
.hm-shell .series-card-image {
  aspect-ratio: 2 / 3;
  height: auto;
  background: var(--ss-surface-2);
  border-radius: 0;
}
.hm-shell .series-card:hover .series-card-image img { transform: none; }
.hm-shell .series-card-info { padding: var(--ss-8) var(--ss-12) var(--ss-12); }
.hm-shell .series-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ss-text);
}
.hm-shell .series-card-info .series-card-meta,
.hm-shell .series-card-chapter,
.hm-shell .series-card-row { font-size: 12px; color: var(--ss-text-muted); }

/* ---------- Ledger (flat rows, from .st-row) ---------- */
.hm-ledger { display: block; }
.hm-ledger > * {
  border-bottom: 1px solid var(--ss-border);
}
.hm-ledger > *:last-child { border-bottom: 0; }

/* Latest Chapters / Latest Comments rows: dividers, not cards. */
.hm-ledger .series-card,
.hm-ledger .latest-chapter-item,
.hm-ledger .latest-comment-item {
  display: flex;
  gap: var(--ss-12);
  align-items: center;
  padding: var(--ss-12) 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--ss-border);
  border-radius: 0;
  box-shadow: none;
  transform: none;
}
.hm-ledger .series-card:hover { transform: none; box-shadow: none; }
.hm-ledger .series-card .series-card-image {
  flex: 0 0 auto;
  width: 44px;
  aspect-ratio: 2 / 3;
  border-radius: var(--ss-radius-chip);
  overflow: hidden;
}
.hm-ledger .series-card .series-card-info { flex: 1; min-width: 0; padding: 0; }
/* Chapter numbers line up. */
.hm-ledger .chapter-number,
.hm-ledger .series-card-chapter { font-variant-numeric: tabular-nums; }

/* ---------- Skeletons match the final geometry ---------- */
.hm-shell .skeleton { border-radius: var(--ss-radius-chip); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hm-shell *,
  .hm-controlzone { transition: none !important; animation: none !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .hm-shell { padding-left: var(--ss-12); padding-right: var(--ss-12); }
  .hm-tabs { gap: var(--ss-16); }
  .hm-notice-tag { display: none; }
}

/* ---------- Empty states span the full feed width ---------- */
.hm-shell .series-grid > .empty-state,
.hm-shell .series-carousel > .empty-state,
.hm-grid > .empty-state,
.hm-rail > .empty-state {
  grid-column: 1 / -1;
  grid-row: 1;
  width: 100%;
  padding: var(--ss-32) var(--ss-16);
  text-align: center;
  color: var(--ss-text-muted);
}
.hm-shell .empty-state-title { font-size: 16px; font-weight: 600; color: var(--ss-text); }
.hm-shell .empty-state-desc { font-size: 13px; color: var(--ss-text-muted); }

/* A rail holding a single full-width message must not size to a poster column. */
.hm-shell .series-carousel:has(> .empty-state),
.hm-rail:has(> .empty-state) { grid-auto-flow: row; grid-auto-columns: auto; overflow-x: hidden; }
