/**
 * newspaper-highlight.css — art direction layer for the newspaper-highlight
 * edit style. Pairs with lib/newspaper-edit-engine.js.
 *
 * Design rules baked in here:
 *  - ink is #1a1a18, never #000; paper is #f4f1ea/#e8e0d0/#d9cdb4, never #fff
 *  - every ink layer composites with mix-blend-mode:multiply so paper grain
 *    shows THROUGH the type instead of sitting on top of it
 *  - body columns are justified + hyphenated (non-negotiable for authenticity)
 *  - halftone uses mid-greys (#777/#888); pure values break the blend
 */

/* ------------------------------------------------------------------ stage */

#stage {
  width: 1080px;
  height: 1920px;
  position: relative;
  overflow: hidden;
  background: #0b0b0a;
  --np-grain-x: 0px;
  --np-grain-y: 0px;
}

.np-deck {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  /* Promote to a cached GPU layer so the zoomed page scales cheaply. */
  will-change: transform;
  /* CRITICAL: clamp the layer to the frame. Without this, the layer's bounds
     become the whole 6.5×-scaled page (~7000×12500px = 87M px), and rasterising
     that at each cut stalls for seconds. Clipping to the stage makes each cut
     a ~2M-px raster — and the visible result is identical (the stage clips
     anyway). This is what keeps playback smooth at high zoom. */
  overflow: hidden;
}

.np-page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--np-paper, #f4f1ea);
  color: #1a1a18;
  font-family: "Times New Roman", Times, Georgia, serif;
  padding: 84px 72px;
  display: flex;
  flex-direction: column;
  --np-fill: var(--np-paper, #f4f1ea);
}

/* The edge fill (paper behind a page that's smaller than the frame) is the
   deck's own background, set per cut — NOT a box-shadow on the page. A
   box-shadow scales with the page's 6.5× transform into a ~10000px spread that
   paints ~1e9 px per cut and stalls playback for seconds. The deck background is
   unscaled and free. */
.np-deck {
  background: var(--np-deck-fill, #f4f1ea);
}

/* ------------------------------------------------------------- textures */

/* Halftone — a baked dot tile (see bakedHalftone). No runtime filter/blend so
   it rasters cheaply even when the page is scaled 5–6×. */
.np-halftone {
  position: absolute;
  inset: -4%;
  pointer-events: none;
  --np-dot: 0.4em;
  font-size: 20px;
  background-repeat: repeat;
  background-size: var(--np-dot) var(--np-dot);
  opacity: 0.13;
  z-index: 6;
}

/* Paper grain — a baked noise PNG (see bakedGrain). Static, no filter/blend. */
.np-grain {
  position: absolute;
  inset: -10%;
  pointer-events: none;
  background-repeat: repeat;
  opacity: 0.34;
  z-index: 7;
}

.np-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  background: radial-gradient(
    ellipse 80% 66% at 50% 46%,
    rgba(255, 250, 236, 0) 45%,
    rgba(146, 122, 78, 0.16) 80%,
    rgba(96, 76, 42, 0.4) 100%
  );
  mix-blend-mode: multiply;
}

/* Radial focus blur — the blurred twin of the deck. `filter: blur()` renders
   everywhere (unlike backdrop-filter, which headless Chromium drops). The mask
   keeps a small centre transparent (the sharp deck shows through, on the word)
   and ramps to fully opaque, blurred, toward the edges. overflow:hidden clamps
   the filter region to the frame so the blur stays cheap. */
.np-deck-blur {
  overflow: hidden;
  -webkit-mask-image: radial-gradient(
    ellipse 128% 62% at 50% 44%,
    transparent 0%,
    transparent 17%,
    rgba(0, 0, 0, 0.72) 40%,
    #000 62%
  );
  mask-image: radial-gradient(
    ellipse 128% 62% at 50% 44%,
    transparent 0%,
    transparent 17%,
    rgba(0, 0, 0, 0.72) 40%,
    #000 62%
  );
}

/* The wrapper carries the anchor scale (GPU texture scale). The blurred page is
   its own cached layer at natural resolution — will-change:transform forces the
   compositor to raster it once (with the filter) and scale the texture, instead
   of re-rastering a 6.5×-huge blurred buffer every frame. */
.np-blur-wrap {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}

.np-deck-blur .np-page {
  will-change: transform;
}

/* ---------------------------------------------------------- effect shell */

.np-shell {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

.np-flash {
  position: absolute;
  inset: 0;
  background: #fffdf6;
  opacity: 0;
}

.np-scan {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.5) 0px,
    rgba(0, 0, 0, 0.5) 1px,
    rgba(0, 0, 0, 0) 3px
  );
  mix-blend-mode: multiply;
}

/* ------------------------------------------------------------- highlight */

/* Marks are CSS boxes anchored to the hero's own edges (left/right/top/bottom),
   so they stay symmetric around the glyphs — see buildMark() for why the old
   stretched-SVG marks hung off the left. inline-block + tight line-height makes
   the hero box hug the word. */
