/*
Theme Name: Doujin123 Reader
Theme URI: https://doujin123.com/
Author: Codex
Author URI: https://openai.com/
Description: A fast manga and comic reading theme with series, chapters, genres, and a focused vertical reader.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: doujin123-reader
*/

:root {
  --reader-bg: #101010;
  --reader-bg-soft: #181816;
  --reader-surface: #20201d;
  --reader-surface-2: #282824;
  --reader-text: #f6f2ea;
  --reader-muted: #bbb3a7;
  --reader-line: #3a3933;
  --reader-red: #ef4444;
  --reader-cyan: #18b7c6;
  --reader-gold: #f2c14e;
  --reader-green: #62c370;
  --reader-shadow: 0 16px 36px rgba(0, 0, 0, .28);
  --reader-radius: 8px;
  --reader-max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--reader-bg);
  color: var(--reader-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus {
  color: var(--reader-gold);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  width: auto;
  height: auto;
  padding: 10px 14px;
  clip: auto;
  color: #101010;
  background: var(--reader-gold);
  border-radius: 6px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(16, 16, 16, .94);
  border-bottom: 1px solid var(--reader-line);
  backdrop-filter: blur(14px);
}

.site-header__inner,
.site-footer__inner,
.reader-wrap {
  width: min(var(--reader-max), calc(100% - 32px));
  margin: 0 auto;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.1;
}

.brand__mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #101010;
  background: var(--reader-gold);
  border-radius: 8px;
  font-weight: 900;
}

.brand__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--reader-muted);
  font-size: .95rem;
}

.primary-nav ul {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.header-search {
  width: min(310px, 32vw);
}

.reader-search {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--reader-surface);
  border: 1px solid var(--reader-line);
  border-radius: var(--reader-radius);
}

.reader-search input[type="search"] {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  color: var(--reader-text);
  background: transparent;
  border: 0;
  outline: 0;
}

.reader-search button,
.reader-button,
.post-password-form input[type="submit"],
.wp-block-search__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  color: #101010;
  font-weight: 800;
  background: var(--reader-gold);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.reader-search button {
  border-radius: 0;
}

.reader-button--ghost {
  color: var(--reader-text);
  background: transparent;
  border: 1px solid var(--reader-line);
}

.reader-button--red {
  color: #fff;
  background: var(--reader-red);
}

.reader-main {
  min-height: calc(100vh - 220px);
}

.site-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .75fr);
  gap: 28px;
  align-items: stretch;
  padding: 44px 0 28px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 360px;
  padding: 36px;
  background:
    linear-gradient(135deg, rgba(239, 68, 68, .22), rgba(24, 183, 198, .12) 44%, rgba(242, 193, 78, .16)),
    var(--reader-surface);
  border: 1px solid var(--reader-line);
  border-radius: var(--reader-radius);
  box-shadow: var(--reader-shadow);
}

.kicker {
  margin: 0 0 10px;
  color: var(--reader-gold);
  font-size: .82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hero-copy h1,
.page-title {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.45rem, 6vw, 5.4rem);
  line-height: .95;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--reader-muted);
  font-size: 1.05rem;
}

.hero-copy .reader-search {
  max-width: 560px;
  margin-top: 28px;
}

.latest-panel {
  display: flex;
  flex-direction: column;
  min-height: 360px;
  padding: 22px;
  background: var(--reader-surface);
  border: 1px solid var(--reader-line);
  border-radius: var(--reader-radius);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
}

.section-heading h2,
.archive-header h1,
.entry-header h1 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.section-heading a {
  color: var(--reader-cyan);
  font-weight: 700;
  white-space: nowrap;
}

.chapter-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.chapter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 10px 12px;
  background: var(--reader-bg-soft);
  border: 1px solid transparent;
  border-radius: var(--reader-radius);
}

.chapter-row:hover {
  border-color: var(--reader-cyan);
}

.chapter-row__title {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-row__meta {
  color: var(--reader-muted);
  font-size: .86rem;
  white-space: nowrap;
}

.content-band {
  padding: 26px 0 42px;
}

.comic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.comic-card {
  min-width: 0;
  overflow: hidden;
  background: var(--reader-surface);
  border: 1px solid var(--reader-line);
  border-radius: var(--reader-radius);
}

.comic-card__cover {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4.1;
  overflow: hidden;
  background: #2c2a25;
}

.comic-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .18s ease;
}

