/* ---------- Tokens ---------- */
:root {
  --paper: #f3eee6;
  --ink: #17140f;
  --muted: #6f675c;
  --faint: rgba(23, 20, 15, 0.38);
  --line: rgba(23, 20, 15, 0.16);
  --accent: #d9481f;

  --serif: "Instrument Serif", "Iowan Old Style", "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --gutter: clamp(16px, 3.5vw, 40px);
  --hud-inset: clamp(14px, 2.2vw, 24px);

  /* Load choreography: focus hunts, locks, shutter fires. */
  --t-lock: 1.45s;
  --t-shutter: 1.6s;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f0e0c;
    --ink: #efe9de;
    --muted: #9a9184;
    --faint: rgba(239, 233, 222, 0.4);
    --line: rgba(239, 233, 222, 0.16);
    --accent: #f2643a;
  }
}

@property --af-color {
  syntax: "<color>";
  inherits: false;
  initial-value: transparent;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(ellipse 70% 55% at 50% 46%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 72%),
    var(--paper);
  background-color: var(--paper);
}

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

/* Film grain */
.grain {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

@media (prefers-color-scheme: dark) {
  .grain {
    filter: invert(1);
    mix-blend-mode: screen;
    opacity: 0.07;
  }
}

/* Shutter flash */
.flash {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: #fff;
  opacity: 0;
  animation: flash 0.55s ease-out var(--t-shutter) both;
}

/* ---------- Header ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: var(--gutter) var(--gutter) 0;
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s both;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 24px;
  height: 24px;
  transition: transform 1.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.brand:hover .brand-mark,
.brand:focus-visible .brand-mark {
  transform: rotate(120deg);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: -0.01em;
}

.wordmark em {
  font-style: italic;
}

.status,
.eyebrow,
.hud,
.bottom {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent);
  animation: pulse 2.2s ease-out infinite;
}

/* ---------- Viewfinder ---------- */
.frame {
  position: relative;
  display: grid;
  place-items: center;
  margin: clamp(14px, 2.6vw, 28px) var(--gutter);
  padding: clamp(64px, 11vh, 112px) clamp(12px, 4vw, 48px);
}

.corner {
  position: absolute;
  width: clamp(18px, 2.8vw, 32px);
  aspect-ratio: 1;
  border: 0 solid var(--ink);
  opacity: 0.8;
  animation: settle 1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s both;
}

.corner.tl { top: 0; left: 0; border-top-width: 1.5px; border-left-width: 1.5px; --dx: -10px; --dy: -10px; }
.corner.tr { top: 0; right: 0; border-top-width: 1.5px; border-right-width: 1.5px; --dx: 10px; --dy: -10px; }
.corner.bl { bottom: 0; left: 0; border-bottom-width: 1.5px; border-left-width: 1.5px; --dx: -10px; --dy: 10px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 1.5px; border-right-width: 1.5px; --dx: 10px; --dy: 10px; }

.hud {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.625rem;
  line-height: 1;
  white-space: nowrap;
  animation: fade 0.8s ease 0.5s both;
}

.hud-tl { top: var(--hud-inset); left: var(--hud-inset); }
.hud-tr { top: var(--hud-inset); right: var(--hud-inset); gap: 14px; }
.hud-bl { bottom: var(--hud-inset); left: var(--hud-inset); gap: 6px; }
.hud-br { bottom: var(--hud-inset); right: var(--hud-inset); }
.hud-bc { bottom: var(--hud-inset); left: 50%; translate: -50% 0; }

.af-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  animation: af-lock 0.01s linear var(--t-lock) both;
}

/* Two stacked labels; the second replaces the first at a set moment. */
.swap {
  display: inline-grid;
}

.swap > span {
  grid-area: 1 / 1;
}

.swap .before { animation: hide 0.01s linear var(--t-lock) both; }
.swap .after { animation: show 0.01s linear var(--t-lock) both; }
.hud-bl .swap .before { animation-delay: var(--t-shutter); }
.hud-bl .swap .after { animation-delay: var(--t-shutter); }

.battery {
  width: 20px;
  height: 10px;
}

/* Exposure meter */
.meter {
  flex-direction: column;
  gap: 7px;
}

.scale {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.5625rem;
  letter-spacing: 0.04em;
}

