/* ═══════════════════════════════════════════════
   INKSIDERS — Community Home
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Outfit:wght@200;300;400;500&family=Sora:wght@200;700&family=Space+Grotesk:wght@400;500;700&family=Space+Mono:wght@400;700&display=swap');

html { overflow-x: hidden; max-width: 100%; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Global dialog centering ─────────────────── */
dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
dialog::backdrop {
  background: rgba(0,0,0,.65);
}
/* Prevent body scroll when any dialog is open */
body:has(dialog[open]),
body.modal-open {
  overflow: hidden !important;
}

:root {
  --bg: #FFFFFF;
  --paper: #F3F4F6;
  --ink: #111827;
  --muted: #9CA3AF;
  --border: #E5E7EB;
  --accent: #FF4D2D;
  --signal: #374151;
  --comic-dark: #111827;
  /* ── Typography ── */
  --font-sans:    'Space Grotesk', Arial, Helvetica, sans-serif;
  --font-outfit:  'Outfit', Arial, Helvetica, sans-serif;
  --font-mono:    'Space Mono', monospace;
  --font-sora:    'Sora', Arial, Helvetica, sans-serif;
  --font-display: 'Bangers', Arial, Helvetica, sans-serif;
  --comic-cream: #FFFFFF;
  --comic-cream-2: #F3F4F6;
  --comic-yellow: #E9C46A;
  --comic-lime: #bdd834;
  --comic-fuchsia: #DDBB5A;
  --comic-cyan: #374151;
  --btn-radius: 6px;
  --btn-shadow: 3px 3px 0 var(--ink);
  --btn-shadow-hover: 5px 5px 0 var(--ink);
  --btn-shadow-active: 1px 1px 0 var(--ink);
  --btn-transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
  --topbar-bg: #FFFFFF;
  --topbar-text: #9CA3AF;
  --topbar-text-active: #111827;
  --topbar-accent: var(--accent);
  --topbar-border: #E5E7EB;
}

body {
  font-family: var(--font-outfit);
  background: var(--bg) !important;
  color: var(--ink) !important;
  min-height: 100vh;
  overflow: auto !important;
  overflow-x: hidden !important;
  display: block !important;
  align-items: unset !important;
  justify-content: unset !important;
}

:is(
  .btn,
  .nav-signin,
  .topbar-dialog-primary,
  .topbar-dialog-secondary,
  .topbar-dialog-close,
  .home-more,
  .creator-callout-action,
  .creator-callout-secondary,
  .home-read-btn,
  .artist-card-link,
  .book-card-action,
  .profile-create,
  .profile-secondary,
  .profile-publish-action,
  .creator-card-cta,
  .series-back-link,
  .series-save-btn,
  .series-action-btn,
  .series-primary-btn,
  .profile-tab-trigger,
  .profile-like,
  .profile-language-chip
) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: var(--btn-radius);
  box-shadow: var(--btn-shadow);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--btn-transition);
}

:is(
  .btn,
  .nav-signin,
  .topbar-dialog-primary,
  .topbar-dialog-secondary,
  .topbar-dialog-close,
  .home-more,
  .creator-callout-action,
  .creator-callout-secondary,
  .home-read-btn,
  .artist-card-link,
  .book-card-action,
  .profile-create,
  .profile-secondary,
  .profile-publish-action,
  .creator-card-cta,
  .series-back-link,
  .series-save-btn,
  .series-action-btn,
  .series-primary-btn,
  .profile-tab-trigger,
  .profile-like,
  .profile-language-chip
):hover {
  transform: translate(3px, 3px);
  box-shadow: none;
}

:is(
  .btn,
  .nav-signin,
  .topbar-dialog-primary,
  .topbar-dialog-secondary,
  .topbar-dialog-close,
  .home-more,
  .creator-callout-action,
  .creator-callout-secondary,
  .home-read-btn,
  .artist-card-link,
  .book-card-action,
  .profile-create,
  .profile-secondary,
  .profile-publish-action,
  .creator-card-cta,
  .series-back-link,
  .series-save-btn,
  .series-action-btn,
  .series-primary-btn,
  .profile-tab-trigger,
  .profile-like,
  .profile-language-chip
):active {
  transform: translate(3px, 3px);
  box-shadow: none;
  filter: brightness(.9);
}

