/* ==========================================================================
   Components. One look per kind: every button, field, strip, card and state
   panel of the same kind shares these rules.
   `.is-hover`, `.is-active`, `.is-focus` mirror the real pseudo-classes so the
   brand guidelines page can show every state side by side.
   ========================================================================== */

/* ---- Button -----------------------------------------------------------
   Variants: primary (rose fill), secondary (black outline), text (no box).
   States: hover, pressed, focus-visible, disabled, loading. */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--color-text);
  --btn-border: transparent;

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  min-height: var(--control-h);
  padding: var(--space-xs) var(--space-m);
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  line-height: var(--leading-snug);
  text-align: center;
  text-decoration: none;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: var(--border) solid var(--btn-border);
  border-radius: var(--radius-s);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    transform var(--dur-instant) var(--ease-out);
}

.btn svg { width: var(--icon-s); height: var(--icon-s); flex: none; }

.btn--primary {
  --btn-bg: var(--color-accent);
  --btn-fg: var(--color-text-on-accent);
  --btn-border: var(--color-accent);
}
.btn--secondary {
  --btn-fg: var(--color-text);
  --btn-border: var(--color-line);
}
.btn--text {
  --btn-fg: var(--color-text);
  min-height: var(--tap);
  padding-inline: var(--space-2xs);
  margin-inline: calc(var(--space-2xs) * -1);
}
.btn--text .btn__label {
  background: linear-gradient(var(--color-accent), var(--color-accent)) 0 100% / 0 var(--border-thick) no-repeat;
  padding-bottom: 0.15em;
  transition: background-size var(--dur-base) var(--ease-out);
}
.btn--text svg { transition: transform var(--dur-base) var(--ease-out); }

@media (hover: hover) {
  .btn--primary:hover { --btn-bg: var(--color-accent-hover); --btn-border: var(--color-accent-hover); }
  .btn--secondary:hover { --btn-bg: var(--color-strip); --btn-fg: var(--color-text-on-strip); --btn-border: var(--color-strip); }
  .btn--text:hover .btn__label { background-size: 100% var(--border-thick); }
  .btn--text:hover [data-nudge="left"] { transform: translateX(-0.2em); }
  .btn--text:hover [data-nudge="right"] { transform: translateX(0.2em); }
}
.btn--primary.is-hover { --btn-bg: var(--color-accent-hover); --btn-border: var(--color-accent-hover); }
.btn--secondary.is-hover { --btn-bg: var(--color-strip); --btn-fg: var(--color-text-on-strip); --btn-border: var(--color-strip); }
.btn--text.is-hover .btn__label { background-size: 100% var(--border-thick); }

.btn:active, .btn.is-active {
  transform: translateY(var(--press-shift)) scale(0.985);
  box-shadow: var(--shadow-press);
}
.btn--primary:active, .btn--primary.is-active { --btn-bg: var(--color-accent); --btn-border: var(--color-accent); }
.btn--secondary:active, .btn--secondary.is-active { --btn-bg: var(--black); --btn-fg: var(--color-text-on-strip-strong); --btn-border: var(--black); }
.btn--text:active, .btn--text.is-active { box-shadow: none; }
.btn--text:active .btn__label, .btn--text.is-active .btn__label { background-size: 100% var(--border-thick); }

.btn.is-focus { outline: var(--border-thick) solid var(--color-focus); outline-offset: var(--focus-offset); }

