/* Stratum — section presets and hover depth.

   A preset is a way of presenting a run of stories, not a colour scheme: it
   changes card shape, type and rhythm and leaves the palette alone, so a
   section can be restyled without the page losing its identity.

   Hover depth is separate, and the names describe what responds to the pointer
   rather than any claim about geometry:

     3D  the card lifts and tilts.
     5D  adds a light that tracks the pointer across the image, and parallax
         between the image and the plate.
     7D  adds separation inside the card — image, plate and kicker each sit at
         their own depth and pull apart, with a specular edge.

   The pointer values (--stx-cx, --stx-cy, --stx-cxn, --stx-cyn) are written by
   depth.js. Every rule here has a resting default, so a section is laid out
   correctly before the pointer arrives and stays correct without the script. */

/* =========================================================== preset: wire === */
/* Agency copy: rows, small thumbnails, no excerpt, timestamps in the mono face. */

.stx-sec--wire .stx-cards { display: flex; flex-direction: column; gap: 0; }

.stx-sec--wire .stx-card {
  flex-direction: row;
  align-items: center;
  gap: .9rem;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--stx-hairline);
  border-radius: 0;
  padding: .75rem 0;
}

.stx-sec--wire .stx-card:first-child { border-top: 0; }
.stx-sec--wire .stx-card__link { flex: 0 0 4.5rem; }
.stx-sec--wire .stx-card__media { aspect-ratio: 3 / 2; border-radius: var(--stx-radius-sm); }
.stx-sec--wire .stx-card__body { padding: 0; }
.stx-sec--wire .stx-card__excerpt { display: none; }
.stx-sec--wire .stx-card__title { font-size: var(--stx-fs-md); margin-bottom: .2rem; }
.stx-sec--wire .stx-kicker { margin-bottom: .15rem; }

/* ===================================================== preset: broadsheet === */
/* A newspaper page: no fill, hairline rules, serif headlines. */

.stx-sec--broadsheet .stx-card {
  background: transparent;
  border: 0;
  border-top: 2px solid var(--stx-fg);
  border-radius: 0;
  padding-top: .8rem;
}

.stx-sec--broadsheet .stx-card__media { border-radius: 0; margin-bottom: .8rem; }
.stx-sec--broadsheet .stx-card__body { padding: 0; }

.stx-sec--broadsheet .stx-card__title {
  font-family: var(--stx-font-body);
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.15;
}

.stx-sec--broadsheet .stx-card__excerpt { font-family: var(--stx-font-body); }

/* ======================================================== preset: bulletin === */
/* The image stands proud of the plate that carries the headline. */

.stx-sec--bulletin .stx-card { background: transparent; border: 0; overflow: visible; }

.stx-sec--bulletin .stx-card__media {
  border-radius: var(--stx-radius);
  box-shadow: var(--stx-elev-2);
}

.stx-sec--bulletin .stx-card__body {
  position: relative;
  z-index: 1;
  margin: -1.8rem .7rem 0;
  padding: 1rem;
  background: var(--stx-plane1);
  border: 1px solid var(--stx-rim);
  border-radius: var(--stx-radius);
}

/* ========================================================= preset: dossier === */
/* Recessed wells. Reads as filed material rather than as a news card. */

.stx-sec--dossier .stx-card {
  background: var(--stx-plane3);
  border-color: transparent;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #000 40%, transparent),
              inset 0 0 0 1px color-mix(in srgb, var(--stx-rim) 30%, transparent);
}

.stx-sec--dossier .stx-card__media { opacity: .82; transition: opacity .3s ease; }
.stx-sec--dossier .stx-card:hover .stx-card__media { opacity: 1; }

.stx-sec--dossier .stx-kicker {
  font-size: calc(var(--stx-fs-xs) * .92);
  letter-spacing: .18em;
  color: var(--stx-z5);
}

.stx-sec--dossier .stx-card__title { font-size: var(--stx-fs-md); }

/* ========================================================= preset: marquee === */
/* Full-bleed image, headline over it. One per page. */

.stx-sec--marquee .stx-card { display: grid; border: 0; background: transparent; }
.stx-sec--marquee .stx-card__link,
.stx-sec--marquee .stx-card__body { grid-area: 1 / 1; }

.stx-sec--marquee .stx-card__link { border-radius: var(--stx-radius); overflow: clip; }
.stx-sec--marquee .stx-card__media { aspect-ratio: 4 / 3; }

.stx-sec--marquee .stx-card__body {
  align-self: end;
  padding: 1.2rem 1rem 1rem;
  border-radius: 0 0 var(--stx-radius) var(--stx-radius);
  background: linear-gradient(to top,
    color-mix(in srgb, var(--stx-substrate) 94%, transparent) 30%,
    transparent);
}

.stx-sec--marquee .stx-card__excerpt { display: none; }

/* ============================================================ hover: shared === */

