/*
Theme Name: Novel Reader
Theme URI: https://example.com/novel-reader
Description: Premium editorial reading theme for AI story fiction on WordPress. Cinematic, typography-led, mobile-first, fast (no jQuery, system + one webfont, JS defer), dark mode, paragraph pagination, bookmark, reading history, progress bar, font controls. Designed to pair with the "Novel Manager" plugin.
Version: 3.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Author: Novel Suite
License: GPL v2 or later
Text Domain: novel-reader
*/

/* ============ Editorial Design Tokens ============ */
:root {
  /* Paper & ink */
  --bg:        #f5efe4;          /* cream paper */
  --bg-2:      #ebe2cf;          /* aged paper */
  --paper:     #faf6ec;          /* bright paper */
  --card:      #fbf7ed;          /* card paper */
  --ink:       #1a1410;          /* deep ink */
  --ink-2:     #4a4239;          /* soft ink */
  --ink-3:     #8a7e6c;          /* faded ink */
  --line:      #e6dbc4;          /* hairline */
  --line-strong:#d4c4a4;         /* strong rule */

  /* Accent palette */
  --accent:    #a8341e;          /* burnt sienna */
  --accent-ink:#faf6ec;
  --accent-soft:#f0dccb;
  --gold:      #b78b3c;          /* antique gold */
  --gold-soft: #e9d3a3;
  --teal:      #2e5a52;          /* patina green */
  --danger:    #b3261e;
  --ok:        #3d6b3c;

  /* Editorial shadows */
  --shadow:    0 1px 0 rgba(26,20,16,.05), 0 24px 48px -24px rgba(60,42,18,.32);
  --shadow-soft:0 1px 0 rgba(26,20,16,.04), 0 10px 28px -16px rgba(60,42,18,.22);
  --shadow-book:0 18px 40px -14px rgba(40,28,12,.45);
  --shadow-deep:0 30px 60px -20px rgba(40,28,12,.55);

  /* Type */
  --font-sans: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif:"Libre Bodoni", "Playfair Display", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-display:"Libre Bodoni", "Playfair Display", Georgia, serif;
  --font-read: "Source Serif 4", "Crimson Text", "Noto Serif", Georgia, serif;
  --font-caps: "Libre Bodoni", Georgia, serif;

  --read-size: 19px;
  --read-lh:   1.9;
  --read-font: var(--font-read);

  /* Spacing & radius */
  --radius:    4px;              /* tight, magazine-like */
  --radius-sm: 2px;
  --radius-lg: 8px;
  --maxw:      1240px;
  --read-maxw: 680px;

  /* Motion */
  --ease:      cubic-bezier(.22, 1, .36, 1);
  --dur:       260ms;

  /* Z-index */
  --z-header:  200;
  --z-progress:400;
  --z-drawer:  300;
  --z-notif:   350;
}

html[data-theme="dark"] {
  --bg:        #0e0c0a;
  --bg-2:      #181410;
  --paper:     #14110d;
  --card:      #181410;
  --ink:       #ece5d6;
  --ink-2:     #a89e8b;
  --ink-3:     #736a5a;
  --line:      #2a241d;
  --line-strong:#3a3229;

  --shadow:    0 1px 0 rgba(0,0,0,.4), 0 28px 56px -16px rgba(0,0,0,.75);
  --shadow-soft:0 1px 0 rgba(0,0,0,.3), 0 12px 28px rgba(0,0,0,.45);
  --shadow-book:0 22px 48px -10px rgba(0,0,0,.7);
  --shadow-deep:0 40px 80px -20px rgba(0,0,0,.85);

  --accent:    #c4573a;
  --accent-ink:#0e0c0a;
  --accent-soft:#3a2418;
  --gold:      #d8a85a;
  --gold-soft: #3a2e18;
  --teal:      #5b8a80;
  --danger:    #d85a4e;
  --ok:        #6fb07a;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1400px 520px at 6% -8%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    radial-gradient(1100px 480px at 100% 2%, color-mix(in srgb, var(--gold) 8%, transparent), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100dvh;
  transition: background .3s ease, color .3s ease;
  font-feature-settings: "kern", "liga", "calt";
}

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

h1,h2,h3,h4 {
  line-height: 1.18;
  margin: 0 0 .55em;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
}
h1 { font-size: clamp(2.2rem, 4.5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 1.8vw, 1.45rem); }

p { margin: 0 0 1em; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.screen-reader-text { position: absolute; left: -9999px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* Subtle paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 0);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}
html[data-theme="dark"] body::before { opacity: .25; mix-blend-mode: screen; }
body > * { position: relative; z-index: 1; }

button, .btn, .icon-btn, .genre-chip, .tag, .rt-btn, .page-numbers, .novel-card, .search-hero button {
  cursor: pointer;
  font-family: inherit;
}

