:root { color-scheme: dark; }

/* ===== Base ===== */

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background:
    radial-gradient(1.5px 1.5px at 6% 12%, rgba(255,255,255,0.45), transparent 65%),
    radial-gradient(1.5px 1.5px at 14% 78%, rgba(190,220,255,0.38), transparent 65%),
    radial-gradient(1.5px 1.5px at 22% 36%, rgba(255,255,255,0.40), transparent 65%),
    radial-gradient(1.5px 1.5px at 30% 60%, rgba(180,210,255,0.36), transparent 65%),
    radial-gradient(1px 1px at 38% 18%, rgba(255,255,255,0.32), transparent 65%),
    radial-gradient(1.5px 1.5px at 48% 80%, rgba(170,200,255,0.34), transparent 65%),
    radial-gradient(1px 1px at 56% 44%, rgba(255,255,255,0.30), transparent 65%),
    radial-gradient(1.5px 1.5px at 66% 24%, rgba(180,210,255,0.36), transparent 65%),
    radial-gradient(1px 1px at 74% 70%, rgba(255,255,255,0.30), transparent 65%),
    radial-gradient(1.5px 1.5px at 82% 42%, rgba(170,200,255,0.34), transparent 65%),
    radial-gradient(1px 1px at 90% 16%, rgba(255,255,255,0.28), transparent 65%),
    radial-gradient(1.5px 1.5px at 96% 82%, rgba(180,210,255,0.34), transparent 65%),
    #0b0b0f;
  background-repeat: repeat;
  background-size: 520px 520px;
  color: #e9e9ef;
  animation: starDriftFar 220s linear infinite;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(2px 2px at 10% 20%, rgba(255,255,255,0.38), transparent 70%),
    radial-gradient(2px 2px at 34% 66%, rgba(150,190,255,0.30), transparent 70%),
    radial-gradient(2px 2px at 58% 14%, rgba(255,255,255,0.34), transparent 70%),
    radial-gradient(2px 2px at 76% 72%, rgba(160,200,255,0.28), transparent 70%),
    radial-gradient(2px 2px at 92% 40%, rgba(255,255,255,0.30), transparent 70%);
  background-repeat: repeat;
  background-size: 800px 800px;
  opacity: 0.55;
  animation: starDriftNear 160s linear infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(2px 2px at 12% 18%, rgba(255,255,255,0.55), transparent 70%),
    radial-gradient(2px 2px at 41% 29%, rgba(180,210,255,0.45), transparent 70%),
    radial-gradient(2px 2px at 67% 74%, rgba(255,255,255,0.50), transparent 70%),
    radial-gradient(2px 2px at 84% 36%, rgba(170,200,255,0.42), transparent 70%);
  background-repeat: no-repeat;
  opacity: 0.35;
  animation: starTwinkle 7s ease-in-out infinite alternate;
}

@keyframes starDriftFar {
  from { background-position: 0 0; }
  to   { background-position: -80px 100px; }
}

@keyframes starDriftNear {
  from { background-position: 0 0; }
  to   { background-position: 60px -70px; }
}

@keyframes starTwinkle {
  0% {
    opacity: 0.18;
    transform: scale(1);
  }
  50% {
    opacity: 0.42;
    transform: scale(1.03);
  }
  100% {
    opacity: 0.22;
    transform: scale(0.99);
  }
}

