/*
Theme Name: Light Novel UI V3
Theme URI: https://example.com/
Author: OpenAI
Description: Fast mobile-first UI for web novel sites.
Version: 3.4.0
License: GPL2+
Text Domain: lightnovel-ui-v2
*/

:root {
  --bg: #faf7fb;
  --surface: #ffffff;
  --surface-2: #f5f1f7;
  --text: #1f1b24;
  --muted: #706b75;
  --line: #ece5f0;
  --primary: #ec4b9b;
  --primary-dark: #d83b88;
  --content-width: 1180px;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(30, 20, 40, 0.06);
  --reading-width: 760px;
  --logo-height-desktop: 52px;
  --logo-height-mobile: 42px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #fff 0, var(--bg) 240px, var(--bg) 100%);
  line-height: 1.7;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary-dark); }
button, input, textarea, select { font: inherit; }

.wrap {
  width: min(calc(100% - 32px), var(--content-width));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(236,229,240,0.95);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: calc(var(--logo-height-desktop) + 24px);
}
.site-branding {
  display: flex;
  align-items: center;
  min-width: 0;
}
.site-branding__link {display:inline-flex;align-items:center;min-height:var(--logo-height-desktop);}
.site-logo .custom-logo-link{display:inline-flex;align-items:center;line-height:0;}
.custom-logo{max-height:var(--logo-height-desktop);width:auto;height:auto;display:block;}
.site-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}

.main-navigation { margin-left: auto; }
.main-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 24px;
}
.main-navigation li { margin: 0; }
.main-navigation a {
  font-size: 15px;
  font-weight: 700;
  color: #413a45;
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a { color: var(--primary); }

.menu-toggle {
  display: none;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
}

.page-shell {
  padding: 26px 0 52px;
}

.home-grid-wrap{padding-top:8px;}
.section-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.novel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px 24px;
}