:is(.btn.primary, .nav-signin, .topbar-dialog-primary, .creator-callout-action, .home-read-btn, .artist-card-link-primary) {
  background: var(--accent);
  color: #FFFFFF;
}

:is(.btn.primary, .nav-signin, .topbar-dialog-primary, .creator-callout-action, .home-read-btn, .artist-card-link-primary):hover {
  background: var(--ink);
  color: #FFFFFF;
}

:is(.btn.secondary, .topbar-dialog-secondary, .topbar-dialog-close, .home-more, .creator-callout-secondary, .artist-card-link-secondary, .book-card-action) {
  background: #FFFFFF;
  color: var(--ink);
}

:is(.btn.secondary, .topbar-dialog-secondary, .topbar-dialog-close, .home-more, .creator-callout-secondary, .artist-card-link-secondary, .book-card-action):hover {
  background: var(--accent);
  color: #FFFFFF;
}
/* ═══════════ TOPBAR ═══════════ */
#topbar {
  --nav-accent: var(--topbar-accent);
  position: fixed; top: 0; left: 0;
  z-index: 300;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 0 clamp(18px, 3vw, 48px);
  background: var(--topbar-bg);
  border-bottom: 0;
  box-shadow: none;
}
.tab { 
  min-height: 64px;
  padding: 0 16px; border: none; background: transparent;
  font-family: var(--font-outfit); font-size: 11px; font-weight: 500;
  letter-spacing: 0; text-transform: none;
  color: var(--topbar-text); border-radius: 0; cursor: pointer; transition: .2s;
  text-decoration: none; display: inline-flex; align-items: center;
  white-space: nowrap; gap: 7px;
}
/* Override SVG inline margin-right so gap drives spacing */
.tab svg { margin-right: 0; vertical-align: middle; flex-shrink: 0; }
.tab:hover { color: var(--topbar-text-active); background: var(--paper); }
.tab.active {
  color: var(--topbar-text-active);
  background: var(--paper);
  box-shadow: inset 0 -3px var(--nav-accent);
}
.tab-brand {
  color: var(--topbar-text-active);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 1px;
  font-weight: 400;
  text-transform: none;
  justify-self: start;
  padding-left: 0;
  padding-right: 18px;
}
.tab-brand:hover { background: transparent; transform: scale(1.02); }
.nav-logo-img {
  height: 36px;
  width: auto;
  display: block;
}
.footer-logo-img {
  height: 44px;
  width: auto;
  display: block;
  margin-bottom: 12px;
}
.nav-profile {
  width: 46px;
  min-width: 40px;
  justify-content: center;
  padding: 0 10px;
  flex: 0 0 46px;
}
.nav-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--nav-accent);
  color: #18191d;
  font-family: var(--font-sora);
  font-size: 10px;
  font-weight: 700;
  border: 1px solid #E5E7EB;
  overflow: hidden;
  flex-shrink: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
