/* Mr Thatch motion and character layer. Loads after styles.css.
   Animates transform and opacity only. Motion is gated behind html.motion,
   which is only set when prefers-reduced-motion is not "reduce". */

:root { --ease-out: cubic-bezier(.16, 1, .3, 1); }

/* ---------- 12. Paper grain on Limestone ---------- */
body {
  background-color: var(--limestone);
  background-image: url("images/inline/7043c5709a.svg");
}

/* ---------- 1. Hero video slot + Ken Burns poster ---------- */
video.hero-img { background: var(--night) url("images/ai/a1-hero.jpg") 68% 50% / cover no-repeat; transform-origin: 62% 55%; }
html.motion video.hero-img { animation: kenburns 20s cubic-bezier(.3, 0, .4, 1) forwards; will-change: transform; }
html.motion video.hero-img.is-playing { animation-play-state: paused; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.06); } }
@media (max-width: 767px) { video.hero-img { background-position: 84% 60%; } }

/* Hero bottom settles into Night palm so the thatch eave reads as one piece */
@media (min-width: 768px) {
  .hero::before {
    background:
      linear-gradient(0deg, rgb(15 42 30) 0, rgb(15 42 30 / .55) 34px, rgb(15 42 30 / 0) 130px),
      linear-gradient(180deg, rgb(10 24 17 / .62) 0, rgb(10 24 17 / 0) 190px),
      linear-gradient(90deg, rgb(10 24 17 / .80) 0%, rgb(10 24 17 / .62) 32%, rgb(10 24 17 / .18) 56%, rgb(10 24 17 / 0) 70%);
  }
}

/* ---------- 2. Hero entrance ---------- */
@keyframes riseIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes drawIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
html.motion .hero-copy > * { animation: riseIn .9s var(--ease-out) both; }
html.motion .hero-copy > :nth-child(1) { animation-delay: .15s; }
html.motion .hero-copy > :nth-child(2) { animation-delay: .23s; }
html.motion .hero-copy > :nth-child(3) { animation-delay: .31s; }
html.motion .hero-copy > :nth-child(4) { animation-delay: .39s; }
html.motion .hero-copy > :nth-child(5) { animation-delay: .47s; }
html.motion .hero .eyebrow::before { transform-origin: left; animation: drawIn 1s .35s var(--ease-out) both; }

/* ---------- 3. Signature thatch fringe ----------
   One generated SVG strip per boundary (symbol #thatch-fringe in index.html).
   Fill is the colour of the section above; it overlaps that section by 2px
   and hangs over the dark band below, beneath the band's content. Static. */
.has-fringe { position: relative; }
.has-fringe > .container { position: relative; z-index: 2; }
.fringe { position: absolute; left: 0; top: -2px; z-index: 1; display: block; width: 100%; height: 40px; overflow: hidden; pointer-events: none;
  color: var(--limestone); fill: currentColor; --fringe-back: color-mix(in oklch, var(--limestone), var(--rainforest) 9%); }
.fringe .fringe-back, .fringe use { fill: currentColor; }
#thatch-fringe .fringe-back { fill: var(--fringe-back); }
@media (max-width: 767px) { .fringe { height: 28px; } }

/* ---------- 4. Marquee ---------- */
.marquee { position: relative; overflow: hidden; padding-block: 20px; border-block: 1px solid var(--border); }
.marquee-track { display: flex; width: max-content; }
.marquee-list { display: flex; align-items: center; flex: none; }
.marquee-list li { display: flex; align-items: center; font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: clamp(18px, 1.75vw, 25px); line-height: 1.2; letter-spacing: 0; color: var(--rainforest); white-space: nowrap; }
.marquee-list li::after { content: ""; width: .62em; height: .62em; margin-inline: .55em; flex: none; background: var(--gold);
  -webkit-mask: url("images/inline/656515f13d.svg") center / contain no-repeat;
          mask: url("images/inline/656515f13d.svg") center / contain no-repeat; }
