/* TSmanhwa typography system: Kanit Light for content and Kanit Bold for emphasis. */
@font-face {
  font-family: "Kanit";
  src: url("../fonts/kanit-light.woff2") format("woff2");
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Kanit";
  src: url("../fonts/kanit-bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --font-body: "Kanit", Tahoma, Arial, sans-serif;
  --font-heading: "Kanit", Tahoma, Arial, sans-serif;
  --font-navigation: "Kanit", Tahoma, Arial, sans-serif;
  --page-ink: #04060c;
  --page-navy: #07101e;
  --page-plum: #170b18;
  --page-gradient:
    radial-gradient(110% 76% at -8% -12%, rgba(22, 54, 92, 0.78) 0%, rgba(10, 24, 45, 0.34) 38%, transparent 62%),
    radial-gradient(86% 64% at 108% -4%, rgba(91, 22, 52, 0.34) 0%, rgba(42, 12, 32, 0.14) 42%, transparent 66%),
    radial-gradient(64% 48% at 50% 108%, rgba(8, 39, 51, 0.2) 0%, transparent 70%),
    linear-gradient(145deg, var(--page-navy) 0%, var(--page-ink) 46%, #080b14 76%, var(--page-plum) 132%);
  --page-surface-gradient:
    linear-gradient(180deg, rgba(5, 8, 15, 0.5) 0%, rgba(4, 6, 12, 0.78) 48%, rgba(6, 8, 15, 0.7) 100%);
  --page-chrome-gradient:
    linear-gradient(135deg, rgba(7, 11, 19, 0.92), rgba(5, 7, 13, 0.82));
}

/* One continuous dark-mode canvas for every page. */
html {
  min-height: 100%;
  background-color: var(--page-ink) !important;
}

body {
  min-height: 100vh;
  background: var(--page-gradient) !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
}

body.ts-page-public .page-wrap,
body[data-page-slug="series"] .page-wrap {
  background: var(--page-surface-gradient) !important;
}

:where(.topbar, .navbar, .footer) {
  background: var(--page-chrome-gradient) !important;
  border-color: rgba(148, 163, 184, 0.14) !important;
}

:where(html, body, input, select, textarea, option) {
  font-family: var(--font-body) !important;
  font-weight: 300;
}

body {
  font-size: 16px !important;
  line-height: 1.6;
  letter-spacing: normal;
}

:where(input, select, textarea, option) {
  font-size: inherit;
}

:where(code, pre, kbd, samp) {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace !important;
}

/* Keep the compact primary navigation light and promote only the active item. */
:where(.topbar .navbar-links a, header .navbar-links a) {
  font-family: var(--font-navigation) !important;
  font-weight: 300 !important;
  line-height: 1.45;
}

:where(.topbar .navbar-links a.active, header .navbar-links a.active) {
  font-weight: 700 !important;
}

/* This late-loading role layer intentionally wins over page-local legacy rules. */
:where(
  button,
  [role="button"],
  [role="tab"],
  b,
  strong,
  h2,
  h3,
  h4,
  h5,
  h6,
  [class~="title"],
  [class$="-title"],
  [class*="-title "],
  [class$="_title"],
  [class*="_title "],
  .latest-chapter-series,
  .hot-board-name,
  .translator-name
) {
  font-family: var(--font-heading) !important;
  font-weight: 700 !important;
  line-height: 1.35;
  letter-spacing: normal !important;
}

:where(
  h1,
  .navbar-logo,
  .brand,
  .brand-name,
  .logo-text,
  .hero-title,
  .series-title,
  .page-title,
  .kpi-value,
  .metric-value,
  .stat-value,
  .summary-value,
  .coin-value,
  .tx-amount,
  .rank,
  .popular-rank,
  .weekly-rank-number
) {
  font-family: var(--font-heading) !important;
  font-weight: 700 !important;
  line-height: 1.35;
  letter-spacing: normal !important;
}

@media (max-width: 780px) {
  body {
    font-size: 15px !important;
    line-height: 1.6;
    background-attachment: scroll !important;
  }

  :where(
    .topbar,
    .navbar,
    .glass,
    .glass-card,
    .mobile-nav,
    .bottom-nav,
    .filter-bar,
    .search-bar,
    .modal-content
  ) {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
