/* Cozy & Coffee intro. Everything is namespaced under .cc-intro; keyframes are prefixed cc-. */

.cc-intro {
  --cc-cream: #faf3e7;
  --cc-cream-2: #f3e6d2;
  --cc-brown: #4a2f22;
  --cc-brown-2: #6b4636;
  --cc-caramel: #c58b4e;
  --cc-exit: 700ms; /* keep in sync with EXIT_MS in intro.js */
  --cc-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --cc-soft: cubic-bezier(0.22, 0.8, 0.25, 1);

  position: fixed;
  inset: 0;
  z-index: 99999;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  box-sizing: border-box;
  color: var(--cc-brown);
  background: var(--cc-cream);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity var(--cc-exit) var(--cc-ease), transform var(--cc-exit) var(--cc-ease);
}

/* Keep the shop usable if the intro script fails to load. */
.cc-intro { display: none; }
html.cc-intro-ready .cc-intro { display: block; }

.cc-intro *,
.cc-intro *::before,
.cc-intro *::after { box-sizing: border-box; }

.cc-intro:focus { outline: none; }
.cc-intro:focus-visible { outline: 3px solid var(--cc-caramel); outline-offset: -10px; }

.cc-intro.is-leaving {
  opacity: 0;
  transform: scale(1.04) translateY(-1.5%);
  pointer-events: none;
}
.cc-intro.is-leaving .cc-scene.is-active {
  filter: blur(4px);
  transition: filter var(--cc-exit) var(--cc-ease), opacity 700ms ease;
}

/* ---------- Background: slow warm light drift ---------- */

.cc-intro .cc-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(197, 139, 78, 0.16), transparent 70%),
    linear-gradient(180deg, var(--cc-cream) 0%, var(--cc-cream-2) 100%);
}
.cc-intro .cc-bg::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle at 30% 30%, rgba(232, 178, 103, 0.22), transparent 45%);
  animation: cc-bgdrift 14s ease-in-out infinite alternate;
}
@keyframes cc-bgdrift {
  from { transform: translate(-4%, -2%); }
  to { transform: translate(14%, 8%); }
}

/* ---------- Scenes ---------- */

.cc-intro .cc-scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vh, 28px);
  padding: 0 24px 56px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 700ms ease, transform 700ms var(--cc-ease), visibility 0s linear 700ms;
}
.cc-intro .cc-scene.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 700ms ease 300ms, transform 900ms var(--cc-ease) 300ms, visibility 0s linear 0s;
}

.cc-intro .cc-eyebrow {
  margin: 0;
  font-size: clamp(0.8rem, 2.4vw, 0.95rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cc-brown-2);
  opacity: 0;
}
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-eyebrow { animation: cc-fade 1260ms ease 140ms forwards; }

.cc-intro .cc-wordmark {
  margin: 0;
  font-weight: 500;
  font-size: clamp(2.6rem, 11vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--cc-brown);
}
.cc-intro .cc-w { display: inline-block; }
.cc-intro .cc-amp { font-style: italic; color: var(--cc-caramel); padding: 0 0.04em; }

.cc-intro .cc-swash { display: block; width: clamp(150px, 38vw, 260px); height: auto; margin-top: -6px; overflow: visible; }

