/* ==========================================================================
   ALL ACCESS AGENCY — Take 02
   Persistent corner chrome.
   Inner content rendered as a "viewfinder card":
     · L-bracket corners
     · justified header / body / footer rows separated by hairlines
     · giant outlined chapter glyph in the background
   Wipe transition between frames (CSS scroll-driven where supported).
   ========================================================================== */

:root {
  --black:   #0A0A0A;
  --ink:     #111111;
  --line:    #1F1F1F;
  --rule:    #2A2A2A;
  --mute:    #6E6E6E;
  --silver:  #B8B8B8;
  --white:   #FFFFFF;
  --red:     #E11D26;

  --mono:    'DM Mono', ui-monospace, Menlo, monospace;
  --gutter:  clamp(20px, 3vw, 40px);

  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--black);
  color: var(--white);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--white); color: var(--black); }

/* Subtle film grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: .035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1   0 0 0 0 1   0 0 0 0 1   0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ==========================================================================
   PERSISTENT CHROME (top + bottom corners)
   ========================================================================== */
.chrome {
  position: fixed;
  left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 22px var(--gutter);
  pointer-events: none;
}
.chrome > * { pointer-events: auto; }
.chrome--top    {
  top: 0;
  padding-top: max(22px, env(safe-area-inset-top));
  padding-left:  max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.chrome--bottom {
  bottom: 0;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  padding-left:  max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.mark img { height: 22px; width: auto; opacity: .9; transition: opacity .3s; }
.mark:hover img { opacity: 1; }

.live {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--silver);
}
.live__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 12px var(--red);
  animation: blink 1.4s steps(2, jump-none) infinite;
  margin-right: 2px;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .25; }
}
.live__sep   { color: var(--mute); }
.live__count {
  color: var(--white);
  display: inline-block;
  min-width: 1.6em;
  text-align: right;
  transition: opacity .2s ease;
}
.live__total { color: var(--mute); }

.meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--mute);
}
.meta--label {
  color: var(--silver);
  transition: opacity .25s ease, transform .25s ease;
}
.meta--label.is-changing {
  opacity: 0;
  transform: translateY(4px);
}
.meta__num  { color: var(--mute); }
.meta__sep  { color: var(--mute); }
.meta__time { color: var(--silver); }
.meta__zone { color: var(--mute); margin-left: 6px; }

.progress {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: var(--line);
  z-index: 99;
}
.progress__bar {
  height: 100%;
  background: var(--white);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform .12s linear;
}

/* ==========================================================================
   REEL
   ========================================================================== */
.reel {
  position: fixed;
  inset: 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.reel::-webkit-scrollbar { display: none; }

.frame {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  position: relative;
  padding: clamp(80px, 12vh, 110px) var(--gutter);
  overflow: hidden;
}

/* ==========================================================================
   CARD — viewfinder centerpiece
   ========================================================================== */
.card {
  --pad-x: clamp(28px, 5vw, 80px);
  --pad-y: clamp(36px, 5vw, 64px);

  position: relative;
  width: min(720px, 92vw);
  padding: var(--pad-y) var(--pad-x);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(36px, 5vw, 64px);
  min-height: clamp(420px, 60vh, 560px);
  will-change: opacity, transform, clip-path;
}

/* L-shaped corner brackets */
.card__corner {
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--silver);
}
.card__corner--tl { top: 0; left: 0;   border-right: 0; border-bottom: 0; }
.card__corner--tr { top: 0; right: 0;  border-left: 0;  border-bottom: 0; }
.card__corner--bl { bottom: 0; left: 0;  border-right: 0; border-top: 0; }
.card__corner--br { bottom: 0; right: 0; border-left: 0;  border-top: 0; }

/* Giant outlined chapter glyph in the background */
.card__bg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(220px, 38vh, 360px);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,.05);
          text-stroke: 1px rgba(255,255,255,.05);
  letter-spacing: -0.02em;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

/* Header row: tiny justified meta */
.card__head,
.card__foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--mute);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.card__foot {
  padding-bottom: 0;
  padding-top: 14px;
  border-bottom: 0;
  border-top: 1px solid var(--rule);
}

.card__index { color: var(--mute); }
.card__next {
  color: var(--silver);
  position: relative;
  transition: color .35s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* tap target */
  padding: 6px 0;
  min-height: 32px;
}
.card__next::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .45s var(--ease-out);
}
.card__next:hover { color: var(--white); }
.card__next:hover::after { transform: scaleX(1); transform-origin: left; }

/* Body */
.card__body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.card__brand {
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(20px, 2.2vw, 30px);
  letter-spacing: .12em;
  text-transform: lowercase;
  color: var(--white);
  line-height: 1;
}
.card__name {
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(18px, 1.7vw, 24px);
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--white);
  line-height: 1;
}
.card__line {
  font-family: var(--mono);
  font-weight: 300;
  font-size: clamp(13px, 1vw, 14.5px);
  line-height: 1.7;
  letter-spacing: .015em;
  color: var(--silver);
  max-width: 44ch;
}

/* Cover — slightly different alignment */
.card__body--cover {
  gap: 22px;
}