.nav-avatar-fallback {
  position: relative;
  z-index: 1;
  line-height: 1;
  opacity: 1;
}
.nav-avatar.has-image .nav-avatar-fallback { opacity: 0; }
.nav-signin {
  margin-left: 8px;
  padding: 0 18px;
  min-height: 38px;
}
.nav-signin:hover { border-color: #111827; }
/* Hide auth-only separators when logged out (view-mode) */
body.view-mode .topbar-sep-edit { display: none; }

/* Hide presentation button on mobile */
@media (max-width: 1024px) {
  #btn-present, #btn-present-exit { display: none; }
}

/* Desktop navigation uses three stable zones: brand, links, account. */
.tb-head   { display: contents; }
.tb-links  {
  display: contents;
}
.tb-primary {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.tb-account {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
}
.tb-account .tab {
  min-height: 40px;
}
.nav-notifications {
  min-width: 44px;
  justify-content: center;
  padding: 0 12px;
}
.nav-notifications svg {
  width: 16px;
  height: 16px;
}
.nav-create-work {
  min-width: 40px;
  justify-content: center;
  padding: 0 12px;
  margin-right: 6px;
  background: #FF5A4F;
  color: #FFFFFF;
  border-color: #111827;
}
.nav-create-work:hover {
  background: #E94B40;
  color: #FFFFFF;
}
.nav-notifications:hover,
.nav-profile:hover {
  color: #2563FF;
}
.nav-create-work svg {
  width: 14px;
  height: 14px;
}
.tb-hamburger { display: none; }

.tb-back-series { color: #888 !important; }
.tb-back-series svg { vertical-align: middle; margin-right: 2px; }

@media (max-width: 1024px) {
  #topbar {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 56px;
    height: 56px;
    padding: 0 16px;
    overflow: hidden;
    transition: height .3s ease;
  }
  #topbar.mob-open { height: auto; min-height: 56px; }
  .tb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 56px;
    flex-shrink: 0;
  }
  .tb-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
  }
  .tb-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: #111827;
    border-radius: 999px;
    transition: transform .2s ease, opacity .2s ease;
  }
  
  .tb-hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .tb-hamburger.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }
  .tb-hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  .tb-links {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 6px 8px 14px;
    gap: 2px;
  }
  .tb-primary {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .tb-account {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  #topbar:not(.mob-open) .tb-links { display: none; }
  #topbar.mob-open {
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    border-bottom: 1px solid var(--border);
  }
  .tab {
    min-height: 44px;
    width: 100%;
    padding: 10px 12px;
    justify-content: flex-start;
    border-radius: 8px;
    gap: 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
  }
  .tab.active {
    background: var(--paper);
    color: var(--ink);
    box-shadow: none;
  }
  .tab:hover { background: var(--paper); }
  /* Add text labels to account icon-only tabs */
  .nav-create-work {
    color: var(--accent) !important;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    font-weight: 700;
  }
  .nav-create-work::after  { content: "Create new work"; }
  a.tab[href="messages"]::after   { content: "Messages"; }
  a.tab[href="chat"]::after       { content: "Messages"; }
  .nav-notifications::after       { content: "Notifications"; }
  .nav-profile::after             { content: "My profile"; }
  #btn-logout::after              { content: "Sign out"; }
  .tab-brand {
    min-height: 56px;
    width: auto;
    padding: 0;
  }
  .nav-signin {
    margin: 6px 0 0;
    justify-content: center;
    font-size: 13px;
  }
  .tb-account .tab { min-height: 44px; }
}

.topbar-dialog {
  width: min(560px, calc(100vw - 32px));
  margin: auto;
  border: 1px solid rgba(255,255,255,.08);
  background: #17181d;
  color: #f5f5f5;
  padding: 0;
}
.topbar-dialog::backdrop {
  background: rgba(0,0,0,.68);
  backdrop-filter: blur(6px);
}
.topbar-dialog-form {
  display: grid;
  gap: 18px;
  padding: 24px;
}
.topbar-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.topbar-dialog-kicker {
  display: block;
  margin-bottom: 8px;
  color: #ed442f;
  font: 600 10px/1 'Outfit', Arial, Helvetica, sans-serif;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}