html.motion .marquee-track { animation: marquee 30s linear infinite; }
html.motion .marquee:hover .marquee-track, .marquee.is-paused .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee-toggle { position: absolute; right: max(12px, calc((100vw - var(--container)) / 2 - 40px)); top: 50%; transform: translateY(-50%); z-index: 2; display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--limestone); color: var(--rainforest); font-size: 12px; font-weight: 600; letter-spacing: .02em; cursor: pointer; box-shadow: -18px 0 14px 6px var(--limestone); }
.marquee-toggle:hover { background: var(--limestone-deep); }
html:not(.motion) .marquee-toggle { display: none; }
html:not(.motion) .marquee-track { width: auto; }
html:not(.motion) .marquee-list { flex-wrap: wrap; justify-content: center; padding-inline: var(--pad); row-gap: 8px; }
html:not(.motion) .marquee-list[aria-hidden="true"] { display: none; }

/* ---------- 6. Eyebrow rule draws in ---------- */
html.motion .eyebrow::before { transform: scaleX(0); transform-origin: left; transition: transform 1s var(--ease-out) .15s; }
html.motion .eyebrow.is-drawn::before { transform: scaleX(1); }

/* ---------- 7. Card hover: lift, slow zoom, arrow nudge ---------- */
.way-card, .p-card { position: relative; isolation: isolate; overflow: visible; transition: opacity .8s var(--ease), transform .6s var(--ease-out); }
.way-media { border-radius: var(--radius) var(--radius) 0 0; }
.p-media { border-radius: var(--radius) var(--radius) 0 0; }
.p-card { overflow: visible; }
.way-card::after, .p-card::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: var(--radius); box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .6s var(--ease-out); pointer-events: none; }
.p-card:hover { box-shadow: none; }
.way-media img, .p-media img, .tile-media img { transition: transform 1.2s var(--ease-out); }
.link-arrow, .link-arrow:hover { gap: 8px; }
.link-arrow .i { transition: transform .35s var(--ease-out); }
@media (hover: hover) {
  .way-card:hover, .p-card:hover { transform: translateY(-6px); }
  .way-card:hover::after, .p-card:hover::after { opacity: 1; }
  .way-card:hover .way-media img, .p-card:hover .p-media img, .tile:hover .tile-media img { transform: scale(1.05); }
  .p-card:hover .link-arrow .i, .link-arrow:hover .i, .way-card:hover .btn .i { transform: translateX(4px); }
  .tile .tile-media { transition: transform .6s var(--ease-out); }
  .tile:hover .tile-media { transform: translateY(-4px); }
}
.tile-hover { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 48px 16px 14px; color: var(--white); font-size: 14px; font-weight: 600; background: linear-gradient(0deg, rgb(15 42 30 / .82), rgb(15 42 30 / 0)); opacity: 0; transform: translateY(8px); transition: opacity .45s var(--ease-out), transform .45s var(--ease-out); pointer-events: none; }
.tile-hover em { font-style: normal; font-weight: 500; color: rgb(255 255 255 / .85); white-space: nowrap; }
@media (hover: hover) { .tile:hover .tile-hover { opacity: 1; transform: none; } }
.tile.is-missing .tile-hover { display: none; }

/* ---------- 8. How it works: drawing line ---------- */
.step::before { content: ""; position: absolute; left: 0; right: 0; top: -2px; height: 2px; background: var(--gold); transform-origin: left; }
html.motion .step { border-top-color: rgb(201 161 91 / .28); }
html.motion .step::before { transform: scaleX(var(--f, 0)); }
html.motion .step-num { opacity: .28; transition: opacity .6s var(--ease-out); }
html.motion .step.is-lit .step-num { opacity: 1; }