.btn:disabled,
.btn[aria-disabled="true"] {
  --btn-bg: transparent;
  --btn-fg: var(--color-text-faint);
  --btn-border: var(--color-text-faint);
  border-style: dashed;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn--text:disabled, .btn--text[aria-disabled="true"] { --btn-border: transparent; }

/* Loading keeps the button's own color so it reads as "working", not "off". */
.btn.is-loading { border-style: solid; cursor: progress; }
.btn--primary.is-loading {
  --btn-bg: var(--color-accent);
  --btn-fg: var(--color-text-on-accent);
  --btn-border: var(--color-accent);
}
.btn--secondary.is-loading {
  --btn-bg: transparent;
  --btn-fg: var(--color-text);
  --btn-border: var(--color-line);
}

.spinner {
  width: 1em;
  height: 1em;
  flex: none;
  border: var(--border-thick) solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-round);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

/* ---- Form field -------------------------------------------------------
   Paper-filled controls on navy. Label above, message below. */

.field { display: grid; gap: var(--space-2xs); }

.field__label {
  font-size: var(--step--1);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  line-height: var(--leading-snug);
  color: var(--color-text-tan);
}

.field__control {
  width: 100%;
  min-height: var(--control-h);
  padding: var(--space-xs) var(--space-s);
  font-size: max(1rem, var(--step-0)); /* never below 16px: stops iOS zooming on focus */
  line-height: var(--leading-snug);
  color: var(--color-text-on-light);
  background: var(--color-paper);
  border: var(--border-thick) solid var(--color-paper);
  border-radius: var(--radius-s);
  appearance: none;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.field__control::placeholder { color: var(--color-placeholder); opacity: 1; }
textarea.field__control { min-height: 9rem; resize: vertical; }

@media (hover: hover) {
  .field__control:hover { border-color: var(--sand-300); }
}
.field__control.is-hover { border-color: var(--sand-300); }

.field__control:focus-visible,
.field__control.is-focus {
  outline: var(--border-thick) solid var(--color-focus);
  outline-offset: var(--focus-offset);
  border-color: var(--color-text-on-light);
}

.field__control[aria-invalid="true"] { border-color: var(--color-danger-border); }

.field__control:disabled,
.field__control[readonly] {
  background: var(--sand-200);
  border-color: var(--sand-200);
  color: var(--color-text-on-light-muted);
  cursor: not-allowed;
}
.is-submitting .field__control[readonly] { cursor: progress; }

.field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
  font-size: var(--step--1);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  color: var(--color-danger);
  animation: slide-in var(--dur-base) var(--ease-out-expo);
}
.field__error[hidden] { display: none; }
.field__error svg { width: var(--icon-s); height: var(--icon-s); flex: none; margin-top: 0.05em; }

@keyframes slide-in {
  from { opacity: 0; transform: translateY(calc(var(--space-3xs) * -1)); }
  to   { opacity: 1; transform: none; }
}

/* ---- Alert ------------------------------------------------------------
   Form-level feedback on the paper surface, so it stays readable.
   Full border, no side stripe. */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  padding: var(--space-s);
  font-size: var(--step--1);
  line-height: var(--leading-snug);
  color: var(--color-text-on-light);
  background: var(--color-paper);
  border: var(--border-thick) solid var(--color-danger-border);
  border-radius: var(--radius-s);
  animation: slide-in var(--dur-base) var(--ease-out-expo);
}
.alert[hidden] { display: none; }
.alert > div { min-width: 0; overflow-wrap: anywhere; }
.alert svg { width: var(--icon-m); height: var(--icon-m); flex: none; color: var(--color-danger-on-light); }
.alert strong { display: block; color: var(--color-danger-on-light); margin-bottom: var(--space-3xs); }
.alert a { color: var(--color-text-on-light); font-weight: var(--weight-bold); }

/* ---- Strip ------------------------------------------------------------
   The thin black bar with tan type: the caption under a playing film, the
   mobile menu. The rose variant (black on pink)
   carries the rebrand notice. */

.strip {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  min-height: var(--strip-h);
  padding: var(--space-3xs) var(--space-s);
  font-size: var(--step--1);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  letter-spacing: 0.02em;
  color: var(--color-text-on-strip);
  background: var(--color-strip);
  max-width: none;
}
.strip a { color: var(--color-text-on-strip-strong); }

/* Rose variant: black type on the pink band. Used for the rebrand notice. */
.strip--rose { color: var(--color-text-on-accent); background: var(--color-accent); }
.strip--rose a { color: inherit; }

/* ---- Work card ------------------------------------------------------
   Just the thumbnail. On hover its top corners rise into an arch while the
   picture pushes in; the caption appears once the film plays. */

.work-card {
  display: block;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.work-card__media {
  --arch-rise: 0%;
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-bg-sunken);
  border-radius: 50% 50% 0 0 / var(--arch-rise) var(--arch-rise) 0 0;
  transition:
    border-radius var(--dur-slow) var(--ease-out-expo),
    transform var(--dur-instant) var(--ease-out);
  isolation: isolate;
}

.work-card__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity var(--dur-slower) var(--ease-out), transform var(--dur-slow) var(--ease-out-expo);
}
.work-card__thumb.is-loaded { opacity: 1; }

.work-card__play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: var(--z-raised);
  display: grid;
  place-items: center;
  width: 3.5rem;
  aspect-ratio: 1;
  color: var(--color-text-on-accent);
  background: var(--color-accent);
  border-radius: var(--radius-round);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-slow) var(--ease-out-expo);
}
.work-card__play svg { width: 1.1rem; height: 1.1rem; margin-left: 0.15rem; }

.work-card__fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  gap: var(--space-2xs);
  padding: var(--space-s);
  text-align: center;
  color: var(--color-text-on-strip);
  font-size: var(--step--1);
}
.work-card__fallback svg { width: 2.25rem; }
.work-card__media.is-broken .work-card__fallback { display: grid; align-content: center; }