.topbar-dialog-head h2 {
  color: #fff;
  font: 600 26px/1.05 'Space Grotesk', Arial, Helvetica, sans-serif;
}
.topbar-dialog-copy {
  color: #a5a7ae;
  font: 400 14px/1.6 'Outfit', Arial, Helvetica, sans-serif;
}
.topbar-dialog-stack {
  display: grid;
  gap: 14px;
}
.topbar-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.topbar-dialog label {
  display: grid;
  gap: 8px;
}
.topbar-dialog label span {
  color: #989aa2;
  font: 600 11px/1 'Outfit', Arial, Helvetica, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.topbar-dialog input,
.topbar-dialog textarea,
.topbar-dialog select {
  width: 100%;
  border: 1px solid rgba(255,255,255,.1);
  background: #101115;
  color: #f4f4f5;
  padding: 12px 14px;
  font: 400 14px/1.4 'Outfit', Arial, Helvetica, sans-serif;
  outline: none;
}
.topbar-dialog textarea {
  resize: vertical;
  min-height: 110px;
}
.topbar-dialog input:focus,
.topbar-dialog textarea:focus,
.topbar-dialog select:focus {
  border-color: rgba(237,68,47,.6);
}
.topbar-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.topbar-dialog-secondary,
.topbar-dialog-primary,
.topbar-dialog-close {
  min-height: 42px;
  padding: 0 16px;
}
.topbar-dialog-primary:disabled {
  opacity: .6;
  cursor: default;
}
@media (max-width: 720px) {
  .topbar-dialog-grid {
    grid-template-columns: 1fr;
  }
}

.home-eyebrow {
  width: fit-content;
  padding: 8px 16px;
  color: var(--comic-yellow);
  background: var(--comic-dark);
  border: 2px solid var(--comic-dark);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  transform: rotate(-2deg);
  margin-bottom: 6px;
}
@media (max-width: 720px) {
  .home-eyebrow {
    transform: none;
    margin-bottom: 4px;
    font-size: 11px;
  }
}
.home-read-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 2px solid var(--comic-dark);
  border-radius: 6px;
  background: var(--comic-dark);
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: none;
  background: #171214;
  color: var(--comic-cream);
}
.creator-card-cta,
.home-read-btn {
  text-decoration: none;
}
.home-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
}
.home-section-head > div {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.home-section-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(0,0,0,.06);
}
.home-section-index svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}
.home-more {
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  text-transform: uppercase;
}
.home-more svg,
.creator-callout-action svg,
.creator-callout-secondary svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.creator-callout {
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  gap: 18px;
  padding: 54px 48px;
  text-align: center;
  background: #F3F4F6 !important;
}
.creator-callout h2 {
  max-width: 720px;
  font-family: var(--font-display);
  font-size: clamp(42px, 6vw, 78px);
  font-weight: 400;
  line-height: .92;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.creator-callout p:last-child {
  max-width: 800px;
  margin-top: 10px;
  font-size: 18px;
  line-height: 1.45;
}
.creator-callout-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.creator-callout-action,
.creator-callout-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 6px;
  text-decoration: none;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .home-section-head { align-items: center; }
  .home-more {
    min-height: 30px;
    padding: 0 9px;
    font-size: 9px;
  }
  .creator-callout {
    width: 100%;
    gap: 24px;
    padding: 32px 20px;
  }
  .creator-callout-actions {
    width: 100%;
    flex-direction: column;
  }
  .creator-callout-action,
  .creator-callout-secondary {
    width: 100%;
  }
}
.artists-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 24px;
}
.artists-grid-hot {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1120px) {
  .artists-grid-hot { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .artists-grid-hot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .artists-grid-hot { grid-template-columns: 1fr; }
}
.artist-card {
  display: flex;
  width: 100%;
  max-width: none;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease;
  justify-self: stretch;
}

.artist-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-height: 36px;
  min-width: 0;
  padding: 8px 10px;
  border: 2px solid #111827;
  border-radius: 6px;
  box-shadow: 3px 3px 0 #111827;
  font: 700 10px/1 'Space Mono', monospace;
  letter-spacing: .5px;
  white-space: normal;
  text-align: center;
}
.artist-card-link-primary {
  background: #FF5A4F;
  color: #FFFFFF;
  text-decoration: none;
}
.artist-card-link-secondary {
  background: #FFFFFF;
  color: #111827;
  text-decoration: none;
}
.artist-card:hover {
  transform: translate(3px, 3px);
}
.artist-card:hover 
.artist-card:hover .artist-card-link {
  box-shadow: none;
}
.artist-card:hover .artist-card-link-primary {
  background: #111827;
  color: #FFFFFF;
}
.artist-card:hover .artist-card-link-secondary {
  background: #FF5A4F;
  color: #FFFFFF;
}
.artist-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,90,79,.35);
}
@keyframes artist-avatar-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,90,79,.55); }
  50% { box-shadow: 0 0 0 7px rgba(255,90,79,0); }
}
/* ── Book card ───────────────────────────────── */
.lib-card {
  display: flex; flex-direction: column; gap: 14px;
  width: 194px;
  flex: 0 0 194px;
  position: relative;
  text-decoration: none; color: inherit;
  cursor: pointer;
}
.lib-card-shell {
  width: 194px;
  flex: 0 0 194px;
}
.lib-card-shell:not(.lib-placeholder-shell) .lib-card:hover .lib-book { transform: translateY(-4px) scale(1.015); }
.lib-card-shell:not(.lib-placeholder-shell):nth-child(odd) .lib-card:hover .lib-book { transform: translateY(-6px) rotate(-1deg) scale(1.015); }
.lib-card-shell:not(.lib-placeholder-shell):nth-child(even) .lib-card:hover .lib-book { transform: translateY(-6px) rotate(1deg) scale(1.015); }
.lib-card-shell:nth-child(3n+1) .lib-book { transform: rotate(-1.2deg); }
.lib-card-shell:nth-child(3n+2) .lib-book { transform: rotate(.8deg); }
.lib-card-shell:nth-child(3n+3) .lib-book { transform: rotate(-.4deg); }