.comic-card:hover img {
  transform: scale(1.035);
}

.comic-card__placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 18px;
  color: #101010;
  background:
    linear-gradient(135deg, rgba(242, 193, 78, .9), rgba(24, 183, 198, .72)),
    #f2c14e;
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 900;
}

.comic-card__body {
  padding: 14px;
}

.comic-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.comic-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--reader-muted);
  font-size: .84rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  color: var(--reader-text);
  background: var(--reader-bg-soft);
  border: 1px solid var(--reader-line);
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
}

.genre-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.archive-header,
.entry-header {
  padding: 38px 0 22px;
}

.entry-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 26px;
  padding: 26px 0 48px;
}

.series-cover {
  overflow: hidden;
  background: var(--reader-surface);
  border: 1px solid var(--reader-line);
  border-radius: var(--reader-radius);
}

.series-cover img,
.series-cover__fallback {
  width: 100%;
  aspect-ratio: 3 / 4.1;
  object-fit: cover;
}

.series-cover__fallback {
  display: grid;
  place-items: center;
  color: #101010;
  background: var(--reader-gold);
  font-size: 4rem;
  font-weight: 900;
}

.entry-content {
  color: #ebe5da;
}

.entry-content > *:first-child {
  margin-top: 0;
}

.entry-content a {
  color: var(--reader-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.entry-content img {
  margin-right: auto;
  margin-left: auto;
}

.reader-toolbar {
  position: sticky;
  top: 72px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  background: rgba(16, 16, 16, .92);
  border-bottom: 1px solid var(--reader-line);
  backdrop-filter: blur(12px);
}

.reader-toolbar__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.chapter-reader {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.chapter-reader .entry-content {
  display: grid;
  gap: 0;
}

.chapter-reader .entry-content p {
  margin: 0 0 16px;
}

.chapter-reader .entry-content img {
  width: auto;
  max-width: 100%;
  margin-top: 0;
  margin-bottom: 0;
}

.post-list {
  display: grid;
  gap: 18px;
}

.post-card {
  padding: 18px;
  background: var(--reader-surface);
  border: 1px solid var(--reader-line);
  border-radius: var(--reader-radius);
}

.post-card h2,
.post-card h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.post-meta,
.empty-state {
  color: var(--reader-muted);
}

.pagination,
.post-navigation,
.comment-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 24px 0 0;
}

.pagination .page-numbers,
.post-navigation a,
.comment-navigation a {
  padding: 8px 12px;
  color: var(--reader-text);
  background: var(--reader-surface);
  border: 1px solid var(--reader-line);
  border-radius: 6px;
}

.pagination .current {
  color: #101010;
  background: var(--reader-gold);
}

.site-footer {
  margin-top: 30px;
  color: var(--reader-muted);
  background: var(--reader-bg-soft);
  border-top: 1px solid var(--reader-line);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
}

.admin-meta-field {
  margin: 0 0 12px;
}

.admin-meta-field label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}

.admin-meta-field input,
.admin-meta-field select {
  width: 100%;
}

@media (max-width: 980px) {
  .site-header__inner {
    flex-wrap: wrap;
    padding: 14px 0;
  }

  .primary-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .header-search {
    width: min(360px, 46vw);
  }

  .site-hero,
  .entry-layout {
    grid-template-columns: 1fr;
  }

  .comic-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .site-header__inner,
  .site-footer__inner,
  .reader-wrap,
  .chapter-reader {
    width: min(100% - 22px, var(--reader-max));
  }

  .header-search {
    width: 100%;
  }

  .hero-copy,
  .latest-panel {
    padding: 18px;
  }

  .hero-copy h1,
  .page-title {
    max-width: 10ch;
    font-size: 2.55rem;
  }

  .comic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .chapter-row {
    grid-template-columns: 1fr;
  }

  .reader-toolbar {
    top: 0;
  }
}

@media (max-width: 420px) {
  .comic-card__body {
    padding: 11px;
  }

  .reader-search button,
  .reader-button {
    padding-right: 10px;
    padding-left: 10px;
  }
}
