/* =========================================================
   StoryVerse Design System
   ========================================================= */

:root {
  --primary: #6C4CE3;
  --primary-dark: #5538c8;
  --primary-soft: #F0ECFF;
  --secondary: #171725;
  --background: #F8F8FC;
  --surface: #FFFFFF;
  --text: #242433;
  --muted: #85859A;
  --border: #E6E6EF;
  --success: #1F9D63;
  --danger: #D64545;
  --warning: #C98516;
  --info: #2F6FED;
  --shadow-sm: 0 2px 8px rgba(23, 23, 37, 0.06);
  --shadow-md: 0 10px 30px rgba(23, 23, 37, 0.08);
  --shadow-lg: 0 20px 50px rgba(23, 23, 37, 0.12);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-full: 999px;
  --font-sans: "Source Sans 3", "Segoe UI", sans-serif;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --container: 1180px;
  --header-h: 72px;
  --transition: 0.22s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition), opacity var(--transition);
}

button,
input,
textarea,
select {
  font: inherit;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  line-height: 1.15;
  font-weight: 600;
  margin: 0 0 0.6em;
  color: var(--secondary);
}

p {
  margin: 0 0 1rem;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.muted {
  color: var(--muted);
}

.section {
  padding: 4.5rem 0;
}

.section--tight {
  padding: 3rem 0;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0;
}

.section-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.link-more {
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}

.link-more:hover {
  color: var(--primary-dark);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-full);
  border: 1.5px solid transparent;
  background: var(--secondary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--primary);
  box-shadow: 0 8px 20px rgba(108, 76, 227, 0.28);
}

.btn--primary:hover {
  background: var(--primary-dark);
}

.btn--secondary {
  background: var(--secondary);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn--ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn--soft {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn--soft:hover {
  background: #e4dcff;
}

.btn--outline-light {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}

.btn--outline-light:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn--sm {
  padding: 0.55rem 1rem;
  font-size: 0.92rem;
}

.btn--lg {
  padding: 1rem 1.7rem;
  font-size: 1.05rem;
}

.btn--block {
  width: 100%;
}

/* ---------- Brand / Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 248, 252, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(230, 230, 239, 0.8);
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--secondary);
}

.brand__mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #8b74f0);
  color: #fff;
  font-size: 0.95rem;
}

.brand--light {
  color: #fff;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.main-nav__links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.main-nav__links > li > a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-full);
  color: var(--text);
  font-weight: 500;
}

.main-nav__links > li > a:hover,
.main-nav__links > li > a.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.main-nav__actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--secondary);
  border-radius: 2px;
}

/* ---------- Dropdown ---------- */
.has-dropdown {
  position: relative;
}

.dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
  z-index: 50;
}

.dropdown--right {
  left: auto;
  right: 0;
}

.dropdown--wide {
  min-width: 240px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.15rem;
}

.dropdown a,
.dropdown button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.dropdown a:hover,
.dropdown button:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.dropdown hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0.35rem 0;
}

.dropdown__more {
  grid-column: 1 / -1;
  font-weight: 600;
  color: var(--primary) !important;
}

.has-dropdown:hover > .dropdown,
.has-dropdown:focus-within > .dropdown,
.has-dropdown.is-open > .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.75rem 0.3rem 0.3rem;
  cursor: pointer;
}

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.badge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-soft);
}

.avatar--sm {
  width: 32px;
  height: 32px;
}

.avatar--lg {
  width: 88px;
  height: 88px;
}

/* ---------- Alerts ---------- */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0 0;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.alert--success {
  background: #e8f8f0;
  color: #146b43;
  border-color: #bfe9d3;
}

.alert--error {
  background: #fdeeee;
  color: #9d2f2f;
  border-color: #f3c4c4;
}

.alert--info {
  background: #eef3fd;
  color: #244fa8;
  border-color: #c9d8f7;
}

.alert__close {
  border: 0;
  background: transparent;
  font-size: 1.25rem;
  cursor: pointer;
  color: inherit;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--secondary);
}

