/* ==========================================================================
   Light Zone Photography - shutter intro
   --------------------------------------------------------------------------
   The aperture overlay that holds the landing page until someone opens it: the blades, the corner frame, the viewfinder readout, the prompt and the flash. Nothing else on the site uses these classes.

   Loaded by: the landing page only
   ========================================================================== */
/* --- Shutter intro -----------------------------------------------------
   A real aperture: six blades meeting in a hexagon. Painted immediately so
   there is no flash of the page behind it. JS removes it (reduced motion,
   already seen this session, or once it has fired); <noscript> hides it
   outright; and the failsafe animation retires it even if JS never runs.

   The whole thing is one 0-100 SVG viewBox scaled to fit, so it is centred
   and correctly proportioned on any screen without a single media query.  */

.intro {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  background: var(--ink-950);
  cursor: pointer;
  overflow: hidden;
  /* Only fires if intro.js never ran. Once it does, it sets data-armed and
     the shutter waits indefinitely for a deliberate action. */
  animation: introFailsafe 0.4s linear 15s forwards;
}
.intro[data-armed="true"] { animation: none; }
@keyframes introFailsafe {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}

/* --- the shutter ------------------------------------------------------- */
.intro__iris {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  color: var(--accent);
}

/* Two nested groups: the outer one breathes, the inner one is driven by the
   phase. Keeping them separate means the idle animation never fights the
   open/close transition. */
.intro__breathe,
.intro__blades {
  transform-box: view-box;
  transform-origin: 50px 50px;
}

.intro__breathe { animation: irisBreathe 6s var(--ease-in-out) infinite; }
@keyframes irisBreathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.035); }
}

.intro__blades {
  /* idle: a viewfinder-sized opening, blades slightly wound */
  transform: rotate(-14deg) scale(0.62);
  transition:
    transform 900ms var(--ease-out),
    opacity 400ms var(--ease-out);
}

.intro__rim  { opacity: 0.75; }
.intro__seams { opacity: 0.38; }

/* Snap shut: fast, mechanical, slightly over-wound. */
.intro[data-phase="closing"] .intro__blades,
.intro[data-phase="flash"] .intro__blades {
  transform: rotate(-40deg) scale(0);
  transition: transform 280ms cubic-bezier(0.55, 0, 0.75, 0.2);
}
.intro[data-phase="closing"] .intro__breathe,
.intro[data-phase="flash"] .intro__breathe { animation: none; }

/* Then sweep open, well past the edges of any screen, and you are inside. */
.intro[data-phase="opening"] .intro__blades {
  transform: rotate(26deg) scale(9);
  transition: transform 1050ms cubic-bezier(0.16, 1, 0.3, 1);
}
.intro[data-phase="opening"] .intro__breathe { animation: none; }
.intro[data-phase="opening"] .intro__rim,
.intro[data-phase="opening"] .intro__seams { opacity: 0; transition: opacity 500ms linear; }

/* Once the blades start opening there must be nothing behind them but the
   site itself. */
.intro[data-phase="opening"] { background: transparent; }

/* --- the camera frame --------------------------------------------------
   A hairline down all four edges, heavier brackets at the corners and a
   centre tick per side. It sits above the blades but below the type, and
   clears out the moment the shutter fires.                              */
.intro__frame {
  position: absolute;
  inset: clamp(0.9rem, 3vw, 2.5rem);
  z-index: 3;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out), transform 0.5s var(--ease-out);
}

.intro__corner {
  position: absolute;
  width: clamp(30px, 5vw, 66px);
  height: clamp(30px, 5vw, 66px);
  border: 2px solid var(--accent);
  opacity: 0.9;
}
.intro__corner--tl { top: 0; left: 0;  border-right: 0; border-bottom: 0; }
.intro__corner--tr { top: 0; right: 0; border-left: 0;  border-bottom: 0; }
.intro__corner--bl { bottom: 0; left: 0;  border-right: 0; border-top: 0; }
.intro__corner--br { bottom: 0; right: 0; border-left: 0;  border-top: 0; }


