/* ==========================================================================
   Brand identity case study: Nektar. One can, every world.
   ========================================================================== */
.nx { --o: #ee5f17; --f-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif; --f-text: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif; font-family: var(--f-text); }
.nx .h2 { font: 700 clamp(2.2rem, 1.5rem + 2.2vw, 3.6rem)/1.02 var(--f-display); letter-spacing: -0.03em; font-stretch: 88%; }

/* ---------- One can, every world ---------- */
.nx-film .st-reel__stage { background: #ef6d02; }
/* the hand comes in from off the right edge of the screen, where its arms were cut */
.nx-hand { position: absolute; right: 0; bottom: 0; width: auto; height: 78vh; max-width: none; will-change: transform; }
/* each world is opened by a diagonal clip, and a band of the next colour runs along its edge */
.nx-w { visibility: hidden; clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); }
.nx-w--side { position: absolute; inset: 0; margin: 0; background: #19532b; }
.nx-w--side img { position: absolute; right: 0; top: 0; display: block; width: auto; height: 100%; max-width: none; }
.nx-band { position: absolute; left: 0; top: -10%; width: 26vw; height: 120%; background: var(--c, #ee5f17); visibility: hidden; will-change: transform; }
.nx-hero { position: absolute; inset: 0; color: #fff; }
.nx-hero__in { display: grid; grid-template-rows: auto 1fr; height: 100%; padding-top: calc(var(--nav-h) + 28px); padding-bottom: clamp(32px, 6vh, 64px); }
.nx-hero__say { align-self: end; max-width: 42%; }
.nx-hero__logo { display: block; width: 100%; height: auto; margin-bottom: clamp(20px, 3vh, 36px); fill: #fff; }
.nx-hero h1 { margin: 0; font: 600 clamp(1.25rem, 0.9rem + 1vw, 1.75rem)/1.25 var(--f-display); letter-spacing: -0.015em; color: #fff; }
/* a sticker on the shot */
.nx-sticker { position: absolute; top: 50%; width: min(31vw, 480px); padding: clamp(22px, 2.4vw, 36px); margin-top: -13vh; background: var(--c); color: var(--t); border-radius: 18px; rotate: var(--r, -2.5deg); opacity: 0; visibility: hidden; }
.nx-sticker[data-side="l"] { left: 7vw; }
.nx-sticker[data-side="r"] { right: 7vw; --r: 2deg; }
.nx-sticker h2 { margin: 0 0 12px; font: 800 clamp(1.9rem, 1.3rem + 1.7vw, 3rem)/1 var(--f-display); letter-spacing: -0.03em; color: inherit; }
.nx-sticker p { margin: 0; font-size: 17px; font-weight: 500; line-height: 1.42; }

/* ---------- The logo ---------- */
.nx-logo__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.nx-logo__copy { grid-column: span 4; display: grid; align-content: start; gap: 20px; padding-right: clamp(16px, 3vw, 48px); font-size: 18px; line-height: 1.5; color: var(--text-2); }
.nx-logo__copy .h2 { color: var(--ink); }
.nx-grounds { display: flex; gap: 6px; }
.nx-grounds button { padding: 8px 16px; border: 1px solid var(--line-strong); border-radius: 999px; font: 500 14px/1.2 var(--f-text); color: var(--ink); cursor: pointer; transition: background-color 0.3s, color 0.3s; }
.nx-grounds button.is-on { background: var(--o); border-color: var(--o); color: #fff; }
.nx-tile { position: relative; display: grid; place-items: center; min-height: clamp(220px, 22vw, 320px); margin: 0; overflow: hidden; border-radius: 16px; }
.nx-tile figcaption { position: absolute; left: 20px; top: 16px; font-size: 14px; color: var(--ink-t, #fff); opacity: 0.85; transition: color 0.4s; }
.nx-tile svg { transition: scale 0.6s var(--ease-out); }
.nx-tile:hover svg { scale: 1.06; }
.nx-tile--logo { grid-column: span 5; background: var(--ground, #ee5f17); fill: var(--ink-t, #fff); transition: background-color 0.5s, fill 0.5s; }
.nx-tile--logo svg { width: 62%; height: auto; }
.nx-tile--mark { grid-column: span 3; background: var(--ground, #ee5f17); fill: var(--ink-t, #fff); transition: background-color 0.5s, fill 0.5s; }
.nx-tile--mark svg { width: auto; height: 58%; }

/* ---------- The colours, poured ---------- */
.nx-pour { position: relative; padding-top: var(--sect-pad); }
.nx-pour__copy { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 12px; align-items: start; font-size: 18px; line-height: 1.5; color: var(--text-2); }
.nx-pour__copy .h2 { color: var(--ink); }
.nx-pour__bars { view-timeline: --nx-bars; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; height: min(72vh, 620px); margin-top: clamp(24px, 4vh, 48px); }
.nx-pour__bars button { position: relative; height: 100%; color: var(--t, #fff); font: 500 15px/1 var(--f-text); text-align: left; cursor: pointer; }
.nx-pour__bars button::before { content: ""; position: absolute; inset: 0; background: var(--c); transform-origin: 50% 100%; transform: scaleY(calc(var(--h) * var(--f, 1))); transition: filter 0.3s; }
.nx-pour__bars button:hover::before { filter: brightness(1.08); }
.nx-pour__bars b { position: absolute; left: clamp(12px, 1.4vw, 22px); bottom: 20px; font-weight: 500; }

/* ---------- The tone ---------- */
.nx-tone__c { position: absolute; inset: 0; opacity: 0; }
.nx-tone__c:first-child { opacity: 1; }
.nx-tone__in { position: relative; height: 100%; }
.nx-tone__state { position: absolute; inset: 0 var(--gutter); display: grid; align-content: center; justify-items: start; gap: clamp(16px, 2.6vh, 28px); color: var(--t); opacity: 0; visibility: hidden; }
.nx-pill { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; border-radius: 999px; background: #fff; color: #111; font: 600 16px/1.2 var(--f-text); }
.nx-pill img { width: 26px; height: 26px; filter: invert(1); }
.nx-say { margin: 0; max-width: 16em; font: 800 clamp(3rem, 1rem + 6.4vw, 7.2rem)/0.98 var(--f-display); font-stretch: 84%; letter-spacing: -0.03em; }

/* ---------- The fan ---------- */
.nx-fan .st-reel__stage { background: #fff1e8; }
.nx-fan__tag { position: absolute; left: var(--gutter); top: calc(var(--nav-h) + 20px); margin: 0; font: 600 18px/1.2 var(--f-text); color: var(--o); }
.nx-fan__hand { position: absolute; inset: 0; }
.nx-fan__hand img { position: absolute; left: 50%; top: 52%; width: min(25vw, 42vh); height: auto; margin-left: calc(min(25vw, 42vh) / -2); border-radius: 14px; transform-origin: 50% 120%; translate: 0 -50%; will-change: transform; }

/* ---------- Everything else, whole ---------- */
.nx-merch figure { border-radius: 16px; }
.nx-merch img { transition: scale 1s var(--ease-out); }
.nx-merch figure:hover img { scale: 1.03; }
@media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes nx-pop { 0% { opacity: 0; transform: scale(0.72) rotate(-3deg); } 70% { opacity: 1; transform: scale(1.03) rotate(0.6deg); } 100% { transform: none; } }
    [data-nx-pop] { animation: nx-pop auto linear backwards; animation-timeline: view(); animation-range: entry 5% entry 95%; }
    /* the colours pour in with the scroll, one after the other */
    @keyframes nx-pour { from { transform: scaleY(0); } to { transform: scaleY(var(--h)); } }
    .nx-pour__bars button::before { animation: nx-pour auto linear both; animation-timeline: --nx-bars; animation-range: entry calc(12% + var(--n) * 7%) entry calc(62% + var(--n) * 7%); }
    .nx-pour__bars button:nth-child(2) { --n: 1; } .nx-pour__bars button:nth-child(3) { --n: 2; } .nx-pour__bars button:nth-child(4) { --n: 3; } .nx-pour__bars button:nth-child(5) { --n: 4; } .nx-pour__bars button:nth-child(6) { --n: 5; }
    .nx-pour__bars button { --n: 0; }
  }
}

/* ---------- The end ---------- */
.nx-end .st-reel__stage { background: #6f7a2c; }
.nx-end__pic { position: absolute; right: 0; top: 0; height: 100%; aspect-ratio: 960 / 1080; margin: 0; overflow: hidden; }
.nx-end__pic img { display: block; width: 100%; height: 100%; will-change: transform; }
.nx-end__panel { position: absolute; left: var(--gutter); top: 50%; width: min(33vw, 480px); padding: clamp(28px, 3vw, 44px); background: #fff; border-radius: 18px; translate: 0 -50%; font-size: 17px; line-height: 1.5; color: var(--text-2); opacity: 0; visibility: hidden; }
.nx-end__panel svg { display: block; width: 150px; height: auto; margin-bottom: 18px; fill: var(--o); }
.nx-end__panel .h2 { margin-bottom: 14px; color: var(--ink); }
.nx-end__panel p + p { margin-top: 12px; }

@media (max-width: 900px), (prefers-reduced-motion: reduce) {
  .nx-w { clip-path: none; }
  .nx-hand { position: static; width: 100%; height: auto; }
  .nx-end__pic { position: static; width: 100%; height: auto; }
  .nx-sticker, .nx-end__panel { width: auto !important; margin: 16px var(--gutter); rotate: none; translate: none; } /* st-core stacks layers at 100%; with the side margins that ran off the screen */
  .nx-hero { padding: 24px 0; background: var(--o); }
  .nx-hero__say { max-width: none; margin-top: 32px; }
  .nx-tone__c { display: none; }
  .nx-tone .st-reel__stage { background: var(--o); }
  .nx-tone__state { padding: 32px 0; color: #fff; inset: auto; }
  .nx-fan__hand { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 12px; }
  .nx-fan__hand img { position: static; width: 100%; margin: 0; translate: none; }
}

/* phones and small tablets: the logo copy over the two tiles, the colour copy over the bars */
@media (max-width: 900px) {
  .nx-logo__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nx-logo__copy { grid-column: 1 / -1; padding-right: 0; font-size: 16px; }
  .nx-tile--logo, .nx-tile--mark { grid-column: auto; min-height: 200px; }
  .nx-pour__copy { grid-template-columns: minmax(0, 1fr); gap: 16px; font-size: 16px; }
  .nx-pour__bars { height: 360px; }
  /* six bars are too narrow for a hex code across; it reads up the bar instead */
  .nx-pour__bars b { left: 50%; bottom: 14px; font-size: 12px; writing-mode: vertical-rl; transform: translateX(-50%) rotate(180deg); }
  .nx-fan__tag { position: relative; left: auto; top: auto; padding: 32px var(--gutter) 0; }
}

/* scroll section heights, so they are in place before st-nektar.js runs (same numbers as its reel() calls) */
@media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  .nx-film { height: 920vh; } .nx-tone { height: 620vh; } .nx-fan { height: 360vh; } .nx-end { height: 280vh; }
}