.novel-card {
  min-width: 0;
  width: 100%;
}
.novel-card__cover-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  background: #ebe7ee;
  box-shadow: var(--shadow);
}
.novel-card__cover-wrap::before {
  content: "";
  display: block;
  padding-top: 146%;
}
.novel-card__cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.novel-card__placeholder,
.book-cover__placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f3e7ef, #e6eef7);
  color: #695f6d;
  font-size: 14px;
  font-weight: 700;
}
.novel-card__meta {
  padding-top: 14px;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
}
.novel-card__title {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.18;
  letter-spacing: -.03em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.novel-card__author {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 34px;
  flex-wrap: wrap;
}
.pagination .page-numbers {
  min-width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: #4f4754;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(20,10,20,.03);
}
.pagination .page-numbers.current,
.pagination .page-numbers:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.book-hero {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding: 16px 0 8px;
}
.book-cover {
  border-radius: 18px;
  overflow: hidden;
  background: #f0ebf2;
  box-shadow: var(--shadow);
  margin-inline: auto;
}
.book-cover__image,
.book-cover__placeholder {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}
.book-summary {
  min-width: 0;
}
.book-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff0f7;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
}
.book-title {
  margin: 14px 0 8px;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1.02;
  letter-spacing: -.04em;
}
.book-author {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
}
.book-description {
  color: #3f3844;
  font-size: 16px;
  max-width: 62ch;
}
.book-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 26px;
}
.btn,
.wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 24px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -.01em;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(236,75,155,.22);
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: #403945;
}
.btn-secondary:hover { border-color: #ddd0e3; background: #fff; }

.book-catalog {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}
.catalog-title {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.chapter-list {
  list-style: none;
  padding: 10px 0 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.chapter-list a {
  display: block;
  padding: 12px 14px;
  background: #faf7fb;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #3c3642;
}
.chapter-list a:hover { background: #fff; border-color: #e1d5e6; }

.reader-shell {
  width: min(calc(100% - 28px), var(--reading-width));
  margin: 0 auto;
  padding: 18px 0 120px;
}
.reader-top {
  margin-bottom: 18px;
}
.reader-book-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.reader-title {
  margin: 8px 0 0;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.08;
  letter-spacing: -.035em;
}
.reader-body {
  background: #fffdf8;
  border: 1px solid #f0e7d8;
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow: 0 10px 30px rgba(24, 18, 10, 0.04);
}
.entry-content,
.reader-content {
  color: #2c252b;
  font-size: 19px;
  line-height: 2.05;
  word-break: break-word;
}
.entry-content p,
.reader-content p {
  margin: 0 0 1.3em;
}
.reader-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}
.reader-nav .btn {
  width: 100%;
  min-height: 52px;
}
.reader-nav .btn.is-disabled {
  background: #f3eef5;
  color: #b0a6b5;
  border-color: #ece3f0;
  pointer-events: none;
  box-shadow: none;
}

.site-footer {
  padding: 30px 0 42px;
  color: var(--muted);
  font-size: 14px;
}
.footer-inner {
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.screen-reader-text {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 900px) {
  .book-hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .book-cover {
    max-width: 280px;
  }
  .book-summary { text-align: center; }
  .book-description { max-width: none; text-align: left; }
  .catalog-title { text-align: left; }
  .book-title { font-size: 40px; }
}

@media (max-width: 760px) {
  .site-header__inner {
    min-height: calc(var(--logo-height-mobile) + 20px);
    align-items: center;
  }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .main-navigation {
    position: absolute;
    left: 16px;
    right: 16px;
    top: calc(100% + 10px);
    background: rgba(255,255,255,0.98);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 14px;
    display: none;
  }
  .main-navigation.is-open { display: block; }
  .main-navigation ul {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .main-navigation a {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-2);
  }
  .novel-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .novel-card {max-width: 460px; margin: 0 auto;}
  .novel-card__title { font-size: 18px; }
  .book-title { font-size: 34px; }
  .reader-body {
    padding: 18px 14px;
    border-radius: 18px;
  }
  .entry-content,
  .reader-content {
    font-size: 18px;
    line-height: 1.95;
  }
  .reader-nav {
    position: sticky;
    bottom: 10px;
    z-index: 20;
    background: rgba(250,247,251,0.92);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    padding: 8px;
    box-shadow: 0 10px 24px rgba(28, 18, 40, 0.08);
  }
}

@media (max-width: 420px) {
  .wrap { width: min(calc(100% - 24px), var(--content-width)); }
  .custom-logo{max-height:var(--logo-height-mobile);}
  .site-title{font-size:22px;}
  .novel-card__cover-wrap, .novel-card__meta { max-width: 100%; }
  .novel-card__title { font-size: 16px; }
  .novel-card__author { font-size: 14px; }
  .book-actions{justify-content:center;}
  .book-actions .btn{flex:1 1 calc(50% - 7px); min-width:0;}
  .btn { min-height: 48px; padding: 0 18px; font-size: 15px; }
  .reader-title { font-size: 30px; }
}


/* Final chapter nav focus update */
.reader-nav.reader-nav--focus {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(180px, 1.35fr);
  gap: 16px;
  align-items: stretch;
  margin-top: 28px;
}
.reader-nav--focus .btn {
  min-height: 64px;
  border-radius: 18px;
  font-size: 19px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.reader-nav--focus .btn-next {
  box-shadow: 0 10px 24px rgba(236,75,155,.22);
}
.reader-nav--focus .btn-catalog {
  background: #fff;
  border: 2px solid #e8dff0;
  color: #3c3440;
}
.reader-nav--focus .btn-catalog:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}
.reader-nav--focus .btn-next:hover {
  transform: translateY(-1px);
}
@media (max-width: 640px) {
  .reader-nav.reader-nav--focus {
    grid-template-columns: minmax(108px, 0.82fr) minmax(170px, 1.45fr);
    gap: 14px;
  }
  .reader-nav--focus .btn {
    min-height: 60px;
    font-size: 17px;
  }
}