.cc-intro .cc-title,
.cc-intro .cc-sub { opacity: 0; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-title { animation: cc-word 1260ms var(--cc-soft) 490ms forwards; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-sub { animation: cc-fade 1260ms ease 2s forwards; }

.cc-intro .cc-title {
  margin: 0;
  font-weight: 500;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  line-height: 1.15;
  color: var(--cc-brown);
}
.cc-intro .cc-title--lg { font-size: clamp(2.2rem, 9vw, 4rem); }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-title--lg { animation-delay: 1.55s; }
.cc-intro .cc-sub { margin: 0; font-size: clamp(0.95rem, 3vw, 1.15rem); font-style: italic; color: var(--cc-brown-2); }

/* Split text (built by intro.js): per-letter wordmark, per-word titles, soft blur-in */
.cc-intro .cc-ch, .cc-intro .cc-tw { display: inline-block; opacity: 0; }
.cc-intro .cc-title { --b: 490ms; }
.cc-intro .cc-title--lg { --b: 1.55s; }
.cc-intro .cc-sub { --b: 2s; }
.cc-intro .cc-scene:is(.is-active, .is-out) .is-split { animation: none; opacity: 1; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-ch { animation: cc-word 1.3s var(--cc-soft) forwards; animation-delay: calc(var(--c) * 60ms + 350ms); }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-tw { animation: cc-word 1.26s var(--cc-soft) forwards; animation-delay: calc(var(--c) * 170ms + var(--b)); }

@keyframes cc-fade { to { opacity: 1; } }
@keyframes cc-word {
  from { opacity: 0; transform: translateY(14px); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* ---------- Line-draw (cup, door, swash) ---------- */

.cc-intro .cc-draw { stroke-dasharray: 1; stroke-dashoffset: 1; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-draw {
  animation: cc-draw 1.55s var(--cc-ease) forwards;
  animation-delay: calc(var(--d, 0s) * 1.4);
}
@keyframes cc-draw { to { stroke-dashoffset: 0; } }

.cc-intro .cc-fill { fill-opacity: 0; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-fill {
  animation: cc-draw 1.55s var(--cc-ease) forwards, cc-fillin 980ms ease 980ms forwards;
}
@keyframes cc-fillin { to { fill-opacity: 1; } }

/* ---------- Cup ---------- */

.cc-intro .cc-art { width: clamp(150px, 42vw, 230px); }
.cc-intro .cc-art--small { width: clamp(110px, 30vw, 160px); position: relative; }
.cc-intro .cc-art svg,
.cc-intro .cc-cup { display: block; width: 100%; height: auto; overflow: visible; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-cup { animation: cc-float 6s ease-in-out 2.2s infinite alternate; }
@keyframes cc-float { from { transform: translateY(0); } to { transform: translateY(-4px); } }

.cc-intro .cc-saucer { opacity: 0; transform-box: fill-box; transform-origin: center; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-saucer { animation: cc-saucer 1120ms var(--cc-soft) forwards; }
@keyframes cc-saucer { from { opacity: 0; transform: scaleX(0.6); } to { opacity: 1; transform: scaleX(1); } }

.cc-intro .cc-coffee { transform-box: fill-box; transform-origin: center; transform: scaleX(0); }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-coffee { animation: cc-growx 1120ms var(--cc-soft) forwards; animation-delay: calc(var(--d, 1.1s) * 1.4); }
@keyframes cc-growx { to { transform: scaleX(1); } }

.cc-intro .cc-ripple { opacity: 0; transform-box: fill-box; transform-origin: center; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-ripple { animation: cc-ripple 4.4s ease-out 2.8s infinite; }
@keyframes cc-ripple {
  0% { opacity: 0; transform: scale(1); }
  15% { opacity: 0.55; }
  100% { opacity: 0; transform: scale(3.4, 3); }
}

/* Steam wisps travel up a curve and fade */
.cc-intro .cc-steam path,
.cc-intro .cc-wisp { stroke-dasharray: 0.55 0.6; stroke-dashoffset: 0.55; opacity: 0; }
.cc-intro .cc-steam { filter: blur(0.6px); }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-steam path {
  animation: cc-wisp 4.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * 1s + 2s);
}
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-wisp {
  animation: cc-wisp 4s ease-in-out infinite;
  animation-delay: calc(var(--w, 0s) + 1.7s);
}
@keyframes cc-wisp {
  0% { opacity: 0; stroke-dashoffset: 0.55; }
  22% { opacity: 0.8; }
  75% { opacity: 0.45; }
  100% { opacity: 0; stroke-dashoffset: -1; }
}

/* ---------- Favorites ---------- */

.cc-intro .cc-cards { display: flex; gap: clamp(10px, 3vw, 22px); justify-content: center; margin: 0; padding: 0; list-style: none; }
.cc-intro .cc-card {
  width: clamp(84px, 24vw, 128px);
  padding: 14px 8px 12px;
  border-radius: 20px;
  background: rgba(255, 252, 246, 0.85);
  border: 1px solid rgba(107, 70, 54, 0.14);
  box-shadow: 0 10px 24px rgba(74, 47, 34, 0.08);
  opacity: 0;
  transform: translateY(12px);
}
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-card {
  animation: cc-rise 1260ms var(--cc-soft) forwards;
  animation-delay: calc(var(--i) * 225ms + 210ms);
}
.cc-intro .cc-card svg { display: block; width: 100%; height: clamp(56px, 16vw, 84px); overflow: visible; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-card svg {
  animation: cc-bob 5s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * -1.3s);
}
@keyframes cc-bob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
.cc-intro .cc-card-name { display: block; margin-top: 8px; font-size: clamp(0.85rem, 2.6vw, 1rem); color: var(--cc-brown-2); }
@keyframes cc-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Latte layers settle in from the bottom */
.cc-intro .cc-layer { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-layer {
  animation: cc-layer 980ms var(--cc-soft) forwards;
  animation-delay: calc(var(--l) * 365ms + 840ms);
}
@keyframes cc-layer { to { transform: scaleY(1); } }

/* ---------- Quiet moment ---------- */

.cc-intro .cc-glow {
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(120vw, 760px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 178, 103, 0.42) 0%, rgba(232, 178, 103, 0.14) 45%, transparent 70%);
  pointer-events: none;
}
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-glow { animation: cc-breathe 5s ease-in-out infinite; }
@keyframes cc-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.85; }
  50% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; }
}

/* Soft window light drifting across the room */
.cc-intro .cc-beam {
  position: absolute;
  top: -10%;
  left: 12%;
  width: 22%;
  height: 120%;
  background: linear-gradient(90deg, transparent, rgba(255, 226, 170, 0.5), transparent);
  filter: blur(14px);
  transform: rotate(18deg);
  opacity: 0;
  pointer-events: none;
}
.cc-intro .cc-beam--2 { left: 42%; width: 14%; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-beam { animation: cc-beam 7s ease-in-out infinite alternate; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-beam--2 { animation-delay: -3s; }
@keyframes cc-beam {
  from { opacity: 0.15; transform: translateX(-3%) rotate(18deg); }
  to { opacity: 0.45; transform: translateX(5%) rotate(18deg); }
}

.cc-intro .cc-mote { position: absolute; border-radius: 50%; background: var(--cc-caramel); opacity: 0; pointer-events: none; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-mote { animation: cc-drift 9s linear infinite; }
@keyframes cc-drift {
  0% { opacity: 0; transform: translate(0, 0); }
  25% { opacity: 0.45; }
  100% { opacity: 0; transform: translate(14px, -90px); }
}

/* ---------- Invitation: door swings open ---------- */

.cc-intro .cc-door { display: block; width: clamp(84px, 22vw, 120px); height: auto; overflow: visible; }
.cc-intro .cc-light { opacity: 0; }
.cc-intro .cc-spill { opacity: 0; }
.cc-intro .cc-leaf { transform-box: fill-box; transform-origin: 0 50%; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-light { animation: cc-lightcycle 5s ease 980ms forwards; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-spill { animation: cc-spillcycle 5s ease 980ms forwards; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-leaf { animation: cc-swing 5s linear 980ms forwards; }
@keyframes cc-lightcycle { 0% { opacity: 0; } 40%, 68% { opacity: 0.9; } 100% { opacity: 0; } }
@keyframes cc-spillcycle { 0% { opacity: 0; } 40%, 68% { opacity: 0.5; } 100% { opacity: 0; } }
@keyframes cc-swing {
  0% { transform: scaleX(1); animation-timing-function: cubic-bezier(0.22, 0.8, 0.25, 1); }
  40% { transform: scaleX(0.3); animation-timing-function: linear; }
  68% { transform: scaleX(0.3); animation-timing-function: cubic-bezier(0.45, 0, 0.35, 1); }
  100% { transform: scaleX(1); }
}

/* ---------- Extra motion graphics ---------- */

/* Soft bokeh lights drifting behind every scene */
.cc-intro .cc-bokeh { position: absolute; inset: 0; pointer-events: none; }
.cc-intro .cc-bokeh i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 178, 103, 0.28) 0%, rgba(232, 178, 103, 0.1) 45%, transparent 70%);
  animation: cc-bokeh 16s ease-in-out infinite alternate;
  animation-delay: var(--d, 0s);
}
@keyframes cc-bokeh {
  from { transform: translate(0, 0) scale(1); opacity: 0.5; }
  to { transform: translate(18px, -34px) scale(1.12); opacity: 1; }
}

/* Floating coffee beans */
.cc-intro .cc-bean { position: absolute; width: 26px; height: 16px; border-radius: 50%; background: #875438; opacity: 0; transform: rotate(var(--r, 30deg)); pointer-events: none; }
.cc-intro .cc-bean::after { content: ""; position: absolute; left: 12px; top: 1px; width: 2px; height: 14px; border-radius: 50%; background: #d0a17b; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-bean { animation: cc-beanin 1.4s ease 0.8s forwards, cc-beanfloat 7s ease-in-out 2.2s infinite alternate; }
@keyframes cc-beanin { to { opacity: 0.85; } }
@keyframes cc-beanfloat {
  from { transform: translateY(0) rotate(var(--r, 30deg)); }
  to { transform: translateY(-12px) rotate(calc(var(--r, 30deg) + 14deg)); }
}

/* Coffee pour into the cup (scene 2) */
.cc-intro .cc-pour { stroke-dasharray: 1; stroke-dashoffset: 1; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-pour { animation: cc-pour 2.8s ease-in-out 1.5s forwards; }
@keyframes cc-pour {
  0% { stroke-dashoffset: 1; }
  22%, 72% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -1; }
}
.cc-intro .cc-splash { opacity: 0; transform-box: fill-box; transform-origin: center; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-splash { animation: cc-splash 1.1s ease-out 2.1s 2 both; }
@keyframes cc-splash {
  0% { opacity: 0.7; transform: scale(1); }
  100% { opacity: 0; transform: scale(3.2, 2.6); }
}

/* Pendant lamp with soft light cone (scene 4) */
.cc-intro .cc-lampwrap { --lw: clamp(52px, 14vw, 80px); position: absolute; top: 0; left: 50%; width: var(--lw); transform: translateX(-50%); pointer-events: none; }
.cc-intro .cc-lamp { display: block; width: 100%; height: auto; overflow: visible; }
.cc-intro .cc-lamp-sway { transform-box: fill-box; transform-origin: 50% 0; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-lamp { animation: cc-lampdrop 1.6s var(--cc-soft) 0.2s backwards; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-lamp-sway { animation: cc-sway 6s ease-in-out infinite alternate; }
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-bulb { animation: cc-bulb 4s ease-in-out infinite alternate; }
@keyframes cc-lampdrop { from { opacity: 0; transform: translateY(-40px); } }
@keyframes cc-sway { from { transform: rotate(-1.8deg); } to { transform: rotate(1.8deg); } }
@keyframes cc-bulb { from { opacity: 0.8; } to { opacity: 1; } }
.cc-intro .cc-cone {
  position: absolute;
  left: 50%;
  top: calc(var(--lw) * 1.35);
  width: calc(var(--lw) * 5.5);
  height: 46vh;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 226, 170, 0.38), transparent 85%);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  opacity: 0;
}
.cc-intro .cc-scene:is(.is-active, .is-out) .cc-cone { animation: cc-cone 2s ease 0.4s forwards, cc-conebreath 5s ease-in-out 2.4s infinite alternate; }
@keyframes cc-cone { to { opacity: 1; } }
@keyframes cc-conebreath { from { opacity: 1; } to { opacity: 0.75; } }

/* ---------- Hint ---------- */

.cc-intro .cc-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cc-brown-2);
  animation: cc-hint 4s ease-in-out infinite;
  pointer-events: none;
}
.cc-intro .cc-hint-pointer { display: none; }
@media (hover: hover) and (pointer: fine) {
  .cc-intro .cc-hint-touch { display: none; }
  .cc-intro .cc-hint-pointer { display: inline; }
}
@keyframes cc-hint { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.85; } }

/* ---------- Reduced motion: static end states, no movement ---------- */

@media (prefers-reduced-motion: reduce) {
  .cc-intro { --cc-exit: 200ms; /* keep in sync with EXIT_MS_REDUCED in intro.js */ }
  .cc-intro.is-leaving { transform: none; }
  .cc-intro.is-leaving .cc-scene.is-active { filter: none; }
  .cc-intro .cc-bg::before { animation: none; }
  .cc-intro .cc-scene,
  .cc-intro .cc-scene.is-active {
    transform: none;
    transition: opacity 400ms ease, visibility 0s linear 400ms;
  }
  .cc-intro .cc-scene.is-active { transition-delay: 0s; }

  .cc-intro .cc-scene .cc-eyebrow,
  .cc-intro .cc-scene .cc-w,
  .cc-intro .cc-scene .cc-ch,
  .cc-intro .cc-scene .cc-tw,
  .cc-intro .cc-scene .cc-title,
  .cc-intro .cc-scene .cc-sub,
  .cc-intro .cc-scene .cc-saucer,
  .cc-intro .cc-scene .cc-card,
  .cc-intro .cc-scene .cc-cup,
  .cc-intro .cc-scene .cc-card svg,
  .cc-intro .cc-scene .cc-glow,
  .cc-intro .cc-scene .cc-hint,
  .cc-intro .cc-scene .cc-draw,
  .cc-intro .cc-scene .cc-fill,
  .cc-intro .cc-scene .cc-coffee,
  .cc-intro .cc-scene .cc-layer,
  .cc-intro .cc-scene .cc-leaf,
  .cc-intro .cc-scene .cc-light,
  .cc-intro .cc-scene .cc-spill,
  .cc-intro .cc-scene .cc-steam path,
  .cc-intro .cc-scene .cc-wisp { animation: none !important; }
  .cc-intro .cc-hint { animation: none; opacity: 0.7; }

  .cc-intro .cc-eyebrow { opacity: 0.8; }
  .cc-intro .cc-w, .cc-intro .cc-ch, .cc-intro .cc-tw, .cc-intro .cc-title, .cc-intro .cc-sub, .cc-intro .cc-saucer, .cc-intro .cc-card { opacity: 1; transform: none; filter: none; }
  .cc-intro .cc-draw { stroke-dashoffset: 0; }
  .cc-intro .cc-fill { fill-opacity: 1; }
  .cc-intro .cc-coffee, .cc-intro .cc-layer { transform: none; }
  .cc-intro .cc-leaf { transform: scaleX(0.3); }
  .cc-intro .cc-light { opacity: 0.9; }
  .cc-intro .cc-spill { opacity: 0.5; }
  .cc-intro .cc-steam path, .cc-intro .cc-wisp { stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0.5; }
  .cc-intro .cc-ripple, .cc-intro .cc-mote, .cc-intro .cc-beam { display: none; }
}

/* Reduced motion: extra graphics hold a calm static state */
@media (prefers-reduced-motion: reduce) {
  .cc-intro .cc-bokeh i,
  .cc-intro .cc-scene .cc-bean,
  .cc-intro .cc-scene .cc-lamp,
  .cc-intro .cc-scene .cc-lamp-sway,
  .cc-intro .cc-scene .cc-bulb,
  .cc-intro .cc-scene .cc-cone { animation: none !important; }
  .cc-intro .cc-bean { opacity: 0.85; }
  .cc-intro .cc-cone { opacity: 0.8; }
  .cc-intro .cc-pour,
  .cc-intro .cc-splash { display: none; }
}

/* Lite mode (low memory / few cores / Data Saver, or ?lite=1): drop blurred beams, drifting motes and bokeh. */
html.cc-lite .cc-intro .cc-bokeh,
html.cc-lite .cc-intro .cc-beam,
html.cc-lite .cc-intro .cc-mote { display: none; }
html.cc-lite .cc-intro.is-leaving .cc-scene.is-active { filter: none; }
