/* ==========================================================================
   Nikkilog — Anime detail page
   ========================================================================== */

/* ==========================================================================
   Hero — cover banner + overlapping details card
   ========================================================================== */
.detail-hero { margin-bottom: var(--s6); }

/* The banner is the artwork behind a dark, blurred layer.
   Two pseudo-elements rather than a filter on the element itself, so the
   artwork blurs while the badge stays sharp, and so the darkening can be
   separate from the blur. */
.hero-banner {
  position: relative;
  height: clamp(200px, 26vw, 320px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: #0b0e14; /* dark base, so the blur never shows a hard edge */
  background-size: cover;
  background-position: center 30%;
}

/* the artwork: blurred, slightly oversized so the blur has no visible edge */
.hero-banner::before {
  content: '';
  position: absolute;
  inset: -28px;
  background-image: inherit;
  background-size: cover;
  background-position: center 30%;
  filter: blur(4px) saturate(1.35) brightness(0.88);
  transform: scale(1.06);
  z-index: 0;
}

/* the dark layer over it, so anything sitting on the banner stays readable */
.hero-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(8, 11, 18, 0.46) 0%,
    rgba(8, 11, 18, 0.30) 55%,
    rgba(8, 11, 18, 0.58) 100%
  );
  z-index: 1;
}
.hero-badge {
  position: absolute;
  top: var(--s4);
  right: var(--s4);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  color: var(--title);
  font-size: 0.75rem;
  font-weight: 700;
}
.hero-badge .material-symbols-outlined { font-size: 16px; color: var(--good); }

/* the card that overlaps the banner */
.hero-card {
  position: relative;
  z-index: 3;
  margin: -72px var(--s5) 0;
  padding: var(--s5);
  display: flex;
  gap: var(--s5);
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-poster {
  flex: none;
  width: 150px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.main-top-anime-image { width: 100%; display: block; aspect-ratio: 2 / 3; object-fit: cover; }

.hero-body { flex: 1; min-width: 0; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  color: var(--muted);
  font-size: 0.82rem;
}
.hero-meta .sep { opacity: 0.5; }
.title-japanese-text { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.season-info a { color: var(--blue-main); font-weight: 600; }
.season-text:empty { display: none; }

.title-text {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  letter-spacing: -0.02em;
  margin: var(--s2) 0 var(--s2);
}
.hero-excerpt {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 68ch;
  margin-bottom: var(--s4);
}

.hero-genres, .hero-themes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s2); }
.hero-genres:empty, .hero-themes:empty { display: none; }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s4);
}
.stat-chip {
  min-width: 108px;
  padding: var(--s3) var(--s4);
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-align: left;
}
.stat-label {
  margin: 0;
  font-size: 0.64rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-chip p:last-child {
  margin: 2px 0 0;
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--title);
}
.anime-type {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: var(--primary-fixed);
  color: var(--on-primary-fixed);
  font-size: 0.75rem;
  font-weight: 700;
}
.hero-sub { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s3); color: var(--muted); font-size: 0.82rem; }
.hero-sub p { margin: 0; }
.hero-sub .sep { opacity: 0.5; }

/* ==========================================================================
   Two-column body + sidebar
   ========================================================================== */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--s6);
  align-items: start;
}
.detail-main { min-width: 0; }

.detail-side { display: flex; flex-direction: column; gap: var(--s4); position: sticky; top: calc(var(--topbar-h) + var(--s4)); }
.side-card {
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.side-title {
  font-size: 0.95rem;
  margin-bottom: var(--s3);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
}
.side-empty { color: var(--muted); font-size: 0.82rem; }

.info-matrix { display: flex; flex-direction: column; gap: 0; }
.info-row {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  padding: 7px 0;
  border-bottom: 1px solid var(--surface-2);
  font-size: 0.8rem;
}
.info-row:last-child { border-bottom: none; }
.info-row dt { color: var(--muted); flex: none; }
.info-row dd { margin: 0; text-align: right; color: var(--title); font-weight: 600; }

.score-bars { display: flex; flex-direction: column; gap: 6px; }
.score-row { display: grid; grid-template-columns: 20px 1fr 38px; align-items: center; gap: var(--s2); font-size: 0.75rem; }
.score-row .bar { height: 8px; border-radius: var(--radius-full); background: var(--surface-high); overflow: hidden; }
.score-row .bar > span { display: block; height: 100%; border-radius: var(--radius-full); background: var(--blue-main); }
.score-row .pct { text-align: right; color: var(--muted); }

.engage-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.engage-chip {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--title);
}
.engage-chip b { color: var(--blue-main); }

