/* ==========================================================
   Kaen Kori War — site styles
   Colors and fonts live in :root so the whole look can be
   changed in one place.
   ========================================================== */

:root {
  --bg: #000000;
  --surface: #0c0c0f;
  --surface-2: #15151a;
  --line: #26262e;
  --text: #f4f1f6;
  --muted: #a7a2ad;
  --accent: #da00ff;        /* KKW purple */
  --accent-soft: rgba(218, 0, 255, 0.18);
  --fire: #ff6a1f;          /* Kaen */
  --ice: #7fd6ff;           /* Kori */

  --font-display: "Vollkorn SC", Georgia, serif;
  --font-body: "Vollkorn", Georgia, serif;

  --max: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 18px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
}

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  /* solid at the very top, fading out at its lower edge so content
     scrolls softly underneath instead of hitting a hard line */
  background: linear-gradient(to bottom,
    rgba(0, 0, 0, 0.95) 0%,
    rgba(0, 0, 0, 0.85) 55%,
    rgba(0, 0, 0, 0.45) 80%,
    rgba(0, 0, 0, 0) 100%);
  padding-bottom: 18px;
  margin-bottom: -18px;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
}

.brand img {
  height: 60px;
  width: auto;
}

.nav {
  display: flex;
  gap: clamp(14px, 3vw, 34px);
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.nav a {
  color: var(--text);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { text-decoration: none; color: var(--accent); }
.nav a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Type ---------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: 0.02em;
}

.page-title {
  text-align: center;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  margin: clamp(40px, 7vw, 72px) 0 8px;
}

.page-lede {
  text-align: center;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto clamp(32px, 5vw, 56px);
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  text-align: center;
  margin-bottom: 8px;
}

.rule {
  width: 64px;
  height: 3px;
  margin: 0 auto 32px;
  border: 0;
  background: linear-gradient(90deg, var(--fire), var(--accent), var(--ice));
  border-radius: 3px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 1.05rem;
  padding: 14px 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--accent-soft);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Home: hero ---------- */

.hero {
  padding: clamp(24px, 4vw, 48px) 0 0;
}

.hero-banner {
  border: 3px solid var(--accent);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 0 60px var(--accent-soft);
}
.hero-banner img { width: 100%; height: auto; }

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 36px 0 12px;
  text-align: center;
}

.tagline {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  letter-spacing: 0.1em;
  color: var(--muted);
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.latest {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  color: var(--muted);
}
.latest a { color: var(--text); border-bottom: 1px solid var(--accent); }
.latest a:hover { color: var(--accent); text-decoration: none; }

/* ---------- Home: synopsis ---------- */

.synopsis {
  padding: clamp(48px, 8vw, 96px) 0;
}
.synopsis p {
  max-width: 760px;
  margin: 0 auto;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  text-align: center;
}

/* ---------- Home: cast preview ---------- */

.cast-preview {
  padding: 0 0 clamp(56px, 8vw, 96px);
}

.cast-strip {
  --per-row: 5;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  max-width: 1000px;
  margin: 0 auto 36px;
}
.cast-strip > a {
  flex: 0 0 calc((100% - (var(--per-row) - 1) * 14px) / var(--per-row));
}

.cast-strip a {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  aspect-ratio: 10 / 13;
  position: relative;
}
.cast-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.cast-strip a:hover img { transform: scale(1.05); }
.cast-strip span {
  position: absolute;
  inset: auto 0 0 0;
  padding: 24px 10px 8px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  text-align: center;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}
.cast-strip a:hover { text-decoration: none; border-color: var(--accent); }

.center { text-align: center; }

/* ---------- Home: creators ---------- */

.creators {
  padding: clamp(48px, 8vw, 96px) 0;
  background: transparent;
}

.creator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 340px));
  justify-content: center;
  gap: clamp(24px, 5vw, 64px);
}