/* ============ Header ============ */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.5) blur(20px);
  -webkit-backdrop-filter: saturate(1.5) blur(20px);
}
.site-header::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 20%, var(--line-strong) 80%, transparent);
  opacity: .6;
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 76px; }

.site-brand {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--font-display); font-size: 24px; font-weight: 700;
  letter-spacing: -0.035em; color: var(--ink); text-decoration: none;
  line-height: 1;
}
.site-brand:hover { text-decoration: none; color: var(--ink); }
.site-brand em, .site-brand .accent { color: var(--accent); font-style: italic; }
.brand-mark {
  width: 46px; height: 46px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--ink);
  position: relative;
  border-radius: 2px;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.site-brand:hover .brand-mark {
  background: var(--accent);
  transform: translateY(-1px);
}
.brand-mark svg { width: 26px; height: 26px; stroke: var(--paper); display: block; }
.brand-mark::after {
  content: "";
  position: absolute;
  top: 6px; right: 6px;
  width: 4px; height: 14px;
  background: var(--gold);
  border-radius: 1px;
}
.brand-name {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  position: relative;
}
.brand-name .name-main { font-weight: 700; color: var(--ink); }
.brand-name .name-accent {
  color: var(--accent);
  font-style: italic;
  font-weight: 700;
  position: relative;
  margin-left: 1px;
}
.brand-name::after {
  content: "✦";
  position: absolute;
  top: -8px;
  right: -14px;
  font-size: 11px;
  color: var(--gold);
  font-style: normal;
  font-weight: 400;
}
.custom-logo-link img { height: 38px; width: auto; display: block; }

.main-nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.main-nav .menu, .main-nav ul {
  display: flex; align-items: center; gap: 2px;
  list-style: none; margin: 0; padding: 0;
}
.main-nav li { margin: 0; }
.main-nav a {
  color: var(--ink-2); padding: 10px 16px; border-radius: 0;
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
  min-height: 40px; display: inline-flex; align-items: center;
  position: relative;
  transition: color var(--dur) var(--ease);
}
.main-nav a::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 6px;
  height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.main-nav a:hover { color: var(--accent); text-decoration: none; }
.main-nav a:hover::after,
.main-nav .current-menu-item a::after,
.main-nav .current_page_item a::after { transform: scaleX(1); }
.main-nav .current-menu-item a,
.main-nav .current_page_item a { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  background: transparent;
  border: 1px solid var(--line); color: var(--ink-2);
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.icon-btn:hover { border-color: var(--ink); color: var(--ink); background: var(--paper); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.menu-toggle { display: none; }
.header-search { display: none; padding: 0 0 18px; }
.header-search.is-open { display: block; }

@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .main-nav {
    position: fixed; inset: 76px 0 auto 0; background: var(--bg);
    flex-direction: column; align-items: stretch; padding: 14px 24px 22px; display: none;
    border-bottom: 1px solid var(--line); box-shadow: var(--shadow-soft);
  }
  .main-nav .menu, .main-nav ul { flex-direction: column; align-items: stretch; width: 100%; }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 14px 12px; min-height: 48px; }
}

/* ============ Reading progress ============ */
.read-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent);
  z-index: var(--z-progress);
  transition: width .08s linear;
  box-shadow: 0 0 8px var(--accent);
}

/* ============ Hero (home) ============ */
.hero {
  padding: 72px 0 32px;
  position: relative;
}
.hero::before {
  content: "THE LIBRARY";
  position: absolute; top: 30px; left: 24px;
  font-family: var(--font-sans); font-size: 11px; font-weight: 700;
  letter-spacing: .3em; color: var(--ink-3);
}
.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 64px;
  align-items: center;
}

.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--font-sans); font-size: 11px;
  letter-spacing: .26em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 28px; font-weight: 700;
}
.hero .eyebrow::before {
  content: "❦"; font-size: 18px; color: var(--gold);
}

.hero h1 {
  font-family: var(--font-display); font-size: clamp(40px, 6.4vw, 76px);
  font-weight: 700; letter-spacing: -0.035em; line-height: 1.02;
  max-inline-size: 16ch; text-wrap: balance; margin: 0 0 22px;
}
.hero h1 em {
  font-style: italic; color: var(--accent); font-weight: 700;
}

.hero .lede {
  color: var(--ink-2);
  font-family: var(--font-serif); font-size: 19px;
  font-style: italic; line-height: 1.6;
  max-width: 540px; margin: 0 0 32px;
}

