/* public/longform/assets/longform.css (FULL SOURCE FILE) */
:root {
  /* Deep blue base + cyan/red accents */
  --bg0: #050816;
  --bg1: #070b1f;

  /* Starfield drift in header: px/sec. Negative = drift left. */
  --star-drift-px-per-sec: -10.8;
  --star-drift-x: 0px; /* runtime-updated */

  /* Wash punch controls (mid-scroll color energy) */
  --wash-opacity: 1.00;
  --wash-saturate: 1.5;
  --wash-contrast: 1.25;
  --wash-brightness: 1.2;
  --wash-blur: 1.05px;

  --paper: rgba(255, 255, 255, 0.06);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.70);

  --cyan: #57e6ff;
  --magenta: #ff3bd4;

  --measure: 980px;
  --radius: 18px;
}

* { box-sizing: border-box; }

/* IMPORTANT: do NOT clamp body height to viewport, or document-anchored layers get cut off */
html { height: 100%; }
body { min-height: 100%; }

body.dl-longform {
  position: relative;
  margin: 0;
  color: var(--text);

  /* Base space gradients */
  background:
    /* Tall sky→horizon canopy (lives in BG, not on content). */
  linear-gradient(
    180deg,
    rgba(5, 8, 22, 0.98) 0%,
    rgba(5, 8, 22, 0.95) 10%,
    rgba(5, 8, 22, 0.82) 28%,
    rgba(5, 8, 22, 0.56) 48%,
    rgba(5, 8, 22, 0.28) 68%,
    rgba(5, 8, 22, 0.10) 82%,
    rgba(5, 8, 22, 0.00) 100%
  ),

    radial-gradient(1200px 700px at 20% 20%, rgba(87, 230, 255, 0.10), transparent 60%),
    radial-gradient(900px 600px at 80% 30%, rgba(255, 59, 212, 0.08), transparent 55%),
    radial-gradient(1000px 700px at 50% 90%, rgba(255, 59, 74, 0.06), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));

  font: 16px/1.55 ui-serif, Georgia, "Times New Roman", Times, serif;
}

/* === DOOM TEXTURE LAYERS ===
   Stacking:
     canvas (.dl-bg) = -2
     wash (.dl-wash) = -1
     grain (body::before) = 0
     bottom haze (body::after) = 0
     content (.dl-page) = 1
     header (.dl-header) = 10
*/

body.dl-longform {
  background-attachment: fixed, fixed, fixed, fixed, fixed;
}

/* Subtle grain (NO bottom stipple) */
body.dl-longform::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;

  /* Less “pattern”, more “air”. No hard stripes near the bottom. */
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.020) 0px,
      rgba(255,255,255,0.020) 1px,
      transparent 2px,
      transparent 8px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.010) 0px,
      rgba(255,255,255,0.010) 1px,
      transparent 2px,
      transparent 11px
    );

  opacity: 0.085;
  mix-blend-mode: overlay;
}

/* Bottom-edge “noisy border” / grunge transition */
body.dl-longform::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 220px;
  pointer-events: none;
  z-index: 0;

  background:
    /* Dark fade up */
    linear-gradient(
      180deg,
      rgba(0,0,0,0.00) 0%,
      rgba(0,0,0,0.20) 30%,
      rgba(0,0,0,0.58) 70%,
      rgba(0,0,0,0.78) 100%
    ),
    /* Irregular blotches (very subtle) */
    radial-gradient(120px 80px at 12% 88%, rgba(255,255,255,0.08), transparent 70%),
    radial-gradient(160px 110px at 28% 95%, rgba(255,255,255,0.06), transparent 72%),
    radial-gradient(140px 90px at 55% 92%, rgba(255,255,255,0.05), transparent 74%),
    radial-gradient(180px 120px at 78% 96%, rgba(255,255,255,0.06), transparent 75%),
    radial-gradient(130px 80px at 92% 90%, rgba(255,255,255,0.07), transparent 72%);

  opacity: 0.24;
  mix-blend-mode: overlay;
  filter: blur(0.6px);
}

