/* Tamala Leaf brand page, cocoa and cream, told by scrolling: the leaf pattern parting in the shape of the emblem on to
   the cafe, the emblem coming down to size over the name, the moments the takeaway goes out the door laid one on
   another, two columns of coffee passing, the table seen from its coasters out, and the crew rising under the sign.
   The logo and the pattern are cut from the brand's own artwork. */
:root {
  --cocoa: #40230F;
  --cocoa-2: #2C170A;
  --cream: #F3EEE8;
  --sand: #D9C6B0;
  --caramel: #A9703F;
  --caramel-hi: #DDB38A;
  --serif: 'Marcellus', Georgia, serif;
  --body: 'Manrope', system-ui, sans-serif;
  --gut: max(clamp(16px, 4vw, 56px), (100vw - 1840px) / 2);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --motif: calc(449px * .3); /* one column of the leaf pattern */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; background: var(--cream); color: var(--cocoa); font: 400 16px/1.6 var(--body); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, p, figure { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--caramel); outline-offset: 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(42px, 6.2vw, 108px); line-height: 1.02; letter-spacing: -.01em; }
em { font-style: normal; color: var(--caramel); }
.on-cocoa { color: var(--cream); }
.on-cocoa em { color: var(--caramel-hi); }

/* small capitals after a short rule that breathes */
.hint { display: inline-flex; align-items: center; gap: 12px; font-size: 11px; font-weight: 600; line-height: 1; letter-spacing: .26em; text-transform: uppercase; }
.hint i { width: 26px; height: 1px; background: currentColor; transform-origin: 0 50%; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scaleX(.4); } }

/* headings rise a line at a time */
.rise .ln { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
.rise .ln > span { display: block; transform: translateY(120%); transition: transform 1.1s var(--ease); }
.rise .ln:nth-child(2) > span { transition-delay: .1s; }
.rise.in .ln > span { transform: none; }

/* small labels on the photos */
figcaption { position: absolute; z-index: 1; left: 18px; bottom: 18px; padding: 8px 14px; border-radius: 999px; background: var(--cream); color: var(--cocoa);
  font-size: 11px; font-weight: 600; line-height: 1; letter-spacing: .22em; text-transform: uppercase; white-space: nowrap; }

.bar { position: fixed; inset: 0 0 auto; z-index: 30; display: flex; padding: 14px var(--gut); pointer-events: none; }
.bar > * { pointer-events: auto; }

/* Pinned sections: taller than the screen, with a stage that holds still while the scroll drives it */
.pin { position: relative; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; min-height: 520px; overflow: hidden; }

/* 1. The leaf pattern, and a window in the emblem's shape opening (--o) on to the cafe, its photo easing back to size */
.open { height: 240vh; }
.paper { position: absolute; inset: -5%; background: url(img/pattern.png) center / var(--motif) auto repeat, var(--cream); scale: calc(1 + var(--op, 0) * .08); }
.window { position: absolute; left: 50%; top: 50%; translate: -50% -50%; overflow: hidden; border-radius: 999px;
  width: calc(25vmin + var(--o, 0) * 160vmax); height: calc(35vmin + var(--o, 0) * 160vmax);
  box-shadow: 0 0 0 10px var(--cream), 0 0 0 11.5px var(--cocoa); }
/* the photo starts on the emblem lit on the cafe wall, and settles to the whole room as the window opens */
.window img { position: absolute; left: 50%; top: 50%; width: 100vw; height: 100vh; height: 100svh; max-width: none; object-fit: cover;
  object-position: 50% 42%; translate: -50% calc(-50% + (1 - var(--o, 0)) * 27vh); scale: calc(1.3 - var(--o, 0) * .3); }
.open-hint { position: absolute; left: 50%; bottom: clamp(20px, 4vh, 36px); translate: -50% 0; padding: 11px 18px; border-radius: 999px; background: var(--cream);
  opacity: calc(1 - var(--op, 0) * 5); }

/* 2. The emblem comes down from filling the screen (--mp), the name writes itself in (--wp) and the line follows (--lp) */
.mark { height: 220vh; }
.mark .stage { display: grid; place-content: center; justify-items: center; gap: clamp(18px, 3vh, 34px); }
.mark .stage::before { content: ""; position: absolute; inset: 0; background: url(img/pattern.png) center / var(--motif) auto repeat; opacity: .05; pointer-events: none; }
.mark-emblem { position: relative; width: clamp(78px, 8vw, 120px); scale: calc(1 + (1 - var(--mp, 0)) * 8); opacity: calc(.15 + var(--mp, 0) * .85); }
.mark-word { position: relative; width: min(80vw, 760px); clip-path: inset(-10% calc((1 - var(--wp, 0)) * 100%) -10% 0); }
.mark-line { position: relative; opacity: var(--lp, 0); translate: 0 calc((1 - var(--lp, 0)) * 14px); }
.mark-line img { width: min(52vw, 340px); }

/* 3. Out the door: each moment slides up over the last (--y) and the ones under it settle back (--s, --b) */
.door .stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.3fr); align-items: center; gap: clamp(24px, 4vw, 72px); padding: clamp(90px, 12vh, 130px) var(--gut) clamp(40px, 8vh, 80px); }
.deck { position: relative; width: min(100%, (100svh - 220px) * 1.777); aspect-ratio: 1672 / 941; justify-self: center; }
.sheet { position: absolute; inset: 0; overflow: hidden; border-radius: clamp(14px, 1.6vw, 26px); transform-origin: 50% 0;
  translate: 0 var(--y, 0px); scale: var(--s, 1); box-shadow: 0 34px 60px -34px rgba(44, 23, 10, .55); }