@media (hover: hover) {
  .work-card:hover .work-card__media { --arch-rise: var(--arch-rise-card); }
  .work-card:hover .work-card__thumb.is-loaded { transform: scale(1.07); }
  .work-card:hover .work-card__play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.work-card.is-hover .work-card__media { --arch-rise: var(--arch-rise-card); }
.work-card.is-hover .work-card__thumb.is-loaded { transform: scale(1.07); }
.work-card.is-hover .work-card__play { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.work-card:focus-visible .work-card__media,
.work-card.is-focus .work-card__media {
  --arch-rise: var(--arch-rise-card);
  outline: var(--border-thick) solid var(--color-focus);
  outline-offset: var(--focus-offset);
}
.work-card:focus-visible .work-card__play { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.work-card:active .work-card__media,
.work-card.is-active .work-card__media { transform: scale(0.98); }

/* Touch screens have no hover, so show the play mark by default. */
@media (hover: none) {
  .work-card__play { opacity: 0.92; transform: translate(-50%, -50%) scale(0.9); width: 3rem; }
}

/* ---- Skeleton ---------------------------------------------------------*/

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--color-bg-sunken);
  border-radius: var(--radius-none);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in oklch, var(--sand-300) 9%, transparent) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer 1.6s var(--ease-in-out) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; opacity: 0.5; transform: none; }
}
.skeleton--line { height: 1em; border-radius: var(--radius-s); }

/* ---- State panel ------------------------------------------------------
   Loading, empty and error screens share one layout: a small arch drawing,
   a heading, one or two sentences, then actions. */

.state {
  display: grid;
  justify-items: start;
  gap: var(--space-s);
  max-width: 34rem;
  padding-block: var(--space-xl);
  animation: slide-in var(--dur-slow) var(--ease-out-expo);
}
.state[hidden] { display: none; }
.state__art { width: 4.5rem; color: var(--color-line); margin-bottom: var(--space-2xs); }
.state__art .accent { color: var(--color-accent); }
.state__title { font-size: var(--step-2); }
.state__text { color: var(--color-text-body); }
.state__actions { display: flex; flex-wrap: wrap; gap: var(--space-s); margin-top: var(--space-2xs); }

/* ---- Lightbox ---------------------------------------------------------
   No frame: the film plays straight on the dimmed page, as large as fits,
   with a thin black caption strip underneath. Everything around it is the
   page, and clicking there closes it. */

.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: var(--lightbox-inset);
  color: var(--color-text-on-strip);
  background: transparent;
  border: 0;
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
  overscroll-behavior: contain;
}
.lightbox[open] { display: grid; }
.lightbox.is-open { opacity: 1; }

.lightbox::backdrop {
  background: var(--color-scrim);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
}
.lightbox.is-open::backdrop { opacity: 1; }

.lightbox__stage {
  display: grid;
  place-items: center;
  min-height: 0;
  container-type: size;
}

/* --film-aspect is the film's own shape (lightbox.js sets it from Framerate),
   so a portrait film isn't boxed into 16:9. */
.lightbox__figure {
  width: min(100cqw, (100cqh - var(--strip-h)) * var(--film-aspect, 16 / 9));
  margin: 0;
  box-shadow: var(--shadow-lift);
  transform: translateY(var(--rise)) scale(0.97);
  transition: transform var(--dur-slow) var(--ease-out-expo);
}
.lightbox.is-open .lightbox__figure { transform: none; }

.lightbox__frame {
  position: relative;
  aspect-ratio: var(--film-aspect, 16 / 9);
  background: var(--ink);
}
.lightbox__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  /* This page is color-scheme: dark; embeds that aren't (Framerate) would get
     an opaque white backdrop from the browser unless the schemes match. */
  color-scheme: normal;
}

.lightbox__caption { justify-content: space-between; padding-block: 0; }
.lightbox__caption-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Close: a tan text control in the strip. The hit area reaches 44px tall even
   though the strip is thinner. */
.lightbox__close {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  flex: none;
  min-height: var(--strip-h);
  font-size: var(--step--1);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-on-strip);
  transition: color var(--dur-fast) var(--ease-out), transform var(--dur-instant) var(--ease-out);
}
.lightbox__close::before { content: ""; position: absolute; inset: calc((var(--tap) - var(--strip-h)) / -2) calc(var(--space-2xs) * -1); }
.lightbox__close svg { width: var(--icon-s); height: var(--icon-s); }
@media (hover: hover) { .lightbox__close:hover { color: var(--color-text-on-strip-strong); } }
.lightbox__close:active { transform: translateY(var(--press-shift)); }

.lightbox__status {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-xs);
  padding: var(--space-m);
  text-align: center;
  color: var(--color-text-on-strip);
  background: var(--ink);
}
.lightbox__status[hidden] { display: none; }
.lightbox__status .spinner { width: 1.75rem; height: 1.75rem; color: var(--color-accent); }
.lightbox__status h2 { font-size: var(--step-1); color: var(--color-text-on-strip-strong); }
.lightbox__status .btn--secondary { --btn-fg: var(--color-text-on-strip); --btn-border: var(--color-text-on-strip); }
