/* Night Drive inside the real homepage. Hand-written. The module rules are scoped to .msl-lib--night.
   The dusk band and the Exit 01 sign treatment are scoped to "the Episodes section that contains
   .msl-lib--night" (#episodes:has(> .msl-lib--night)), so they cannot match any other section.

   The band: evening falls straight out of the green hero, the road runs through the dark with its edge
   lines lit, the reel's own road branches off it, and the page returns to paper before Exit 02. */

/* ---------- the band (painted behind the road, so the road visibly passes through it) ---------- */
#episodes:has(> .msl-lib--night){position:relative;
  --nd-top:clamp(3rem,6vw,5rem);                         /* the route's top padding: the band starts at the hero's edge */
  --nd-road:calc(100vw - var(--rail));                   /* the road's left edge, in band coordinates */
  --nd-edge:rgba(255,236,190,.34)}
#episodes:has(> .msl-lib--night)::before{content:"";position:absolute;z-index:-1;pointer-events:none;
  left:-100vw;right:-100vw;top:calc(-1 * var(--nd-top));bottom:0;
  background:
    /* lit edge lines either side of the road */
    linear-gradient(90deg,transparent calc(var(--nd-road) - 8px),var(--nd-edge) calc(var(--nd-road) - 8px) calc(var(--nd-road) - 6px),
      transparent calc(var(--nd-road) - 6px) calc(var(--nd-road) + 16px),var(--nd-edge) calc(var(--nd-road) + 16px) calc(var(--nd-road) + 18px),transparent calc(var(--nd-road) + 18px)),
    /* a faint stripe of starlight across the top */
    radial-gradient(1.4px 1.4px at 30px 40px,rgba(255,255,255,.7),transparent) 0 0/310px 230px repeat-x,
    radial-gradient(1px 1px at 140px 90px,rgba(255,255,255,.55),transparent) 0 0/310px 230px repeat-x,
    radial-gradient(1.2px 1.2px at 230px 25px,rgba(255,255,255,.6),transparent) 0 0/310px 230px repeat-x,
    radial-gradient(1px 1px at 80px 160px,rgba(255,255,255,.4),transparent) 0 0/310px 230px repeat-x,
    /* warm horizon glow low in the band */
    radial-gradient(1100px 220px at 50% calc(100% - 4.5rem),rgba(255,150,60,.2),transparent 70%),
    /* the sky: hero green at the top edge, night in the middle, dawn back to paper at the bottom */
    linear-gradient(180deg,#04673F 0,#05452B calc(var(--nd-top) * .9),#071A11 calc(var(--nd-top) + 10rem),#08170F 45%,#0B2419 calc(100% - 9rem),#1F4532 calc(100% - 3.25rem),#EFF2EE 100%)}

/* the Exit 01 sign, node and arm on the dark band: the green sign already reads; the arm becomes a lit
   grey post (ink would vanish), the node keeps its colours with a soft halo, the sub-line turns light */
#episodes:has(> .msl-lib--night) > .sec-head .arm{background:#9AA39E}
#episodes:has(> .msl-lib--night) > .sec-head .node{box-shadow:0 0 0 3px rgba(255,236,190,.35),0 0 18px rgba(255,210,58,.35)}
#episodes:has(> .msl-lib--night) > .sec-head .sign{box-shadow:inset 0 0 0 4px var(--g),inset 0 0 0 7px #fff,0 0 28px rgba(255,236,190,.16)}
#episodes:has(> .msl-lib--night) > .sec-head .sec-sub{color:#C3CEC7}

/* ---------- the module ---------- */
.msl-lib.msl-lib--night{min-height:0;background:none;overflow-x:visible;
  --screen-w:max(440px,calc((100svh - var(--hdr-h) - 400px) * 1.7778))}
.msl-lib--night .preview-banner{justify-content:flex-start;margin-bottom:.9rem;padding:.1rem .9rem;border:1px solid rgba(255,210,58,.35);border-radius:10px;text-align:left}
.msl-lib--night .ic-chooser{justify-content:flex-start}

/* toolbar row ("Where to?" + List view) sits above the drive-in; the site's sign is the section heading */
.msl-lib--night .nd-hdr{max-width:none;margin:0 0 1rem;padding:0}
.msl-lib--night .nd-h1{font-size:1.25rem}
.msl-lib--night .nd-main{max-width:none;margin:0;padding:0}
.msl-lib--night .marquee,.msl-lib--night .mq-title{scroll-margin-top:calc(var(--hdr-h) + 1.25rem)}

/* the reel's road branches off the main road: a short strip of asphalt across the rail, same height and dashes */
.msl-lib--night .reel-wrap::before{content:"";position:absolute;right:100%;bottom:0;width:calc(var(--rail) - 10px);height:46px;pointer-events:none;
  background:repeating-linear-gradient(90deg,var(--y) 0 34px,transparent 34px 64px) 0 calc(100% - 22px)/100% 3px no-repeat,linear-gradient(#1A1F1C,#121614)}

/* a browser without :has() gets no band; give the module its own night panel so its light text still reads */
@supports not selector(:has(a)){
  .msl-lib.msl-lib--night{padding:clamp(.75rem,2vw,1.25rem);border-radius:14px;background:#08170F}
}

@media (max-width:1023px){
  .msl-lib.msl-lib--night{--screen-w:100%}
}
/* desktop: the module's one grid fills the site's content column (the column itself is the max width); the
   site's Exit 01 sign is the section heading, so the drive-in line is not repeated above the marquee */
@media (min-width:1024px){
  .msl-lib--night .nd-frame{max-width:none;margin:0;padding:0}
  .msl-lib--night .nd-h1{display:none}
}
@media (max-width:720px){
  .msl-lib--night .nd-hdr{margin-bottom:.75rem}
  .msl-lib--night .nd-h1{font-size:1.1rem}
}
@media (max-width:380px){
  .msl-lib--night .nd-hdr{padding-inline:0}
  .msl-lib--night .nd-main{padding-inline:0}
  .msl-lib--night .preview-banner{padding-inline:.6rem}
}
