/* Warm dark catalogue palette. */
:root {
  --bg0: #140e0a;
  --bg1: #1c1410;
  --bg2: #2c2018;
  --ink: #f6efe4;
  --muted: #c4b09a;
  --line: rgba(243, 220, 190, 0.16);
  --accent: #d4a24a;
  --accent-soft: rgba(212, 162, 74, 0.2);
  --focus: #f0d7a2;
  --panel: rgba(28, 16, 10, 0.88);
  --radius: 10px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background: #140e0a;
  /* No-op on desktop; keeps notched phones clear of the home indicator. */
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(28, 14, 8, 0.55), rgba(18, 8, 4, 0.64)),
    url("site-bg.jpg?v=5c68e66b") center / cover no-repeat;
}

body > * {
  position: relative;
  z-index: 1;
}

a {
  color: var(--accent);
}

a:hover {
  color: #f0d7a2;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.visually-hidden {
  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 {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--bg2);
  color: var(--ink);
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  z-index: 10;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.site-header,
main {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  padding: 2.5rem 0 1.5rem;
  animation: rise 0.7s ease both;
}

.header-main {
  display: grid;
  gap: 1.25rem;
  align-items: end;
}

@media (min-width: 840px) {
  .header-main {
    grid-template-columns: 1fr minmax(220px, 320px);
  }
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--muted);
}

.brand-block {
  display: grid;
  gap: 1rem;
}

.brand-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 1.25rem;
  row-gap: 0;
}

.brand-logo {
  width: clamp(4.5rem, 12vw, 7rem);
  height: auto;
  display: block;
  /* Opaque mark as-is — no cream fill, blend, or filter. */
  background: none;
  border-radius: 0;
  box-shadow: none;
  filter: none;
  mix-blend-mode: normal;
  opacity: 1;
}

.brand-text {
  min-width: 0;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.subtitle {
  margin: 0.55rem 0 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.brand-logo-link {
  display: block;
  line-height: 0;
  color: inherit;
  text-decoration: none;
}

html.boot-hub #view-manga {
  display: none !important;
}

html.boot-hub #view-hub[hidden] {
  display: block !important;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.site-nav a:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff8ee;
}

.brand-text .nav-ext,
.nav-ext {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.7rem 0 0;
}

.nav-ext .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: rgba(36, 24, 16, 0.72);
  color: var(--muted);
  text-decoration: none;
  line-height: 0;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.nav-ext .nav-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.nav-ext .nav-icon-text {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}

.nav-ext .nav-icon:hover {
  color: var(--ink);
  border-color: rgba(212, 162, 74, 0.55);
  background: rgba(52, 34, 20, 0.88);
}

.nav-ext .nav-icon:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.search-wrap input {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(28, 16, 10, 0.92);
  color: var(--ink);
  font: inherit;
}

.search-wrap input::placeholder {
  color: var(--muted);
}

.section-head {
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
}

.section-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.progress-head p {
  margin-top: 0.45rem;
}

.progress-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.progress-toggle-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem 0.85rem;
  min-width: 0;
}

.section-head h2 .progress-toggle {
  font: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
}

.progress-toggle-label {
  display: inline;
}

.progress-summary {
  color: var(--muted);
  font-size: 0.95rem;
}

.progress-chevron {
  flex: 0 0 auto;
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.progress-toggle[aria-expanded="true"] .progress-chevron {
  transform: rotate(225deg);
  margin-top: 0.35rem;
}

.latest.is-collapsed .progress-head > p,
.latest.is-collapsed #latest-body,
.progress.is-collapsed .progress-head > p,
.progress.is-collapsed #progress-body,
.projects.is-collapsed .progress-head > p,
.projects.is-collapsed #projects-body {
  display: none;
}

.latest,
.progress,
.projects {
  padding: 1.5rem 0 0.5rem;
}

.projects {
  padding-bottom: 3rem;
}

.progress-list {
  display: grid;
  gap: 0.65rem;
}

.progress-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.progress-pager button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.progress-pager button:hover:not(:disabled) {
  border-color: var(--accent);
}

.progress-pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

.progress-page-meta {
  color: var(--muted);
  font-size: 0.9rem;
  min-width: 7.5rem;
  text-align: center;
}

.progress-card {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0.85rem;
  align-items: start;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
}

a.progress-card:hover {
  border-color: rgba(212, 162, 74, 0.5);
  background: rgba(212, 162, 74, 0.14);
}

.progress-card > div {
  min-width: 0;
}

.progress-card img {
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg1);
}

.progress-card .series {
  font-weight: 600;
  line-height: 1.25;
}

