/* Page-wide cloud world: one wind, one pause switch, vapor between sections.
   Ambient motion follows data-clouds-paused (user choice, reduced motion,
   hidden tab, hero entry). The hero volume alone also stops when offscreen. */
:root {
  /* Shared wind. Everything drifts left to right, like the WebGL deck. */
  --wind-period: 220s;
  --seam-tile: 1200px;
  --seam-height: 150px;
  --puff-lit: #fff; --puff-shade: #b8cbe0; --puff-edge: #7f9dbe; --puff-ink: #172b41;
}
:root[data-sky="sunrise"] { --puff-lit: #fff6ec; --puff-shade: #d7b3b0; --puff-edge: #9a7a86; --puff-ink: #302330; }
:root[data-sky="sunset"] { --puff-lit: #ffeee4; --puff-shade: #c99aa4; --puff-edge: #85606f; --puff-ink: #332431; }
:root[data-sky="nighttime"] { --puff-lit: #d3dcea; --puff-shade: #61779a; --puff-edge: #0b1629; --puff-ink: #10203a; }

/* Section seams: a drifting cumulus band the next section rises out of.
   The hero needs none: its own deck already dissolves into the page. */
.cloud-seam { position: relative; z-index: -1; height: var(--seam-height); margin-inline: calc(50% - 50vw); margin-block: -40px -30px; overflow: hidden; pointer-events: none; }
.cloud-seam::before { content: ''; position: absolute; top: 0; bottom: 0; left: calc(-1 * var(--seam-tile)); width: calc(100% + var(--seam-tile)); background: url('/assets/cloud-seam.webp') 0 100% / var(--seam-tile) var(--seam-height) repeat-x; opacity: var(--cloud-opacity); filter: brightness(var(--cloud-light)) sepia(var(--cloud-warmth)); }
.cloud-seam.seam-flip::before { transform: scaleX(-1); }
.cloud-journey .reveal-story, .cloud-journey .idea { border-top: 0; }

/* Footer bookend: the page ends on the same deck it opened above. */
.cloud-journey footer { position: relative; isolation: isolate; border-top: 0; }
.footer-deck { position: absolute; z-index: -1; left: calc(50% - 50vw); width: 100vw; bottom: 0; height: clamp(300px, 30vw, 460px); overflow: hidden; pointer-events: none; mask-image: linear-gradient(transparent, #000 45%); }
.footer-deck img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; filter: brightness(var(--cloud-light)) sepia(var(--cloud-warmth)); }
:root[data-sky="nighttime"] .footer-deck img { filter: brightness(.35) sepia(.65) hue-rotate(170deg); }
/* When the WebGL volume is handed down, the sailboat rides a live deck here. */
.footer-sky { position: absolute; left: 50%; top: 0; width: min(560px, 86vw); height: var(--footer-sky-height); transform: translateX(-50%); pointer-events: none; }
.cloud-journey footer { --footer-sky-height: clamp(260px, 24vw, 340px); padding-top: var(--footer-sky-height); }
.footer-cloud-volume { position: absolute; z-index: -1; left: calc(50% - 50vw); width: 100vw; top: 0; bottom: 0; pointer-events: none; }
.footer-cloud-volume .cloud-sculpture { mask-image: linear-gradient(transparent, #000 22%); }
footer[data-cloud-volume="webgl"] .footer-deck { display: none; }

/* Puff: the button is a cloud. Label sits on the visual centre of the mass. */
.puff { position: relative; display: inline-grid; place-items: center; min-width: 236px; height: 100px; padding: 22px 40px 0; color: var(--puff-ink); text-decoration: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: transform .5s cubic-bezier(.34,1.56,.64,1); }
.puff:active { transform: scale(.96); transition-duration: .12s; }
.puff-tops, .puff-body { position: absolute; pointer-events: none; }
.puff-tops { inset: 0; }
.puff-tops i { position: absolute; bottom: 30px; border-radius: 50%; background: radial-gradient(circle at 45% 30%, var(--puff-lit) 58%, var(--puff-shade) 100%); transition: transform .6s cubic-bezier(.34,1.56,.64,1); }
.puff-tops i:nth-child(1) { left: 12%; width: 60px; height: 60px; }
.puff-tops i:nth-child(2) { left: 33%; width: 82px; height: 82px; bottom: 26px; transition-delay: .05s; }
.puff-tops i:nth-child(3) { left: 61%; width: 56px; height: 56px; transition-delay: .1s; }
.puff-body { left: 0; right: 0; bottom: 0; height: 64px; border-radius: 34px 34px 118px 118px / 30px 30px 40px 40px; background: radial-gradient(120% 110% at 50% 18%, var(--puff-lit) 52%, var(--puff-shade)); box-shadow: 0 14px 26px -16px var(--puff-edge); }
.puff-label { position: relative; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) {
  .puff:hover .puff-tops i { transform: translateY(-5px) scale(1.07); }
  .puff:hover .puff-tops i:nth-child(2) { transform: translateY(-8px) scale(1.05); }
}
.puff:focus-visible { outline: none; }
.puff:focus-visible .puff-body { outline: 3px solid var(--highlight); outline-offset: 4px; }
.puff:focus-visible .puff-tops i { transform: translateY(-5px) scale(1.07); }
.puff:active .puff-tops i { transform: translateY(2px) scale(.97); transition-duration: .12s; transition-delay: 0s; }
.availability .puff { margin-top: 8px; margin-left: -6px; }

/* One pause switch in the header governs every cloud on the page. */
.sky-motion.sky-motion-header { display: inline-grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; color: var(--ink); }
.sky-motion-header svg { width: 16px; height: 16px; fill: currentColor; }
.sky-motion-header .icon-play { display: none; }
.sky-motion-header[aria-pressed="true"] .icon-pause { display: none; }
.sky-motion-header[aria-pressed="true"] .icon-play { display: block; }
.sky-motion-header:disabled { opacity: .55; }
@media (max-width: 480px) { header nav .sky-motion-header { margin-left: auto; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@keyframes wind-drift { to { transform: translate3d(var(--seam-tile), 0, 0); } }
@media (prefers-reduced-motion: no-preference) {
  .cloud-seam::before { animation: wind-drift var(--wind-period) linear infinite; }
  .cloud-seam.seam-flip::before { animation-name: wind-drift-flip; animation-duration: calc(var(--wind-period) * 1.3); }
  .footer-deck img { animation: hero-floor-drift 72s ease-in-out infinite alternate; }
  :root:not([data-clouds-paused="false"]) .cloud-seam::before,
  :root:not([data-clouds-paused="false"]) .footer-deck img { animation-play-state: paused; }
}
/* Mirrored band still travels with the wind. */
@keyframes wind-drift-flip { from { transform: scaleX(-1) translate3d(0, 0, 0); } to { transform: scaleX(-1) translate3d(calc(-1 * var(--seam-tile)), 0, 0); } }
@media (max-width: 640px) {
  :root { --seam-tile: 800px; --seam-height: 100px; }
  .cloud-seam { margin-block: -24px -18px; }
  .puff { min-width: 220px; }
}

/* Studio card: one small cloud per real job. */
.status-sky { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 24px 0 20px; padding: 16px 20px 12px; border-radius: 18px; background: linear-gradient(180deg, color-mix(in srgb, var(--sky-top) 38%, transparent), color-mix(in srgb, var(--sky-bottom) 22%, transparent)); }
.status-lane { display: grid; grid-template-rows: 1fr auto; gap: 6px; min-width: 0; }
.status-lane-active { border-left: 1px dashed color-mix(in srgb, var(--line) 60%, transparent); padding-left: 20px; }
.status-clouds { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 8px; min-height: 56px; }
.status-lane-label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--body); }
.status-cloud { display: block; width: 40px; aspect-ratio: 13 / 8; }
.status-lane-active .status-cloud { width: 82px; }
.status-cloud svg { display: block; width: 100%; height: 100%; fill: var(--puff-lit); filter: drop-shadow(0 3px 0 var(--puff-shade)); overflow: visible; }
.status-more { font-size: 13px; color: var(--body); align-self: center; }
.status-clouds:empty::before { font-size: 14px; color: var(--body); align-self: center; }
.status-sky[data-state="clear"] [data-lane="queued"]:empty::before { content: 'No one waiting'; }
.status-sky[data-state="clear"] [data-lane="active"]:empty::before { content: 'Clear skies'; }
.status-sky[data-state="busy"] [data-lane="queued"]:empty::before { content: 'No one waiting'; }
.status-sky[data-state="paused"] [data-lane="active"]:empty::before { content: 'Studio resting'; }
.status-sky[data-state="unknown"] .status-clouds:empty::before, .status-sky[data-state="loading"] .status-clouds:empty::before { content: '—'; }
.status-sky[data-state="paused"] .status-cloud { opacity: .55; }
@keyframes queue-bob { 50% { transform: translateY(-3px); } }
@keyframes studio-condense { 0%, 100% { transform: translateX(0) scale(1); opacity: .92; } 50% { transform: translateX(10px) scale(1.07); opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .status-sky[data-state="busy"] .status-lane-queue .status-cloud { animation: queue-bob 3.2s calc(var(--i) * -.45s) ease-in-out infinite; }
  .status-sky[data-state="busy"] .status-lane-active .status-cloud { animation: studio-condense 5s calc(var(--i) * -1.3s) ease-in-out infinite; }
  :root:not([data-clouds-paused="false"]) .status-cloud { animation-play-state: paused; }
}
@media (max-width: 640px) {
  .status-sky { gap: 14px; padding: 14px 14px 10px; }
  .status-lane-active { padding-left: 14px; }
  .status-cloud { width: 30px; }
  .status-lane-active .status-cloud { width: 58px; }
}

/* Reveal story: "Your turn" lays a drawing surface over the example cloud. */
.reveal-visual { position: relative; }
.reveal-draw { position: absolute; z-index: 2; top: 0; left: 0; right: 0; aspect-ratio: 3 / 2; border-radius: 24px; overflow: hidden; background: var(--wash); animation: draw-open .35s ease-out; }
.reveal-draw img { display: block; width: 100%; height: 100%; object-fit: cover; }
.reveal-draw canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.reveal-draw-hint { position: absolute; top: 16px; left: 16px; margin: 0; padding: 8px 14px; border-radius: 999px; background: rgb(255 255 255 / .82); color: #172b41; font-size: 14px; pointer-events: none; transition: opacity .3s; }
.reveal-draw[data-drawn] .reveal-draw-hint { opacity: 0; }
.reveal-draw-bar { position: absolute; left: 14px; right: 14px; bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; pointer-events: none; }
.reveal-draw-bar > * { pointer-events: auto; min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; font: inherit; font-size: 14px; text-decoration: none; }
.reveal-draw-clear { border: 0; background: rgb(255 255 255 / .82); color: #172b41; cursor: pointer; }
.reveal-draw-clear:disabled { opacity: .55; cursor: default; }
.reveal-draw-app { gap: 6px; background: var(--accent); color: #1b2130; }
.reveal-story[data-reveal-drawing="true"] .reveal-controls button[data-reveal-stage][aria-pressed="true"] { background: transparent; border-color: var(--line); }
@keyframes draw-open { from { opacity: 0; filter: blur(6px); } }
@media (prefers-reduced-motion: reduce) { .reveal-draw { animation: none; } }
@media (max-width: 420px) { .reveal-draw { border-radius: 20px; } .reveal-draw-bar > * { font-size: 13px; padding: 0 12px; } }