a {
  color: #c7b7ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== Navigation ===== */

nav {
  padding: 0;
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: nowrap;
}

.site-brand {
  display: flex;
  align-items: center;
  margin-right: 18px;
  gap: 12px;
  flex-shrink: 0;
}

.site-brand img {
  height: 54px;
  width: auto;
  border: none;
  border-radius: 0;
  display: block;
}

.site-brand span {
  font-weight: 600;
  letter-spacing: 0.5px;
  line-height: 1;
  white-space: nowrap;
}

.nav-inner > a:first-of-type {
  margin-left: auto;
}

nav a.nav-current {
  color: #ffffff;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ===== Cards ===== */

.card {
  background: #141421;
  border: 1px solid #24243a;
  border-radius: 14px;
  padding: 14px;
  margin: 12px 0;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.card::before {
  content: "";
  position: absolute;
  inset: -30%;
  z-index: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(110,90,255,0.15), transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(80,160,255,0.13), transparent 32%);
  filter: blur(30px);
  opacity: 0.65;
  transition: opacity .2s ease, filter .2s ease, transform .2s ease;
  pointer-events: none;
}

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

.card:hover::before {
  opacity: 1;
  filter: blur(36px);
  transform: scale(1.02);
}

.meta {
  opacity: 0.75;
  font-size: 12px;
  margin-top: 8px;
}

/* ===== Typography ===== */

h1 {
  font-size: 28px;
  margin: 10px 0 6px;
}

h2 {
  font-size: 16px;
  margin: 0 0 8px;
}

small {
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 11px;
  opacity: 0.6;
}

/* ===== Buttons ===== */

.button {
  display: inline-block;
  padding: 8px 14px;
  margin-top: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg,#2a2a48,#3c2f5a);
  border: 1px solid #4b3f70;
  color: #ffffff;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: all .15s ease;
}

.button:hover {
  background: linear-gradient(135deg,#3c2f5a,#57438a);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(80,60,140,.4);
}

/* ===== Media ===== */

img,
video {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid #24243a;
}

/* ===== Dividers ===== */

hr {
  border: none;
  border-top: 1px solid #24243a;
  margin: 16px 0;
}

/* ===== Access headers ===== */

.access-header {
  position: relative;
}

.access-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.access-label,
.access-id {
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 11px;
  opacity: 0.7;
}

/* ===== Hero glow ===== */

.access-header.hero-glow::before {
  content: "";
  position: absolute;
  inset: -30%;
  z-index: 0;
  background:
    radial-gradient(circle at 25% 35%, rgba(120,90,220,0.18), transparent 32%),
    radial-gradient(circle at 75% 30%, rgba(80,130,255,0.10), transparent 28%),
    radial-gradient(circle at 50% 80%, rgba(160,90,200,0.10), transparent 30%);
  filter: blur(34px);
  animation: imperialGlowDrift 14s ease-in-out infinite alternate;
  pointer-events: none;
}

.access-header.hero-glow > * {
  position: relative;
  z-index: 1;
}

@keyframes imperialGlowDrift {
  0% {
    transform: translate3d(-1.5%,-1%,0) scale(1);
    opacity: .85;
  }
  50% {
    transform: translate3d(1.5%,1%,0) scale(1.03);
    opacity: 1;
  }
  100% {
    transform: translate3d(.5%,-1.5%,0) scale(1.01);
    opacity: .9;
  }
}

/* ===== Hero raven watermark ===== */

.access-header.hero-glow::after {
  content: "";
  position: absolute;

  width: 460px;
  height: 460px;

  left: 50%;
  top: 50%;
  transform: translate(-50%, -45%);

  background: url("/assets/img/RavenHeart.png") center / contain no-repeat;

  opacity: 0.20;

  pointer-events: none;
  z-index: 0;
}


/* ===== Episode reading layout ===== */

.episode-text {
  font-family: "Literata", Georgia, serif;
  max-width: 660px;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.75;
}

.episode-text p {
  margin: 0 0 1.6em 0;
}

.card-narrow {
  max-width: 660px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Episode navigation ===== */

.episode-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.episode-nav .prev { justify-self: start; }
.episode-nav .center { justify-self: center; }
.episode-nav .next { justify-self: end; }

.episode-nav .placeholder {
  display: block;
  height: 1px;
}

/* ===== Intro / Outro blocks ===== */

.imperial-intro,
.imperial-outro {
  max-width: 660px;
  margin: 2.2em auto;
  padding: 14px 16px;
  border: 1px solid #24243a;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  letter-spacing: .2px;
}

.imperial-intro { font-weight: 700; }
.imperial-outro { font-style: italic; }

/* ===== Homepage layout ===== */

.home-row-wrap {
  margin: 12px 0;
  overflow: visible;
}

.home-row-wrap .card {
  margin: 0;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 900px) {
  .home-grid {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}

.home-card {
  display: block;
}

.home-card-body {
  display: block;
}

.push-bottom {
  margin-top: 14px;
}

#latest-transmission-body {
  margin-top: 10px;
}

#latest-transmission-body img {
  width: 100%;
  max-width: 420px;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid #24243a;
}

.home-actions {
  margin-top: 10px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.home-actions .button {
  margin-top: 0;
}

#yt-embed {
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-frame {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #24243a;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-embed {
  position: relative;
  width: 100%;
  max-width: 660px;
  margin: 12px auto 0;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #24243a;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  display: block;
}

/* merch block */
#shop-card {
  display: flex;
  flex-direction: column;
  opacity: 0.95;
}

#shop-card .home-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

#shop-card .push-bottom {
  margin-top: auto;
}

#shop-card .access-label,
#shop-card .access-id {
  opacity: 0.55;
}

#shop-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
}

