/* "Follow one order through the plant" - the scroll-driven 3D section.
   Every rule is scoped under .an so it can sit inside any page of the site.

   Three states, set by anatomy.js on the section:
     (none)     no script or no WebGL: the cards are a plain readable list, no canvas
     .an-live   the pinned scroll film
     .an-still  reduced motion: one still picture of the order above the same list

   HOW LONG THE SCROLL IS: --an-step is the scroll distance of one step. Ten cards are
   nine steps plus a short hold, so the whole film is about 9.25 x --an-step of scrolling. */
.an {
  --an-gold: #F2B01E; --an-ink: #F8F4EC; --an-ground: #07060A; --an-panel: #141007; --an-dim: #A19E98;
  --an-step: 42vh;
  --an-top: 0px;      /* the height of a header that stays at the top of the screen; anatomy.js sets it (data-under) */
  position: relative; margin: 0; padding: 0; background: var(--an-ground); color: var(--an-ink);
  font: 500 16px/1.55 Montserrat, system-ui, sans-serif;
}
.an *, .an *::before, .an *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---- the plain list (no script, no WebGL) and the still (reduced motion) ---- */
.an-pin { position: relative; }
.an-stage, .an-tags, .an-shade, .an-route, .an-bar, .an-loading { display: none; }
.an-cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            max-width: 1180px; margin: 0 auto; padding: 72px 24px; }
.an-card { background: rgba(20,16,7,.82); border: 1px solid rgba(242,176,30,.28); border-left: 2px solid var(--an-gold);
           padding: 26px 28px; border-radius: 3px; }
.an-card.an-center { grid-column: 1 / -1; background: none; border: 0; padding: 0 0 8px; text-align: center; }
.an-title { font-weight: 700; font-size: clamp(28px, 4.2vw, 58px); line-height: 1.08; letter-spacing: -.01em; margin-bottom: 16px; }
.an-h { font-weight: 600; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.2; margin-bottom: 12px; }
.an-h span { color: var(--an-gold); margin-right: 12px; font-variant-numeric: tabular-nums; }
.an-card p { color: #D9D5CC; }
.an-lead { font-size: clamp(16px, 1.6vw, 19px); }
.an-card table { width: 100%; border-collapse: collapse; margin-top: 16px; font-weight: 600; font-size: 13px; letter-spacing: .04em; }
.an-card td { padding: 10px 0; border-top: 1px solid rgba(248,244,236,.12); transition: color .3s; }
.an-card td:last-child { text-align: right; color: var(--an-gold); }
.an-cta { display: inline-block; margin-top: 22px; padding: 14px 26px; background: var(--an-gold); color: #141007; font-weight: 700;
          letter-spacing: .08em; text-transform: uppercase; font-size: 13px; text-decoration: none; border-radius: 3px;
          transition: transform .2s, box-shadow .2s; }
.an-cta:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(242,176,30,.28); }
.an-cta:focus-visible { outline: 2px solid var(--an-ink); outline-offset: 3px; }
.an-hint, .an-play { display: none; }
.an-still .an-play { all: unset; cursor: pointer; display: block; width: max-content; margin: 22px auto 0; padding: 12px 22px; border: 1px solid var(--an-gold);
                     border-radius: 3px; color: var(--an-gold); font: 700 12px/1 Montserrat, system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; }
.an-still .an-play:hover { background: rgba(242,176,30,.12); }
.an-still .an-play:focus-visible { outline: 2px solid var(--an-ink); outline-offset: 3px; }

.an-still .an-stage { display: block; position: relative; height: min(58vh, 620px); }
.an-still .an-shade { display: block; position: absolute; left: 0; right: 0; top: 0; height: min(58vh, 620px); }
.an-still .an-cards { padding-top: 34px; }

/* ---- the pinned film ---- */
.an-live { height: calc(100vh - var(--an-top) + var(--an-step) * 9.25); height: calc(100svh - var(--an-top) + var(--an-step) * 9.25); }
.an-live .an-pin { position: sticky; top: var(--an-top); height: calc(100vh - var(--an-top)); height: calc(100svh - var(--an-top)); overflow: hidden; }
.an-live .an-stage, .an-live .an-tags, .an-live .an-shade { display: block; position: absolute; inset: 0; }
.an-stage canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity .9s ease; }
.an.is-ready .an-stage canvas { opacity: 1; }
.an-tags { pointer-events: none; overflow: hidden; }
.an-shade { pointer-events: none;
            background: radial-gradient(120% 95% at 50% 42%, rgba(7,6,10,0) 52%, rgba(7,6,10,.62) 100%),
                        linear-gradient(to bottom, rgba(7,6,10,.5), rgba(7,6,10,0) 16%, rgba(7,6,10,0) 72%, rgba(7,6,10,.7)); }