/* ---------- 9. Parallax ---------- */
html.motion .image-break .ib-media img { transform: translate3d(0, var(--py, 0px), 0); will-change: transform; }
html.motion .wa-media img, html.motion .display-photo img { transform: translate3d(0, var(--py, 0px), 0) scale(1.14); will-change: transform; }

/* ---------- 10. Ember buttons ---------- */
.btn--ember { position: relative; overflow: hidden; isolation: isolate; transition: background-color .2s var(--ease), transform .25s var(--ease-out); }
@media (hover: hover) { .btn--ember:hover { transform: translateY(-2px); } }
.btn--ember:active { transform: translateY(0) scale(.97); }
.btn-shimmer::after { content: ""; position: absolute; inset: -2px auto -2px 0; width: 46%; z-index: -1; background: linear-gradient(100deg, rgb(255 255 255 / 0), rgb(255 255 255 / .38), rgb(255 255 255 / 0)); transform: translateX(-130%) skewX(-18deg); pointer-events: none; }
html.motion .btn-shimmer::after { animation: shimmer 5.5s 2.4s ease-in-out infinite; }
@keyframes shimmer { 0% { transform: translateX(-130%) skewX(-18deg); } 22%, 100% { transform: translateX(330%) skewX(-18deg); } }

/* ---------- 13. Hand-drawn annotation ---------- */
.ways-grid { position: relative; }
.annotation { position: absolute; z-index: 2; top: -54px; right: calc(50% + 40px); display: flex; align-items: flex-start; gap: 2px; pointer-events: none; }
.annotation span { font-family: "Caveat", "Segoe Script", cursive; font-size: 28px; line-height: 1; color: var(--rainforest); transform: rotate(-4deg); white-space: nowrap; }
.annotation svg { width: 58px; height: 48px; margin-top: 4px; color: var(--gold); flex: none; overflow: visible; }
.annotation path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
html.motion .annotation { opacity: 0; transform: translateY(6px) rotate(-2deg); transition: opacity .8s var(--ease-out) .5s, transform .8s var(--ease-out) .5s; }
html.motion .annotation.is-in { opacity: 1; transform: none; }
@media (max-width: 960px) {
  .annotation { position: relative; top: auto; right: auto; justify-self: end; margin: -18px 18% -10px 0; }
}

/* ---------- Reduced motion: everything settles in place ---------- */
@media (prefers-reduced-motion: reduce) {
  video.hero-img, .marquee-track, .btn-shimmer::after { animation: none !important; }
  .wa-media img, .display-photo img, .image-break .ib-media img { transform: none !important; }
}

@media (max-width: 767px) { .marquee { padding-block: 21px; } .marquee-toggle { right: 10px; } }

/* Fade the ticker under its pause control so words never collide with it */
.marquee::before, .marquee::after { content: ""; position: absolute; top: 0; bottom: 0; width: 140px; pointer-events: none; z-index: 1; }
.marquee::before { left: 0; background: linear-gradient(to left, transparent, var(--limestone)); }
.marquee::after { right: 0; width: 200px; background: linear-gradient(to right, transparent, var(--limestone) 60%); }
.marquee-toggle { z-index: 2; }
html:not(.motion) .marquee::before, html:not(.motion) .marquee::after { display: none; }
@media (max-width: 767px) { .marquee::before { width: 48px; } .marquee::after { width: 110px; } }
@media (max-width: 480px) { .annotation { margin-right: 6%; } .annotation span { font-size: 24px; } }

/* Slower header shimmer: one gentle sweep roughly every 9 seconds */
html.motion .btn-shimmer::after { animation: shimmer-slow 9s 3s ease-in-out infinite; }
@keyframes shimmer-slow { 0% { transform: translateX(-130%) skewX(-18deg); } 15%, 100% { transform: translateX(330%) skewX(-18deg); } }

/* Pause button removed: even fades on both ends of the ticker */
.marquee::after { width: 140px; background: linear-gradient(to right, transparent, var(--limestone)); }
@media (max-width: 767px) { .marquee::after { width: 48px; } }
