/* Motion and interaction layer for seyiola.site.
   Everything here is an enhancement: the page reads fine without it,
   and it switches off for visitors who ask their device for less motion. */

html { scroll-behavior: smooth; }
:focus-visible { outline: 2px solid #6E9E5A; outline-offset: 3px; border-radius: 6px; }

/* ---- Sticky header that firms up once you scroll ---- */
header {
  position: sticky; top: 0; z-index: 50;
  transition: background-color .35s ease, box-shadow .35s ease, backdrop-filter .35s ease;
}
header.is-scrolled {
  background-color: rgba(221, 230, 209, .82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(22, 54, 31, .08);
}
header > div { transition: padding .35s ease; }
header.is-scrolled > div { padding-top: 14px !important; padding-bottom: 14px !important; }
/* ---- Phone top bar: logo + menu button; the menu opens as a full-screen panel ---- */
.m-menu-btn, .m-menu-name { display: none; }
@media (max-width: 720px) {
  header { background-color: rgba(221, 230, 209, .94); box-shadow: 0 1px 0 rgba(22, 54, 31, .08); }
  header > div, header.is-scrolled > div { flex-wrap: nowrap !important; padding: 12px 20px !important; }
  header > div > a:first-child { font-size: 0 !important; gap: 0 !important; }
  .m-menu-btn {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    width: 46px; height: 46px; border-radius: 999px; border: 1px solid rgba(22, 54, 31, .25);
    background: transparent; color: #16361F; cursor: pointer; padding: 0; position: relative; z-index: 2;
  }
  .m-menu-btn span { display: block; width: 20px; height: 1.8px; border-radius: 2px; background: currentColor; transition: transform .35s cubic-bezier(.2, .7, .2, 1), opacity .25s ease; }
  header.menu-open .m-menu-btn span:nth-child(1) { transform: translateY(6.8px) rotate(45deg); }
  header.menu-open .m-menu-btn span:nth-child(2) { opacity: 0; }
  header.menu-open .m-menu-btn span:nth-child(3) { transform: translateY(-6.8px) rotate(-45deg); }
  header > div > a:first-child { position: relative; z-index: 2; }
  header.menu-open { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }

  header nav {
    position: fixed; inset: 0; z-index: 1;
    display: flex !important; flex-direction: column; align-items: flex-start !important; flex-wrap: nowrap !important;
    gap: 6px !important; padding: 96px 28px 40px; box-sizing: border-box; overflow-y: auto;
    background: #DDE6D1; font-size: 30px !important; letter-spacing: -0.02em;
    opacity: 0; visibility: hidden; transform: translateY(-12px);
    transition: opacity .35s ease, transform .45s cubic-bezier(.2, .7, .2, 1), visibility 0s linear .45s;
  }
  header.menu-open nav { opacity: 1; visibility: visible; transform: none; transition: opacity .35s ease, transform .45s cubic-bezier(.2, .7, .2, 1); }
  header nav .m-menu-name {
    display: flex; flex-direction: column; gap: 2px; width: 100%;
    padding-bottom: 20px; margin-bottom: 14px; border-bottom: 1px solid rgba(22, 54, 31, .15);
  }
  .m-menu-name strong { font-size: 26px; font-weight: 500; }
  .m-menu-name small { font-size: 14px; color: #3F5A44; letter-spacing: 0; }
  header nav a:not([style*="999px"]) { padding: 8px 0; }
  header nav a[style*="999px"] { margin-top: 22px; font-size: 17px !important; padding: 15px 28px !important; }
}

/* ---- Nav links: underline that grows from the left ---- */
nav a:not([style*="999px"]) { position: relative; }
nav a:not([style*="999px"])::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1.5px;
  background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
nav a:not([style*="999px"]):hover::after, nav a.is-current::after { transform: scaleX(1); }

/* ---- Pill buttons: lift, glow and a nudge ---- */
a[style*="999px"], button[type="submit"] {
  transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s ease, filter .3s ease;
  will-change: transform;
}
a[style*="999px"]:hover, button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -10px rgba(22, 54, 31, .55);
  filter: brightness(1.06);
}
a[style*="999px"]:active, button[type="submit"]:active { transform: translateY(0) scale(.98); }

/* ---- Cards: lift on hover, icon gets a small turn ---- */
article, #help li, dl > div {
  transition: transform .45s cubic-bezier(.2, .7, .2, 1), box-shadow .45s ease;
}
article:hover, #help li:hover, dl > div:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 40px -22px rgba(22, 54, 31, .45);
}
article > svg { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
article:hover > svg { transform: rotate(-8deg) scale(1.1); }
#help li:hover { background: #2A5634 !important; }

/* Speaking topics: pills that fill on hover */
#speaking li { transition: background-color .3s ease, color .3s ease, transform .3s ease; cursor: default; }
#speaking li:hover { background: #16361F !important; color: #EEF3E6; transform: translateY(-2px); }

/* Form fields: soft focus ring */
#contact-form input, #contact-form select, #contact-form textarea { transition: border-color .25s ease, box-shadow .25s ease; }
#contact-form input:focus, #contact-form select:focus, #contact-form textarea:focus {
  outline: none; border-color: #6E9E5A !important; box-shadow: 0 0 0 4px rgba(110, 158, 90, .25);
}

/* ---- Logo: strands swap places on hover ---- */
header a:first-child svg, footer svg { transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
header a:first-child:hover svg, footer span:hover svg { transform: rotate(180deg); }

/* ---- Portrait: slow settle-in, then gentle drift with scroll ---- */
.m-portrait { scale: 1.08; translate: 0 var(--drift, 0px); transition: scale 1.8s cubic-bezier(.2, .7, .2, 1), translate .2s linear; }
.m-ready .m-portrait { scale: 1; }

/* Founded card arrow spins on hover */
.m-founded span:last-child { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.m-founded:hover span:last-child { transform: rotate(45deg) scale(1.08); }

/* ---- Reveal on scroll ---- */
.m-js .m-reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity .9s cubic-bezier(.2, .7, .2, 1), transform .9s cubic-bezier(.2, .7, .2, 1);
  transition-delay: var(--d, 0ms);
}
.m-js .m-reveal.is-in { opacity: 1; transform: none; }
/* once revealed, hand transform back to the hover rules */
.m-js .m-reveal.is-done { transition: transform .45s cubic-bezier(.2, .7, .2, 1), box-shadow .45s ease, background-color .3s ease, color .3s ease; transition-delay: 0ms; }

/* Headline words rise in one after another */
.m-word { display: inline-block; }
.m-js .m-word { opacity: 0; transform: translateY(.45em); transition: opacity .8s ease, transform .9s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0ms); }
.m-js .is-in .m-word, .m-js h1.is-in .m-word { opacity: 1; transform: none; }

/* Scroll progress bar */
.m-progress { position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 60; background: #6E9E5A; transform-origin: left; transform: scaleX(0); pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .m-js .m-reveal, .m-js .m-word { opacity: 1 !important; transform: none !important; }
  .m-portrait { transform: none !important; }
  .m-progress { display: none; }
}