/* Connect — quote + email */
.card__body--connect { gap: 28px; }
.card__quote {
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(17px, 1.6vw, 22px);
  letter-spacing: .03em;
  line-height: 1.45;
  color: var(--white);
  max-width: 26ch;
}
.card__quote em {
  font-style: normal;
  color: var(--mute);
}
.card__mail {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  font-family: var(--mono);
  font-size: clamp(13px, 1.05vw, 15px);
  letter-spacing: .04em;
  color: var(--silver);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 6px;
  /* tap target */
  min-height: 36px;
  transition: color .35s var(--ease-out), border-color .35s var(--ease-out), gap .35s var(--ease-out);
}
.card__mail:hover { color: var(--white); border-color: var(--white); gap: 14px; }

/* ==========================================================================
   FRAME TRANSITION — wipe in / wipe out (CSS scroll-driven)
   ========================================================================== */
@supports (animation-timeline: view()) {
  .card {
    animation: filmCut linear both;
    animation-timeline: view();
    animation-range: cover 0% cover 100%;
  }
  @keyframes filmCut {
    0%   { opacity: 0; clip-path: inset(0 100% 0 0); transform: translateX(20px); }
    25%  { opacity: 1; clip-path: inset(0 0 0 0);    transform: translateX(0); }
    75%  { opacity: 1; clip-path: inset(0 0 0 0);    transform: translateX(0); }
    100% { opacity: 0; clip-path: inset(0 0 0 100%); transform: translateX(-20px); }
  }
}

/* JS fallback */
.card {
  opacity: 0;
  transform: translateX(20px);
  clip-path: inset(0 100% 0 0);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out), clip-path .8s var(--ease-out);
}
.frame.is-active .card {
  opacity: 1;
  transform: translateX(0);
  clip-path: inset(0 0 0 0);
}
@supports (animation-timeline: view()) {
  .card {
    opacity: initial;
    transform: initial;
    clip-path: initial;
    transition: none;
  }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
/* — Tablet & below — */
@media (max-width: 768px) {
  :root { --gutter: 18px; }

  .chrome--top    { padding-top: max(16px, env(safe-area-inset-top)); }
  .chrome--bottom { padding-bottom: max(16px, env(safe-area-inset-bottom)); }

  .live__label { display: none; }

  .card { --pad-x: 24px; --pad-y: 28px; gap: 28px; }
  .card__name  { font-size: 16px; letter-spacing: .28em; }
  .card__brand { font-size: 22px; letter-spacing: .1em; }
  .card__line  { font-size: 13px; max-width: 38ch; }
  .card__quote { font-size: 18px; max-width: 22ch; }
  .card__bg { font-size: clamp(180px, 34vh, 260px); }
}

/* — Phone — */
@media (max-width: 560px) {
  :root { --gutter: 16px; }

  /* Top chrome: keep mark + live count (no "ON AIR" word) */
  .live { gap: 7px; font-size: 9.5px; letter-spacing: .2em; }

  /* Bottom chrome: stack chapter name onto its own line if long, hide zone */
  .meta { font-size: 9.5px; letter-spacing: .18em; gap: 7px; }
  .meta--est .meta__zone { display: none; }
  .meta__name {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: .15em;
  }

  /* Card: stack header & footer rows on phones — editorial feel preserved */
  .card {
    --pad-x: 18px;
    --pad-y: 22px;
    width: calc(100vw - 32px);
    min-height: 0;
    gap: 22px;
  }
  .card__corner { width: 11px; height: 11px; }

  .card__head,
  .card__foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 9.5px;
    letter-spacing: .2em;
    padding-bottom: 12px;
  }
  .card__foot { padding-top: 12px; padding-bottom: 0; }

  /* Right-side items in head/foot align flush left when stacked */
  .card__head > span:last-child,
  .card__foot > .card__next { align-self: flex-start; }

  /* Larger tap targets on phones */
  .card__next { min-height: 44px; padding: 10px 0; }
  .card__mail { min-height: 44px; padding-bottom: 10px; }

  /* Body text sizing */
  .card__brand { font-size: clamp(20px, 6.5vw, 26px); letter-spacing: .08em; }
  .card__name  { font-size: 15px; letter-spacing: .26em; }
  .card__line  {
    font-size: 12.5px;
    line-height: 1.65;
    max-width: 32ch;
  }
  .card__quote { font-size: 17px; line-height: 1.4; max-width: 18ch; }

  /* Background glyph: smaller, kept faint */
  .card__bg {
    font-size: clamp(140px, 30vh, 200px);
    -webkit-text-stroke: 1px rgba(255,255,255,.045);
            text-stroke: 1px rgba(255,255,255,.045);
  }
}

/* — Very narrow / older phones — */
@media (max-width: 360px) {
  .card { --pad-x: 16px; --pad-y: 20px; }
  .card__brand { font-size: 19px; }
  .card__line  { font-size: 12px; }
  .meta__name  { max-width: 38vw; }
}

/* — Landscape phones / very short — */
@media (max-height: 560px) and (orientation: landscape) {
  .frame { padding: 60px var(--gutter); }
  .card { gap: 18px; --pad-y: 18px; }
  .card__bg { font-size: clamp(120px, 38vh, 180px); }
  .card__line { line-height: 1.55; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .card { opacity: 1; transform: none; clip-path: none; }
  .live__dot { animation: none; }
}
