/* ============================================================
   AnimeInn theme — ink chrome + crimson accent
   Palette: ink #14161c | ink-light #1d2029 | primary #dc2626
            primary-dark #b91c1c | paper #fafafa
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --ink: #14161c;
  --ink-light: #1d2029;
  --primary: #dc2626;
  --primary-dark: #b91c1c;
  --paper: #fafafa;
  --text: #1c1917;
  --text-soft: #57534e;
  --border: #e7e5e4;
  --radius: 16px;
  --font: 'Sofia Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.site-main { flex: 1; }

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

a { color: var(--primary-dark); }

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

.container {
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(20, 22, 28, 0.97);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  text-decoration: none;
  margin: 0;
}

.logo span { color: var(--primary); }

.main-nav { display: flex; align-items: center; gap: 4px; }

.main-nav a {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #d4d4d8;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.main-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }

.main-nav a.active { color: #fff; background: rgba(255, 255, 255, 0.1); font-weight: 600; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #e4e4e7;
  padding: 8px;
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  background: var(--ink);
  background-image:
    radial-gradient(ellipse 60% 80% at 80% 20%, rgba(220, 38, 38, 0.25), transparent 60%),
    radial-gradient(ellipse 50% 60% at 10% 90%, rgba(185, 28, 28, 0.15), transparent 60%);
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2.5rem;
  align-items: center;
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.hero-kicker {
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin: 0;
}

.hero h1 {
  margin: 0.75rem 0 0;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  max-width: 36rem;
}

.hero-sub {
  margin-top: 1rem;
  font-size: 1.125rem;
  color: #d4d4d8;
  max-width: 34rem;
}

.hero-actions { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 12px; }
.hero-actions.center { justify-content: center; }

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost { color: #fff; border: 1px solid rgba(255, 255, 255, 0.25); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

.btn-outline { color: var(--ink); border: 1px solid #d6d3d1; }
.btn-outline:hover { border-color: rgba(220, 38, 38, 0.5); color: var(--primary-dark); }

.hero-issue { position: relative; display: block; }

.hero-issue img {
  width: 224px;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(69, 10, 10, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transform: rotate(2deg);
  transition: transform 0.3s;
  display: block;
}

.hero-issue:hover img { transform: rotate(0deg) scale(1.05); }

.hero-issue-badge {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 999px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* ---------- Sections ---------- */
.section { padding-top: 4rem; padding-bottom: 4rem; }

.section-alt { background: #f5f5f4; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.section-head h2 { margin: 0; font-size: 1.75rem; font-weight: 800; color: var(--ink); }

.more-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-dark);
  text-decoration: none;
}

.more-link:hover { color: var(--primary); }

/* ---------- Cards ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
  border-color: rgba(220, 38, 38, 0.4);
  box-shadow: 0 10px 25px -5px rgba(69, 10, 10, 0.08);
}

.card-media { aspect-ratio: 16 / 9; overflow: hidden; }

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
  display: block;
}

.card:hover .card-media img { transform: scale(1.03); }

.media-placeholder {
  width: 100%;
  height: 100%;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ink), var(--ink-light) 60%, var(--primary-dark));
}

.media-placeholder span {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 800;
  letter-spacing: 0.3em;
  font-size: 1rem;
  user-select: none;
}

.cover-ratio { aspect-ratio: 3 / 4; }

.card-body { display: flex; flex-direction: column; gap: 10px; padding: 1.25rem; }

.card-meta { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; }

.chip {
  display: inline-flex;
  align-items: center;
  background: #fef2f2;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  text-decoration: none;
}

a.chip:hover { background: #fee2e2; }

.card-date { color: #78716c; font-size: 0.8rem; }

.card-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card:hover .card-title { color: var(--primary-dark); }

.card-excerpt {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Covers (magazine) ---------- */
.covers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.cover-card { text-decoration: none; color: inherit; display: block; }

.cover-card img,
.cover-card .media-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
  display: block;
}

.cover-card:hover img {
  border-color: rgba(220, 38, 38, 0.5);
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(69, 10, 10, 0.12);
}

.cover-card p {
  margin: 12px 0 2px;
  font-weight: 600;
  color: var(--ink);
}

.cover-card:hover p { color: var(--primary-dark); }

/* ---------- Listing pages ---------- */
.page-pad { padding-top: 3rem; padding-bottom: 3rem; }

.page-title { margin: 0; font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; color: var(--ink); }

.page-sub { margin-top: 0.75rem; color: var(--text-soft); max-width: 42rem; }

.chips-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.5rem; }