.scale i {
  width: 1px;
  height: 5px;
  background: var(--faint);
}

.needle {
  position: relative;
  width: 100%;
  height: 5px;
}

.needle::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 0;
  translate: -50% 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid var(--accent);
  animation: meter 1.3s cubic-bezier(0.3, 0.9, 0.3, 1) 0.35s both;
}

/* ---------- Content ---------- */
.content {
  position: relative;
  z-index: 1;
  max-width: 64rem;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 clamp(22px, 3.6vh, 40px);
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.25s both;
}

.subject {
  position: relative;
  display: inline-block;
}

.headline {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3.5rem, min(14vw, 24vh), 11.5rem);
  line-height: 0.95;
  letter-spacing: -0.025em;
  text-wrap: balance;
  animation: focus-pull 1.25s cubic-bezier(0.25, 0.7, 0.2, 1) 0.2s both;
}

.headline em {
  font-style: italic;
  color: var(--accent);
  padding-right: 0.04em;
}

/* Autofocus brackets around the headline */
.af-box {
  --af-len: clamp(10px, 1.4vw, 16px);
  --af-w: 1.5px;
  position: absolute;
  inset: -0.1em -0.2em -0.14em;
  font-size: clamp(3.5rem, min(14vw, 24vh), 11.5rem);
  pointer-events: none;
  background:
    linear-gradient(var(--af-color), var(--af-color)) top left / var(--af-len) var(--af-w),
    linear-gradient(var(--af-color), var(--af-color)) top left / var(--af-w) var(--af-len),
    linear-gradient(var(--af-color), var(--af-color)) top right / var(--af-len) var(--af-w),
    linear-gradient(var(--af-color), var(--af-color)) top right / var(--af-w) var(--af-len),
    linear-gradient(var(--af-color), var(--af-color)) bottom left / var(--af-len) var(--af-w),
    linear-gradient(var(--af-color), var(--af-color)) bottom left / var(--af-w) var(--af-len),
    linear-gradient(var(--af-color), var(--af-color)) bottom right / var(--af-len) var(--af-w),
    linear-gradient(var(--af-color), var(--af-color)) bottom right / var(--af-w) var(--af-len);
  background-repeat: no-repeat;
  animation: af-box 2.4s ease 0.2s both;
}

.sub {
  max-width: 28ch;
  margin: clamp(22px, 3.6vh, 40px) auto 0;
  font-size: clamp(1.0625rem, 1.5vw, 1.3125rem);
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--muted);
  text-wrap: balance;
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 1.05s both;
}

/* ---------- Footer ---------- */
.bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding: 0 var(--gutter) var(--gutter);
  animation: fade 0.8s ease 0.6s both;
}

/* ---------- Motion ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes settle {
  from { opacity: 0; transform: translate(var(--dx), var(--dy)); }
  to { opacity: 0.8; transform: none; }
}

@keyframes focus-pull {
  0% { opacity: 0; filter: blur(22px); transform: scale(1.035); }
  35% { opacity: 1; filter: blur(3px); }
  60% { filter: blur(8px); }
  100% { opacity: 1; filter: blur(0); transform: none; }
}

@keyframes af-box {
  0% { --af-color: transparent; }
  10% { --af-color: var(--faint); }
  52% { --af-color: var(--faint); }
  53% { --af-color: var(--accent); }
  75% { --af-color: var(--accent); }
  100% { --af-color: var(--line); }
}

@keyframes af-lock {
  to { background: var(--accent); border-color: var(--accent); }
}

@keyframes hide {
  to { visibility: hidden; }
}

@keyframes show {
  from { visibility: hidden; }
  to { visibility: visible; }
}

@keyframes flash {
  0% { opacity: 0; }
  14% { opacity: 0.55; }
  100% { opacity: 0; }
}

@keyframes meter {
  0% { left: 8%; }
  45% { left: 72%; }
  70% { left: 42%; }
  100% { left: 50%; }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  70%,
  100% { box-shadow: 0 0 0 7px transparent; }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .hud-bc { display: none; }
  .tagline { display: none; }
  .hud-tr { gap: 10px; }
}

@media (max-width: 360px) {
  .hud-tr span:first-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }

  .flash {
    display: none;
  }
}