a { color: inherit; text-decoration: none; }
a:hover { color: color: #ffffff; }

/* Background canvas element (PARALLAX MODE) */
.dl-bg{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  pointer-events: none;
}



/* HEADER — dark canopy + starfield horizon controls (PIXEL-based) */
.dl-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  border-bottom: none;

  .dl-header,
.dl-shell,
.dl-card,
main {
  position: relative;
  z-index: 1;
}
  /*
    Two knobs (PIXELS):
      --horizon-y:    vertical center of the fade band (px from top of header)
      --horizon-band: total height of the fade band (px)
      --horizon-bleed: how far the starfield layer is allowed to extend BELOW the header (px)
  */
  --horizon-y: -90px;   /* << move this DOWN to bring stars/transition closer to paper */
  --horizon-band: 670px;    /* << make this bigger for a taller/softer transition */
  --horizon-bleed: 710px;   /* << must be >= (horizon-y + band/2 - headerHeight) */

  /* Derived: start/end of fade band (px) */
  --fade-start: calc(var(--horizon-y) - (var(--horizon-band) / 2));
  --fade-end:   calc(var(--horizon-y) + (var(--horizon-band) / 2));

  /* IMPORTANT:
     We must allow the overlay to extend below the header box,
     otherwise anything beyond header height gets clamped.
  */
  overflow: visible;
  isolation: isolate;

  /* Header’s own canopy gradient (independent of the starfield fade) */
  background: linear-gradient(
    180deg,
    rgba(5, 8, 22, 0.96) 0%,
    rgba(5, 8, 22, 0.95) 26%,
    rgba(5, 8, 22, 0.92) 42%,
    rgba(5, 8, 22, 0.84) 58%,
    rgba(5, 8, 22, 0.70) 70%,
    rgba(5, 8, 22, 0.52) 80%,
    rgba(5, 8, 22, 0.34) 88%,
    rgba(5, 8, 22, 0.16) 94%,
    rgba(5, 8, 22, 0.00) 100%
  );
}




/* Ensure header content stays above overlays */
.dl-header > * {
  position: relative;
  z-index: 2;
}




