/* ---------------------------------------------------------------------------
   Base — reset, typography, shared primitives and the keyframe library.
--------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* `clip` prevents sideways scrolling outright; `hidden` would create a
     scrollable box and still let iOS rubber-band horizontally. */
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--duration), color var(--duration);
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 400; }
p { margin: 0; }

/*
  Wrapping of admin-entered text.

  Anything typed in the admin can contain a run with no spaces in it — a URL, a
  tracking code, a long compound word. `break-word` stops that overflowing its
  own box, but it does not change how wide the browser thinks the box wants to
  be, so inside a grid or flex track one long token still widens the whole
  column and pushes the card out of its container. `anywhere` is the value that
  feeds back into intrinsic sizing, so it is the one used on the text elements
  themselves; the `min-width: 0` below lets the track actually shrink to it.

  Neither breaks a word that fits — they only apply when there is no other way.
*/
body { overflow-wrap: break-word; }

:where(p, li, dd, dt, td, th, figcaption, blockquote, h1, h2, h3, h4, h5, h6) {
  overflow-wrap: anywhere;
}
ul, ol { margin: 0; padding: 0; }
/* blockquote and figure carry a 40px side margin by default, which silently
   crushes any card they sit in. */
blockquote, figure, dl, dd { margin: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }

a {
  color: var(--text);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--accent); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* A visible, consistent focus ring — never removed, only styled. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--accent); color: var(--ink); }

/*
  The hidden attribute only sets display:none at user-agent priority, so any
  later `display: flex` on the same element silently overrides it. This is what
  keeps [hidden] meaning hidden.
*/
[hidden] { display: none !important; }

/* --------------------------------------------------------------- utilities */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px; left: 12px;
  z-index: calc(var(--z-preloader) + 10);
  padding: 12px 20px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: top var(--duration) var(--ease-out);
}
.skip-link:focus { top: 12px; color: var(--ink); }

.shell {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.shell--wide  { padding-inline: var(--gutter-wide); }
.shell--article { max-width: var(--article-max); }
.shell--reading { max-width: var(--reading-max); }

.section    { padding-block: var(--section-y); }
.section--sm { padding-block: var(--section-y-sm); }
.section--top-0 { padding-top: 0; }

.stack-sm  { display: flex; flex-direction: column; gap: 10px; }
.stack     { display: flex; flex-direction: column; gap: 14px; }
.stack-lg  { display: flex; flex-direction: column; gap: 24px; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.row--between { justify-content: space-between; }
.row--baseline { align-items: baseline; }

/* ------------------------------------------------------------- type styles */

.display {
  font-family: var(--font-display);
  text-transform: uppercase;
  line-height: .94;
  letter-spacing: -.01em;
}

.eyebrow {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--accent-text);
  text-transform: uppercase;
}

.chrome-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-chrome);
  color: var(--faint);
  text-transform: uppercase;
}

.lede {
  font-size: 17px;
  line-height: 1.65;
  color: var(--muted);
}

.outline-text {
  color: transparent;
  -webkit-text-stroke: 2px var(--accent);
  paint-order: stroke fill;
}
.outline-text--light { -webkit-text-stroke-color: var(--text); }

.accent { color: var(--accent-text); }
.muted  { color: var(--muted); }
.faint  { color: var(--faint); }

/* ------------------------------------------------------------------ chrome */

/* The REC / timecode strip that frames every hero. */
.slate {
  position: absolute;
  inset-inline: var(--gutter-wide);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  z-index: 3;
  pointer-events: none;
}
.slate--top    { top: 20px; }
.slate--bottom { bottom: 20px; }

/*
  On a phone the three metadata items wrap onto a second line and collide with
  the corner marks and the headline. The running timecode is the part that
  actually does something — it ticks — so it carries the film-set idea alone and
  the static labels step aside.
*/
@media (max-width: 639px) {
  .slate {
    inset-inline: var(--gutter);
    gap: 8px;
    flex-wrap: nowrap;
  }
  .slate > :not(.slate__primary) { display: none; }
  .slate--bottom { display: none; }

  /* No room for decorative brackets beside the metadata. */
  .corner-mark { display: none; }
}

.rec-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ff2020;
  animation: dt-pulse 1.4s infinite;
}

.grid-field {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(236, 236, 241, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 236, 241, .045) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 55%, black 25%, transparent 78%);
          mask-image: radial-gradient(ellipse at 50% 55%, black 25%, transparent 78%);
  pointer-events: none;
}

.scanlines {
  position: absolute;
  inset: 0;
  opacity: .5;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .03) 0 1px, transparent 1px 4px);
  animation: dt-scan 8s linear infinite;
}

.orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.corner-mark {
  position: absolute;
  width: 22px; height: 22px;
  border-color: rgba(236, 236, 241, .3);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}
.corner-mark--tl { top: 48px;    left: 14px;  border-top-width: 2px;    border-left-width: 2px; }
.corner-mark--tr { top: 48px;    right: 14px; border-top-width: 2px;    border-right-width: 2px; }
.corner-mark--bl { bottom: 14px; left: 14px;  border-bottom-width: 2px; border-left-width: 2px; }
.corner-mark--br { bottom: 14px; right: 14px; border-bottom-width: 2px; border-right-width: 2px; }

/* ------------------------------------------------------------------ motion */

/* Distance is one group's width, measured and set by marquee.js. */
@keyframes dt-loop    { from { transform: translate3d(0,0,0); }
                        to   { transform: translate3d(calc(-1 * var(--loop-distance, 0px)),0,0); } }
@keyframes dt-spin    { from { transform: rotate(0);        } to { transform: rotate(360deg);   } }
@keyframes dt-scan    { from { background-position: 0 0;    } to { background-position: 0 120px; } }
@keyframes dt-pulse   { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

@keyframes dt-float {
  0%, 100% { transform: rotate(-5deg) translateY(0); }
  50%      { transform: rotate(-5deg) translateY(-10px); }
}

@keyframes dt-scroll-hint {
  0%   { transform: scaleY(0); transform-origin: top; }
  45%  { transform: scaleY(1); transform-origin: top; }
  55%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

@keyframes dt-glitch {
  0%, 91%, 100% { transform: none;                opacity: 1; }
  92%           { transform: translateX(5px);      opacity: .65; }
  94%           { transform: translateX(-5px); }
  96%           { transform: translateX(2px);      opacity: .85; }
}

/*
  Reduced motion: stop the ambient loops and let the reveal engine resolve
  everything immediately (fx.js reads the same media query).
*/
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }

  .scanlines,
  #dtfx-grain,
  #dtfx-glow,
  #dtfx-ring { display: none !important; }
}