.search-hero { display: flex; max-width: 560px; gap: 0; margin-top: 8px; }
.search-hero input {
  flex: 1; min-height: 54px; padding: 14px 22px;
  border-radius: 0;
  border: 1px solid var(--ink); border-right: 0;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-serif); font-size: 17px; font-style: italic;
  outline: none;
  transition: background var(--dur) var(--ease);
}
.search-hero input::placeholder { color: var(--ink-3); }
.search-hero input:focus { background: var(--bg); }
.search-hero button {
  padding: 0 32px; min-height: 54px; border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-sans); font-weight: 700; font-size: 12px;
  letter-spacing: .2em; text-transform: uppercase;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.search-hero button:hover { background: var(--accent); border-color: var(--accent); }

.hero-actions {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
  margin-top: 26px; padding-top: 22px;
  border-top: 1px solid var(--line);
}
.hero-actions .meta {
  font-family: var(--font-sans); font-size: 13px; color: var(--ink-3);
  letter-spacing: .04em;
}
.hero-actions .meta b { color: var(--ink); font-weight: 700; }

/* Featured story - editorial callout */
.featured-story {
  display: grid; grid-template-columns: 150px 1fr; gap: 24px;
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-book);
  text-decoration: none; color: inherit;
  position: relative;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.featured-story::before {
  content: ""; position: absolute; top: 8px; left: 8px; right: 8px; bottom: 8px;
  border: 1px solid var(--gold-soft); pointer-events: none;
  opacity: .5;
}
.featured-story:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-deep);
  text-decoration: none; color: inherit;
}
.featured-story .cover {
  aspect-ratio: 2 / 3; overflow: hidden;
  box-shadow: var(--shadow-book); background: var(--bg-2); position: relative;
  border-radius: 2px;
}
.featured-story .cover img,
.featured-story .cover .placeholder {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.featured-story .cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 70%, rgba(0,0,0,.4));
  pointer-events: none;
}
.featured-story .body { display: flex; flex-direction: column; }
.featured-story .kicker {
  font-family: var(--font-sans); font-size: 10px; letter-spacing: .24em;
  text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 10px;
  display: inline-flex; align-items: center; gap: 8px;
}
.featured-story .kicker::before {
  content: ""; width: 18px; height: 1px; background: var(--accent);
}
.featured-story h2 {
  font-family: var(--font-display); font-size: clamp(22px, 2.4vw, 30px);
  margin: 0 0 10px; line-height: 1.15; font-weight: 700;
}
.featured-story .excerpt {
  color: var(--ink-2); font-family: var(--font-serif); font-size: 14.5px;
  font-style: italic; line-height: 1.55;
  margin: 0 0 14px; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.featured-meta {
  display: flex; flex-wrap: wrap; gap: 14px; font-family: var(--font-sans);
  font-size: 11.5px; color: var(--ink-3);
  letter-spacing: .04em; text-transform: uppercase;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.featured-meta b { color: var(--ink); font-weight: 700; }

@media (max-width: 980px) {
  .hero-layout { grid-template-columns: 1fr; gap: 36px; }
  .hero h1 { max-inline-size: none; }
}

/* ============ Genre rail ============ */
.genre-rail { display: flex; flex-wrap: wrap; gap: 8px; }
.genre-chip {
  font-family: var(--font-sans); font-size: 12px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-2); background: transparent; border: 1px solid var(--line-strong);
  border-radius: 0; padding: 10px 18px; min-height: 40px;
  display: inline-flex; align-items: center; text-decoration: none;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.genre-chip:hover { color: var(--paper); border-color: var(--ink); background: var(--ink); text-decoration: none; }

/* ============ Novel grid ============ */
.novel-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 36px 22px;
}
.novel-card {
  background: transparent; border: 0; border-radius: 0;
  overflow: visible; display: flex; flex-direction: column; color: var(--ink);
  text-decoration: none;
  transition: transform var(--dur) var(--ease);
}
.novel-card:hover { transform: translateY(-4px); text-decoration: none; }

.novel-cover {
  position: relative; aspect-ratio: 2 / 3; background: var(--bg-2);
  overflow: hidden; margin-bottom: 14px;
  box-shadow: var(--shadow-book);
  border: 1px solid var(--ink);
  transition: box-shadow var(--dur) var(--ease);
}
.novel-card:hover .novel-cover { box-shadow: var(--shadow-deep); }
.novel-cover::before {
  content: ""; position: absolute; inset: 4px;
  border: 1px solid var(--gold-soft); z-index: 2; pointer-events: none;
  opacity: 0; transition: opacity var(--dur) var(--ease);
}
.novel-card:hover .novel-cover::before { opacity: .7; }

.novel-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .6s var(--ease), filter .4s var(--ease);
  filter: saturate(.95) contrast(1.02);
}
.novel-card:hover .novel-cover img { transform: scale(1.06); filter: saturate(1.1); }

.novel-cover .placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 22px; color: var(--paper); font-weight: 700;
  font-style: italic; padding: 20px; text-align: center;
  letter-spacing: -.01em; line-height: 1.2;
  background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--ink)));
}
.novel-cover .placeholder::before {
  content: ""; position: absolute; inset: 8px; border: 1px solid rgba(255,255,255,.25);
}