/* --- Tab navigation --- */
.details-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.details-navigation-ul {
  display: flex;
  gap: var(--s2);
}
.details-navigation-ul-li {
  padding: var(--s3) var(--s4);
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.details-navigation-ul-li:hover { color: var(--title); }
.details-navigation-ul-li.active { color: var(--blue-main); border-bottom-color: var(--blue-main); }

#recommend-btn {
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--blue-main);
  color: #fff;
  font-weight: 600;
}
#recommend-btn:hover { background: var(--blue-dark); }

#recommend-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s5);
  margin-bottom: var(--s5);
}
.recommend-search-div input { margin-top: var(--s2); }

/* --- Tabs --- */
.tab-content { display: none; }
.tab-content.active { display: block; }

.show-stats-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--s5);
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface);
  font-weight: 600;
  color: var(--title);
}
.show-stats-btn:hover { border-color: var(--blue-main); color: var(--blue-main); }

.overview-top-section {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

/* the page script sets display:flex on the active tab, so pin the direction */
#overview-content { flex-direction: column; gap: var(--s5); }
.tab-content.active { flex-direction: column; gap: var(--s5); }
.overview-left { min-width: 0; display: flex; flex-direction: column; gap: var(--s5); }

.synopsis h2 { margin-bottom: var(--s3); }
.synopsis p { color: var(--text); line-height: 1.7; max-width: 78ch; }

/* --- Tracking widget --- */
.track-watch-order {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s5);
  box-shadow: var(--shadow-sm);
}
.button-section {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s5);
}
.status-button {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  transition: all 0.16s var(--ease);
}
.status-button:hover { border-color: var(--blue-main); color: var(--blue-main); }
.status-button.active {
  background: var(--blue-main);
  border-color: var(--blue-main);
  color: #fff;
}

.input-section {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--s5);
  align-items: end;
}
.input-section label { display: block; font-size: 0.82rem; margin-bottom: var(--s2); }
.ep-controls { display: flex; align-items: center; gap: var(--s2); }
.ep-controls input { width: 74px; text-align: center; }
.ep-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--title);
  line-height: 1;
}
.ep-button:hover { background: var(--blue-soft); border-color: var(--blue-main); color: var(--blue-main); }
#ep-max-label { color: var(--muted); font-size: 0.8rem; }
.score input { width: 130px; }
.mood select { width: 220px; }

/* --- Relations / recommendations --- */
.watch-order h3,
#recommendations-below-relations h3 { margin-bottom: var(--s3); }
.relations, #recommendations-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--s4);
}
.relation-div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.relation-image-anchor { display: block; }
.relation-image { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.relation-title { padding: var(--s3) var(--s3) 0; font-weight: 600; font-size: 0.85rem; }
.relation-type,
.relation-year { padding: 0 var(--s3); font-size: 0.75rem; color: var(--muted); }
.relation-year { padding-bottom: var(--s3); }

/* --- Statistics graphs (revealed by "Show Stats") --- */
#statistics-content { display: none; order: -1; }
#statistics-content.visible {
  display: block;
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stats-info-text { display: flex; gap: var(--s5); flex-wrap: wrap; margin-bottom: var(--s4); font-weight: 600; }
.stats-info-text span { color: var(--blue-main); }
.graphs { display: grid; grid-template-columns: 3fr 2fr; gap: var(--s5); }
.scatter-chart, .doughnut-chart {
  display: flex;
  flex-direction: column;
}
.chart-title { margin-bottom: var(--s3); font-size: 0.95rem; }
.chart-box { position: relative; height: 260px; }

/* --- Reviews --- */
#reviews-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s5);
  box-shadow: var(--shadow-sm);
}
.reviews-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s4);
}
.header-and-view-all { display: flex; align-items: center; gap: var(--s2); }
.add-review-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--blue-main);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
}
.reviews-scroll-container { position: relative; }
.comment-list {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  max-height: 520px;
  overflow-y: auto;
  padding-right: var(--s2);
}
.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 34px; height: 34px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--title);
}
#scroll-btn-left { left: -12px; }
#scroll-btn-right { right: -12px; }

.comment-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: var(--s4);
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  transition: opacity 0.3s var(--ease);
}
.comment-card.fade-out { opacity: 0; }
.comment-image-div { display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
.comment-image-anchor { width: 52px; height: 52px; border-radius: var(--radius-full); overflow: hidden; }
.comment-image { width: 100%; height: 100%; object-fit: cover; }
.like-comment-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}
.like-comment-btn.liked { color: var(--blue-main); border-color: var(--blue-main); }
.like-comment-btn .material-symbols-outlined { font-size: 15px; }