.form-control {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108, 76, 227, 0.12);
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.form-hint {
  margin-top: 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.form-error {
  margin-top: 0.35rem;
  font-size: 0.88rem;
  color: var(--danger);
}

.search-bar {
  display: flex;
  gap: 0.65rem;
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 0.4rem;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.search-bar .form-control {
  border: 0;
  box-shadow: none;
  background: transparent;
  border-radius: var(--radius-full);
}

.search-bar .form-control:focus {
  box-shadow: none;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
}

.badge--dark {
  background: rgba(23, 23, 37, 0.08);
  color: var(--secondary);
}

.badge--success {
  background: #e8f8f0;
  color: #146b43;
}

.genre-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.genre-chip {
  cursor: pointer;
}

.genre-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.genre-chip span {
  display: inline-flex;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.genre-chip input:checked + span,
.genre-chip:hover span {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.genre-chip input:focus-visible + span {
  box-shadow: 0 0 0 4px rgba(108, 76, 227, 0.12);
}

/* ---------- Cards ---------- */
.story-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(230, 230, 239, 0.9);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.story-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.story-card__cover {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--primary-soft);
}

.story-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.story-card:hover .story-card__cover img {
  transform: scale(1.04);
}

.story-card__body {
  padding: 1.15rem 1.2rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.story-card__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
}

.story-card__title {
  font-size: 1.35rem;
  margin: 0;
}

.story-card__title a:hover {
  color: var(--primary);
}

.story-card__excerpt {
  color: var(--muted);
  margin: 0;
  flex: 1;
}

.story-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.4rem;
  font-size: 0.9rem;
}

.author-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  font-weight: 500;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.4rem;
}

.story-grid--featured {
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.4rem;
}

.story-card--featured {
  min-height: 100%;
}

.story-card--featured .story-card__cover {
  aspect-ratio: 16 / 11;
}

.story-card--featured .story-card__title {
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
}

.author-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.author-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.author-card .avatar {
  margin: 0 auto 0.9rem;
}

.author-card h3 {
  margin-bottom: 0.25rem;
  font-size: 1.25rem;
}

.author-card__stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 0.9rem 0 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.category-card {
  position: relative;
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 160px;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.category-card__media {
  position: absolute;
  inset: 0;
}

.category-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(23, 23, 37, 0.15), rgba(23, 23, 37, 0.78));
}

.category-card__content {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.2rem;
}

.category-card h3 {
  color: #fff;
  margin: 0;
  font-size: 1.4rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.author-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5.5rem 0 4.5rem;
  background:
    radial-gradient(circle at 12% 20%, rgba(108, 76, 227, 0.18), transparent 35%),
    radial-gradient(circle at 88% 10%, rgba(108, 76, 227, 0.12), transparent 28%),
    linear-gradient(180deg, #efeafc 0%, var(--background) 70%);
}

.hero::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -80px;
  top: -60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108, 76, 227, 0.18), transparent 70%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items: center;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(108, 76, 227, 0.15);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 1.1rem;
}

.hero h1 {
  font-size: clamp(2.7rem, 6vw, 4.4rem);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero__lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 34rem;
  margin-bottom: 1.6rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.25rem;
}

.hero-visual {
  position: relative;
}

.hero-stack {
  display: grid;
  gap: 1rem;
}

.hero-panel {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  box-shadow: var(--shadow-md);
}

.hero-panel--accent {
  background: linear-gradient(145deg, var(--primary), #8a72ef);
  color: #fff;
  border: 0;
}

.hero-panel--accent h3,
.hero-panel--accent p {
  color: #fff;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.hero-stat {
  text-align: center;
  padding: 0.85rem 0.5rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
}

.hero-stat strong {
  display: block;
  font-size: 1.35rem;
  font-family: var(--font-display);
}

.hero-stat span {
  font-size: 0.8rem;
  opacity: 0.85;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--muted);
}

.empty-state i {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

/* ---------- CTA ---------- */
.cta {
  margin: 1rem 0 4rem;
}

.cta__inner {
  border-radius: 28px;
  padding: 3.2rem;
  background:
    radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0.16), transparent 30%),
    linear-gradient(135deg, #171725 0%, #2b2158 55%, #6C4CE3 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  box-shadow: var(--shadow-lg);
}

.cta h2 {
  color: #fff;
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  margin-bottom: 0.5rem;
}

.cta p {
  margin: 0;
  max-width: 34rem;
  color: rgba(255, 255, 255, 0.82);
}

.cta__actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--secondary);
  color: rgba(255, 255, 255, 0.78);
  padding-top: 3.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2rem;
  padding-bottom: 2.5rem;
}

.footer-brand p {
  margin-top: 1rem;
  max-width: 28rem;
}

.footer-heading {
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.footer-links {
  display: grid;
  gap: 0.55rem;
}

.footer-links a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-bottom__inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  font-size: 0.92rem;
}