.badge {
  position: absolute; top: 12px; left: 12px; font-size: 9.5px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; padding: 5px 10px;
  font-family: var(--font-sans);
  z-index: 3;
}
.badge.ongoing { background: var(--paper); color: var(--ok); border: 1px solid var(--ok); }
.badge.completed { background: var(--ink); color: var(--gold); border: 1px solid var(--gold); }
.badge.unread { position: static; background: var(--danger); color: #fff; }

.novel-card .card-body { padding: 0; text-align: center; }
.novel-card h3 {
  font-family: var(--font-display); font-size: 17px; font-weight: 700;
  margin: 0 0 4px; line-height: 1.25; letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.novel-card h3 em { font-style: italic; }
.novel-card .author {
  font-family: var(--font-serif); font-size: 13px; font-style: italic;
  color: var(--ink-3); margin: 0 0 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-meta {
  display: flex; justify-content: center; align-items: center; gap: 12px;
  font-family: var(--font-sans); font-size: 11px; color: var(--ink-3);
  letter-spacing: .1em; text-transform: uppercase;
}
.stars { color: var(--gold); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.star-icon { width: 11px; height: 11px; fill: currentColor; }
.novel-card .chapters { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.novel-card .chapters::before { content: "·"; margin-right: 8px; color: var(--ink-3); }

/* ============ Section ============ */
.section { padding: 56px 0 12px; position: relative; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 32px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
  position: relative;
}
.section-head::after {
  content: ""; position: absolute; left: 0; bottom: -2px; width: 60px; height: 2px;
  background: var(--accent);
}
.section-head h2 {
  font-family: var(--font-display); font-size: clamp(26px, 3vw, 34px);
  font-weight: 700; margin: 0; letter-spacing: -0.025em; line-height: 1.1;
}
.section-head h2 em { font-style: italic; color: var(--accent); }
.section-head .subtitle {
  display: block; font-family: var(--font-sans); font-size: 11px;
  font-weight: 600; letter-spacing: .24em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 8px;
}
.section-head a {
  font-family: var(--font-sans); font-size: 12px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; white-space: nowrap;
  position: relative; padding-bottom: 4px;
}
.section-head a::after {
  content: "→"; margin-left: 6px; display: inline-block;
  transition: transform var(--dur) var(--ease);
}
.section-head a:hover { text-decoration: none; }
.section-head a:hover::after { transform: translateX(4px); }

/* ============ Novel detail ============ */
.novel-hero {
  display: grid; grid-template-columns: 280px 1fr; gap: 56px;
  padding: 56px 0 28px;
  align-items: start;
}
.novel-hero .cover {
  flex: 0 0 auto; position: relative;
  box-shadow: var(--shadow-deep);
}
.novel-hero .cover img {
  width: 100%; height: auto; border-radius: 2px; box-shadow: var(--shadow-book);
  border: 1px solid var(--ink); display: block;
}
.novel-hero .cover .placeholder {
  width: 100%; aspect-ratio: 2 / 3; border-radius: 2px;
  box-shadow: var(--shadow-book); border: 1px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 28px; color: var(--paper);
  font-weight: 700; font-style: italic; padding: 20px; text-align: center;
  background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--ink)));
  position: relative;
}
.novel-hero .cover .placeholder::before {
  content: ""; position: absolute; inset: 12px; border: 1px solid rgba(255,255,255,.25);
}
.novel-hero-info { flex: 1; min-width: 0; }
.novel-hero-info .eyebrow {
  font-family: var(--font-sans); font-size: 11px; letter-spacing: .24em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 16px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 10px;
}
.novel-hero-info .eyebrow::before {
  content: ""; width: 24px; height: 1px; background: var(--accent);
}
.novel-hero-info h1 {
  font-family: var(--font-display); font-size: clamp(34px, 4.8vw, 56px);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; margin-bottom: 12px;
}
.novel-hero-info h1 em { font-style: italic; color: var(--accent); }
.novel-hero-info .author-line {
  color: var(--ink-2); font-family: var(--font-serif); font-size: 17px;
  font-style: italic; margin-bottom: 18px;
}
.novel-hero-info .author-line b { color: var(--ink); font-weight: 600; font-style: normal; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 22px; }
.tag {
  background: transparent; border: 1px solid var(--line-strong); border-radius: 0;
  padding: 7px 14px; min-height: 36px; display: inline-flex; align-items: center;
  font-family: var(--font-sans); font-size: 11px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-2); text-decoration: none;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.tag:hover { color: var(--paper); border-color: var(--ink); background: var(--ink); text-decoration: none; }

.stat-row { display: flex; flex-wrap: wrap; gap: 0; margin: 14px 0 24px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.stat {
  text-align: left; padding: 18px 28px 18px 0; flex: 1; min-width: 110px;
  position: relative;
}
.stat:not(:last-child)::after {
  content: ""; position: absolute; right: 0; top: 18px; bottom: 18px; width: 1px;
  background: var(--line);
}
.stat:not(:first-child) { padding-left: 28px; }
.stat b {
  display: block; font-family: var(--font-display); font-size: 26px; font-weight: 700;
  color: var(--ink); letter-spacing: -.02em;
}
.stat span {
  font-family: var(--font-sans); font-size: 11px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
}

.novel-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 28px; min-height: 50px;
  border-radius: 0; font-family: var(--font-sans); font-weight: 700;
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  border: 1px solid transparent; line-height: 1.2; text-decoration: none;
  transition: all var(--dur) var(--ease);
  position: relative;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--ink); color: var(--paper);
  border-color: var(--ink);
}
.btn-primary:hover {
  background: var(--accent); border-color: var(--accent); color: var(--paper);
}
.btn-ghost {
  background: transparent; border-color: var(--line-strong); color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.novel-desc {
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 0;
  padding: 28px 32px; margin-top: 28px;
  color: var(--ink-2); box-shadow: var(--shadow-soft);
  font-family: var(--font-serif); font-size: 17px; line-height: 1.8;
  position: relative;
}
.novel-desc p:first-child { padding-top: 8px; }
.novel-desc p:last-child { margin-bottom: 0; }

/* ============ Chapter list ============ */
.chapter-panel {
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 0;
  margin-top: 40px; box-shadow: var(--shadow-soft); padding: 28px 32px 32px;
  position: relative;
}
.chapter-panel::before {
  content: "TABLE OF CONTENTS"; position: absolute; top: -10px; left: 24px;
  background: var(--paper); padding: 0 12px;
  font-family: var(--font-sans); font-size: 11px; font-weight: 700;
  letter-spacing: .18em; color: var(--accent);
}
.chapter-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.chapter-list a {
  display: grid; grid-template-columns: 1fr auto auto; gap: 14px;
  align-items: center;
  padding: 16px 12px; border-bottom: 1px solid var(--line); color: var(--ink);
  font-family: var(--font-serif); font-size: 16px;
  text-decoration: none; min-height: 56px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), padding-left var(--dur) var(--ease);
}
.chapter-list a:last-child { border-bottom: 0; }
.chapter-list a:hover {
  background: var(--bg-2); text-decoration: none; color: var(--accent);
  padding-left: 20px;
}
.chapter-list .num {
  font-family: var(--font-display); font-size: 15px; font-style: italic;
  color: var(--ink-3); font-variant-numeric: tabular-nums;
  font-weight: 700; min-width: 36px; text-align: right;
}
.chapter-list a:hover .num { color: var(--accent); }
.chapter-list .title {
  line-height: 1.3; min-width: 0;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.chapter-list .is-new {
  background: var(--accent); font-family: var(--font-sans); font-size: 9.5px;
  font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-ink); padding: 3px 8px;
  flex: 0 0 auto;
}

/* ============ Sidebar ============ */
.recent-list { display: flex; flex-direction: column; gap: 6px; }
.recent-item {
  display: flex; gap: 14px; align-items: center; padding: 12px 14px;
  border: 1px solid var(--line); background: var(--paper);
  font-size: 14px; transition: border-color var(--dur) var(--ease);
}
.recent-item:hover { border-color: var(--ink); }
.recent-item .rnum {
  color: var(--accent); font-family: var(--font-display); font-size: 18px;
  font-weight: 700; font-style: italic;
  width: 24px; flex: 0 0 auto; text-align: center;
}
.recent-item a { color: var(--ink); line-height: 1.35; font-weight: 500; font-family: var(--font-serif); }
.recent-item a:hover { color: var(--accent); text-decoration: none; }
.recent-item time { display: block; font-size: 11px; color: var(--ink-3); letter-spacing: .04em; }
.sidebar .panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: 0;
  padding: 22px 24px; margin-bottom: 22px; box-shadow: var(--shadow-soft);
}
.sidebar .panel h3 {
  font-family: var(--font-sans); font-size: 11px; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--ink);
}
.sidebar .recent-item .rcover {
  width: 38px; height: 54px; object-fit: cover;
  background: var(--bg-2); flex: 0 0 auto; border: 1px solid var(--line);
}