.creator {
  text-align: center;
}
.creator {
  --g1: var(--fire);
  --g2: var(--ice);
  position: relative;
  padding: 24px 16px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.creator img {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 18px;
  border: 3px solid color-mix(in srgb, var(--g1) 60%, var(--accent));
  box-shadow:
    -6px -4px 22px -4px color-mix(in srgb, var(--g1) 60%, transparent),
    6px 6px 22px -4px color-mix(in srgb, var(--g2) 60%, transparent);
  transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.2s ease;
}
.creator:hover,
.creator:focus-within { transform: translateY(-4px); }
.creator:hover img,
.creator:focus-within img {
  transform: scale(1.04);
  border-color: var(--g1);
  box-shadow:
    -10px -6px 40px -2px color-mix(in srgb, var(--g1) 85%, transparent),
    10px 10px 40px -2px color-mix(in srgb, var(--g2) 85%, transparent);
}
/* The whole creator block links to their Instagram */
.creator .ig-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
.creator:hover .ig-link { color: var(--g1); }
.ig-hint {
  position: absolute;
  top: 150px;
  left: 50%;
  transform: translate(-50%, 6px);
  padding: 4px 12px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: #fff;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--g1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.creator:hover .ig-hint,
.creator:focus-within .ig-hint { opacity: 1; transform: translate(-50%, 0); }
.creator .role {
  font-family: var(--font-display);
  color: var(--accent);
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  margin: 0;
}
.creator h3 { font-size: 1.6rem; margin: 4px 0 10px; }

.ig-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.ig-link svg { width: 20px; height: 20px; fill: var(--accent); }

/* ---------- Read page ---------- */

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: clamp(18px, 3vw, 32px);
  padding-bottom: clamp(56px, 8vw, 96px);
}

.chapter {
  --g1: var(--fire);
  --g2: var(--ice);
  position: relative;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--g1) 45%, var(--line));
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-shadow:
    -6px -4px 18px -6px color-mix(in srgb, var(--g1) 55%, transparent),
    6px 6px 18px -6px color-mix(in srgb, var(--g2) 55%, transparent);
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}
.chapter:hover,
.chapter:focus-within {
  transform: translateY(-4px);
  border-color: var(--g1);
  box-shadow:
    -10px -6px 34px -4px color-mix(in srgb, var(--g1) 80%, transparent),
    10px 10px 34px -4px color-mix(in srgb, var(--g2) 80%, transparent);
}
/* The whole card is clickable: the Read Now link stretches over it */
.chapter .btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
.chapter:hover .btn { box-shadow: 0 8px 28px var(--accent-soft); }
.chapter .chapter-cover img { transition: transform 0.35s ease; }
.chapter:hover .chapter-cover img { transform: scale(1.03); }