.chip-outline {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  color: #44403c;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.chip-outline:hover { border-color: rgba(220, 38, 38, 0.5); color: var(--primary-dark); }

.chip-clear { color: var(--primary-dark); font-weight: 600; }

.page-pad .cards-grid { margin-top: 2.5rem; }

.empty-state {
  margin-top: 2.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  color: #78716c;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 3rem;
}

.page-num {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  color: #44403c;
  font-size: 0.9rem;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.page-num:hover { border-color: rgba(220, 38, 38, 0.5); color: var(--primary-dark); }

.page-num.current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ---------- Article ---------- */
.article-pad { max-width: 768px; padding-top: 3rem; padding-bottom: 3rem; }

.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 0.9rem; }

.article-title { margin: 1rem 0 0; font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; line-height: 1.2; color: var(--ink); }

.article-author { margin-top: 0.75rem; font-size: 0.9rem; color: #78716c; }

.article-cover { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin-top: 2rem; }

.prose { margin-top: 2rem; font-size: 1.075rem; line-height: 1.8; color: #292524; }

.prose h2 { margin: 2em 0 0; font-size: 1.6rem; font-weight: 800; line-height: 1.3; color: var(--ink); }
.prose h3 { margin: 1.6em 0 0; font-size: 1.3rem; font-weight: 700; color: var(--ink); }
.prose h4 { margin: 1.4em 0 0; font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: 1.1em 0 0; }
.prose a { color: var(--primary-dark); text-underline-offset: 3px; font-weight: 500; }
.prose a:hover { color: var(--primary); }
.prose strong { font-weight: 700; color: var(--text); }
.prose ul, .prose ol { padding-left: 1.5rem; }
.prose li { margin-top: 0.4em; }
.prose blockquote { border-left: 4px solid var(--primary); padding: 4px 0 4px 20px; font-style: italic; color: var(--text-soft); margin-left: 0; }
.prose img { border-radius: 12px; margin: 1.75rem auto; display: block; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose code { background: #f5f5f4; border-radius: 6px; padding: 2px 6px; font-size: 0.9em; }

.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.back-row { margin-top: 2.5rem; }

/* ---------- Issue (broy) ---------- */
.issue-head {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: start;
}

.issue-cover img,
.issue-cover .media-placeholder {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  display: block;
}

.issue-info .page-title { margin-top: 0.5rem; }

.issue-desc { margin-top: 1rem; color: var(--text-soft); max-width: 42rem; }

.pdf-frame {
  margin-top: 2.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f5f5f4;
}

.pdf-frame object { width: 100%; height: 85vh; display: block; }

.pdf-fallback { padding: 2.5rem; text-align: center; color: var(--text-soft); }

/* ---------- Downloads (issue versions) ---------- */
.issue-cover { display: flex; flex-direction: column; gap: 1rem; }

.downloads { margin-top: 2.5rem; }

.downloads h2 { margin: 0 0 1rem; font-size: 1.35rem; font-weight: 800; color: var(--ink); }

.downloads-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.downloads-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 14px 20px;
}

.downloads-list li + li { border-top: 1px solid var(--border); }

.dl-label { font-weight: 600; color: var(--text); }

.dl-meta { display: flex; align-items: center; gap: 14px; color: #78716c; font-size: 0.9rem; white-space: nowrap; }

.dl-btn {
  display: inline-flex;
  padding: 7px 16px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.15s;
}

.dl-btn:hover { background: var(--primary-dark); }

/* ---------- Issue prev/next chain ---------- */
.issue-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
}

.issue-nav-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  min-width: 40%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.issue-nav-card.next { text-align: right; margin-left: auto; }

.issue-nav-card:hover {
  border-color: rgba(220, 38, 38, 0.5);
  box-shadow: 0 10px 20px -8px rgba(69, 10, 10, 0.12);
}

.issue-nav-kicker {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-dark);
}

.issue-nav-title { font-weight: 700; color: var(--ink); }

@media (max-width: 640px) {
  .issue-nav { flex-direction: column; }
  .issue-nav-card.next { margin-left: 0; text-align: left; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #a1a1aa; margin-top: 5rem; }

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.site-footer .logo { font-size: 1.25rem; }

.footer-text { margin-top: 0.75rem; font-size: 0.9rem; line-height: 1.6; }

.footer-heading {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #e4e4e7;
}

.footer-links { list-style: none; margin: 0.75rem 0 0; padding: 0; }
.footer-links li { margin-top: 8px; }
.footer-links a { color: #a1a1aa; text-decoration: none; font-size: 0.9rem; }
.footer-links a:hover { color: #fff; }

.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.footer-bottom .container { padding-top: 1.25rem; padding-bottom: 1.25rem; font-size: 0.75rem; color: #71717a; }

/* ---------- Error page ---------- */
.error-page { text-align: center; padding-top: 6rem; padding-bottom: 6rem; }
.error-code { margin: 0; font-size: 4.5rem; font-weight: 800; color: var(--primary); }
.error-page h1 { margin: 1rem 0 0; font-size: 1.5rem; color: var(--ink); }
.error-page .page-sub { margin-left: auto; margin-right: auto; }
.error-page .hero-actions { margin-top: 2rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .covers-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--ink);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    gap: 4px;
  }

  .main-nav.open { display: flex; }

  .nav-toggle { display: block; }

  .hero-inner { grid-template-columns: 1fr; padding-top: 3rem; padding-bottom: 3rem; }
  .hero-issue { display: none; }

  .cards-grid { grid-template-columns: 1fr; }
  .covers-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }

  .issue-head { grid-template-columns: 1fr; }
  .issue-cover img { max-width: 200px; }

  .pdf-frame object { height: 70vh; }
}