/* ============ Reader (single-novel_chapter) ============ */
.reader-wrap {
  display: flex; gap: 36px; max-width: var(--maxw); margin: 0 auto;
  padding: 0 24px;
}
.reader-main { flex: 1; min-width: 0; max-width: var(--read-maxw); margin: 0 auto; }
.reader-sidebar {
  flex: 0 0 280px; position: sticky; top: 96px;
  align-self: flex-start; max-height: calc(100vh - 116px);
  display: flex; flex-direction: column;
}
.chapter-nav-panel {
  background: var(--paper); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-soft); display: flex; flex-direction: column;
  min-height: 0;
}
.chapter-nav-panel .cn-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.chapter-nav-panel .cn-head a {
  font-family: var(--font-sans); font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
}
.cn-list {
  overflow-y: auto; min-height: 0; list-style: none; margin: 0;
  padding: 10px 12px 14px;
}
.cn-list a {
  display: block; padding: 10px 12px;
  font-family: var(--font-serif); font-size: 14px; line-height: 1.4;
  color: var(--ink-2); border-left: 2px solid transparent;
  text-decoration: none; transition: all var(--dur) var(--ease);
}
.cn-list a:hover { background: var(--bg-2); color: var(--ink); text-decoration: none; }
.cn-list a.active {
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; border-left-color: var(--accent);
  font-style: italic;
}