.progress-card .detail {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.progress-series .series a {
  color: inherit;
  text-decoration: none;
}

.progress-series .series a:hover {
  color: var(--focus);
}

.progress-chapters {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.55rem;
}

.progress-chapter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 1.25rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.progress-chapter-meta {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.progress-chapter .ch {
  color: var(--accent);
  font-weight: 700;
}

.progress-chapter .since {
  color: #b5a08c;
  font-size: 0.8rem;
  font-style: italic;
}

.progress-chapter .since-empty {
  color: var(--muted);
  font-style: normal;
  opacity: 0.85;
}

.stage-pill {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  width: max-content;
  max-width: 100%;
  margin-left: auto;
  min-width: 0;
  padding: 0.38rem 0.9rem;
  border: 1px solid rgba(243, 220, 190, 0.22);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-x: auto;
  scrollbar-width: none;
}

.stage-pill::-webkit-scrollbar {
  display: none;
}

.stage-step {
  color: #b5a08c;
  white-space: nowrap;
}

.stage-short {
  display: none;
}

@media (max-width: 640px) {
  .stage-long {
    display: none;
  }

  .stage-short {
    display: inline;
  }
}

.stage-step.current {
  color: var(--accent);
  font-weight: 700;
}

.stage-sep {
  color: #7a6858;
  font-size: 0.72rem;
}

.progress-more {
  align-self: flex-start;
  margin-top: 0.15rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.progress-more:hover {
  text-decoration: underline;
}

.latest-scroll {
  max-height: calc(5 * 4.6rem);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  scrollbar-color: var(--accent) transparent;
}

.latest-row {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  gap: 0.85rem;
  align-items: center;
  min-height: 4.6rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease;
}

.latest-row:last-child {
  border-bottom: 0;
}

.latest-row:hover,
.latest-row:focus-visible {
  background: var(--accent-soft);
}

.latest-row img {
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg2);
}

.latest-row .meta {
  min-width: 0;
}

.latest-row .series {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.latest-row .chapter {
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.latest-row .date {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
  white-space: nowrap;
}

.latest-row .cta {
  display: none;
}

@media (min-width: 720px) {
  .latest-row {
    grid-template-columns: 3rem 1fr auto auto;
  }

  .latest-row .cta {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 0.85rem;
    color: var(--ink);
  }
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.filters {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  max-width: 100%;
  scrollbar-width: thin;
}

.filter-btn {
  flex: 0 0 auto;
  min-height: 2.35rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff8ee;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.sort-wrap select {
  min-height: 2.35rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(28, 16, 10, 0.92);
  color: var(--ink);
  font: inherit;
}

.result-meta {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-items: stretch;
}

@media (min-width: 1100px) {
  .card-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.project-card,
.project-card.hub-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: rgba(212, 162, 74, 0.5);
}

.cover-link {
  display: block;
  aspect-ratio: 2 / 3;
  background: var(--bg2);
}

.cover-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 0.9rem 1rem;
  flex: 1 1 auto;
  min-height: 0;
}

.card-body > :not(.card-actions) {
  flex: 0 0 auto;
}

.card-body h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.25;
}

.card-body h3 a {
  color: inherit;
  text-decoration: none;
}

.card-body h3 a:hover {
  color: var(--accent);
}

.category {
  display: inline-flex;
  align-self: start;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.category.series {
  color: #d7e7c8;
  background: rgba(90, 140, 70, 0.2);
}

.category.anthology {
  color: #cfe0f5;
  background: rgba(70, 110, 160, 0.25);
}

.category.oneshot {
  color: #f0d8b0;
  background: rgba(160, 110, 40, 0.22);
}

.category.doujin {
  color: #e5d0f0;
  background: rgba(120, 80, 140, 0.22);
}

.latest-line,
.released-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.card-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.75rem;
}

.card-actions a {
  display: inline-flex;
  flex: 1 1 0;
  justify-content: center;
  align-items: center;
  min-height: 2.2rem;
  min-width: 0;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.86rem;
  text-align: center;
}

.card-actions .primary {
  background: var(--accent);
  color: #fff8ee;
}

.card-actions .primary:hover {
  color: #fff;
  filter: brightness(1.05);
}

.card-actions .secondary {
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
}

.card-actions .secondary:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.empty {
  margin: 1.5rem 0 0;
  color: var(--muted);
}

.back-to-top {
  position: fixed;
  right: max(1.25rem, calc(env(safe-area-inset-right, 0px) + 0.75rem));
  bottom: max(1.25rem, calc(env(safe-area-inset-bottom, 0px) + 0.75rem));
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  width: auto;
  min-width: 3.1rem;
  height: auto;
  min-height: 3.1rem;
  padding: 0.45rem 0.7rem 0.4rem;
  border: 1px solid rgba(243, 220, 190, 0.4);
  border-radius: 999px;
  background: var(--accent);
  color: #fff8ee;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  opacity: 0;
  transform: translateY(0.35rem);
  transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.back-to-top.is-visible {
  display: inline-flex;
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  filter: brightness(1.08);
  color: #fff;
}

.back-to-top:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.back-to-top svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.back-to-top-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile polish only — desktop rules above stay unchanged.
   Cap at 719px so it never overlaps the existing min-width: 720px desktop rules. */
@media (max-width: 719px) {
  .site-nav a {
    min-height: 2.75rem;
    padding: 0.45rem 1rem;
  }

  .nav-ext .nav-icon {
    width: 2.75rem;
    height: 2.75rem;
  }

  .nav-ext .nav-icon svg {
    width: 1.15rem;
    height: 1.15rem;
  }

  .progress-toggle {
    min-height: 2.75rem;
    padding: 0.25rem 0;
  }

  .filters {
    flex-wrap: wrap;
    overflow-x: visible;
    row-gap: 0.45rem;
  }

  .filter-btn {
    min-height: 2.75rem;
    padding: 0.45rem 0.95rem;
  }

  .sort-wrap select {
    min-height: 2.75rem;
  }

  .progress-pager button {
    min-height: 2.75rem;
    padding: 0.5rem 0.9rem;
  }

  .card-actions a {
    min-height: 2.75rem;
  }

  /* Free horizontal space for titles: date under meta instead of a side column. */
  .latest-row {
    grid-template-columns: 3rem minmax(0, 1fr);
    align-items: start;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .latest-row img {
    align-self: center;
  }

  .latest-row .date {
    grid-column: 2;
    text-align: left;
    font-size: 0.8rem;
    line-height: 1.3;
  }

  .stage-pill {
    -webkit-overflow-scrolling: touch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