.comment-detail { min-width: 0; }
.comment-top-section { display: flex; align-items: flex-start; justify-content: space-between; }
.comment-user-name { font-size: 0.95rem; }
.time-ago { font-size: 0.72rem; color: var(--muted); }
.comment-title { font-weight: 700; color: var(--title); margin-top: var(--s2); }
.comment-content { font-size: 0.9rem; color: var(--text); }
.comment-content.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* --- Characters --- */
.charContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: var(--s3);
}
.charInfoAndVoiceActor { display: contents; }
.charDiv {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.charDiv:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.char_image { width: 100%; aspect-ratio: 3 / 4; background-size: cover; background-position: center top; }
.char_detail { padding: 8px 10px; }
.char_detail p:first-child { font-weight: 600; color: var(--title); font-size: 0.78rem; line-height: 1.3; }
.char_detail p:last-child { font-size: 0.68rem; color: var(--muted); }
.va-cycler { padding: 0 10px 10px; }
.voiceActor_detail { display: flex; align-items: center; gap: var(--s2); }
.voiceActor_image { width: 24px; height: 24px; border-radius: var(--radius-full); background-size: cover; background-position: center; flex: none; }
.voiceActor_detail p { font-size: 0.74rem; color: var(--muted); }

/* --- Overlays (character / review) --- */
.character-overlay,
.add-review-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(23, 32, 44, 0.55);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: var(--s5);
  overflow-y: auto;
}
.character-overlay.active,
.character-overlay.show,
.add-review-overlay.active,
.add-review-overlay.show { display: flex; }

.character-overlay .details,
.add-review-overlay .overlay-content,
.add-review-overlay > h2 {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.character-overlay .details {
  position: relative;
  width: min(720px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--s6);
}
.character-overlay .character-name { font-size: 1.4rem; }
#close-overlay-button {
  position: absolute;
  top: var(--s4); right: var(--s4);
  width: 38px; height: 38px;
  border: none; border-radius: var(--radius-full);
  background: var(--surface-2);
}
.character-image-and-detail { display: grid; grid-template-columns: 200px 1fr; gap: var(--s5); }
.character-image-container { border-radius: var(--radius); overflow: hidden; }
.character-image { width: 100%; }
.alternate-name-container .kanji-katakana { color: var(--muted); margin-bottom: var(--s3); }
.character-about-container { font-size: 0.9rem; line-height: 1.65; max-height: 300px; overflow-y: auto; }
.language-container-ul { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.language-container-ul-li { padding: 4px 12px; border-radius: var(--radius-full); background: var(--blue-soft); font-size: 0.78rem; font-weight: 600; cursor: pointer; }

/* add review overlay */
.add-review-overlay { flex-direction: column; gap: var(--s4); }
.add-review-overlay > h2 { padding: var(--s5) var(--s6) 0; margin: 0; }
.add-review-overlay .overlay-content {
  width: min(640px, 94vw);
  max-height: 82vh;
  overflow-y: auto;
  padding: var(--s5) var(--s6);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.title-char-count { color: var(--muted); align-self: flex-end; }
.form-actions { display: flex; gap: var(--s3); }
.verdict-options { display: flex; gap: var(--s3); flex-wrap: wrap; }
.close-button {
  position: absolute; top: var(--s4); right: var(--s4);
  width: 36px; height: 36px; border: none; border-radius: var(--radius-full);
  background: var(--surface-2);
}
.instructions { font-size: 0.8rem; color: var(--muted); }
.comment-overlay-backdrop { display: none; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .graphs { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .top-section { margin: calc(-1 * 72px) calc(-1 * var(--s4)) var(--s5); }
}
@media (max-width: 1024px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-side { position: static; }
}
@media (max-width: 768px) {
  .hero-card { margin: -56px var(--s3) 0; padding: var(--s4); flex-direction: column; gap: var(--s4); }
  .hero-poster { width: 118px; }
  .hero-banner { height: 180px; }
  .title-text { font-size: 1.5rem; }
}
@media (max-width: 640px) {
  .input-section { grid-template-columns: 1fr; }
  .character-image-and-detail { grid-template-columns: 1fr; }
  .comment-card { grid-template-columns: 48px 1fr; }
}

/* --- Production staff --- */
.staffContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: var(--s3);
  margin-top: var(--s3);
}
.staffCard {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.16s var(--ease);
}
.staffCard:hover { border-color: var(--blue-main); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.staff_image {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: var(--radius-full);
  background-color: var(--surface-container);
  background-size: cover;
  background-position: center top;
}
.staff_detail { min-width: 0; }
.staff_detail p:first-child {
  font-weight: 600;
  color: var(--title);
  font-size: 0.82rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.staff_detail p:last-child {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .staffContainer { grid-template-columns: 1fr; }
  .staff_image { width: 40px; height: 40px; }
}