.reader-toolbar {
  position: sticky; top: 76px; z-index: 150;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  border: 1px solid var(--line); border-radius: 0;
  padding: 10px 12px; margin: 22px 0 28px;
  box-shadow: var(--shadow-soft); backdrop-filter: blur(12px);
}
.rt-group {
  display: flex; align-items: center; gap: 2px;
  border-right: 1px solid var(--line); padding-right: 10px; margin-right: 6px;
}
.rt-group:last-child { border-right: 0; }
.rt-btn {
  border: 0; background: transparent; color: var(--ink-2);
  font-family: var(--font-sans); font-size: 12px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  padding: 8px 10px; min-height: 40px; border-radius: 0;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.rt-btn:hover { background: var(--bg-2); color: var(--accent); }
.rt-btn.active { background: var(--ink); color: var(--paper); }
.rt-label {
  font-family: var(--font-sans); font-size: 10px; color: var(--ink-3);
  padding: 0 4px; font-weight: 700; letter-spacing: .14em;
}
.toc-mobile { display: none; }

@media (max-width: 1023px) {
  .reader-wrap { display: block; }
  .reader-sidebar { display: none; }
  .reader-sidebar.open {
    display: flex; position: fixed; inset: 0; z-index: var(--z-drawer);
    background: rgba(0,0,0,.5); padding: 0; max-height: none;
  }
  .reader-sidebar.open .chapter-nav-panel {
    height: 100%; max-width: 320px; width: 90%; margin-left: auto;
    border-radius: 0; border-left: 1px solid var(--ink);
  }
  .toc-mobile { display: inline-flex; }
  .cn-close { display: inline-block; cursor: pointer; }
}
@media (min-width: 1024px) { .cn-close { display: none; } }

.reader-article {
  background: var(--paper); border: 1px solid var(--line-strong);
  padding: 56px clamp(24px, 6vw, 64px) 60px;
  box-shadow: var(--shadow-soft);
  position: relative;
}
.reader-article::before {
  content: ""; position: absolute; top: 14px; left: 14px; right: 14px;
  height: 1px; background: var(--line-strong);
}
.reader-article::after {
  content: ""; position: absolute; bottom: 14px; left: 14px; right: 14px;
  height: 1px; background: var(--line-strong);
}

.chapter-title {
  font-family: var(--font-display); font-size: clamp(28px, 4vw, 40px);
  font-weight: 700; text-align: center;
  margin: 12px 0 6px; letter-spacing: -0.025em; line-height: 1.12;
}
.chapter-title em { font-style: italic; color: var(--accent); }
.chapter-sub {
  text-align: center; color: var(--ink-3);
  font-family: var(--font-sans); font-size: 11px;
  letter-spacing: .24em; text-transform: uppercase;
  margin-bottom: 36px; padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; gap: 14px;
}
.chapter-sub::before, .chapter-sub::after {
  content: ""; width: 30px; height: 1px; background: var(--ink-3);
}

.reader-content {
  font-family: var(--read-font); font-size: var(--read-size);
  line-height: var(--read-lh); color: var(--ink);
  font-feature-settings: "kern", "liga", "calt", "onum";
}
.reader-content p { margin: 0 0 1.2em; text-align: justify; hyphens: auto; orphans: 3; widows: 3; }
.reader-content p:first-of-type::first-letter {
  font-family: var(--font-display); font-size: 4.5em;
  float: left; line-height: .85; padding: 6px 12px 0 0;
  color: var(--accent); font-weight: 700; font-style: italic;
}

.chapter-divider {
  margin: 40px 0; text-align: center; color: var(--ink-3);
  display: flex; align-items: center; gap: 16px;
  font-family: var(--font-display); font-size: 18px;
}
.chapter-divider::before, .chapter-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line-strong); }
.chapter-divider .div-label {
  font-size: 11px; font-weight: 700; letter-spacing: .24em;
  text-transform: uppercase; color: var(--accent);
  font-family: var(--font-sans);
}