.lib-book {
  display: flex;
  transition: transform .3s cubic-bezier(.22,.68,.35,1);
}
.lib-card-ranked::before {
  content: '#' attr(data-rank);
  position: absolute;
  left: -5px;
  top: -7px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  background: #f4f1ea;
  color: #151515;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
}
.lib-card-ranked[data-rank="1"]::before {
  background: #d4af37;
  color: #111;
  border-color: rgba(212,175,55,.55);
}
.lib-card-ranked[data-rank="2"]::before {
  background: #c0c0c0;
  color: #111;
  border-color: rgba(192,192,192,.55);
}
.lib-card-ranked[data-rank="3"]::before {
  background: #cd7f32;
  color: #111;
  border-color: rgba(205,127,50,.55);
}

/* Spine */
.lib-book-spine {
  width: 14px;
  border-radius: 3px 0 0 3px;
  background: var(--lc-spine, #0f0f0f);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: inset -2px 0 6px rgba(0,0,0,.3);
}
.lib-book-spine span {
  font-family: var(--font-sans); font-size: 7px; font-weight: 500;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--lc-spine-text, rgba(255,255,255,.5));
  writing-mode: vertical-rl; transform: rotate(180deg);
  white-space: nowrap; overflow: hidden;
  max-height: 100px; text-overflow: ellipsis;
}

/* Cover face */
.lib-book-cover {
  width: 180px; height: 260px;
  border-radius: 0 4px 4px 0;
  background: var(--lc-cover, #0f0f0f) center/cover no-repeat;
  position: relative; overflow: hidden;
  border: none;
  box-shadow: none;
  transition: box-shadow .3s;
  display: flex; flex-direction: column;
}
/* Light overlay */
.lib-book-cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.07) 0%, transparent 40%, rgba(0,0,0,.2) 100%);
  z-index: 1; pointer-events: none;
}

/* Book badges (New, Updated, etc) */
.book-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--color-accent, var(--accent));
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.book-badge-new {
  background: linear-gradient(135deg, var(--accent) 0%, #ff6b4d 100%);
}

/* ── Card info wrapper ───────────────────────────────── */
.lib-card-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding-right: 14px;
}

/* ── Card meta ───────────────────────────────── */
.lib-card-meta {
  display: flex; flex-direction: column; gap: 2px;
  padding-left: 14px;
  flex: 1;
  min-width: 0;
}
.lib-card-name {
  font-family: var(--font-sans); font-weight: 500; font-size: 11px;
  color: var(--ink); letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-card-sub {
  font-family: var(--font-outfit); font-weight: 300; font-size: 10px;
  color: var(--muted);
}
.book-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-left: 14px;
}
.book-card-action {
  gap: 5px;
  height: 30px;
  min-height: 30px;
  padding: 0 10px;
  font-size: 9px;
  box-shadow: 2px 2px 0 var(--ink);
}

/* ── Like button: icon only, no count ── */
.book-card-like.book-card-like {
  display: inline-flex;
  min-width: 30px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  gap: 0;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
}
.book-card-like [data-book-like-count] { display: none; }
.book-card-like.book-card-like svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
  margin: 0;
}
/* Active: keep same bg/border, just fill the heart red */
.book-card-like.active.active {
  background: #fff;
  border-color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  color: var(--ink);
}
.book-card-like.active.active svg {
  fill: var(--accent);
  stroke: var(--accent);
}