.chapter-cover {
  aspect-ratio: 7 / 10;
  background: var(--surface-2);
  overflow: hidden;
}
.chapter-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Title card used when a chapter has no cover art yet */
.cover-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 106, 31, 0.35), transparent 55%),
    radial-gradient(circle at 80% 85%, rgba(127, 214, 255, 0.3), transparent 55%),
    var(--surface-2);
}
.cover-card .num {
  font-family: var(--font-display);
  font-size: 4.5rem;
  line-height: 1;
  color: var(--accent);
}
.cover-card .name {
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.chapter-body {
  padding: 18px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.chapter-num {
  font-family: var(--font-display);
  color: var(--accent);
  letter-spacing: 0.12em;
  font-size: 0.9rem;
  margin: 0;
}
.chapter h2 { font-size: 1.35rem; margin: 0; }
.chapter .btn { margin-top: auto; text-align: center; padding: 11px 20px; }

.badge {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

/* ---------- Characters page ---------- */

.cast-jump {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 auto clamp(40px, 6vw, 64px);
  padding: 0;
  list-style: none;
}
.cast-jump a {
  display: inline-block;
  font-family: var(--font-display);
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
}
.cast-jump a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.character {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  padding: clamp(40px, 6vw, 72px) 0;
  scroll-margin-top: 90px;
}
.character:nth-of-type(even) .character-art { order: 2; }

.character-art {
  justify-self: center;
  width: 100%;
  max-width: 420px;
  border: 3px solid var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 50px var(--accent-soft);
}
.character-art img {
  width: 100%;
  height: auto;
}

.character-name {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  color: var(--accent);
  margin-bottom: 4px;
}
.character-role {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 18px;
  min-height: 1.6em;           /* keeps space for the role line */
}
.character-bio {
  margin: 0;
  min-height: 8em;             /* keeps space for the bio */
}
.character-bio p { margin: 0 0 1em; }

/* ---------- Footer ---------- */

.site-footer {
  padding: 40px 0 48px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer .ig-link { margin-bottom: 14px; }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .cast-strip { --per-row: 3; }
  .character { grid-template-columns: 1fr; }
  .character:nth-of-type(even) .character-art { order: 0; }
  .character-art { max-width: 420px; width: 100%; margin: 0 auto; }
  .character-text { text-align: center; }
}

@media (max-width: 560px) {
  .site-header .wrap { flex-direction: column; gap: 6px; padding-top: 10px; padding-bottom: 10px; }
  .brand img { height: 48px; }
  .creator-grid { grid-template-columns: 1fr; }
  .cast-strip { gap: 8px; }
  .cast-strip > a { flex-basis: calc((100% - 16px) / 3); }
  .hero-buttons .btn { width: 100%; text-align: center; }
}

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

/* ---------- Chapter reader ---------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 60;
  background: linear-gradient(90deg, var(--fire), var(--accent), var(--ice));
}

.reader-head {
  text-align: center;
  padding: clamp(36px, 6vw, 64px) 0 clamp(24px, 4vw, 40px);
}
.reader-head .chapter-num { font-size: 1rem; }
.reader-head h1 {
  font-size: clamp(2rem, 6vw, 3.4rem);
  margin: 6px 0 10px;
}
.reader-meta {
  color: var(--muted);
  margin: 0 0 24px;
}

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.chapter-nav .btn { padding: 11px 22px; font-size: 0.95rem; }
.btn[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}

.reader {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reader img {
  width: 100%;
  height: auto;
  background: var(--surface-2);
  -webkit-user-drag: none;
  user-select: none;
}

.reader-end {
  text-align: center;
  padding: clamp(48px, 8vw, 88px) 0;
}
.reader-end h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.reader-end p { color: var(--muted); margin: 0 0 24px; }

@media (max-width: 560px) {
  .reader { gap: 6px; }
}

/* ---------- Back to top (reader) ---------- */
.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 55;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(0, 0, 0, 0.8);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { background: var(--accent); }

.continue { margin: 0; font-family: var(--font-display); letter-spacing: 0.05em; }
.continue a { color: var(--text); border-bottom: 1px solid var(--accent); }
.continue a:hover { color: var(--accent); text-decoration: none; }

/* ---------- Panel bleed (art breaking out of its frame, manga-style) ---------- */
.character-art.bleed {
  position: relative;
  overflow: visible;
  aspect-ratio: 700 / 910;
  background: var(--frame-bg, #fff);
  isolation: isolate;
}
.character-art.bleed .bleed-art {
  position: absolute;
  max-width: none;
  height: auto;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

/* bleeding art may spill sideways; never let it cause sideways page scroll */
main { overflow-x: clip; }
.character-art.bleed { box-shadow: 0 0 50px var(--accent-soft); }
.character { position: relative; }

/* ---------- Character hover: step closer, eyes and markings ignite ---------- */
.character-name {
  background: linear-gradient(100deg, var(--n1, var(--accent)), var(--n2, var(--accent)));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 10px rgba(var(--glow, 218, 0, 255), 0.35));
  transition: filter 0.35s ease;
}
.character:hover .character-name {
  filter: drop-shadow(0 0 14px rgba(var(--glow), 0.8)) drop-shadow(0 0 30px rgba(var(--glow), 0.45));
}
.character-art.bleed { cursor: pointer; }
.character-art.bleed .bleed-art,
.character-art.bleed .glow-art {
  transform-origin: 50% 100%;
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1);
}
.character-art.bleed .glow-art {
  position: absolute;
  max-width: none;
  height: auto;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1), opacity 0.4s ease;
}
.character-art.bleed:hover .bleed-art,
.character-art.bleed:hover .glow-art { transform: scale(1.05); }
.character-art.bleed:hover .glow-art {
  opacity: 1;
  animation: ignite 1.6s ease-in-out infinite alternate;
}
@keyframes ignite {
  from { filter: brightness(1.1) drop-shadow(0 0 4px rgba(var(--glow), 0.9)); }
  to   { filter: brightness(1.9) drop-shadow(0 0 12px rgba(var(--glow), 1)) drop-shadow(0 0 26px rgba(var(--glow), 0.7)); }
}
@media (prefers-reduced-motion: reduce) {
  .character-art.bleed:hover .glow-art { animation: none; }
}
