/* Shared maritime motion: visible defaults, stationary layout containers. */
:root { --ismar-motion-ease: cubic-bezier(.33, 0, .2, 1); }

.home-content > .eyebrow,
.home-content > h1,
.home-content > .home-intro,
.hero-inner > .eyebrow,
.hero-inner > h1,
.hero-inner > .gold-rule,
.contact-content > .eyebrow,
.contact-content > h1,
.contact-content > h2,
.contact-content > .gold-rule,
main [data-ismar-motion] {
  opacity: 1;
  transform: none;
}

/* Underlines occupy their existing space; only their paint is revealed. */
.header nav a:not(:last-child)::after {
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  transition: none;
}
.header nav a:not(:last-child)[aria-current="page"]::after,
.header nav a:not(:last-child):focus-visible::after { transform: scaleX(1); }
@media (hover: hover) and (pointer: fine) {
  .header nav a:not(:last-child):hover::after { transform: scaleX(1); }
}

@media (prefers-reduced-motion: no-preference) {
  .home-content > .eyebrow,
  .hero-inner > .eyebrow,
  .contact-content > .eyebrow {
    --ismar-rise: 4px;
    animation: ismar-hero-rise 1000ms var(--ismar-motion-ease) 0ms both;
  }
  .home-content > h1,
  .hero-inner > h1,
  .contact-content > h1 {
    --ismar-rise: 6px;
    animation: ismar-hero-rise 1200ms var(--ismar-motion-ease) 80ms both;
  }
  .home-content > .home-intro,
  .contact-content > h2 {
    --ismar-rise: 4px;
    animation: ismar-hero-rise 1100ms var(--ismar-motion-ease) 180ms both;
  }
  .hero-inner > .gold-rule,
  .contact-content > .gold-rule {
    transform-origin: left center;
    animation: ismar-hero-line 1100ms var(--ismar-motion-ease) 140ms both;
  }
  main .ismar-motion-reveal[data-ismar-motion="rise"] {
    animation: ismar-content-rise 850ms var(--ismar-motion-ease) var(--ismar-stagger, 0ms) backwards;
  }
  main .ismar-motion-reveal[data-ismar-motion="fade"] {
    animation: ismar-photo-fade 850ms var(--ismar-motion-ease) var(--ismar-stagger, 0ms) backwards;
  }
  main .ismar-motion-reveal[data-ismar-motion="line"] {
    transform-origin: left center;
    animation: ismar-hero-line 850ms var(--ismar-motion-ease) var(--ismar-stagger, 0ms) backwards;
  }
  .header nav a:not(:last-child)::after { transition: transform 220ms ease-out; }
  .header nav a:last-child {
    transition: border-color 220ms ease-out, background-color 220ms ease-out;
  }
  /* Lightbox-only opacity fades; the native modal stays active until close. */
  .page-operations .operations-lightbox[open],
  .page-operations .operations-lightbox[open]::backdrop {
    animation: ismar-lightbox-in 200ms ease-out both;
  }
  .page-operations .operations-lightbox[open][data-closing="true"],
  .page-operations .operations-lightbox[open][data-closing="true"]::backdrop {
    animation: ismar-lightbox-out 160ms ease-in both;
  }
}

/* Gallery hover uses independent scale, leaving the reveal transforms untouched. */
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  .page-operations .operations-photo-grid img {
    transition: scale 400ms ease-out, filter 300ms ease-out;
  }
  .page-operations .operations-photo-grid button:hover img {
    scale: 1.01;
    filter: brightness(1.025);
  }
}

@keyframes ismar-lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes ismar-lightbox-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes ismar-hero-rise {
  from { opacity: .85; transform: translateY(var(--ismar-rise, 4px)); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ismar-content-rise {
  from { opacity: .88; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ismar-photo-fade {
  from { opacity: .88; }
  to { opacity: 1; }
}
@keyframes ismar-hero-line {
  from { opacity: .85; transform: scaleX(.7); }
  to { opacity: 1; transform: scaleX(1); }
}

/* Keyboard focus never waits for a reveal to finish. */
main [data-ismar-motion]:focus-within,
.operations-photo-grid figure:focus-within [data-ismar-motion] {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .home-content > *,
  .hero-inner > *,
  .contact-content > h1,
  .contact-content > h2,
  .contact-content > .eyebrow,
  .contact-content > .gold-rule,
  main [data-ismar-motion],
  .page-operations .operations-lightbox[open],
  .page-operations .lightbox-stage img {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .header nav a::after,
  .header nav a:last-child { transition: none; }
  .page-operations .operations-lightbox::backdrop { animation: none; opacity: 1; }
}
