/*
Theme Name: MangaForte
Theme URI: https://example.com/mangaforte
Author: Your Studio
Author URI: https://example.com
Description: A dark manga-panel WordPress theme for comic and manga reading sites. Custom Series and Chapter post types, native PDF reader, and a screentone-inspired visual language with vivid manga-cover colors.
Version: 2.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: mangaforte
*/

/* =========================================================
   DESIGN TOKENS — v2 Manga Refresh
   =========================================================
   Base: true neutral grey-black (zero purple shift)
   Borders: visible medium grey — manga panel lines
   Accent trio: magenta · yellow · sky blue
   ========================================================= */
:root {
  /* Neutrals */
  --black:          #080808;
  --panel:          #111111;
  --panel-raised:   #191919;
  --border:         #303030;   /* manga panel line — visible grey */
  --border-strong:  #484848;
  --text:           #F0EDE8;
  --text-muted:     #888888;
  --text-dim:       #555555;

  /* Accent trio — manga cover brightness */
  --magenta:        #FF1F6E;   /* hot pink / magenta — primary */
  --magenta-dim:    #C4185A;
  --yellow:         #FFE600;   /* electric yellow — highlight / star */
  --sky:            #00C4FF;   /* sky blue — info / links */
  --green:          #00E676;   /* chapter-new / ok */

  /* Type */
  --font-display: 'Bangers', 'Archivo Black', Impact, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Layout */
  --max-width: 1300px;
  --panel-border: 2px solid var(--border);
  --radius: 2px;
  --gap: 1.25rem;
}

/* =========================================================
   RESET / BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; }

::selection { background: var(--magenta); color: #fff; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}

/* =========================================================
   SIGNATURE TEXTURES
   ========================================================= */

/* Screentone dots — magenta */
.screentone {
  position: relative;
  overflow: hidden;
}
.screentone::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,31,110,0.22) 1.2px, transparent 1.6px);
  background-size: 8px 8px;
  pointer-events: none;
  z-index: 0;
}
.screentone > * { position: relative; z-index: 1; }

/* Speed-lines — radiating from top-right on hero */
.speed-lines {
  position: relative;
  overflow: hidden;
}
.speed-lines::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(
    from 0deg at 105% -10%,
    rgba(255,230,0,0.04) 0deg,
    transparent 1.2deg,
    transparent 4deg
  );
  pointer-events: none;
  z-index: 0;
}
.speed-lines > * { position: relative; z-index: 1; }

/* Manga panel border — thick grey frame used on cards and sections */
.panel-box {
  border: var(--panel-border);
  background: var(--panel);
}
.panel-box--raised {
  border: var(--panel-border);
  background: var(--panel-raised);
}

/* =========================================================
   TYPOGRAPHY
   ========================================================= */
h1, h2, h3, .display {
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  line-height: 1.05;
  margin: 0;
}
.eyebrow {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--magenta);
}
.muted { color: var(--text-muted); }

/* Section heading — left-bar accent, manga chapter style */
.section-title {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.section-title::before {
  content: "";
  display: block;
  width: 5px;
  height: 1.3em;
  background: var(--magenta);
  border-radius: 1px;
  flex-shrink: 0;
}

/* =========================================================
   LAYOUT
   ========================================================= */
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.section { padding: 3rem 0; }

.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: .85rem;
  border-bottom: var(--panel-border);
}
.section__head a {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--sky);
}
.section__head a:hover { text-decoration: underline; }

/* =========================================================
   MASTHEAD
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8,8,8,0.94);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 1.5rem;
}

/* Logo: Bangers font, two-color split */
.site-logo {
  font-family: var(--font-display);
  font-size: 1.65rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--text);
}
.site-logo em { color: var(--magenta); font-style: normal; }
.site-logo sup {
  font-size: .55rem;
  font-family: var(--font-body);
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--yellow);
  vertical-align: super;
  margin-left: .15em;
}

.primary-nav ul { display: flex; gap: 1.5rem; }
.primary-nav a {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color .12s;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.primary-nav a:hover { color: var(--text); border-bottom-color: var(--magenta); }
.primary-nav .current-menu-item a { color: var(--magenta); border-bottom-color: var(--magenta); }

.site-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  border: 2px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: .35rem .65rem;
  transition: border-color .12s;
}
.site-search:focus-within { border-color: var(--magenta); }
.site-search input {
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: .82rem;
  width: 150px;
}
.site-search input::placeholder { color: var(--text-dim); }
.site-search button { background: none; border: 0; color: var(--text-dim); font-size: .9rem; }

.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.4rem; }