/* ── Bookmark/favorite button: bookmark icon only ── */
[data-save-bookmark][data-save-bookmark] {
  display: inline-flex;
  font-size: 0;
  min-width: 30px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  gap: 0;
  justify-content: center;
  align-items: center;
  position: relative;
  border-radius: 50%;
}
[data-save-bookmark]::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23111827' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center/contain no-repeat;
}
/* Active: keep same appearance, just fill bookmark red */
[data-save-bookmark].active[data-save-bookmark] {
  background: #fff;
  border-color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
[data-save-bookmark].active::before {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' fill='%23ff4d2d' stroke='%23ff4d2d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
}
.book-card-action svg,
.profile-like svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.book-card-like,
.profile-like {
  min-width: 38px;
  justify-content: center;
}
.book-card-action.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #FFFFFF;
}
.lib-card-likes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #888;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  flex-shrink: 0;
  padding-right: 2px;
}
.lib-card-likes svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Creator profile card ────────────────────── */
.creator-card {
  display: flex;
  flex-direction: column;
  flex: 0 0 170px;
  width: 170px;
  text-decoration: none;
  color: inherit;
  border: 3px solid #171214;
  box-shadow: 4px 4px 0 #171214;
  background: #fff;
  transition: transform .12s ease, box-shadow .12s ease;
}
.creator-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 6px 6px 0 #171214;
}
.creator-card-head {
  height: 80px;
  background: var(--creator-accent, #FF5A4F);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  border-bottom: 3px solid #171214;
  flex-shrink: 0;
}
.creator-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 12px 14px;
  gap: 3px;
  text-align: center;
}
.creator-card-avatar {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--creator-accent, #FF5A4F);
  color: #fff;
  font: 700 22px 'Sora', Arial, Helvetica, sans-serif;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  margin-top: -35px;
  flex-shrink: 0;
}
.creator-card-avatar.has-img { background: transparent; }
.creator-card-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.creator-card-name {
  color: #171214;
  font: 400 18px/1 'Bangers', Arial, Helvetica, sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: 8px;
}
.creator-card-handle {
  color: #888;
  font: 400 9px 'Space Mono', monospace;
}
.verified-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  vertical-align: middle;
  line-height: 1;
}
.creator-card-stat {
  color: #555;
  font: 500 10px 'Space Grotesk', Arial, Helvetica, sans-serif;
  margin-top: 2px;
}
.creator-card-cta {
  margin-top: 10px !important;
  font-size: 9px !important;
  min-height: 28px !important;
  padding: 0 12px !important;
  box-shadow: 2px 2px 0 #171214 !important;
}

/* ── Empty state ─────────────────────────────── */
.lib-empty {
  width: 100%; padding: 80px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px; font-weight: 300;
}
.lib-empty strong { display: block; font-size: 18px; font-weight: 500; color: var(--ink); margin-bottom: 8px; }