.subchapter-title {
  font-family: var(--font-display); font-weight: 700; text-align: center;
  margin: 36px 0 20px; font-size: calc(var(--read-size) * 1.25);
  letter-spacing: -0.02em; position: relative;
}
.subchapter-title::before, .subchapter-title::after {
  content: ""; display: block; width: 40px; height: 1px;
  background: var(--ink-3); margin: 12px auto;
}

.lock-box {
  text-align: center; padding: 32px 24px;
  background: var(--bg-2); border-radius: 0; border: 1px dashed var(--line-strong);
  margin-top: 22px;
}
.lock-box .lock-icon { font-size: 28px; margin-bottom: 8px; }
.lock-box p { color: var(--ink-2); margin-bottom: 18px; }

.reader-pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin: 32px 0;
}
.reader-pager .pnum {
  font-family: var(--font-sans); font-size: 12px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; letter-spacing: .12em;
}
.pager-btn { flex: 1; text-align: center; }
.pager-btn.disabled { opacity: .35; pointer-events: none; }
.chapter-nav-btns { display: flex; gap: 16px; margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.chapter-nav-btns .btn { flex: 1; justify-content: center; }

/* ============ Archive & others ============ */
.page-title {
  font-family: var(--font-display); font-size: clamp(36px, 5vw, 56px);
  font-weight: 700; margin: 56px 0 24px; letter-spacing: -0.03em;
  line-height: 1.05; text-align: center;
  padding-bottom: 28px; position: relative;
}
.page-title::after {
  content: "❦"; display: block;
  font-size: 24px; color: var(--gold); margin-top: 18px;
  letter-spacing: 0;
}
.page-title em { font-style: italic; color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; justify-content: center; }
.chips .tag.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.single-content {
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 0;
  padding: 40px; box-shadow: var(--shadow-soft);
  max-width: var(--read-maxw); margin: 36px auto;
}

.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; padding: 36px 0; }
.pagination .page-numbers {
  padding: 10px 16px; min-height: 42px; display: inline-flex; align-items: center;
  border-radius: 0; background: transparent; border: 1px solid var(--line);
  color: var(--ink); font-family: var(--font-serif); font-size: 15px;
  text-decoration: none; transition: all var(--dur) var(--ease);
}
.pagination .page-numbers:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); text-decoration: none; }
.pagination .current { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 700; }

.empty-state {
  text-align: center; padding: 60px 28px;
  background: var(--paper); border: 1px dashed var(--line-strong); border-radius: 0;
}
.empty-state h2 { margin-bottom: 10px; }
.empty-state p { color: var(--ink-2); margin-bottom: 20px; }

/* ============ Notification pill ============ */
.nv-notif { position: fixed; bottom: 22px; right: 22px; z-index: var(--z-notif); display: none; }
.nv-notif.has-new { display: flex; }
.nv-notif a {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper); border: 1px solid var(--ink); border-radius: 0;
  padding: 12px 22px; box-shadow: var(--shadow); color: var(--ink);
  font-family: var(--font-sans); font-size: 12px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none;
}
.nv-notif a:hover { text-decoration: none; background: var(--ink); color: var(--paper); }
.nv-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: nv-pulse 1.4s infinite; }
@keyframes nv-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(1.4); } }

/* ============ Footer ============ */
.site-footer {
  border-top: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  margin-top: 96px;
  position: relative;
  width: 100%;
}
.site-footer::before {
  content: ""; position: absolute; top: -2px; left: 0; width: 80px; height: 2px;
  background: var(--accent);
}
.footer-inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: 48px; padding: 64px 24px 36px; align-items: start;
  box-sizing: border-box;
}
.footer-brand {
  font-family: var(--font-display); font-size: 28px; font-weight: 700;
  color: var(--paper); margin-bottom: 14px; letter-spacing: -0.025em;
}
.footer-brand em { font-style: italic; color: var(--gold); }
.footer-copy {
  font-family: var(--font-serif); font-size: 16px; font-style: italic;
  color: color-mix(in srgb, var(--paper) 70%, transparent);
  max-width: 42ch; line-height: 1.65;
}
.footer-nav { display: flex; gap: 12px 22px; flex-wrap: wrap; justify-content: flex-end; }
.footer-nav .menu, .footer-nav ul {
  display: flex; flex-wrap: wrap; gap: 12px 22px;
  list-style: none; margin: 0; padding: 0;
}
.footer-nav a {
  color: color-mix(in srgb, var(--paper) 80%, transparent);
  text-decoration: none; font-family: var(--font-sans); font-size: 11px;
  font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  min-height: 40px; display: inline-flex; align-items: center;
  transition: color var(--dur) var(--ease);
}
.footer-nav a:hover { color: var(--gold); }
.footer-legal {
  grid-column: 1 / -1; padding-top: 28px; margin-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--paper) 20%, transparent);
  font-family: var(--font-sans); font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase;
  color: color-mix(in srgb, var(--paper) 60%, transparent);
}

