/* ==========================================================================
   mimiyoshii.com — shared enhancement layer
   Motion, micro-interactions and accessibility refinements shared by all
   public pages. Loaded after each page's inline styles, so it only layers
   behaviour on top of the existing design tokens (--rose, --text, etc.).
   All movement is gated behind prefers-reduced-motion: no-preference.
   ========================================================================== */

/* ---------- Layout / navigation refinements ---------- */

/* Anchor targets should not hide behind the fixed nav */
html { scroll-padding-top: 4.75rem; }

/* Skip link (hidden until focused) */
.skip-link {
  position: absolute; top: -100%; left: 1rem; z-index: 300;
  padding: 0.6rem 1.2rem;
  background: var(--text, #1C1C1C); color: var(--bg, #FDFAF8);
  font-family: var(--sans, sans-serif); font-size: 0.75rem;
  letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
}
.skip-link:focus-visible { top: 1rem; }

/* Keyboard focus: consistent, visible ring */
:focus-visible {
  outline: 2px solid var(--rose, #D4708A);
  outline-offset: 3px;
}
.hamburger:focus-visible span { background: var(--rose, #D4708A); }

/* Animated underline on primary nav and mobile menu links */
.nav-links a,
.mobile-menu a {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 0% 1px;
  background-position: 0 100%;
  padding-bottom: 2px;
}
@media (prefers-reduced-motion: no-preference) {
  .nav-links a,
  .mobile-menu a { transition: color 0.2s, background-size 0.25s ease; }
}
.nav-links a:hover,
.nav-links a.active,
.mobile-menu a:hover { background-size: 100% 1px; }

/* ---------- Forms: submitting state and focus ---------- */

button[disabled] { opacity: 0.55; cursor: progress; }

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus,
.newsletter-form input:focus {
  box-shadow: 0 0 0 3px rgba(212, 112, 138, 0.16);
}

/* Buttons: subtle lift */
@media (prefers-reduced-motion: no-preference) {
  .contact-form button,
  .newsletter-form button,
  .teaching-cta a,
  .aoc-btn {
    transition: background 0.2s, color 0.2s, border-color 0.2s,
                transform 0.15s ease, box-shadow 0.2s ease;
  }
  .contact-form button:hover:not([disabled]),
  .newsletter-form button:hover:not([disabled]),
  .teaching-cta a:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(28, 28, 28, 0.12);
  }
  .contact-form button:active,
  .newsletter-form button:active,
  .teaching-cta a:active { transform: translateY(0); box-shadow: none; }
}

/* ---------- Entrance animations ---------- */

@media (prefers-reduced-motion: no-preference) {
  /* Homepage hero: slow settle on the image, staggered rise on the text */
  .hero-bg {
    animation: mv-hero-zoom 2.8s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  }
  .hero-name    { animation: mv-rise-soft 1.1s 0.15s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
  .hero-tagline,
  .hero-bio     { animation: mv-rise 0.9s 0.45s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
  .hero-nav     { animation: mv-rise 0.9s 0.62s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
  .hero-credit  { animation: mv-fade 1.2s 1s ease both; }

  /* Sub-page headers: quiet rise on the block, soft focus on the title */
  .page-header-content,
  .page-header-inner,
  .t-hero-inner,
  .faq-hero-inner { animation: mv-rise 0.9s 0.1s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
  .page-header h1,
  .t-h1,
  .faq-h1 { animation: mv-blur-in 1.2s 0.2s ease both; }

  /* Acknowledgement of Country overlay: staggered entrance */
  .aoc-label { animation: mv-rise 0.8s 0.2s ease both; }
  .aoc-text  { animation: mv-rise 0.9s 0.45s ease both; }
  .aoc-btn   { animation: mv-rise 0.9s 0.75s ease both; }

  /* Italic keywords in headings: a thin rose line draws in underneath.
     Inline ems size to their text; the block-level ems on the homepage
     need fit-content so the line stops at the word. */
  .work-heading em, .choreo-heading em, .rep-heading em, .media-heading em,
  .page-header h1 em, .t-h1 em, .faq-h1 em,
  .teaching-heading em, .services-heading em, .sponsor-heading em, .contact-heading em {
    background-image: linear-gradient(var(--rose, #D4708A), var(--rose, #D4708A));
    background-repeat: no-repeat;
    background-size: 0% 1px;
    background-position: 0 94%;
  }
  .teaching-heading em, .services-heading em, .sponsor-heading em, .contact-heading em {
    width: fit-content;
  }
  .work-heading.is-in em,
  .teaching-left.is-in .teaching-heading em,
  .services-inner.is-in .services-heading em,
  .sponsor-inner.is-in .sponsor-heading em,
  .contact-inner.is-in .contact-heading em,
  .choreo-heading.is-in em,
  .rep-heading.is-in em,
  .media-heading.is-in em,
  .page-header h1 em,
  .t-h1 em,
  .faq-h1 em { animation: mv-underline 0.9s 1s cubic-bezier(0.22, 0.61, 0.36, 1) forwards; }

  /* Site nav slips away on scroll down, returns on scroll up (enhance.js) */
  #main-nav, body > nav { transition: transform 0.35s ease, background 0.3s, border-color 0.3s; }
  nav.nav-hide { transform: translateY(-105%); }

  /* Lightbox (work pages): fade the backdrop, settle the image */
  .lightbox.open { animation: mv-fade 0.25s ease both; }
  .lightbox.open img { animation: mv-lightbox-in 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) both; }

  /* FAQ: crossfade when switching tabs */
  .faq-panel.active { animation: mv-fade 0.35s ease both; }

  /* Mobile menu: fade in, links follow */
  .mobile-menu.open { animation: mv-fade 0.3s ease both; }
  .mobile-menu.open a { animation: mv-rise 0.5s ease both; }
  .mobile-menu.open a:nth-child(1) { animation-delay: 0.04s; }
  .mobile-menu.open a:nth-child(2) { animation-delay: 0.08s; }
  .mobile-menu.open a:nth-child(3) { animation-delay: 0.12s; }
  .mobile-menu.open a:nth-child(4) { animation-delay: 0.16s; }
  .mobile-menu.open a:nth-child(5) { animation-delay: 0.2s; }
  .mobile-menu.open a:nth-child(6) { animation-delay: 0.24s; }
  .mobile-menu.open a:nth-child(7) { animation-delay: 0.28s; }
}

@keyframes mv-rise {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}
@keyframes mv-rise-soft {
  from { opacity: 0; transform: translateY(32px); filter: blur(10px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes mv-blur-in {
  from { opacity: 0; filter: blur(6px); }
  to   { opacity: 1; filter: blur(0); }
}
@keyframes mv-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes mv-hero-zoom {
  from { transform: translate3d(0, var(--parallax-y, 0px), 0) scale(1.06); }
  to   { transform: translate3d(0, var(--parallax-y, 0px), 0) scale(1); }
}
@keyframes mv-underline {
  to { background-size: 100% 1px; }
}
@keyframes mv-lightbox-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes mv-kenburns {
  from { transform: scale(1); }
  to   { transform: scale(1.055); }
}

/* ---------- Scroll reveal ----------
   enhance.js adds .reveal only when motion is allowed and
   IntersectionObserver is available, so nothing is ever hidden without JS. */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
    transition-delay: var(--reveal-delay, 0s);
  }
  .reveal.is-in { opacity: 1; transform: none; }

  /* Photo breaks settle from a slight zoom as they reveal, then keep a
     near-still Ken Burns drift while on screen */
  .photo-break.reveal img {
    transform: scale(1.06);
    transition: transform 1.3s cubic-bezier(0.22, 0.61, 0.36, 1);
    transition-delay: var(--reveal-delay, 0s);
  }
  .photo-break.reveal.is-in img {
    transform: scale(1);
    animation: mv-kenburns 26s 1.5s ease-in-out infinite alternate;
  }
}

/* ---------- Reduced motion: stop everything ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