/* ── Footer ───────────────────────────────────── */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 48px 24px 32px;
  background: #0a0a0a;
  border-top: 1px solid rgba(255,255,255,.07);
  text-align: center;
}
.footer-logo-link { display: inline-block; }
.footer-logo-img { height: 44px; width: auto; display: block; }
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 24px;
}
.footer-nav a {
  color: #9CA3AF;
  text-decoration: none;
  font-size: 13px;
  font-family: var(--font-sans);
  transition: color .12s;
}
.footer-nav a:hover { color: #fff; }
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.05);
  width: 100%;
}
.footer-legal a {
  color: #4B5563;
  text-decoration: none;
  font-size: 11px;
  transition: color .12s;
}
.footer-legal a:hover { color: #9CA3AF; }
.footer-copy {
  color: #374151;
  font-size: 11px;
  margin: 0;
}
.site-footer-nav div,
.site-footer-social {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.site-footer a,
.site-footer-nav span {
  margin-bottom: 9px;
  color: #c8c9cd;
  font-size: 12px;
  text-decoration: none;
}
.site-footer a:hover { color: #fff; }
.site-footer-social > div {
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-footer-social-links {
  flex-wrap: wrap;
}
.site-footer-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-bottom: 0;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.04);
}
.site-footer-social-link img {
  display: block;
  width: 16px;
  height: 16px;
}
.site-footer-social-link:hover {
  border-color: rgba(255,255,255,.38);
  background: rgba(255,255,255,.08);
}
.site-footer-bottom {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: #666a73;
  font-family: var(--font-sans);
  font-size: 9px;
  text-transform: uppercase;
}
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 800;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px max(20px, calc((100vw - 1320px) / 2));
  background: rgba(10,12,16,.96);
  border-top: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 -18px 40px rgba(0,0,0,.28);
}
.cookie-banner[hidden] {
  display: none !important;
}
.cookie-banner-copy {
  max-width: 760px;
}
.cookie-banner-copy strong {
  color: #fff;
  font: 600 14px 'Space Grotesk', Arial, Helvetica, sans-serif;
}
.cookie-banner-copy p {
  margin-top: 10px;
  color: #b9c2c8;
  font-size: 12px;
  line-height: 1.65;
}
.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.cookie-banner-link,
.cookie-banner-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.14);
  color: #eef4f7;
  font: 500 11px 'Space Grotesk', Arial, Helvetica, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.cookie-banner-btn {
  background: transparent;
}
.cookie-banner-btn.is-muted {
  background: rgba(255,255,255,.04);
}
.cookie-banner-btn.is-accept {
  border-color: rgba(237,68,47,.4);
  background: #ed442f;
  color: #fff;
}
.cookie-banner-link {
  background: rgba(255,255,255,.04);
}

@media (max-width: 860px) {
  .site-footer {
    grid-template-columns: 1fr;
    gap: 34px;
    padding: 40px 20px 22px;
  }
  .site-footer-nav { grid-template-columns: repeat(3, 1fr); }
  .cookie-banner {
    display: grid;
    justify-content: stretch;
    padding: 16px 20px;
  }
}
@media (max-width: 520px) {
  .site-footer-nav { grid-template-columns: repeat(3, 1fr); gap: 20px 12px; }
  .site-footer-bottom { flex-direction: column; }
  .cookie-banner-actions {
    align-items: stretch;
  }
  .cookie-banner-link,
  .cookie-banner-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Modal dialog ─────────────────────── */
#lib-modal {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.45); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
#lib-modal-box {
  background: rgba(18,18,18,.97);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  padding: 32px 32px 26px;
  width: 100%; max-width: 360px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  opacity: 0; transform: scale(.95) translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}
#lib-modal-box.show { opacity: 1; transform: none; }
#lib-modal-msg {
  font-family: var(--font-outfit); font-size: 15px; font-weight: 400;
  color: #eee; line-height: 1.55; margin-bottom: 20px;
}
#lib-modal-msg strong { color: #fff; font-weight: 600; }
#lib-modal-msg span   { font-size: 12px; color: #888; display: block; margin-top: 6px; }
#lib-modal-input-wrap { margin-bottom: 20px; }
#lib-modal-input {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; color: #fff;
  font-family: var(--font-outfit); font-size: 14px;
  outline: none; transition: border-color .2s;
}
#lib-modal-input:focus { border-color: rgba(255,255,255,.35); }
#lib-modal-select-wrap { margin-bottom: 20px; }
#lib-modal-select {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; color: #fff;
  font-family: var(--font-outfit); font-size: 14px;
  outline: none; cursor: pointer;
}
#lib-modal-select option { background: #1a1a1a; color: #fff; }
#lib-modal-btns {
  display: flex; justify-content: flex-end; gap: 10px;
}
#lib-modal-btns button {
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
#lib-modal-cancel {
  background: #FFFFFF;
  color: var(--ink);
}
#lib-modal-cancel:hover {
  transform: translate(3px, 3px);
  box-shadow: none;
  background: var(--accent);
  color: #FFFFFF;
}
#lib-modal-ok {
  background: rgba(255,255,255,.12); color: #fff;
}
#lib-modal-ok:hover { background: rgba(255,255,255,.22); }
#lib-modal-ok.danger { background: rgba(220,30,30,.25); color: #ff6b6b; }
#lib-modal-ok.danger:hover { background: rgba(220,30,30,.45); color: #fff; }