.home-product-img {
  width: 100%;
  max-width: 320px;
  height: 180px;
  object-fit: cover;
  object-position: center;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid #24243a;
}


/* ===== Character image grids ===== */

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(240px,1fr));
  gap: 12px;
  margin-top: 10px;
}

.image-grid figure {
  margin: 0;
}

.image-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #24243a;
}

.image-grid figcaption {
  margin-top: 6px;
  font-size: 12px;
  opacity: .75;
}

.image-grid--portrait img {
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

/* ===== Shot overlay ===== */

.shot {
  position: relative;
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #24243a;
}

.shot img {
  width: 100%;
  height: 100%;
  display: block;
}

.shot figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 12px;
  font-size: 12px;
}


.episode-banner {
  display: block;
  width: 100%;
  max-width: 660px;
  margin: 14px auto 18px;
  border-radius: 12px;
  border: 1px solid #24243a;
  box-shadow: 0 0 0 1px rgba(120, 100, 255, 0.15),
              0 10px 30px rgba(0,0,0,0.4);
}


.character-signature {
  margin: 8px 0 0;
  font-size: 0.95rem;
  font-style: italic;
  color: #b8b8d9;
  opacity: 0.75;
}

.character-card {
  position: relative;
  overflow: hidden;
}

.character-card__content {
  position: relative;
  z-index: 2;
}

.character-card--visual::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 42%;
  height: 100%;
  background-image:
    linear-gradient(to left, rgba(10,10,20,0.6), rgba(10,10,20,0)),
    var(--card-portrait);
  background-repeat: no-repeat;
  background-position: var(--card-portrait-position, 92% bottom);
  background-size: contain;
  opacity: var(--card-portrait-opacity, 0.50);
  transform: scale(var(--card-portrait-scale, 1));
  transform-origin: bottom right;
  pointer-events: none;

mask-image:
  linear-gradient(to left, rgba(0,0,0,1) 40%, rgba(0,0,0,0)),
  linear-gradient(to top, rgba(0,0,0,1) 70%, rgba(0,0,0,0));

-webkit-mask-image:
  linear-gradient(to left, rgba(0,0,0,1) 40%, rgba(0,0,0,0)),
  linear-gradient(to top, rgba(0,0,0,1) 70%, rgba(0,0,0,0));
}

.quote-block {
  max-width: 660px;
}

.quote-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #e9e9ef;
}

.quote-speaker {
  margin-top: 10px;
  font-style: italic;
  opacity: 0.75;
  color: #b8b8d9;
}



#shop-card .home-card-body {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#shop-card .push-bottom {
  margin-top: auto;
}

#shop-card {
  display: flex;
  flex-direction: column;
}

#shop-card .home-card-body {
  flex: 1;
}


.kaji-toggle {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.kaji-toggle button {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.14);
  color: #d8d8e8;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
  font: inherit;
}

.kaji-toggle button.active {
  background: linear-gradient(135deg,#2a2a48,#3c2f5a);
  border-color: #4b3f70;
  color: #ffffff;
}

.kaji-toggle button:hover {
  background: rgba(255,255,255,0.08);
}