.an-tag { font: 600 11px/1.3 Montserrat, system-ui, sans-serif; letter-spacing: .1em; white-space: nowrap; color: var(--an-ink);
          border-top: 1px solid var(--an-gold); padding-top: 9px; text-shadow: 0 0 8px #000; opacity: 0; transition: opacity .35s; }
.an-tag b { color: var(--an-gold); font-weight: 600; }

.an-live .an-loading { display: block; position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); text-align: center;
                       font-weight: 600; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--an-dim);
                       transition: opacity .5s; }
.an-loading i { display: block; width: 150px; height: 1px; margin: 14px auto 0; background: rgba(242,176,30,.22); position: relative; overflow: hidden; }
.an-loading i::after { content: ""; position: absolute; inset: 0; background: var(--an-gold); transform: translateX(-100%);
                       animation: an-load 1.3s cubic-bezier(.6,0,.3,1) infinite; }
@keyframes an-load { to { transform: translateX(100%); } }
.an.is-ready .an-loading { opacity: 0; pointer-events: none; }

/* the plant route, left */
.an-live .an-route { display: flex; gap: 6px; position: absolute; z-index: 3; left: 28px; bottom: 24px; opacity: 0; transition: opacity .4s; }
.an-route button { all: unset; cursor: pointer; font: 600 11px/1 Montserrat, system-ui, sans-serif; letter-spacing: .14em; color: var(--an-dim);
                   white-space: nowrap; position: relative; padding: 14px 22px 6px 0; transition: color .3s; }
.an-route button::before { content: ""; position: absolute; left: 0; right: 6px; top: 0; height: 2px; background: currentColor; opacity: .32;
                           transition: opacity .3s; }
.an-route button:hover { color: var(--an-ink); }
.an-route button:focus-visible { outline: 1px solid var(--an-gold); outline-offset: 2px; }
.an-route button.is-done { color: var(--an-ink); }
.an-route button.is-done::before { opacity: .7; }
.an-route button.is-on { color: var(--an-gold); }
.an-route button.is-on::before { opacity: 1; }

/* the cards: one at a time, over the stage */
.an-live .an-cards { display: block; position: absolute; inset: 0; z-index: 2; max-width: none; margin: 0; padding: 0; pointer-events: none; }
.an-live .an-card { position: absolute; right: 6vw; top: 50%; width: min(400px, calc(100% - 32px)); background: rgba(20,16,7,.92);
                    /* no backdrop blur: blurring a 3D canvas that changes every frame costs a weak device its frame rate */
                    opacity: 0; transform: translateY(calc(-50% + 22px));
                    transition: opacity .32s ease, transform .5s cubic-bezier(.2,.7,.2,1); }
.an-live .an-card.is-past { transform: translateY(calc(-50% - 22px)); }
.an-live .an-card.is-on { opacity: 1; transform: translateY(-50%); pointer-events: auto; }
.an-live .an-card.an-center { right: auto; left: 50%; top: auto; bottom: 9vh; width: min(1240px, calc(100% - 32px)); padding: 0;
                              background: none; transform: translate(-50%, 22px); }
.an-live .an-card.an-center.is-past { transform: translate(-50%, -22px); }
.an-live .an-card.an-center.is-on { transform: translate(-50%, 0); }
.an-live .an-hint { display: inline-flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 26px; font-weight: 600;
                    font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--an-gold); }
.an-live .an-hint::after { content: ""; width: 1px; height: 34px; background: linear-gradient(var(--an-gold), rgba(242,176,30,0));
                           transform-origin: top; animation: an-hint 1.8s ease-in-out infinite; }
@keyframes an-hint { 0% { transform: scaleY(0); opacity: 1; } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* how far through the order we are */
.an-live .an-bar { display: block; position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(242,176,30,.14); }
.an-bar i { display: block; height: 100%; background: var(--an-gold); transform-origin: left; transform: scaleX(0); }

@media (max-width: 820px) {
  .an-live .an-route { display: grid; left: 14px; top: 12px; bottom: auto; gap: 0 12px; grid-template-columns: auto auto auto; justify-content: start; }
  .an-route button { font-size: 9.5px; letter-spacing: .06em; padding: 10px 6px 8px 0; }
  .an-route button::before { right: 0; }
  .an-live .an-tags { display: none; }      /* the windows are too small on a phone for their line tags; the card's table says it */
  .an-live .an-card { right: 16px; left: 16px; top: auto; bottom: 5vh; width: auto; padding: 18px 20px; transform: translateY(22px); }
  .an-live .an-card.is-past { transform: translateY(-22px); }
  .an-live .an-card.is-on { transform: none; }
  .an-live .an-card.an-center { left: 16px; right: 16px; bottom: 7vh; width: auto; transform: translateY(22px); }
  .an-live .an-card.an-center.is-past { transform: translateY(-22px); }
  .an-live .an-card.an-center.is-on { transform: none; }
  .an-card td { padding: 7px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .an-card, .an-route button, .an-route button::before, .an-stage canvas { transition: none; }
  .an-loading i::after, .an-live .an-hint::after { animation: none; }
}