/* ============ Static pages ============ */
.static-page { max-width: var(--read-maxw); margin: 0 auto; padding: 72px 0 32px; }
.static-hero { text-align: center; margin-bottom: 48px; }
.static-hero .eyebrow {
  font-family: var(--font-sans); font-size: 11px; letter-spacing: .28em;
  text-transform: uppercase; color: var(--accent); display: inline-block;
  margin-bottom: 16px; font-weight: 700;
}
.static-hero .eyebrow::before {
  content: "❦"; margin-right: 10px; color: var(--gold);
}
.static-title {
  font-family: var(--font-display); font-size: clamp(36px, 5.5vw, 60px);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1.08; margin: 0 0 14px;
  max-inline-size: 22ch; text-wrap: balance; margin-inline: auto;
}
.static-title em { font-style: italic; color: var(--accent); }
.static-meta { color: var(--ink-3); font-family: var(--font-serif); font-size: 14px; font-style: italic; }

.static-stats {
  display: flex; flex-wrap: wrap; gap: 0; justify-content: center;
  margin: 0 0 56px;
  border: 1px solid var(--ink);
}
.stat-block {
  background: var(--paper); padding: 22px 32px; text-align: center;
  min-width: 170px; flex: 1;
  border-right: 1px solid var(--line);
}
.stat-block:last-child { border-right: 0; }
.stat-block b {
  display: block; font-family: var(--font-display); font-size: 28px;
  font-weight: 700; color: var(--accent); font-style: italic;
  letter-spacing: -.02em;
}
.stat-block span {
  display: block; font-family: var(--font-sans); font-size: 10px;
  font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-3); margin-top: 6px;
}

.static-prose {
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 0;
  padding: 40px clamp(24px, 5vw, 52px); box-shadow: var(--shadow-soft);
}
.static-section { margin-bottom: 36px; }
.static-section:last-child { margin-bottom: 0; }
.static-section h2 {
  font-family: var(--font-display); font-size: 24px; font-weight: 700;
  margin: 0 0 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
  position: relative;
}
.static-section h2::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 40px; height: 1px; background: var(--accent);
}
.static-section h2 em { font-style: italic; color: var(--accent); }
.static-section h3 {
  font-family: var(--font-display); font-size: 18px; font-weight: 700;
  margin: 22px 0 8px; color: var(--ink);
}
.static-section p {
  color: var(--ink-2); font-family: var(--font-serif); font-size: 17px;
  line-height: 1.8; margin: 0 0 14px;
}
.static-section p:last-child { margin-bottom: 0; }
.static-section a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.aligncenter { text-align: center; }
.reader-flex { display: flex; flex-wrap: wrap; }

/* ============ Responsive ============ */
@media (max-width: 760px) {
  .novel-hero { grid-template-columns: 1fr; gap: 28px; padding: 36px 0 16px; }
  .novel-hero .cover { max-width: 220px; margin: 0 auto; }
  .novel-hero-info { text-align: center; }
  .novel-hero-info .eyebrow { justify-content: center; }
  .tags { justify-content: center; }
  .stat-row { justify-content: center; flex-wrap: wrap; }
  .stat { padding: 14px 18px; min-width: 100px; }
  .stat:not(:last-child)::after { display: none; }
  .novel-actions { justify-content: center; }

  .novel-grid { grid-template-columns: repeat(3, 1fr); gap: 24px 12px; }
  .novel-card h3 { font-size: 14px; }
  .novel-card .author { font-size: 12px; }
  .card-meta { font-size: 10px; gap: 6px; }

  .section { padding: 36px 0 8px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }

  .hero { padding: 48px 0 24px; }
  .hero::before { display: none; }
  .featured-story { grid-template-columns: 100px 1fr; padding: 16px; gap: 16px; }
  .featured-story h2 { font-size: 18px; }

  .reader-article { padding: 36px 22px 44px; }
  .reader-content p:first-of-type::first-letter { font-size: 3.5em; padding: 4px 8px 0 0; }

  .footer-inner {
    grid-template-columns: 1fr;
    padding: 48px 20px 28px;
    gap: 32px;
  }
  .footer-nav { justify-content: flex-start; }
  .static-stats { flex-direction: column; border: 1px solid var(--ink); }
  .stat-block { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat-block:last-child { border-bottom: 0; }
}

@media (max-width: 420px) {
  .novel-grid { grid-template-columns: repeat(2, 1fr); }
  .featured-story { grid-template-columns: 90px 1fr; }
  .container { padding: 0 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .novel-card:hover, .featured-story:hover { transform: none; }
  .novel-card:hover .novel-cover img { transform: none; }
}