@media (max-width: 860px) {
  .primary-nav, .site-search { display: none; }
  .nav-toggle { display: block; }
  .primary-nav.is-open {
    display: block;
    position: absolute;
    top: 60px; left: 0; right: 0;
    background: var(--panel);
    border-bottom: 2px solid var(--border);
    padding: 1rem 1.5rem;
  }
  .primary-nav.is-open ul { flex-direction: column; gap: 1rem; }
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  padding: 7rem 0 6rem;
  border-bottom: 2px solid var(--border);
  position: relative;
  background-image:
    linear-gradient(
      105deg,
      rgba(8,8,8,0.97)  0%,
      rgba(8,8,8,0.88) 45%,
      rgba(8,8,8,0.60) 72%,
      rgba(8,8,8,0.30) 100%
    ),
    url('assets/hero-bg.png');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  overflow: hidden;
}
/* Vignette on the right edge so the artwork bleeds in dramatically */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 85% 50%, transparent 30%, rgba(8,8,8,0.55) 100%);
  pointer-events: none;
  z-index: 0;
}
.hero .wrap { position: relative; z-index: 1; }
.hero__kicker { margin-bottom: .9rem; }
.hero__title {
  font-size: clamp(3rem, 7vw, 5.5rem);
  max-width: 14ch;
  text-transform: uppercase;
  line-height: 1;
}
.hero__title em {
  font-style: normal;
  color: var(--magenta);
  -webkit-text-stroke: 1px var(--magenta);
}
.hero__sub {
  margin-top: 1.1rem;
  max-width: 50ch;
  color: var(--text-muted);
  font-size: 1rem;
}
.hero__actions { display: flex; gap: .75rem; margin-top: 2rem; flex-wrap: wrap; }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.4rem;
  font-weight: 700;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  border: 2px solid transparent;
  border-radius: var(--radius);
  transition: all .12s;
}
.btn--primary {
  background: var(--magenta);
  border-color: var(--magenta);
  color: #fff;
}
.btn--primary:hover { background: var(--magenta-dim); border-color: var(--magenta-dim); }
.btn--yellow {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #080808;
}
.btn--yellow:hover { filter: brightness(0.9); }
.btn--ghost {
  border-color: var(--border-strong);
  color: var(--text);
  background: transparent;
}
.btn--ghost:hover { border-color: var(--text-muted); }

/* =========================================================
   SERIES GRID  — manga panel style
   ========================================================= */
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: var(--gap);
}

.series-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.series-card__cover {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--panel-raised);
  border: 2px solid var(--border);
  transition: border-color .15s, transform .15s;
}
.series-card:hover .series-card__cover {
  border-color: var(--magenta);
  transform: translateY(-4px);
}
.series-card__cover img { width: 100%; height: 100%; object-fit: cover; }

/* Overlay gradient for title readability */
.series-card__overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 55%;
  background: linear-gradient(to top, rgba(8,8,8,0.95) 0%, transparent 100%);
}

/* Status pill */
.series-card__status {
  position: absolute;
  top: 6px; left: 6px;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .2rem .45rem;
  border: 1.5px solid currentColor;
  background: rgba(8,8,8,0.82);
  border-radius: 1px;
}
.series-card__status.is-ongoing   { color: var(--green); }
.series-card__status.is-completed { color: var(--sky); }
.series-card__status.is-hiatus    { color: var(--yellow); }

.series-card__title {
  margin-top: .55rem;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.3;
}
.series-card__meta {
  font-size: .73rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* Chapter count badge inside card overlay */
.series-card__chapters {
  position: absolute;
  bottom: 6px; right: 6px;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .05em;
  color: var(--yellow);
}

/* =========================================================
   LATEST UPDATES LIST
   ========================================================= */
.update-list { display: flex; flex-direction: column; }
.update-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
}
.update-row:hover { background: var(--panel); margin: 0 -.75rem; padding-left: .75rem; padding-right: .75rem; }
.update-row__thumb {
  width: 52px;
  height: 70px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}
.update-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.update-row__series { font-weight: 700; font-size: .88rem; }
.update-row__chapter { font-size: .78rem; color: var(--sky); margin-top: .15rem; }
.update-row__time { font-size: .7rem; color: var(--text-dim); white-space: nowrap; }

/* =========================================================
   SERIES SINGLE PAGE
   ========================================================= */
.series-detail {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3rem;
  padding: 3rem 0;
  border-bottom: 2px solid var(--border);
}
.series-detail__cover {
  border: 2px solid var(--border);
  overflow: hidden;
  background: var(--panel-raised);
}
.series-detail__cover img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }

.series-detail__title { font-size: clamp(1.8rem, 4vw, 2.8rem); text-transform: uppercase; }
.series-detail__authors { font-size: .82rem; color: var(--text-muted); margin-top: .4rem; }

.tags { display: flex; gap: .4rem; flex-wrap: wrap; margin: .9rem 0; }
.tag {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .22rem .55rem;
  border: 1.5px solid var(--border-strong);
  border-radius: 1px;
  color: var(--text-muted);
}
.tag:hover { border-color: var(--sky); color: var(--sky); }