.sheet img { width: 100%; height: 100%; object-fit: cover; filter: brightness(var(--b, 1)); }
.deck-count { position: absolute; right: var(--gut); bottom: clamp(18px, 4vh, 34px); font-size: 12px; font-weight: 600; letter-spacing: .24em; }
.deck-count b { font-family: var(--serif); font-weight: 400; font-size: 22px; letter-spacing: 0; }

/* 4. Coffee: two columns pass each other as you scroll (--cy) */
.sip { height: 260vh; }
.sip .stage { background: var(--cocoa); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: center; gap: clamp(24px, 4vw, 72px); padding-inline: var(--gut); }
.cols { align-self: stretch; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 1.6vw, 24px); overflow: hidden; }
.col { display: grid; gap: clamp(12px, 1.6vw, 24px); align-content: start; translate: 0 var(--cy, 0px); will-change: translate; }
.col img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: clamp(14px, 1.6vw, 26px); }
.col-up img:nth-child(2) { object-position: 62% 50%; }
.col-down img:nth-child(2) { object-position: 60% 50%; }

/* 5. The table: the whole setting starts zoomed in on the coasters in the middle and pulls back (--zs) */
.table { height: 260vh; }
.mosaic { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1vw, 14px); padding: clamp(8px, 1vw, 14px); scale: var(--zs, 1); will-change: scale; }
.cell { width: 100%; height: 100%; min-height: 0; object-fit: cover; border-radius: clamp(10px, 1.2vw, 20px); }
.cell-word { display: grid; align-content: end; padding: clamp(16px, 2.4vw, 40px); background: var(--cocoa); color: var(--cream); }
.cell-word h2 { font-size: clamp(28px, 3.6vw, 66px); }
.cell-word em { color: var(--caramel-hi); }
.cell-leaf { background: url(img/pattern-cream.png) center / calc(var(--motif) * .8) auto repeat, var(--cocoa); }

/* 6. The crew: the sign settles (--cs) and dims (--cd) as the three uniforms rise one after another (--k) */
.crew { height: 260vh; }
.crew .stage { background: var(--cocoa-2); }
.crew-sign { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; scale: calc(1.15 - var(--cs, 0) * .15); filter: brightness(calc(1 - var(--cd, 0) * .5)); }
.crew h2 { position: absolute; z-index: 2; left: var(--gut); top: clamp(80px, 12vh, 130px); text-shadow: 0 2px 30px rgba(20, 10, 4, .45); }
.crew-row { position: absolute; z-index: 1; left: var(--gut); right: var(--gut); bottom: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 2vw, 32px);
  height: min(60svh, 44vw); }
.person { position: relative; overflow: hidden; border-radius: 999px 999px 0 0; translate: 0 calc((1 - var(--k, 0)) * 105%); }
.person img { width: 100%; height: 100%; object-fit: cover; }
.person figcaption { left: 50%; bottom: 22px; translate: -50% 0; }

/* The end: a row of whole leaf ovals from the pattern, clear of the photos above, fading out to either side */
.end { display: grid; justify-items: center; gap: 22px; padding: clamp(56px, 9vh, 100px) var(--gut) clamp(48px, 8vh, 80px); background: var(--cocoa); color: var(--cream); text-align: center; }
.end-band { justify-self: stretch; margin-inline: calc(var(--gut) * -1); height: clamp(80px, 11vh, 120px); background: url(img/pattern-row-cream.png) center / auto 100% repeat-x; opacity: .55;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); }
.end-logo { width: min(64vw, 360px); margin-top: clamp(10px, 3vh, 30px); }
.end-line { color: var(--sand); }
.end-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 8px; }
.pill { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 26px; border-radius: 999px; border: 1px solid var(--cream); background: var(--cream); color: var(--cocoa);
  text-decoration: none; font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; transition: background-color .3s, color .3s; }
