/* ========================================================================== 
   NOCTURNE INDEX / NOVELS
   Phase 2: a cinematic entry point for the existing novel archives.
   ========================================================================== */

body.novels-page {
  min-width: 320px;
  overflow-x: hidden;
  background: var(--night);
  color: var(--white);
  font-family: var(--sans);
}

.novels-page :focus-visible { outline: 1px solid var(--gold); outline-offset: 5px; }
.novels-page .skip-link { position: fixed; z-index: 1000; top: -100px; left: 18px; padding: 10px 14px; background: var(--white); color: var(--night); }
.novels-page .skip-link:focus { top: 12px; }
.novels-page .nocturne-header { background: linear-gradient(180deg, rgba(3, 9, 17, .96), rgba(3, 9, 17, .72) 72%, transparent); }

/* Full-screen novels index */
.novels-stage {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(190px, .48fr) minmax(480px, 1.35fr) minmax(330px, .82fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "selector visual detail"
    "selector episodes episodes";
  gap: 24px clamp(34px, 3.8vw, 68px);
  padding: 110px clamp(28px, 3.5vw, 56px) 26px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(28, 45, 61, .08), transparent 34%),
    linear-gradient(135deg, #030911 0%, #06111d 53%, #030912 100%);
}

.novels-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: .1;
  background-image: linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 100% 4px;
}

.novels-stage__backdrop {
  position: absolute;
  z-index: -1;
  top: 76px;
  left: 10px;
  color: rgba(190, 204, 214, .13);
  font: 500 clamp(5.5rem, 10vw, 9.4rem)/.82 var(--serif);
  pointer-events: none;
}

.novels-stage__backdrop span { display: inline-block; margin-top: 52px; }
.novels-stage__label { display: none; }

/* Main artwork */
.novels-visual {
  grid-area: visual;
  position: relative;
  align-self: center;
  width: 100%;
  height: min(62vh, 580px);
  min-height: 430px;
  overflow: hidden;
  background: #07121d;
}

.novels-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 9, 17, .58), transparent 17%, transparent 82%, rgba(3, 9, 17, .7)),
    linear-gradient(0deg, rgba(3, 9, 17, .62), transparent 22%, transparent 78%, rgba(3, 9, 17, .22));
}

.novels-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 44% center;
  filter: saturate(.84) brightness(.82);
  transition: opacity .32s ease, filter .32s ease, transform .36s ease;
}

.novels-stage[data-novel="remember-me"] .novels-visual img {
  object-fit: contain;
  object-position: center;
  filter: saturate(.78) brightness(.74);
}

.novels-stage.is-changing .novels-visual img,
.novels-stage.is-changing .novels-detail { opacity: .12; }

/* Selected work information */
.novels-detail {
  grid-area: detail;
  align-self: center;
  max-width: 440px;
  transition: opacity .3s ease;
}

.novels-detail__index,
.novels-detail__genre,
.novels-detail__episodes,
.novels-detail__meta dt {
  font-size: .57rem;
  letter-spacing: .2em;
}