.series-detail__desc { max-width: 65ch; color: var(--text-muted); font-size: .92rem; margin-top: .5rem; }
.series-detail__actions { display: flex; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* Chapter list on series page */
.chapter-list { margin-top: 2.5rem; }
.chapter-list__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
}
.chapter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.chapter-row:hover { background: var(--panel); }
.chapter-row__num {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--magenta);
  min-width: 4.5rem;
}
.chapter-row__title { font-weight: 600; font-size: .88rem; flex: 1; }
.chapter-row a:hover .chapter-row__title { color: var(--magenta); }
.chapter-row__date { font-size: .72rem; color: var(--text-dim); }
.chapter-row__new {
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--green);
  border: 1px solid var(--green);
  padding: .1rem .35rem;
  border-radius: 1px;
  margin-right: .5rem;
}

/* =========================================================
   READER BAR + PDF VIEWER
   ========================================================= */
.reader-bar {
  position: sticky;
  top: 60px;
  z-index: 40;
  background: var(--panel);
  border-bottom: 2px solid var(--border);
}
.reader-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
  gap: 1rem;
}
.reader-bar__breadcrumb { font-size: .8rem; }
.reader-bar__breadcrumb a { color: var(--text-muted); }
.reader-bar__breadcrumb a:hover { color: var(--sky); }
.reader-bar__sep { margin: 0 .35rem; color: var(--text-dim); }
.reader-bar__current { font-weight: 700; color: var(--magenta); }

.reader-controls { display: flex; gap: .4rem; align-items: center; }
.reader-controls a,
.reader-controls select {
  font-size: .75rem;
  font-weight: 700;
  padding: .35rem .65rem;
  border: 1.5px solid var(--border-strong);
  background: var(--panel-raised);
  color: var(--text);
  border-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.reader-controls a:hover { border-color: var(--magenta); color: var(--magenta); }

/* PDF viewport — full and dominant */
.reader-pdf {
  display: flex;
  flex-direction: column;
  padding: 0;
}
.reader-pdf__frame-wrap {
  width: 100%;
  height: calc(100vh - 110px); /* full remaining viewport below the two bars */
  border-top: 0;
  border-left: 3px solid var(--border);
  border-right: 3px solid var(--border);
  border-bottom: 3px solid var(--border);
  background: #1a1a1a;
}
.reader-pdf__frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.reader-pdf__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-raised);
  border: 2px solid var(--border);
  border-bottom: 0;
  padding: .5rem 1rem;
  font-size: .75rem;
}
.reader-pdf__toolbar a {
  color: var(--sky);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.reader-pdf__toolbar a:hover { text-decoration: underline; }

/* Page image stack fallback */
.reader-stack {
  max-width: 840px;
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}
.reader-stack img {
  width: 100%;
  border: 2px solid var(--border);
  margin-bottom: 3px;
  display: block;
}

/* End of chapter nav */
.reader-end {
  text-align: center;
  padding: 2.5rem 1rem;
  border-top: 2px solid var(--border);
  display: flex;
  justify-content: center;
  gap: .75rem;
  flex-wrap: wrap;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 3rem;
  align-items: start;
}
.widget {
  border: var(--panel-border);
  background: var(--panel);
  margin-bottom: 1.5rem;
}
.widget__head {
  padding: .6rem 1rem;
  border-bottom: 2px solid var(--border);
  font-family: var(--font-display);
  font-size: .95rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.widget__head::before {
  content: "";
  width: 4px; height: 1em;
  background: var(--yellow);
  border-radius: 1px;
  flex-shrink: 0;
}
.widget__body { padding: .5rem 1rem .75rem; }
.widget__body ol { display: flex; flex-direction: column; gap: .6rem; }

.rank-row { display: flex; align-items: baseline; gap: .65rem; }
.rank-row__num {
  font-family: var(--font-display);
  font-size: 1.05rem;
  min-width: 1.6rem;
  color: var(--yellow);
}
.rank-row__title { font-size: .85rem; font-weight: 600; }
.rank-row__title:hover { color: var(--magenta); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 960px) {
  .layout-with-sidebar { grid-template-columns: 1fr; }
  .series-detail { grid-template-columns: 1fr; }
  .series-detail__cover { max-width: 200px; }
}
@media (max-width: 600px) {
  .series-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
  .reader-pdf__frame-wrap { height: calc(100vh - 120px); }
}

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  border-top: 2px solid var(--border);
  background: var(--panel);
  padding: 2rem 0;
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: .78rem;
}
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}
.site-footer__logo {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: .05em;
  color: var(--text-dim);
}
.site-footer__logo em { color: var(--magenta); font-style: normal; }