.pill span { transition: translate .3s cubic-bezier(.2, 1.5, .4, 1); }
.pill:hover span { translate: 4px 0; }
.pill:hover { background: transparent; color: var(--cream); }
.pill.ghost { background: transparent; color: var(--cream); }
.pill.ghost:hover { background: var(--cream); color: var(--cocoa); }

/* on narrower or squarer screens the deck goes under its heading, full width, so it fills the page */
@media (max-width: 1100px), (max-aspect-ratio: 5 / 4) {
  .door .stage { grid-template-columns: minmax(0, 1fr); align-content: center; }
  .deck { width: min(100%, (100svh - 300px) * 1.777); }
}
@media (max-width: 860px) {
  :root { --motif: calc(449px * .22); }
  /* on phones the deck stands taller, cropped round the packaging */
  .door .stage { grid-template-columns: minmax(0, 1fr); align-content: center; }
  .deck { width: min(100%, (100svh - 300px) * .8); aspect-ratio: 4 / 5; }
  .sip .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); align-items: start; padding-top: clamp(84px, 12vh, 120px); }
  .table { height: auto; }
  .table .stage { position: relative; height: auto; min-height: 0; padding: 0; }
  .mosaic { position: relative; inset: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; scale: 1; padding: 56px var(--gut); gap: 10px; }
  .cell-word { grid-column: 1 / -1; padding: 28px 24px; }
  .mosaic img.cell, .cell-leaf { aspect-ratio: 1; height: auto; }
  .crew-row { height: 46svh; gap: 8px; }
  figcaption { left: 12px; bottom: 12px; font-size: 9px; letter-spacing: .16em; padding: 7px 10px; }
  .person figcaption { left: 50%; bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .hint i { animation: none; }
  .rise .ln > span { transition: none; }
}

/* Back to Grit Fox: the agency's own chip on every brand page. The fox blinks now and then, and tilts its head and
   glances back when you point at it. */
.bar-back.fox-back {
  justify-self: start; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 15px 0 12px;
  border-radius: 999px; background: #1A1A1A; color: #fff; border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  line-height: 1; text-decoration: none; white-space: nowrap; opacity: 1;
  transition: translate .3s cubic-bezier(.2, 1.4, .4, 1), box-shadow .3s;
}
.bar-back.fox-back:hover { color: #fff; text-decoration: none; opacity: 1; translate: -2px 0; box-shadow: 0 10px 24px rgba(0, 0, 0, .26); }
.bar-back.fox-back:focus-visible { outline: 3px solid #F0AC1D; outline-offset: 3px; }
.fox-back i { font-style: normal; font-weight: 400; font-size: 14px; color: #F0AC1D; transition: translate .3s cubic-bezier(.2, 1.4, .4, 1); }
.fox-back:hover i { translate: -3px 0; }
.fox-back .fx { width: 24px; height: 24px; flex: none; overflow: visible; }
.fox-back .fx-head { transform-box: view-box; transform-origin: 500px 430px; transition: rotate .5s cubic-bezier(.2, 1.6, .4, 1); }
.fox-back:hover .fx-head { rotate: -12deg; }
.fox-back .fx-iris { transition: translate .35s cubic-bezier(.2, .8, .2, 1); }
.fox-back:hover .fx-iris { translate: -24px 6px; }
.fox-back .fx-eye { transform-box: fill-box; transform-origin: center; animation: fxBlink 5.2s ease-in-out infinite; }
.fox-back:active .fx-eye { animation: none; scale: 1 .08; }
@keyframes fxBlink { 0%, 93%, 100% { scale: 1 1; } 96% { scale: 1 .08; } }
/* a wink when pointed at: it stays even with reduced motion, as it is tiny and only follows the pointer */
.fox-back:hover .fx-eye { animation: fxWink .34s ease-in-out; }
@keyframes fxWink { 0%, 100% { scale: 1 1; } 50% { scale: 1 .08; } }
@media (max-width: 760px) { .bar-back.fox-back { gap: 5px; padding: 0 11px 0 10px; } .fox-back span { display: none; } }
@media (prefers-reduced-motion: reduce) { .fox-back .fx-eye { animation: none; } }