.novels-detail__index { margin-bottom: 24px; color: var(--blue-gray-dark); }
.novels-detail h2 { font: 500 clamp(2rem, 3.25vw, 3.55rem)/1.35 var(--serif); }
.novels-detail h2 > span { display: inline; }
.novels-detail h2 small { display: block; margin-top: 18px; color: #dce3e6; font: 500 .28em/1.5 var(--sans); letter-spacing: .24em; text-transform: uppercase; }
.novels-detail__rule { display: block; width: 30px; height: 1px; margin: 26px 0 28px; background: var(--gold); }
.novels-detail__genre { color: #bec8ce; line-height: 1.7; }
.novels-detail__episodes { margin-top: 20px; color: var(--gold); }
.novels-detail__summary { margin-top: 34px; color: #aeb9c1; font: 500 clamp(.76rem, .86vw, .86rem)/2.05 var(--serif); }
.novels-detail__meta { display: flex; gap: 46px; margin-top: 24px; }
.novels-detail__meta dt { margin-bottom: 6px; color: var(--blue-gray-dark); }
.novels-detail__meta dd { color: var(--blue-gray); font-size: .68rem; }
.novels-detail__link { display: inline-flex; align-items: center; gap: 28px; min-height: 44px; margin-top: 26px; padding-bottom: 8px; border-bottom: 1px solid rgba(182, 162, 118, .55); color: var(--white); font: 500 .7rem/1.4 var(--serif); }
.novels-detail__link span { color: var(--gold); transition: transform .3s ease; }
.novels-detail__link:hover span { transform: translate(3px, -3px); }

/* Work selector */
.novels-selector {
  grid-area: selector;
  align-self: end;
  padding-bottom: 28px;
}

.novels-selector > p { margin-bottom: 20px; color: var(--gold); font-size: .52rem; letter-spacing: .24em; }
.novels-selector [role="tablist"] { border-top: 1px solid var(--line); }
.novels-selector button {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--blue-gray-dark);
  text-align: left;
  cursor: pointer;
  transition: color .3s ease, padding-left .3s ease;
}

.novels-selector button::before {
  content: "";
  position: absolute;
  top: 28px;
  left: 31px;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width .3s ease;
}

.novels-selector button span { color: inherit; font: 500 .77rem/1.5 var(--serif); }
.novels-selector button strong { font: 500 clamp(.83rem, 1.1vw, 1.05rem)/1.55 var(--serif); }
.novels-selector button:hover,
.novels-selector button:focus-visible,
.novels-selector button.is-active { color: var(--white); }
.novels-selector button.is-active { padding-left: 18px; }
.novels-selector button.is-active::before { width: 17px; }
.novels-selector button.is-active span { color: var(--gold); }

/* Episode routes */
.novels-episodes {
  grid-area: episodes;
  display: grid;
  grid-template-columns: minmax(180px, .6fr) minmax(0, 1.4fr);
  gap: clamp(32px, 5vw, 82px);
  align-items: end;
  min-height: 84px;
}

.novels-episodes__start { display: flex; flex-direction: column; gap: 15px; color: var(--white); }
.novels-episodes__start strong { font: 500 clamp(.9rem, 1.25vw, 1.12rem)/1 var(--serif); letter-spacing: .16em; }
.novels-episodes__start small { color: var(--gold); font-size: .5rem; letter-spacing: .28em; }
.novels-episodes__numbers { display: grid; grid-template-columns: repeat(7, minmax(34px, 1fr)); align-items: end; border-bottom: 1px solid var(--line); }
.novels-episodes__numbers a,
.novels-episodes__numbers span { position: relative; min-height: 54px; display: grid; place-items: center; color: var(--blue-gray); font: 500 .86rem/1 var(--serif); }
.novels-episodes__numbers a::after { content: ""; position: absolute; right: 50%; bottom: -1px; left: 50%; height: 2px; background: var(--gold); transition: right .3s ease, left .3s ease; }
.novels-episodes__numbers a:hover,
.novels-episodes__numbers a:focus-visible { color: var(--white); }
.novels-episodes__numbers a:hover::after,
.novels-episodes__numbers a:focus-visible::after { right: 16%; left: 16%; }
.novels-episodes__numbers a.is-primary { color: var(--gold); font-size: 1.12rem; }

/* Laptop and tablet */
@media (max-width: 1100px) {
  .novels-stage { grid-template-columns: minmax(160px, .42fr) minmax(420px, 1.25fr) minmax(285px, .78fr); gap: 20px 30px; padding-inline: 30px; }
  .novels-detail h2 { font-size: clamp(1.8rem, 3.5vw, 2.7rem); }
  .novels-detail__summary { margin-top: 25px; line-height: 1.9; }
  .novels-visual { min-height: 390px; }
}

@media (max-width: 820px) {
  .novels-stage {
    display: block;
    min-height: 0;
    padding: 92px 24px 66px;
    overflow: hidden;
  }

  .novels-stage__backdrop { top: 72px; left: 20px; font-size: clamp(3.8rem, 15vw, 6rem); }
  .novels-stage__backdrop span { margin-top: 24px; }
  .novels-stage__label { position: relative; display: block; margin-bottom: 34px; }
  .novels-stage__label p { margin-bottom: 8px; color: var(--gold); font-size: .5rem; letter-spacing: .2em; }
  .novels-stage__label h1 { font: 500 .72rem/1.4 var(--sans); letter-spacing: .18em; }
  .novels-stage__label h1 span { color: var(--blue-gray-dark); }
  .novels-visual { height: auto; min-height: 0; aspect-ratio: 4 / 3; }
  .novels-detail { max-width: none; margin-top: 34px; }
  .novels-detail__index { margin-bottom: 16px; }
  .novels-detail h2 { font-size: clamp(1.75rem, 7vw, 2.65rem); }
  .novels-stage[data-novel="last-love"] .novels-detail h2 > span { display: block; white-space: nowrap; }
  .novels-detail h2 small { margin-top: 11px; font-size: .31em; }
  .novels-detail__summary { max-width: 630px; margin-top: 24px; }
  .novels-selector { margin-top: 54px; padding-bottom: 0; }
  .novels-selector button { grid-template-columns: 44px 1fr; }
  .novels-episodes { display: block; margin-top: 54px; }
  .novels-episodes__numbers { margin-top: 28px; }
}

@media (max-width: 480px) {
  .novels-stage { padding: 88px 18px 58px; }
  .novels-stage__label { margin-bottom: 25px; }
  .novels-visual { aspect-ratio: 4 / 3; }
  .novels-visual::after { background: linear-gradient(90deg, rgba(3,9,17,.24), transparent 18%, transparent 84%, rgba(3,9,17,.42)), linear-gradient(0deg, rgba(3,9,17,.42), transparent 27%); }
  .novels-detail { margin-top: 28px; }
  .novels-detail h2 { font-size: clamp(1.62rem, 8vw, 2rem); }
  .novels-detail__genre { font-size: .52rem; }
  .novels-detail__episodes { margin-top: 14px; }
  .novels-detail__summary { font-size: .78rem; line-height: 1.9; }
  .novels-detail__meta { gap: 36px; }
  .novels-selector { margin-top: 48px; }
  .novels-selector button { padding-block: 17px; }
  .novels-episodes { margin-top: 48px; }
  .novels-episodes__numbers { grid-template-columns: repeat(4, 1fr); row-gap: 4px; }
  .novels-episodes__numbers a,
  .novels-episodes__numbers span { min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .novels-page *,
  .novels-page *::before,
  .novels-page *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