.np-hero {
  position: relative;
  display: inline-block;
  line-height: 1;
  white-space: nowrap;
  isolation: isolate;
  /* The hero is a block container, so a paragraph's text-indent (1.2em on body
     columns) inherits in and pushes the word right inside its own box — which
     dragged the mark off the left. Neutralise the inherited text flow. */
  text-indent: 0;
  text-align: left;
}

.np-hero-label {
  position: relative;
  z-index: 2;
}

.np-mark {
  position: absolute;
  pointer-events: none;
  z-index: 3;
  mix-blend-mode: multiply;
  --np-mark-color: #c8202a;
}

/* Highlighter swipe — a filled block behind the word; the word reads through
   the ink via multiply. */
.np-mark-swipe {
  left: -5%;
  right: -5%;
  top: 0.12em;
  bottom: 0.06em;
  z-index: 1;
  background: var(--np-mark-color, #f5e14b);
  border-radius: 0.04em;
}

/* Circle — an elliptical marker loop drawn over the word. */
.np-mark-circle {
  left: -12%;
  right: -12%;
  top: -0.26em;
  bottom: -0.18em;
  border: 0.11em solid var(--np-mark-color, #c8202a);
  border-radius: 50%;
}

/* Underline — a marker stroke just below the baseline. */
.np-mark-underline {
  left: -2%;
  right: -2%;
  height: 0.12em;
  bottom: -0.06em;
  background: var(--np-mark-color, #c8202a);
  border-radius: 0.06em;
}

/* Box — a hand-boxed outline around the word. */
.np-mark-box {
  left: -9%;
  right: -9%;
  top: -0.2em;
  bottom: -0.14em;
  border: 0.09em solid var(--np-mark-color, #c8202a);
  border-radius: 0.03em;
}

/* Redaction — an opaque bar (on top, no blend). */
.np-mark-redaction {
  left: -4%;
  right: -4%;
  top: 0.06em;
  bottom: 0.06em;
  background: var(--np-mark-color, #1a1a18);
  mix-blend-mode: normal;
}

/* ------------------------------------------------------------ shared type */

.np-masthead {
  font-size: 84px;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.01em;
  padding-bottom: 14px;
}

.np-rule {
  display: flex;
  justify-content: space-between;
  font-size: 17px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border-top: 3px solid #1a1a18;
  border-bottom: 1px solid #1a1a18;
  padding: 8px 2px;
  margin-bottom: 26px;
  color: #3a3630;
}

.np-kicker {
  font-size: 18px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #3a3630;
  border-bottom: 1px solid #3a3630;
  padding-bottom: 8px;
  margin-bottom: 20px;
}

.np-headline {
  font-size: 104px;
  line-height: 0.94;
  font-weight: 900;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  margin-bottom: 26px;
  text-wrap: balance;
}

.np-subhead {
  font-size: 62px;
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
}

/* 14–16 picas is the optimum newspaper column; body 9–10pt on +2 leading. */
.np-cols {
  column-gap: 34px;
  column-rule: 1px solid rgba(58, 54, 48, 0.45);
  font-size: 21px;
  line-height: 27px;
  text-align: justify;
  hyphens: auto;
  flex: 1;
  overflow: hidden;
}

.np-cols p {
  margin: 0 0 14px;
  text-indent: 1.2em;
}

.np-cols p:first-child {
  text-indent: 0;
}

/* ------------------------------------------------------------- layouts */

.np-layout-front .np-headline .np-hero {
  display: inline-block;
}

.np-layout-body .np-hero-label {
  font-weight: 700;
}

/* dictionary definition */
.np-layout-def {
  justify-content: flex-start;
  padding: 120px 96px 84px;
}

.np-layout-def .np-cols {
  border-top: 1px solid #3a3630;
  padding-top: 20px;
  margin-top: 12px;
}

.np-def-head {
  font-size: 176px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.np-def-pron {
  font-size: 32px;
  font-style: italic;
  color: #3a3630;
  margin-bottom: 40px;
  border-bottom: 3px solid #1a1a18;
  padding-bottom: 22px;
}

.np-def-sense {
  font-size: 30px;
  line-height: 40px;
  margin-bottom: 26px;
  text-align: left;
}

.np-def-note {
  font-size: 22px;
  font-style: italic;
  color: #3a3630;
  margin-top: 18px;
}

/* photo box */
.np-photo {
  position: relative;
  height: 620px;
  margin-bottom: 14px;
  background: linear-gradient(150deg, #6b6156 0%, #cdc3b2 45%, #3f3a33 100%);
  border: 1px solid #1a1a18;
  overflow: hidden;
}

/* The photo box: the baked dot tile over a tonal gradient reads as a printed
   halftone image. No runtime filter (kept cheap to raster). */
.np-photo .np-halftone {
  opacity: 0.55;
  z-index: 2;
  font-size: 26px;
  inset: 0;
  background-color: transparent;
  background-blend-mode: multiply;
}

.np-caption {
  font-size: 21px;
  line-height: 29px;
  font-style: italic;
  color: #3a3630;
  border-bottom: 1px solid #3a3630;
  padding-bottom: 18px;
  margin-bottom: 22px;
}

/* The marked caption word is upright + bold so it reads at a normal in-line
   width (an italic caption word is too narrow and would need excessive zoom). */
.np-caption .np-hero-label {
  font-style: normal;
  font-weight: 700;
}

/* redacted */
.np-layout-redacted {
  background: #e8e0d0;
  --np-fill: #e8e0d0;
  justify-content: center;
  font-family: "Courier New", Courier, monospace;
}

.np-stamp {
  align-self: center;
  border: 5px solid #c8202a;
  color: #c8202a;
  font-size: 46px;
  font-weight: 700;
  letter-spacing: 0.3em;
  padding: 10px 26px 10px 34px;
  transform: rotate(-6deg);
  margin-bottom: 60px;
  opacity: 0.85;
}

.np-redact-body {
  font-size: 30px;
  line-height: 62px;
}

.np-redact-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.np-bar {
  display: inline-block;
  height: 34px;
  background: #1a1a18;
}

/* ransom note */
.np-layout-ransom {
  justify-content: flex-start;
}

.np-ransom-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;            /* long words wrap to 2 rows instead of overflowing */
  max-width: 94%;
  margin: 0 auto 34px;
  gap: 8px;
  font-size: 168px;
  font-weight: 900;
  line-height: 1;
}

.np-ransom-char {
  display: inline-block;
  box-shadow: 3px 4px 0 rgba(26, 26, 24, 0.35);
}

.np-ransom-echo {
  align-self: center;
  font-size: 74px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 34px;
}

/* torn clipping */
.np-layout-clipping {
  background: #2a2620;
  --np-fill: #2a2620;
  justify-content: center;
  align-items: center;
  padding: 60px;
}

.np-clip {
  width: 940px;
  height: 1360px;
  display: flex;
  flex-direction: column;
  background: var(--np-paper, #f4f1ea);
  padding: 60px 52px 70px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
  clip-path: polygon(
    0% 2%, 12% 0%, 31% 2.4%, 55% 0.4%, 78% 2.6%, 100% 0.6%,
    99% 30%, 100% 62%, 98.6% 100%, 74% 97.6%, 48% 99.6%, 22% 97.4%,
    0% 99.4%, 1.2% 66%, 0.2% 34%
  );
}

.np-clip-head {
  font-size: 104px;
  line-height: 0.96;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

.np-clip-photo {
  height: 420px;
  margin-bottom: 26px;
  flex: 0 0 auto;
}

.np-clip-body {
  font-size: 22px;
  line-height: 29px;
}

/* classifieds */
.np-class-head {
  font-size: 34px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border-top: 4px solid #1a1a18;
  border-bottom: 4px solid #1a1a18;
  padding: 12px 0;
  text-align: center;
  margin-bottom: 26px;
}

.np-class-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  flex: 1;
  overflow: hidden;
}

.np-class-cell {
  border: 1px solid #3a3630;
  padding: 16px 14px;
  font-size: 19px;
  line-height: 25px;
  text-align: justify;
  hyphens: auto;
}

.np-class-cell-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 66px;
  font-weight: 900;
  text-align: center;
  border-width: 3px;
}

.np-class-sub {
  font-size: 17px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.06em;
  margin-top: 12px;
}

/* market table */
.np-table {
  font-family: "Courier New", Courier, monospace;
  font-size: 30px;
  flex: 1;
}

.np-trow {
  display: grid;
  grid-template-columns: 1fr 200px 240px;
  border-bottom: 1px dotted #3a3630;
  padding: 14px 4px;
}

.np-trow span:nth-child(2),
.np-trow span:nth-child(3) {
  text-align: right;
}

.np-trow-hero {
  font-size: 54px;
  font-weight: 700;
  align-items: center;
  border-top: 3px solid #1a1a18;
  border-bottom: 3px solid #1a1a18;
  padding: 20px 4px;
}

/* hero payoff — the mid block grows to fill, centring the word vertically so
   the held page fills the frame instead of being shoved down by the anchor. */
.np-layout-hero {
  justify-content: flex-start;
}

.np-hero-mid {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 40px 0;
  border-bottom: 3px solid #1a1a18;
  margin-bottom: 28px;
}

/* Columns are a fixed bottom band so the mid block keeps the vertical middle. */
.np-layout-hero .np-cols {
  flex: 0 0 auto;
  height: 460px;
}

.np-hero-kicker {
  font-size: 24px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: #3a3630;
}

.np-bigword {
  font-size: 150px;
  line-height: 0.9;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.np-hero-sub {
  font-size: 34px;
  font-style: italic;
  letter-spacing: 0.04em;
  color: #3a3630;
}