.footer-bottom p {
  margin: 0;
}

/* ---------- Pagination ---------- */
.pagination ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 2rem;
}

.pagination__link {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
}

.pagination__link.is-active,
.pagination__link:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- Auth pages (shared) ---------- */
.auth-shell {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  place-items: center;
  padding: 2.5rem 1rem;
}

.auth-card {
  width: min(100%, 460px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.auth-card h1 {
  font-size: 2rem;
  margin-bottom: 0.35rem;
}

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-center { text-align: center; }

.fade-up {
  animation: fadeUp 0.7s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Explore / discovery ---------- */
.page-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin: 0;
}

.explore-search {
  max-width: 760px;
  margin-bottom: 1.75rem;
}

.explore-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.75rem;
  align-items: start;
}

.explore-filters {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}

.filter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.filter-card h2 {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--background);
  font-size: 0.88rem;
  font-weight: 600;
}

.chip:hover,
.chip.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.filter-list {
  display: grid;
  gap: 0.2rem;
  max-height: 280px;
  overflow: auto;
}

.filter-list a {
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  font-weight: 500;
}

.filter-list a:hover,
.filter-list a.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.category-hero {
  position: relative;
  min-height: 280px;
  display: grid;
  align-items: end;
  color: #fff;
  overflow: hidden;
}

.category-hero__media {
  position: absolute;
  inset: 0;
}

.category-hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(23, 23, 37, 0.25), rgba(23, 23, 37, 0.82));
}

.category-hero__content {
  position: relative;
  z-index: 1;
  padding: 3.5rem 0 2.5rem;
}

.category-hero__content h1 {
  color: #fff;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin: 0.75rem 0 0.5rem;
}

.category-hero__content p {
  max-width: 40rem;
  color: rgba(255, 255, 255, 0.88);
}

/* ---------- Story detail ---------- */
.story-detail__grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.story-detail__cover {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  aspect-ratio: 3 / 4;
  background: var(--primary-soft);
}

.story-detail__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-detail__cta {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.story-detail__title {
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0.75rem 0;
}

.story-detail__desc {
  font-size: 1.12rem;
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0 1.5rem;
}

.story-author-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.75rem;
}

.chapter-panel,
.story-excerpt-panel,
.comments-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.chapter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.chapter-list a {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--background);
}

.chapter-list a:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.chapter-list__order {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--secondary);
  color: #fff;
  font-weight: 700;
}

.chapter-list__body {
  display: grid;
  gap: 0.15rem;
}

.story-excerpt-panel {
  position: relative;
}

.story-excerpt {
  max-height: 320px;
  overflow: hidden;
}

.story-excerpt-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 70px;
  height: 120px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), var(--surface));
  pointer-events: none;
}

.page-reader .site-footer {
  display: none;
}

.author-profile-card {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  text-align: left;
  padding: 2rem;
}

.comment-form {
  margin-bottom: 1.25rem;
}

.comment-form--reply {
  margin-top: 0.75rem;
}

.comments-list {
  display: grid;
  gap: 1rem;
}

.comment-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.comment-item--reply {
  margin-top: 0.75rem;
}

.comment-item__body {
  flex: 1;
  min-width: 0;
}

.comment-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.25rem;
}

.comment-item__content {
  line-height: 1.6;
}

.comment-item__actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.comment-replies {
  margin-top: 0.75rem;
  padding-left: 0.5rem;
  border-left: 2px solid var(--border);
}

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.linkish--danger {
  color: var(--danger);
}

/* Image upload previews */
.image-upload {
  display: grid;
  gap: 0.65rem;
}

.image-upload--profile {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.image-upload__preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--primary-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
}

.image-upload__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-upload__preview--cover {
  width: 96px;
  height: 128px;
}

.image-upload__preview--avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  flex-shrink: 0;
}

.image-upload__preview--category {
  width: 100%;
  max-width: 240px;
  height: 130px;
}

.image-upload__placeholder {
  padding: 0.75rem;
  text-align: center;
}

.image-upload__remove {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.92rem;
  color: var(--muted);
}

.image-upload.has-preview .image-upload__preview {
  border-style: solid;
  border-color: var(--primary);
}

@media (max-width: 640px) {
  .author-profile-card {
    flex-direction: column;
    text-align: center;
  }

  .author-profile-card .author-card__stats {
    justify-content: center;
  }

  .image-upload--profile {
    flex-direction: column;
    align-items: flex-start;
  }
}