.stx-hover-3d .stx-card,
.stx-hover-5d .stx-card,
.stx-hover-7d .stx-card,
.stx-hover-3d .stx-index__tile,
.stx-hover-5d .stx-index__tile,
.stx-hover-7d .stx-index__tile {
  transition: transform .3s cubic-bezier(.2, .7, .3, 1), box-shadow .3s ease, border-color .3s ease;
}

.stx-hover-5d .stx-cards,
.stx-hover-7d .stx-cards,
.stx-hover-5d .stx-mosaic,
.stx-hover-7d .stx-mosaic,
.stx-hover-5d .stx-index,
.stx-hover-7d .stx-index { perspective: 1200px; }

.stx-hover-none .stx-card:hover { transform: none; }

/* ================================================================ hover: 3D === */

.stx-hover-3d .stx-card:hover,
.stx-hover-3d .stx-index__tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--stx-elev-3);
  border-color: var(--stx-rim);
}

/* ================================================================ hover: 5D === */
/* Pointer-tracked light across the image, and the plate lags behind it. */

.stx-hover-5d .stx-card { position: relative; }

.stx-hover-5d .stx-card:hover,
.stx-hover-5d .stx-index__tile:hover {
  transform:
    translateY(-5px)
    rotateX(calc(var(--stx-cyn, 0) * -3deg))
    rotateY(calc(var(--stx-cxn, 0) * 3deg));
  box-shadow: var(--stx-elev-3);
  border-color: var(--stx-rim);
}

.stx-hover-5d .stx-card__media { overflow: clip; }

.stx-hover-5d .stx-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
  background: radial-gradient(14rem 14rem at var(--stx-cx, 50%) var(--stx-cy, 50%),
    color-mix(in srgb, var(--stx-fg) 26%, transparent), transparent 60%);
}

.stx-hover-5d .stx-card__media { position: relative; }
.stx-hover-5d .stx-card:hover .stx-card__media::after { opacity: 1; }

.stx-hover-5d .stx-card:hover .stx-card__media img {
  transform: scale(1.05) translate3d(calc(var(--stx-cxn, 0) * -6px), calc(var(--stx-cyn, 0) * -6px), 0);
}

/* ================================================================ hover: 7D === */
/* The card's own layers separate. Image, plate and kicker each take a depth. */

.stx-hover-7d .stx-card { transform-style: preserve-3d; position: relative; }

.stx-hover-7d .stx-card__link,
.stx-hover-7d .stx-card__body,
.stx-hover-7d .stx-kicker,
.stx-hover-7d .stx-card__title {
  transition: transform .35s cubic-bezier(.2, .7, .3, 1);
  transform-style: preserve-3d;
}

.stx-hover-7d .stx-card:hover {
  transform:
    translateY(-6px)
    rotateX(calc(var(--stx-cyn, 0) * -4deg))
    rotateY(calc(var(--stx-cxn, 0) * 4deg));
  box-shadow: var(--stx-elev-3);
}

.stx-hover-7d .stx-card:hover .stx-card__link { transform: translateZ(14px); }
.stx-hover-7d .stx-card:hover .stx-card__body { transform: translateZ(26px); }
.stx-hover-7d .stx-card:hover .stx-kicker { transform: translateZ(38px); }
.stx-hover-7d .stx-card:hover .stx-card__title { transform: translateZ(32px); }

.stx-hover-7d .stx-card__media { position: relative; overflow: clip; }

.stx-hover-7d .stx-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
  background: radial-gradient(12rem 12rem at var(--stx-cx, 50%) var(--stx-cy, 50%),
    color-mix(in srgb, var(--stx-fg) 30%, transparent), transparent 58%);
}

.stx-hover-7d .stx-card:hover .stx-card__media::after { opacity: 1; }

/* The specular edge: a rim that brightens on the side the light is coming
   from, which is what sells the separation as physical rather than as a stack
   of translated boxes. */
.stx-hover-7d .stx-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
  background: linear-gradient(
    calc(90deg + var(--stx-cxn, 0) * 45deg),
    color-mix(in srgb, var(--stx-z1) 45%, transparent),
    transparent 45%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 1px;
}

.stx-hover-7d .stx-card:hover::before { opacity: 1; }

/* ====================================================== reduced motion === */

@media (prefers-reduced-motion: reduce) {
  .stx-hover-3d .stx-card:hover,
  .stx-hover-5d .stx-card:hover,
  .stx-hover-7d .stx-card:hover,
  .stx-hover-7d .stx-card:hover .stx-card__link,
  .stx-hover-7d .stx-card:hover .stx-card__body,
  .stx-hover-7d .stx-card:hover .stx-kicker,
  .stx-hover-7d .stx-card:hover .stx-card__title,
  .stx-hover-5d .stx-card:hover .stx-card__media img {
    transform: none !important;
  }
}