/*
  Rail alignment:
  - .dl-page uses 16px side padding.
  - .dl-paper is centered within (viewport - 32px) and maxes at var(--measure).
  So header inner should be (measure + 32px) wide with 16px padding
  to match the paper outer edges.
*/
.dl-header__inner {
  max-width: calc(var(--measure) + 32px);
  margin: 0 auto;

  /* Modern vertical air */
  padding: 78px 16px 42px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ------------------------------------------------------------
   Header auto-hide after short scroll
   - JS toggles: body.dl-header-hidden
   ------------------------------------------------------------ */

.dl-header {
  transition: transform 660ms ease, opacity 420ms ease, filter 660ms ease;
  will-change: transform, opacity;
}

/* Hidden state: header fully exits the viewport */
body.dl-header-hidden .dl-header {
  transform: translateY(-120%);
  opacity: 0;
  pointer-events: none;
  filter: blur(2px);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .dl-header { transition: none; }
  body.dl-header-hidden .dl-header { filter: none; }
}


/* BRAND */
.dl-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.dl-brand img {
  display: block;
  height: 72px;
  width: auto;
}

/* NAV */
.dl-nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
  text-align: right;

  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.dl-nav a {
  color: var(--muted);
  text-decoration: none;
}

.dl-nav a:hover {
  color: #ffffff;;
}

/* PAGE */
.dl-page {
  position: relative;
  z-index: 1;
  padding: 40px 16px 80px;
}

/* PAPER */
.dl-paper {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 34px 32px;

  /* Frosted-glass "paper": MUCH more transparent so the wash actually shows through. */
  background: linear-gradient(
    180deg,
    rgba(10, 14, 30, 0.57),
    rgba(7, 10, 22, 0.54)
  );

  /* Let the backdrop’s color intensity survive. */
  -webkit-backdrop-filter: blur(16px) saturate(1.35) brightness(1.02);
  backdrop-filter: blur(16px) saturate(1.35) brightness(1.02);

  border: 1px solid rgba(255,255,255,0.11);
  border-radius: var(--radius);
  box-shadow: 0 20px 80px rgba(0,0,0,0.42);
}
.dl-paper {
  font-size: 17px;
  line-height: 1.60;
}

.dl-paper__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dl-paper {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Strong serif for main titles */
.dl-paper h1,
.dl-paper h2,
.dl-paper .dl-title {
  font-family: "Playfair Display", serif;
  font-weight: 900;
}

.dl-paper h1 {
  margin: 18px 0 18px;
  font-size: clamp(46px, 7.5vw, 82px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  font-family: "Playfair Display", serif;
  font-weight: 900;
}


/* Optional: preserve normal serif for subheadings */
.dl-paper h3,
.dl-paper h4,
.dl-paper h5 {
  font-family: "Playfair Display", serif;
  font-weight: 700;
}

.dl-paper h2 {
  font-size: 5rem;
  margin-top: z.75em;
}


.dl-dot { opacity: 0.6; }

/* HERO TITLE — authoritative, readable */
.dl-paper h1 {
  /* Vertical blast radius lives HERE */
  margin-top: 56px;
  margin-bottom: 48px;

  font-size: clamp(52px, 8vw, 88px);
  line-height: 0.97;

  /* Slightly loosened for scanability */
  letter-spacing: -0.018em;

  font-family: "Playfair Display", serif;
  font-weight: 900;
}


.dl-paper hr {
  margin: 44px 0 40px;              /* more breathing room */
  border: 0;
  height: 1px;

  /* less “bright”, more “tone-matched” */
  background: rgba(255,255,255,0.14);
  opacity: 1;
}

/* Space between title and byline */
.dl-paper h1 + p {
  margin-top: 25px;
}

.dl-paper h2 {
  font-size: 2.45rem;

  /* Optical balance */
  margin-top: 2.0em;
  margin-bottom: 0.6em;
}

.dl-paper > h2:first-of-type + p {
  margin-top: 10px;
  margin-bottom: 15px;
}

.dl-paper hr + h2 {
  margin-top: 0.9em;
}

.dl-lede {
  margin: 0 0 24px;
  font-size: 18px;
  color: var(--muted);
  max-width: 70ch;
}


/* Optional content primitives you’ll want later */
.dl-section { margin-top: 24px; margin-bottom: 20px;}

.dl-h2 {
  margin: 0 0 15px;
  font-size: 18px;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.88);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.dl-list { margin: 0; padding-left: 18px; }

.dl-list a { color: var(--cyan); text-decoration: none; }
.dl-list a:hover { color: var(--magenta); }

/* ------------------------------------------------------------
   Images (Markdown/HTML primitives)
   ------------------------------------------------------------ */

.dl-figure{
  margin: 22px 0 26px;
}

.dl-figure img{
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
}

.dl-figcap{
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Full-bleed inside the paper card (extends past paper padding) */
.dl-img-full{
  margin-left: -32px;
  margin-right: -32px;
  width: calc(100% + 64px);
}

/* Float images (text wraps around them) */
.dl-img-left,
.dl-img-right{
  max-width: 46%;
  margin-top: 6px;
  margin-bottom: 14px;
}

.dl-img-left{
  float: left;
  margin-right: 18px;
}

.dl-img-right{
  float: right;
  margin-left: 18px;
}

/* Image aligned to paper rails (no bleed) */
.dl-img-paper {
  margin: 28px 0 30px;
}

.dl-img-paper img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
}

/* Clear floats after a float figure if needed */
.dl-clear{
  clear: both;
}

/* Media embeds */
.dl-media {
  max-width: var(--measure, 950px);
  margin: 2.5rem auto;
}

.dl-video {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  border-radius: 14px;
  overflow: hidden;
}

.dl-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Mobile: no floats, no bleed */
@media (max-width: 720px){
  .dl-img-full{
    margin-left: -18px;
    margin-right: -18px;
    width: calc(100% + 36px);
  }

  .dl-img-left,
  .dl-img-right{
    float: none;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}


/* Responsive */
@media (max-width: 720px) {
  .dl-brand img { height: 54px; }
  .dl-paper { padding: 24px 18px; }

  /* Keep the modern air, but compress a bit for phones */
  .dl-header__inner {
    padding: 8px 12px;           /* tight */
    gap: 10px;
  }

  .dl-page {
    padding-top: 50px;
  }
}
@media (max-width: 720px) {
  .dl-paper h2 {
    font-size: 1.50rem;
    line-height: 1.25;
    margin-top: 2.2em;
    margin-bottom: 0.8em;
  }
}
@media (max-width: 420px) {
  .dl-nav { display: none; }
  .dl-brand img { height: 42px; } /* keep it compact on iPhone SE */
}
@media (max-width: 720px) {
  .dl-h1 {
    font-size: clamp(38px, 9vw, 52px);
    line-height: 1.05;
  }
}
@media (max-width: 720px) {
  .dl-paper h1 {
    font-size: clamp(40px, 11vw, 56px);
    line-height: 1.02;
  }
}

@media (max-width: 720px) {
  .dl-img-left,
  .dl-img-right {
    float: none;
    width: 100%;
    margin: 32px 0;
  }

  .dl-img-full {
    width: 100%;
    margin: 32px 0;
  }
}

/* Typography Section */
/* Normalize body rhythm */
.dl-paper p {
  margin: 0 0 1em;
}

.dl-paper ul,
.dl-paper ol {
  margin: 0 0 1.1em;
  padding-left: 1.2em;
}

/* Inline links inside longform text */
.dl-paper a {
  color: rgba(135, 255, 180, 0.96);


  transition: color 120ms ease, text-decoration-color 120ms ease;
}

/* Strong, consistent H2 rhythm */
.dl-paper h2 {
  margin: 52px 0 27px;   /* top / bottom */
}

/* If a section starts right after an HR, tighten it */
.dl-paper hr + h2 {
  margin-top: 32px;
}

/* If H2 is immediately followed by a paragraph, don’t add extra air */
.dl-paper h2 + p {
  margin-top: 0;
}

.dl-img-full {
  display: block;
  width: calc(100% + 64px);   /* cancel .dl-paper padding */
  margin: 48px -32px;
  border-radius: 14px;
}

.dl-img-left {
  float: left;
  width: 42%;
  margin: 8px 24px 16px 0;
  border-radius: 12px;
}

.dl-img-right {
  float: right;
  width: 42%;
  margin: 8px 0 16px 24px;
  border-radius: 12px;
}

/* ------------------------------------------------------------
   Header starfield overlay (image-based, horizon in PIXELS)
   - ::before extends BELOW header so fade can sit near paper
   - --horizon-y / --horizon-band are true pixel controls
   ------------------------------------------------------------ */

/* STARFIELD LAYER */
.dl-header::before {
  content: "";
  position: absolute;

  /* Extend below header so the fade isn’t clamped by header height */
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(-1 * var(--horizon-bleed));

  pointer-events: none;
  z-index: 0;

  background-image: url("/img/Starfield_Doomlaser.jpg");
  background-repeat: repeat-x;
  background-size: auto 148%;
  background-position: calc(50% + var(--star-drift-x)) 0%;
  mix-blend-mode: screen;
  opacity: 0.95;
  filter: brightness(1.05) contrast(1.15);

  /* Pixel-based fade band */
  -webkit-mask-image: linear-gradient(
    180deg,
    rgba(0,0,0,1) 0px,
    rgba(0,0,0,1) var(--fade-start),
    rgba(0,0,0,0.55) var(--horizon-y),
    rgba(0,0,0,0.00) var(--fade-end),
    rgba(0,0,0,0.00) 100%
  );
  mask-image: linear-gradient(
    180deg,
    rgba(0,0,0,1) 0px,
    rgba(0,0,0,1) var(--fade-start),
    rgba(0,0,0,0.55) var(--horizon-y),
    rgba(0,0,0,0.00) var(--fade-end),
    rgba(0,0,0,0.00) 100%
  );
}

/* CANOPY / HORIZON REINFORCEMENT (makes the “dark → less dark → dissolve” feel fatter) */
.dl-header::after {
  content: "";
  position: absolute;

  top: 0;
  left: 0;
  right: 0;
  bottom: calc(-1 * var(--horizon-bleed));

  pointer-events: none;
  z-index: 1;

  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.78) 0px,
    rgba(0,0,0,0.52) calc(var(--fade-start) - 120px),
    rgba(0,0,0,0.26) var(--fade-start),
    rgba(0,0,0,0.10) var(--horizon-y),
    rgba(0,0,0,0.00) var(--fade-end)
  );

  -webkit-mask-image: linear-gradient(
    180deg,
    rgba(0,0,0,1) 0px,
    rgba(0,0,0,1) var(--fade-start),
    rgba(0,0,0,0.00) var(--fade-end),
    rgba(0,0,0,0.00) 100%
  );
  mask-image: linear-gradient(
    180deg,
    rgba(0,0,0,1) 0px,
    rgba(0,0,0,1) var(--fade-start),
    rgba(0,0,0,0.00) var(--fade-end),
    rgba(0,0,0,0.00) 100%
  );
}

/* Ensure header content stays above overlays */
.dl-header > * {
  position: relative;
  z-index: 2;
}


/* ------------------------------------------------------------
   Document-anchored background wash
   ------------------------------------------------------------ */

.dl-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;

  /* Between canvas (.dl-bg) = -2 and grain/haze = 0 */
  z-index: -1;

  background:
    /* Broad 2D undertone so nothing reads as single isolated blobs */
    linear-gradient(
      90deg,
      rgba(255,  90, 220, 0.08) 0%,
      rgba(255, 170,  60, 0.10) 22%,
      rgba(120, 255, 160, 0.10) 50%,
      rgba( 60, 210, 255, 0.10) 74%,
      rgba(140, 110, 255, 0.10) 100%
    ),
    linear-gradient(
      180deg,
      rgba(255,  60, 210, 0.00) 0%,
      rgba(255,  60, 210, 0.00) 14%,
      rgba(255, 170,  60, 0.18) 26%,
      rgba(255,  70, 110, 0.18) 40%,
      rgba(120, 255, 160, 0.18) 56%,
      rgba( 60, 210, 255, 0.18) 72%,
      rgba(140, 110, 255, 0.18) 86%,
      rgba(255,  60, 210, 0.18) 100%
    ),

    /* Huge overlapping fields (bigger + higher chroma) */
    radial-gradient(2600px 1900px at 18% 1300px, rgba(255, 170,  60, 0.30), transparent 68%),
    radial-gradient(2500px 1800px at 82% 1750px, rgba(255,  80, 220, 0.32), transparent 67%),
    radial-gradient(2800px 2050px at 52% 2550px, rgba(255,  70, 110, 0.28), transparent 70%),
    radial-gradient(2900px 2150px at 30% 3400px, rgba(120, 255, 160, 0.28), transparent 72%),
    radial-gradient(2800px 2050px at 76% 4350px, rgba( 60, 210, 255, 0.30), transparent 70%),
    radial-gradient(3200px 2350px at 50% 5650px, rgba(140, 110, 255, 0.28), transparent 74%),

    /* Extra overlap near the “start” region to avoid discrete blobs entering */
    radial-gradient(2300px 1700px at 40% 1550px, rgba( 60, 210, 255, 0.22), transparent 70%),
    radial-gradient(2300px 1700px at 60% 1500px, rgba(255, 170,  60, 0.20), transparent 70%),

    /* Keep it classy: mild center vignette to prevent “flat filter” look */
    radial-gradient(1500px 1100px at 50% 45%, rgba(0,0,0,0.24), transparent 74%);

  /* Stronger presence, less “vague” */
  opacity: var(--wash-opacity);
  mix-blend-mode: screen;
  filter:
    saturate(var(--wash-saturate))
    contrast(var(--wash-contrast))
    brightness(var(--wash-brightness))
    blur(var(--wash-blur));

  /* Gate: OFF for first ~850px, slower/softer fade-in (avoids discrete “blob reveal”) */
  -webkit-mask-image: linear-gradient(
    180deg,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 850px,
    rgba(0,0,0,0.35) 1250px,
    rgba(0,0,0,1) 1850px,
    rgba(0,0,0,1) 100%
  );
  mask-image: linear-gradient(
    180deg,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 850px,
    rgba(0,0,0,0.35) 1250px,
    rgba(0,0,0,1) 1850px,
    rgba(0,0,0,1) 100%
  );
}

/* A second wash layer that only adds punchy highlights (bloom) */
.dl-wash::after{
  content:"";
  position:absolute;
  inset:-10%;
  pointer-events:none;

  background: inherit;               /* same gradient */
  opacity: 0.65;                     /* tune 0.25–0.65 */
  mix-blend-mode: screen;

  filter:
    saturate(1.45)
    contrast(1.10)
    brightness(1.45)
    blur(8px);                       /* “bloom”, not fog */

  transform: translateZ(0);
}

.dl-wash{
  overflow: hidden; /* critical: prevents bloom/blur from bleeding past page bottom */
}
.dl-wash::after{
  inset: 0;          /* was -10% (or similar) */
}
