/*
Theme Name: MangaOps Reader
Theme URI: https://mangaops.local/
Description: A fast, single-series manga theme with three selectable homepage layouts (Sidebar / Hero / Poster) and a distraction-free long-strip reader. Consolidates the MangaOps REST API, sequential image loader, GA4, and ad slots into the theme — no companion plugins needed except Rank Math.
Version: 2.0.0
Author: MangaOps
Text Domain: manga-reader-theme
*/

/* =========================================================================
   Design tokens. --accent / --ink / --cover are injected inline in <head>
   from the Customizer + featured image (see inc/customizer.php).
   ========================================================================= */
:root {
  --surface: rgba(28, 24, 38, 0.66);
  --surface-2: rgba(44, 38, 60, 0.72);
  --surface-3: #2c2640;
  --surface-solid: #1a1723;
  --line: rgba(255, 255, 255, 0.10);
  --text: #f1eef8;
  --muted: #a49bb8;
  --muted-2: #7a7190;
  --accent-deep: #c9821a;
  --accent-light: #ffe6b0;
  --accent-soft: rgba(240, 169, 43, 0.14);
  --accent-glow: rgba(240, 169, 43, 0.34);
  --hot: #ff4b6e;
  --good: #35d29a;
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1200px;
  --rail: 322px;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink, #0d0b13);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { text-wrap: balance; margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent, #f0a92b); color: #1a1200; }
.tnum { font-variant-numeric: tabular-nums; }

.wrap, .container { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---- Full-page cover backdrop ---- */
.page-bg { position: fixed; inset: 0; z-index: -3; background: var(--cover) center top / cover no-repeat; filter: blur(40px) saturate(1.15) brightness(0.62); transform: scale(1.18); }
.page-bg-grad { position: fixed; inset: 0; z-index: -2; background: linear-gradient(180deg, rgba(13,11,19,0.30) 0%, rgba(13,11,19,0.62) 52%, rgba(13,11,19,0.92) 82%, var(--ink, #0d0b13) 100%); }
.page-bg-tone { position: fixed; inset: 0; z-index: -1; opacity: 0.3; mix-blend-mode: overlay; background-image: radial-gradient(circle, rgba(255,255,255,0.10) 0.7px, transparent 1.3px); background-size: 5px 5px; }
body.reading .page-bg { filter: blur(48px) saturate(0.9) brightness(0.28); }

/* ---- Header (static, scrolls away — not sticky) ---- */
.site-head { position: static; background: rgba(13,11,19,0.5); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 20px; height: 58px; }
.logo { font-weight: 900; font-size: 20px; letter-spacing: 0.14em; text-transform: uppercase; background: linear-gradient(180deg, var(--accent-light), var(--accent, #f0a92b) 62%, var(--accent-deep)); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-flex; align-items: center; gap: 7px; }
.logo .glyph { -webkit-text-fill-color: var(--accent, #f0a92b); font-size: 17px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid transparent; padding: 13px 18px; border-radius: var(--radius-sm); font-weight: 700; font-size: 14.5px; transition: transform .12s, box-shadow .18s, background .18s, border-color .16s, color .16s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--accent, #f0a92b), var(--accent-deep)); color: #1a1200; box-shadow: 0 10px 26px var(--accent-glow); }
.btn.primary:hover { box-shadow: 0 16px 36px var(--accent-glow); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent, #f0a92b); color: var(--accent, #f0a92b); }
.btn.block { width: 100%; }
.btn .k { font-size: 12px; opacity: .72; font-weight: 600; }

/* ---- Shared series bits ---- */
.series-alt { color: var(--muted); font-size: 13.5px; }
.series-title { font-weight: 900; letter-spacing: -0.01em; line-height: 1.02; background: linear-gradient(180deg, #fff 0%, var(--accent-light) 60%, var(--accent, #f0a92b) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.genres { display: flex; flex-wrap: wrap; gap: 8px; }
.genre { font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; transition: .15s; }
.genre:hover { border-color: var(--accent, #f0a92b); color: var(--accent, #f0a92b); }
.status-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; background: rgba(8,7,13,0.72); backdrop-filter: blur(6px); color: var(--good); padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(53,210,154,0.35); }
.status-flag i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.cover-rating { position: absolute; left: 11px; bottom: 11px; display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 13.5px; background: rgba(8,7,13,0.74); backdrop-filter: blur(6px); color: #fff; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.14); }
.cover-rating svg { color: var(--accent, #f0a92b); }
.rating-max { color: var(--muted); font-weight: 600; font-size: 0.8em; margin-left: 1px; }
.cover-img { background: var(--cover) center/cover no-repeat; background-color: var(--surface-3); }

.synopsis { font-family: var(--serif); font-size: 16.5px; line-height: 1.75; color: #ddd7ea; }
.synopsis p { margin: 0 0 14px; }
.synopsis p:last-child { margin-bottom: 0; }
.credits { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 20px; }
.credit .k { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); }
.credit .v { font-weight: 700; margin-top: 2px; }
.sec-title { font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 800; margin-bottom: 16px; color: var(--muted); }

/* ---- Chapter browser (shared toolbar) ---- */
.mangaops-chapters { margin-top: 4px; }
.ch-toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.ch-search { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 15px; }
.ch-search svg { flex: none; color: var(--muted-2); }
.ch-search input { border: 0; background: transparent; color: var(--text); outline: none; width: 100%; font-size: 14px; }
.ch-search input::placeholder { color: var(--muted-2); }
.sort-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); padding: 0 15px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; white-space: nowrap; }
.sort-btn:hover { color: var(--text); border-color: var(--accent, #f0a92b); }
.no-hits { color: var(--muted); text-align: center; padding: 26px; }
.badge { font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--hot); border: 1px solid rgba(255,75,110,0.4); background: rgba(255,75,110,0.1); padding: 2px 6px; border-radius: 5px; margin-left: 8px; vertical-align: 1px; }

main.site-main { padding: 30px 0 70px; }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted-2); font-size: 13px; position: relative; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer p { margin: 0; }

/* ---- Generic fallback pages (index.php / page.php / search) ---- */
.site-main .page-title, .site-main .entry-title { color: var(--text); font-size: 26px; margin: 0 0 16px; }
.entry-content { color: var(--text); line-height: 1.7; }
.entry-content a { color: var(--accent, #f0a92b); }
.post-item, .page-content { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.search-form { display: flex; gap: 8px; margin-top: 12px; }
.search-form .search-field { flex: 1; background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm); padding: 11px 14px; }
.search-form .search-submit { background: var(--accent, #f0a92b); color: #1a1200; border: 0; border-radius: var(--radius-sm); padding: 0 16px; font-weight: 700; }

/* ---- Ads ---- */
.mangaops-ad { margin: 18px auto; text-align: center; max-width: 100%; overflow: hidden; }

/* ---- Mobile bottom nav (app-style; phones only, off the reader) ---- */
.mobile-nav { display: none; }
@media (max-width: 700px) {
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    justify-content: space-around; align-items: center;
    background: rgba(9,8,14,0.94); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  }
  .mobile-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted-2); font-size: 10.5px; font-weight: 600; }
  .mobile-nav a.is-active, .mobile-nav a:active { color: var(--accent, #f0a92b); }
  body:not(.reading) .site-footer { margin-bottom: 62px; }
}

/* ---- Utilities ---- */
[hidden] { display: none !important; }
.is-disabled { opacity: .4; pointer-events: none; }

html { scroll-behavior: smooth; }

@media (max-width: 440px) {
  .wrap, .container { padding: 0 15px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