/* The frame pulls back with everything else once the shutter is triggered */
.intro:not([data-phase="idle"]) .intro__frame {
  opacity: 0;
  transform: scale(1.04);
}

/* --- viewfinder HUD ---------------------------------------------------- */
.intro__hud {
  position: absolute;
  inset: clamp(2rem, 5.5vw, 4.5rem);
  z-index: 3;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out);
}
.intro__readout {
  position: absolute;
  left: 0; bottom: 0;
  display: flex;
  gap: clamp(0.75rem, 2vw, 1.25rem);
  font-size: var(--fs-micro);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.intro__rec {
  position: absolute;
  right: 0; bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: var(--fs-micro);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}
.intro__rec::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: recPulse 1.8s var(--ease-in-out) infinite;
}
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* --- prompt ------------------------------------------------------------ */
.intro__prompt {
  position: relative;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: clamp(0.85rem, 2vw, 1.25rem);
  text-align: center;
  padding-inline: var(--gutter);
  align-self: end;
  /* clears the aperture on short screens, sits under it on tall ones */
  margin-bottom: clamp(2rem, 11vh, 6.5rem);
  transition: opacity 0.3s var(--ease-out), transform 0.45s var(--ease-out);
}

.intro__line {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 4.4vw, 3rem);
  line-height: 1.08;
  font-style: italic;
  color: var(--text);
  text-shadow: 0 2px 30px rgba(5, 5, 8, 0.9);
}
.intro__line em { font-style: italic; color: var(--accent); }

.intro__shoot {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  padding: clamp(0.85rem, 2vw, 1.05rem) clamp(1.6rem, 4vw, 2.3rem);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  color: var(--text);
  font-size: var(--fs-small);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.4s var(--ease-out), border-color 0.4s var(--ease-out), background-color 0.4s;
}
.intro__shoot::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: shootPulse 2.4s var(--ease-out) infinite;
}
@keyframes shootPulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 14px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.intro__shoot:hover {
  color: var(--ink-950);
  background: var(--accent);
  border-color: var(--accent);
}
/* Focus gets a ring, not an inversion. The button is focused programmatically
   on load, and swapping its fill there left the label unreadable. */
.intro__shoot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-color: var(--accent);
}

.intro__hint {
  font-size: var(--fs-micro);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* The chrome clears out the moment the shutter fires */
.intro:not([data-phase="idle"]) .intro__prompt,
.intro:not([data-phase="idle"]) .intro__hud {
  opacity: 0;
  pointer-events: none;
}
.intro:not([data-phase="idle"]) .intro__prompt { transform: translateY(12px); }

/* --- the flash --------------------------------------------------------- */
.intro__flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.intro[data-phase="flash"] .intro__flash { animation: flashPop 200ms ease-out forwards; }
@keyframes flashPop {
  0%   { opacity: 0; }
  16%  { opacity: 1; }
  100% { opacity: 0; }
}

/* --- short and wide screens ------------------------------------------- */
/* On a landscape phone there is no room under the aperture, so the prompt
   moves out of the way rather than colliding with it. */
@media (max-height: 560px) {
  .intro__prompt { margin-bottom: clamp(1rem, 4vh, 2rem); gap: 0.6rem; }
  .intro__line { font-size: clamp(1.1rem, 3.4vh, 1.6rem); }
  .intro__hint { display: none; }
}
/* The aperture is sized off the shorter viewport edge, so on a narrow phone it
   would otherwise sit tiny in the middle of a tall screen. The phase rules are
   more specific, so opening and closing still override this. */
@media (max-width: 700px) {
  .intro__blades { transform: rotate(-14deg) scale(0.95); }
}
@media (max-width: 560px) {
  .intro__rec { display: none; }
  .intro__readout { letter-spacing: 0.12em; font-size: 0.6rem; }
  /* The hint is one long line; let it wrap rather than run off the edge. */
  .intro__hint {
    white-space: normal;
    max-width: 22ch;
    line-height: 1.6;
    letter-spacing: 0.16em;
  }
  .intro__frame { inset: 0.75rem; }
  .intro__hud { inset: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  /* intro.js removes the overlay outright here; this is the belt-and-braces. */
  .intro { display: none !important; }
}