/* citadel archive theme, portal green / rick blue / morty yellow / diane pink on deep space */

@font-face {
  font-family: "Get Schwifty";
  src: url("../assets/get_schwifty.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #070a14;
  --bg-2: #0c1322;
  --panel: #101a2e;
  --panel-2: #16223a;
  --line: #223050;

  --green: #97ce4c;
  --lime: #c6f24e;
  --blue: #5cd6e8;
  --yellow: #f5d94b;
  --pink: #ff5fa2;
  --red: #ff6b6b;

  --text: #e9eff9;
  --muted: #9db0cc;

  --tier-core: var(--green);
  --tier-diane: var(--pink);
  --tier-optional: var(--yellow);
  --tier-other: var(--blue);
  --tier-unranked: #46536b;

  --radius: 14px;
  /* schwifty font got no punctuation glyphs so logo n season headings only */
  --font-logo: "Get Schwifty", "Bangers", "Impact", sans-serif;
  --font-display: "Bangers", "Impact", sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }

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

/* stars */
.stars {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 22%, #ffffffb0 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, #ffffff70 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 34% 64%, #ffffff90 50%, transparent 51%),
    radial-gradient(1px 1px at 62% 84%, #ffffff60 50%, transparent 51%),
    radial-gradient(2px 2px at 88% 42%, #9be7ff66 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 8%, #ffffff80 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 88%, #c6f24e55 50%, transparent 51%),
    radial-gradient(900px 500px at 85% -10%, #97ce4c14, transparent 70%),
    radial-gradient(700px 500px at -10% 30%, #5cd6e810, transparent 70%),
    radial-gradient(800px 600px at 50% 110%, #ff5fa20d, transparent 70%),
    linear-gradient(180deg, #0a0f1d, var(--bg) 40%);
  background-size:
    340px 340px, 420px 420px, 380px 380px, 460px 460px, 520px 520px,
    300px 300px, 440px 440px, auto, auto, auto, auto;
}

/* hero */
.hero { text-align: center; padding: 3.2rem 1rem 1.6rem; position: relative; }

.portal { width: 150px; margin: 0 auto 0.6rem; }
.portal img {
  width: 100%; height: auto; display: block;
  animation: portal-glow 3.2s ease-in-out infinite;
}
@keyframes portal-glow {
  0%, 100% { filter: drop-shadow(0 0 18px #97ce4c77) drop-shadow(0 0 55px #97ce4c2e); }
  50%      { filter: drop-shadow(0 0 30px #97ce4cb0) drop-shadow(0 0 85px #97ce4c55); }
}

.site-title {
  font-family: var(--font-logo);
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  letter-spacing: 3px;
  color: var(--green);
  text-shadow: 0 0 24px #97ce4c55, 3px 3px 0 #14301b;
}
.site-title span { color: var(--blue); text-shadow: 0 0 24px #5cd6e855, 3px 3px 0 #12293a; }

.tagline { color: var(--muted); font-size: 0.98rem; margin-top: 0.3rem; }

/* progress dashboard */
.dashboard { max-width: 1180px; margin: 0.6rem auto 0; padding: 0 1.2rem; }
.progress-track {
  height: 14px; border-radius: 99px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line);
}
.progress-fill {
  height: 100%; width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #38c172, var(--green), var(--lime));
  box-shadow: 0 0 16px #97ce4c88;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-label { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 0.4rem; }

/* controls */
.controls {
  max-width: 1180px; margin: 1.1rem auto 0.4rem; padding: 1rem 1.2rem;
}
.control-row { display: flex; gap: 0.7rem; flex-wrap: wrap; }

#search {
  flex: 1; min-width: 220px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0.65rem 0.95rem; font: inherit; font-size: 0.95rem;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
#search:focus { border-color: var(--green); box-shadow: 0 0 0 3px #97ce4c2b; }
#search::placeholder { color: #6b7d9c; }

.btn-danger {
  background: transparent; color: var(--red);
  border: 1px solid #ff6b6b55; border-radius: 10px;
  padding: 0.65rem 1rem; font: inherit; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.btn-danger:hover { background: #ff6b6b1a; border-color: var(--red); }

/* tier filter pills */
.tier-pills { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 0.9rem; }

.tier-pill {
  --tc: var(--tier-unranked);
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--panel);
  border: 2px solid var(--tc); border-radius: 99px;
  padding: 0.42rem 0.9rem 0.42rem 0.6rem;
  cursor: pointer; user-select: none;
  font-size: 0.86rem; font-weight: 600;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s, background 0.2s;
}
.tier-pill:hover { transform: translateY(-2px); box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--tc) 55%, transparent); }
.pill-core     { --tc: var(--tier-core); }
.pill-diane    { --tc: var(--tier-diane); }
.pill-optional { --tc: var(--tier-optional); }
.pill-other    { --tc: var(--tier-other); }
.pill-unranked { --tc: var(--tier-unranked); }

.tier-pill input { position: absolute; opacity: 0; pointer-events: none; }
.tier-pill .box {
  width: 19px; height: 19px; flex: none;
  border: 2px solid var(--tc); border-radius: 6px;
  display: grid; place-items: center;
  transition: background 0.15s;
}
.tier-pill .box::after {
  content: "";
  width: 9px; height: 5px;
  margin-top: -2px;
  border-left: 2px solid #0a1020;
  border-bottom: 2px solid #0a1020;
  transform: rotate(-45deg) scale(0);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tier-pill input:checked + .box { background: var(--tc); }
.tier-pill input:checked + .box::after { transform: rotate(-45deg) scale(1); }
.tier-pill:has(input:not(:checked)) { opacity: 0.45; }
.tier-pill input:focus-visible + .box { outline: 2px solid var(--lime); outline-offset: 2px; }

.pill-name { color: var(--text); }
.pill-count {
  background: color-mix(in srgb, var(--tc) 22%, transparent);
  color: var(--tc);
  border-radius: 99px; padding: 0.05rem 0.5rem; font-size: 0.76rem; font-weight: 700;
}

/* switches */
.switch-row { display: flex; gap: 1.4rem; flex-wrap: wrap; margin-top: 0.85rem; }
.switch {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--muted); font-size: 0.88rem; font-weight: 500; cursor: pointer; user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .slider {
  width: 38px; height: 21px; flex: none; border-radius: 99px;
  background: var(--panel-2); border: 1px solid var(--line); position: relative;
  transition: background 0.2s, border-color 0.2s;
}
.switch .slider::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--muted); transition: transform 0.2s, background 0.2s;
}
.switch input:checked + .slider { background: #3c5a1e; border-color: var(--green); }
.switch input:checked + .slider::after { transform: translateX(17px); background: var(--lime); }
.switch input:focus-visible + .slider { outline: 2px solid var(--lime); outline-offset: 2px; }

/* loading n errors */
.loading { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.portal-spinner {
  width: 72px; height: auto; display: block; margin: 0 auto 1rem;
  filter: drop-shadow(0 0 16px #97ce4c66);
}
.load-error { color: var(--red); margin-bottom: 1rem; }

.empty-state { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.portal-mini {
  width: 52px; height: auto; display: block; margin: 0 auto 0.8rem;
  opacity: 0.55; filter: grayscale(0.35);
}

/* seasons */
main { max-width: 1180px; margin: 0 auto; padding: 0 1.2rem 3rem; }

.season { margin-top: 2.4rem; }
.season-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; margin-bottom: 1.1rem;
}
.season-head h2 { display: flex; align-items: baseline; gap: 0.7rem; }
.season-num {
  font-family: var(--font-logo); font-size: 1.9rem; letter-spacing: 2px;
  color: var(--lime); text-shadow: 0 0 18px #c6f24e33, 2px 2px 0 #16240c;
}
.season-year { color: var(--muted); font-size: 0.9rem; }

.season-stats { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; font-size: 0.86rem; }
.season-avg { color: var(--yellow); font-weight: 700; }
.season-progress { color: var(--muted); }
.season-toggle {
  background: transparent; color: var(--blue);
  border: 1px solid #5cd6e855; border-radius: 8px;
  padding: 0.3rem 0.7rem; font: inherit; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.season-toggle:hover { background: #5cd6e81a; border-color: var(--blue); }

/* episode cards */
.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 1.1rem;
}

.ep-card {
  --tc: var(--tier-unranked);
  position: relative;
  background: var(--panel);
  border: 2px solid var(--tc);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column;
  transform: translateZ(0);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s, border-color 0.2s;
  animation: card-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--stagger, 0) * 35ms);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.ep-card.tier-core     { --tc: var(--tier-core); }
.ep-card.tier-diane    { --tc: var(--tier-diane); }
.ep-card.tier-optional { --tc: var(--tier-optional); }
.ep-card.tier-other    { --tc: var(--tier-other); }

.ep-card:hover, .ep-card:focus-visible {
  transform: translateY(-7px) scale(1.015);
  box-shadow:
    0 16px 38px -8px color-mix(in srgb, var(--tc) 45%, transparent),
    0 0 0 1px color-mix(in srgb, var(--tc) 70%, transparent);
  z-index: 2;
  outline: none;
}

.ep-thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-2); }
.ep-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), filter 0.3s;
}
.ep-card:hover .ep-thumb img, .ep-card:focus-visible .ep-thumb img { transform: scale(1.09); }

.thumb-placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, #1c2c17, var(--bg-2) 75%);
}
.thumb-placeholder span {
  font-family: var(--font-display); font-size: 3rem; color: var(--green); opacity: 0.5;
}
.thumb-placeholder.tall { aspect-ratio: 16/9; }

.code-chip {
  position: absolute; top: 8px; left: 8px;
  background: #060a12d9; color: var(--lime);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.5px;
  padding: 0.18rem 0.5rem; border-radius: 6px;
  border: 1px solid #c6f24e33;
  backdrop-filter: blur(4px);
}
.code-chip.big { font-size: 0.9rem; top: 14px; left: 14px; }

.rating-chip {
  position: absolute; top: 8px; right: 8px;
  background: #060a12d9; color: var(--yellow);
  font-size: 0.75rem; font-weight: 700;
  padding: 0.18rem 0.5rem; border-radius: 6px;
  border: 1px solid #f5d94b33;
  backdrop-filter: blur(4px);
}
.rating-chip.alt { color: #b8c6dd; border-color: #ffffff22; }

.watched-ribbon, .upcoming-ribbon {
  position: absolute; bottom: 8px; left: 8px;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.8px;
  padding: 0.18rem 0.55rem; border-radius: 6px;
}
.watched-ribbon { background: #97ce4ce8; color: #10250b; display: none; }
.ep-card.watched .watched-ribbon { display: block; }
.upcoming-ribbon { background: #5cd6e8e0; color: #082530; }

.hover-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 0.4rem;
  padding: 0.85rem;
  background: linear-gradient(180deg, transparent 5%, #05080fdb 55%, #05080ff5);
  opacity: 0; transform: translateY(12%);
  transition: opacity 0.25s, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.ep-card:hover .hover-overlay, .ep-card:focus-visible .hover-overlay { opacity: 1; transform: translateY(0); }
.hover-overlay p { font-size: 0.8rem; color: #d7e2f2; line-height: 1.45; }
.open-hint { font-size: 0.74rem; font-weight: 700; color: var(--lime); letter-spacing: 0.4px; }

.ep-body { padding: 0.8rem 0.9rem 0.95rem; flex: 1; }
.ep-title { font-size: 1.02rem; font-weight: 700; line-height: 1.3; padding-right: 2rem; }
.ep-meta {
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
  margin-top: 0.4rem;
}
.ep-date { color: var(--muted); font-size: 0.78rem; }
.badges { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }

.badge {
  font-size: 0.64rem; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase;
  padding: 0.14rem 0.45rem; border-radius: 5px;
  border: 1px solid; background: transparent;
}
.badge-core     { color: var(--tier-core); border-color: color-mix(in srgb, var(--tier-core) 55%, transparent); background: color-mix(in srgb, var(--tier-core) 12%, transparent); }
.badge-diane    { color: var(--tier-diane); border-color: color-mix(in srgb, var(--tier-diane) 55%, transparent); background: color-mix(in srgb, var(--tier-diane) 12%, transparent); }
.badge-optional { color: var(--tier-optional); border-color: color-mix(in srgb, var(--tier-optional) 55%, transparent); background: color-mix(in srgb, var(--tier-optional) 12%, transparent); }
.badge-other    { color: var(--tier-other); border-color: color-mix(in srgb, var(--tier-other) 55%, transparent); background: color-mix(in srgb, var(--tier-other) 12%, transparent); }
.badge-upcoming { color: var(--blue); border-color: #5cd6e855; }

.ep-note {
  margin-top: 0.55rem; font-size: 0.78rem; color: var(--muted);
  border-left: 2px solid var(--tc); padding-left: 0.55rem; line-height: 1.45;
}

.watch-toggle {
  position: absolute; right: 10px; bottom: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel-2); color: var(--muted);
  border: 1.5px solid var(--line);
  cursor: pointer; transition: all 0.18s;
}
.watch-toggle:hover { border-color: var(--green); color: var(--green); transform: scale(1.12); }
.ep-card.watched .watch-toggle {
  background: var(--green); color: #10250b; border-color: var(--green);
  box-shadow: 0 0 12px #97ce4c66;
}

.ep-card.watched .ep-thumb img { filter: saturate(0.55) brightness(0.75); }
.ep-card.watched:hover .ep-thumb img { filter: saturate(0.9) brightness(0.95); }
.ep-card.watched { border-style: solid; }
.ep-card.watched::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: #070a1440; transition: opacity 0.2s;
}
.ep-card.watched:hover::after { opacity: 0; }

.ep-card.upcoming { border-style: dashed; opacity: 0.85; }

/* modal */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: none; align-items: center; justify-content: center;
  padding: 1.2rem;
  background: #04060cd0;
  backdrop-filter: blur(6px);
}
.modal.open { display: flex; animation: modal-fade 0.2s ease-out; }
@keyframes modal-fade { from { opacity: 0; } }

.modal-shell {
  position: relative; width: min(780px, 100%);
  max-height: 92vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 80px -20px #000, 0 0 60px -20px #97ce4c33;
  animation: modal-pop 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modal-pop { from { transform: translateY(22px) scale(0.97); opacity: 0; } }

.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 36px; height: 36px; border-radius: 50%;
  background: #060a12c9; color: var(--text);
  border: 1px solid var(--line); font-size: 1rem; cursor: pointer;
  transition: all 0.15s;
}
.modal-close:hover { color: var(--red); border-color: var(--red); transform: rotate(90deg); }

.modal-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 44px; height: 44px; border-radius: 50%;
  background: #0a1120e8; color: var(--lime);
  border: 1px solid var(--line);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
  transition: all 0.15s;
}
.modal-nav:hover:not(:disabled) { border-color: var(--green); box-shadow: 0 0 16px #97ce4c55; }
.modal-nav:disabled { opacity: 0.25; cursor: default; }
.modal-nav.prev { left: max(0.7rem, calc(50% - 440px)); }
.modal-nav.next { right: max(0.7rem, calc(50% - 440px)); }

.modal-banner { position: relative; aspect-ratio: 16 / 9; background: var(--bg-2); }
.modal-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-fade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, var(--panel));
}

.modal-body { padding: 1.1rem 1.6rem 1.6rem; }
.modal-body h2 {
  font-family: var(--font-display); font-size: 2.1rem; letter-spacing: 1.5px;
  color: var(--text); text-shadow: 0 0 20px #97ce4c2b;
}
.modal-meta {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  color: var(--muted); font-size: 0.85rem; margin: 0.35rem 0 1rem;
}

.modal-rating {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  align-items: baseline; column-gap: 0.45rem;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.8rem 1rem; margin-bottom: 1.1rem;
}
.modal-rating.none { color: var(--muted); font-size: 0.9rem; display: block; }
.big-star { color: var(--yellow); font-size: 1.5rem; }
.big-score { font-size: 1.9rem; font-weight: 800; color: var(--text); }
.out-of { color: var(--muted); font-size: 0.95rem; }
.rating-sub { justify-self: end; text-align: right; font-size: 0.78rem; color: var(--muted); display: flex; gap: 0.7rem; }
.rating-sub .src { color: var(--yellow); font-weight: 700; }
.rating-bar {
  grid-column: 1 / -1; height: 6px; margin-top: 0.6rem;
  background: var(--bg-2); border-radius: 99px; overflow: hidden;
}
.rating-bar div {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #f5d94b, #c6f24e);
  box-shadow: 0 0 10px #f5d94b77;
}

.lore-notes { margin-bottom: 1.1rem; }
.lore-notes h3 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); margin-bottom: 0.55rem;
}
.lore-row {
  display: flex; gap: 0.7rem; align-items: flex-start;
  padding: 0.55rem 0.7rem; border-radius: 10px; margin-bottom: 0.45rem;
  background: var(--panel-2);
}
.lore-row .badge { flex: none; margin-top: 0.15rem; }
.lore-row p { font-size: 0.86rem; color: #c9d6ea; }
.lore-core     { border-left: 3px solid var(--tier-core); }
.lore-diane    { border-left: 3px solid var(--tier-diane); }
.lore-optional { border-left: 3px solid var(--tier-optional); }
.lore-other    { border-left: 3px solid var(--tier-other); }

.modal-summary { color: #c9d6ea; font-size: 0.95rem; margin-bottom: 1.3rem; }

.modal-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.btn-primary {
  background: var(--green); color: #10250b;
  border: none; border-radius: 10px;
  padding: 0.65rem 1.2rem; font: inherit; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; transition: all 0.18s;
  box-shadow: 0 4px 18px -4px #97ce4c88;
}
.btn-primary:hover { background: var(--lime); transform: translateY(-1px); }
.btn-primary.on { background: var(--panel-2); color: var(--lime); border: 1px solid var(--green); box-shadow: none; }
.btn-ghost {
  display: inline-flex; align-items: center;
  background: transparent; color: var(--blue);
  border: 1px solid #5cd6e855; border-radius: 10px;
  padding: 0.65rem 1.1rem; font-size: 0.88rem; font-weight: 600;
  text-decoration: none; transition: all 0.18s;
}
.btn-ghost:hover { background: #5cd6e814; border-color: var(--blue); }

/* footer */
.footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem; padding: 1.6rem 1.2rem 2.2rem;
  text-align: center; color: #7488a8; font-size: 0.78rem;
}
.footer p { max-width: 760px; margin: 0.3rem auto; }
.footer a { color: #9db0cc; }
.cookie-note { opacity: 0.8; }

/* responsive n motion */
@media (max-width: 560px) {
  .ep-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.7rem; }
  .ep-note { display: none; }
  .modal-nav.prev { left: 0.4rem; }
  .modal-nav.next { right: 0.4rem; }
  .modal-body { padding: 1rem 1.1rem 1.3rem; }
}

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