/* Off your mind (home, under "Stop carrying it all. Pea's got it.").
   A heavy thought cloud crammed with little jobs. Pea hops up and files them,
   one at a time, onto a tidy list. The cloud shrinks to "Clear head."
   Chaos on the left, calm on the right; stacked on phones. */

.anim-offmind .om-frame { container-type: inline-size; overflow: hidden; background: radial-gradient(ellipse 60% 70% at 18% 40%, rgba(232, 236, 223, .9), transparent 70%), var(--card); }

/* ---------- Stage layout ---------- */
.anim-offmind .om-stage { --fs: clamp(10.5px, 1.3cqw, 13.5px); position: relative; display: grid; grid-template-columns: 1.36fr .54fr 1.08fr; grid-template-areas: "mind pea list" "cap cap cap"; align-items: center; column-gap: 1.4cqw; padding: 3.4cqw 2.8cqw 0; }
.anim-offmind .om-mind { grid-area: mind; position: relative; aspect-ratio: 500 / 400; }
.anim-offmind .om-pea { grid-area: pea; position: relative; align-self: end; height: min(19cqw, 205px); margin-bottom: 4px; }
.anim-offmind .om-list { grid-area: list; }
.anim-offmind .om-cap { grid-area: cap; min-height: 2.6em; margin: 0; padding: 22px 12px 26px; text-align: center; font: 800 clamp(19px, 2.3cqw, 25px)/1.2 var(--display); letter-spacing: -.02em; color: var(--ink); text-wrap: balance; }
.anim-offmind .om-cap.is-new { animation: offmind-cap .5s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes offmind-cap { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
.anim-offmind .om-fly { position: absolute; inset: 0; z-index: 6; pointer-events: none; }

/* ---------- The thought cloud ---------- */
.anim-offmind .om-cloud { --cs: 1; --amp: 1; position: absolute; inset: 0; transform: scale(var(--cs)); transform-origin: 50% 48%; transition: transform 1.4s cubic-bezier(.2, .7, .2, 1); }
.anim-offmind .om-shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.anim-offmind .om-shape .om-o > * { stroke-width: 7; stroke-linejoin: round; }
.anim-offmind .om-shape--busy { filter: drop-shadow(0 22px 26px rgba(34, 56, 26, .16)); }
.anim-offmind .om-shape--busy .om-o > * { fill: var(--line); stroke: var(--line); }
.anim-offmind .om-shape--busy .om-f > * { fill: var(--paper-2); }
.anim-offmind .om-shape--calm { opacity: 0; filter: drop-shadow(0 0 26px rgba(199, 222, 168, .9)); }
.anim-offmind .om-shape--calm .om-o > * { fill: var(--pea-glow); stroke: var(--pea-glow); }
.anim-offmind .om-shape--calm .om-f > * { fill: var(--card); }
.anim-offmind .om-clear { position: absolute; left: 50%; top: 47%; margin: 0; translate: -50% -50%; white-space: nowrap; font: 800 clamp(20px, 2.7cqw, 31px)/1 var(--display); letter-spacing: -.035em; color: var(--pea); opacity: 0; }

.anim-offmind .om-spark { position: absolute; left: var(--sx); top: var(--sy); width: clamp(12px, 1.7cqw, 18px); aspect-ratio: 1; translate: -50% -50%; background: var(--pea-hi); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: 0; }
.anim-offmind .om-spark--sm { width: clamp(8px, 1.1cqw, 12px); background: #e2c891; }

/* the little jobs */
.anim-offmind .om-todo { position: absolute; left: var(--x); top: var(--y); z-index: 1; transform: translate(-50%, -50%) rotate(var(--r)); }
.anim-offmind .om-todo__in { position: relative; display: inline-flex; align-items: center; gap: .55em; padding: .5em .9em .5em .6em; border: 1px solid rgba(58, 51, 32, .13); border-radius: .65em; background: var(--c, #fbf6e3); color: #3a3320; font: 700 var(--fs)/1.15 var(--body); white-space: nowrap; box-shadow: 0 9px 16px -10px rgba(34, 56, 26, .6), 0 1px 2px rgba(34, 56, 26, .08); }
.anim-offmind .om-box { flex: none; width: 1.15em; height: 1.15em; border: 2px solid rgba(58, 51, 32, .3); border-radius: 50%; }
.anim-offmind .om-due { position: absolute; right: -5px; top: -5px; width: 11px; height: 11px; border-radius: 50%; background: #a2402a; box-shadow: 0 0 0 2.5px var(--card); }
.anim-offmind .om-flyer { position: absolute; left: 0; top: 0; margin: 0; animation: none !important; will-change: transform; }
.anim-offmind .om-flyer .om-due { display: none; }

/* ---------- Pea ---------- */
.anim-offmind .om-pea::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 70%; height: 14px; translate: -50% 0; border-radius: 50%; background: radial-gradient(ellipse, rgba(34, 56, 26, .26), transparent 70%); z-index: -1; opacity: 0; transition: opacity .4s ease; }
.anim-offmind.is-pea .om-pea::after { opacity: 1; }
.anim-offmind .om-pea__pop, .anim-offmind .om-pea__sq { position: absolute; inset: 0; transform-origin: 50% 100%; }
.anim-offmind .om-pose { position: absolute; left: 50%; bottom: 0; width: auto; height: 100%; max-width: none; translate: -50% 0; opacity: 0; filter: drop-shadow(0 14px 16px rgba(34, 56, 26, .2)); }
.anim-offmind .om-pose.is-on { opacity: 1; }
.anim-offmind .om-pose[data-pose="relax"] { height: 92%; }

/* ---------- Pea's list ---------- */
.anim-offmind .om-list { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: var(--shadow); font-size: var(--fs); }
.anim-offmind .om-list__top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .55em .7em; padding: .95em 1.05em .85em; background: linear-gradient(120deg, #e9f1dd, #f6f8f1); border-bottom: 1px solid var(--line); }
.anim-offmind .om-list__top img { width: 1.9em; height: auto; }
.anim-offmind .om-list__top b { justify-self: start; font: 800 1.45em/1 var(--display); letter-spacing: -.025em; }
.anim-offmind .om-list__ok { display: grid; place-items: center; width: 1.8em; height: 1.8em; border-radius: 50%; background: var(--pea-hi); color: #fff; scale: 0; }
.anim-offmind .om-list__ok svg { width: 1.05em; height: 1.05em; }
.anim-offmind .om-bar { grid-column: 1 / -1; display: block; height: 6px; border-radius: 6px; background: var(--pea-soft); overflow: hidden; }
.anim-offmind .om-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--pea-hi), var(--pea)); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.anim-offmind .om-rows { display: grid; gap: .42em; margin: 0; padding: .85em .85em .95em; list-style: none; }
.anim-offmind .om-row { position: relative; display: grid; grid-template-columns: 1.15em minmax(0, 1fr) auto; align-items: center; gap: .55em; padding: .5em .6em; border: 1px solid transparent; border-radius: .65em; font: 700 var(--fs)/1.15 var(--body); color: var(--ink); }
.anim-offmind .om-row::before, .anim-offmind .om-row::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; transition: opacity .3s ease; }
.anim-offmind .om-row::before { border: 1.5px dashed var(--line); opacity: .8; }
.anim-offmind .om-row::after { border: 1px solid var(--line); background: #fff; box-shadow: 0 6px 14px -12px rgba(34, 56, 26, .6); opacity: 0; z-index: 0; }
.anim-offmind .om-row > * { position: relative; z-index: 1; opacity: 0; }
.anim-offmind .om-tick { display: grid; place-items: center; width: 1.15em; height: 1.15em; border-radius: 50%; background: var(--pea-hi); color: #fff; }
.anim-offmind .om-tick svg { width: .78em; height: .78em; }
/* Pea's handling it, the owner decides: a hollow brass dot, not a done tick */
.anim-offmind .om-tick--you { background: var(--brass-soft); box-shadow: inset 0 0 0 2px var(--brass); }
.anim-offmind .om-row__t { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.anim-offmind .om-tag { padding: .3em .6em; border-radius: 999px; background: var(--pea-soft); color: var(--pea); font: 800 max(9.5px, .7em)/1 var(--body); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.anim-offmind .om-tag--brass { background: var(--brass-soft); color: var(--brass); }
.anim-offmind .om-row.is-in::before { opacity: 0; }
.anim-offmind .om-row.is-in::after { opacity: 1; }
.anim-offmind .om-row.is-in > * { opacity: 1; }
.anim-offmind .om-row.is-in .om-tick { animation: offmind-pop .45s cubic-bezier(.3, 1.6, .5, 1) both; }
.anim-offmind .om-row.is-in .om-tag { animation: offmind-pop .45s cubic-bezier(.3, 1.6, .5, 1) .12s both; }

/* ---------- Controls ----------
   The row shows from the first frame, so the sound button is there while it plays.
   Only Watch again waits for the end (it keeps its space, so nothing jumps). */
.anim-offmind .om-ctl { position: relative; justify-content: center; align-items: center; min-height: 44px; }
.anim-offmind .om-again { visibility: hidden; }
/* Before the first play, the hidden Watch again leaves the row, so "Watch with
   sound" sits centred on its own. */
.anim-offmind:not(.is-played) .om-again { position: absolute; pointer-events: none; }
.anim-offmind.is-played .om-again { visibility: visible; animation: offmind-fade .4s ease both; }

/* ---------- The timeline (JS adds the state classes) ---------- */
/* waiting to play: an empty, heavy cloud */
.anim-offmind.is-ready .om-todo > .om-todo__in { opacity: 0; }
.anim-offmind.is-ready .om-pea__pop { opacity: 0; }
.anim-offmind.is-ready .om-list { opacity: 0; translate: 0 18px; }
.anim-offmind.is-ready .om-cloud { --cs: .9; }

/* 1. the jobs pile in and jostle; the cloud swells */
.anim-offmind.is-on .om-todo > .om-todo__in { animation: offmind-pop .5s cubic-bezier(.3, 1.5, .5, 1) var(--pd, 0s) both, offmind-jig var(--jd, 1.5s) ease-in-out var(--jl, 0s) infinite; }
.anim-offmind.is-on .om-todo--due > .om-todo__in { animation: offmind-pop .5s cubic-bezier(.3, 1.5, .5, 1) var(--pd, 0s) both, offmind-wob .8s ease-in-out var(--jl, 0s) infinite; }
.anim-offmind.is-on .om-due { animation: offmind-due 1s ease-in-out infinite; }
.anim-offmind.is-on .om-cloud { animation: offmind-breathe 2.2s ease-in-out 1.4s infinite; }
.anim-offmind .om-todo.is-gone { visibility: hidden; animation: none; }

/* 2. Pea hops up, the list slides in */
.anim-offmind.is-pea .om-pea__pop { opacity: 1; animation: offmind-peapop .7s cubic-bezier(.3, 1.5, .5, 1) both, offmind-bob 2.6s ease-in-out .8s infinite; }
.anim-offmind .om-pea__sq.is-sq { animation: offmind-sq .45s cubic-bezier(.3, 1.5, .5, 1); }
.anim-offmind.is-list .om-list { opacity: 1; translate: 0 0; transition: opacity .5s ease, translate .6s cubic-bezier(.2, .7, .2, 1); }

/* 3. clear head */
.anim-offmind.is-clear .om-cloud { animation: offmind-float 4s ease-in-out 1.4s infinite; }
.anim-offmind.is-clear .om-shape--busy { opacity: 0; transition: opacity .9s ease; }
.anim-offmind.is-clear .om-shape--calm { opacity: 1; transition: opacity .9s ease; }
.anim-offmind.is-clear .om-clear { animation: offmind-pop .6s cubic-bezier(.3, 1.5, .5, 1) .45s both; }
.anim-offmind.is-clear .om-spark { animation: offmind-spark .7s cubic-bezier(.3, 1.6, .5, 1) var(--sd, .6s) both, offmind-twinkle 2.6s ease-in-out calc(var(--sd, .6s) + .7s) infinite; }
.anim-offmind.is-done .om-list__ok { animation: offmind-pop .5s cubic-bezier(.3, 1.6, .5, 1) both; }

.anim-offmind.is-paused *, .anim-offmind.is-paused *::before, .anim-offmind.is-paused *::after { animation-play-state: paused !important; }

@keyframes offmind-pop { from { opacity: 0; scale: .3; } to { opacity: 1; scale: 1; } }
@keyframes offmind-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes offmind-out { from { opacity: 1; translate: 0 0; } to { opacity: 0; translate: 0 -12px; } }
@keyframes offmind-jig {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  18% { translate: calc(var(--jx) * var(--amp) * 2px) calc(var(--jy) * var(--amp) * -1.5px); rotate: calc(var(--jx) * var(--amp) * 1.4deg); }
  40% { translate: calc(var(--jx) * var(--amp) * -1.5px) calc(var(--jy) * var(--amp) * 1px); rotate: calc(var(--jx) * var(--amp) * -1deg); }
  62% { translate: calc(var(--jx) * var(--amp) * 1px) calc(var(--jy) * var(--amp) * 2px); rotate: calc(var(--jx) * var(--amp) * .6deg); }
  78% { translate: calc(var(--jx) * var(--amp) * 4px) calc(var(--jy) * var(--amp) * -1px); rotate: calc(var(--jx) * var(--amp) * 2.4deg); }
  85% { translate: calc(var(--jx) * var(--amp) * -1px) 0; rotate: calc(var(--jx) * var(--amp) * -.8deg); }
}
@keyframes offmind-wob {
  0%, 100% { rotate: 0deg; translate: 0 0; }
  25% { rotate: calc(var(--amp) * 3deg); translate: calc(var(--amp) * 1px) 0; }
  75% { rotate: calc(var(--amp) * -3deg); translate: calc(var(--amp) * -1px) 0; }
}
@keyframes offmind-due { 0%, 100% { scale: 1; } 50% { scale: 1.25; } }
@keyframes offmind-breathe { 0%, 100% { scale: 1; } 50% { scale: 1.025; } }
@keyframes offmind-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes offmind-peapop { 0% { opacity: 0; translate: 0 35%; scale: .7 1.15; } 55% { opacity: 1; translate: 0 -4%; scale: 1.06 .94; } 78% { translate: 0 0; scale: .97 1.03; } 100% { translate: 0 0; scale: 1; } }
@keyframes offmind-spark { from { opacity: 0; scale: 0; rotate: -45deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes offmind-twinkle { 0%, 100% { scale: 1; opacity: 1; } 50% { scale: .7; opacity: .6; } }
@keyframes offmind-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes offmind-sq { 0% { scale: 1; } 30% { scale: 1.06 .93; } 62% { scale: .97 1.04; } 100% { scale: 1; } }

/* ---------- Reduced motion: still plays, with fades and short slides ---------- */
.anim-offmind.is-gentle.is-on .om-todo > .om-todo__in { animation: offmind-fade .5s ease var(--pd, 0s) both; }
.anim-offmind.is-gentle.is-on .om-due, .anim-offmind.is-gentle.is-on .om-cloud, .anim-offmind.is-gentle.is-clear .om-cloud { animation: none; }
.anim-offmind.is-gentle .om-todo.is-gone { visibility: visible; animation: offmind-out .45s ease forwards; }
.anim-offmind.is-gentle.is-pea .om-pea__pop { animation: offmind-fade .6s ease both; }
.anim-offmind.is-gentle .om-pea__sq.is-sq { animation: none; }
.anim-offmind.is-gentle .om-pose { transition: opacity .35s ease; }
.anim-offmind.is-gentle .om-cloud { transition-duration: 1.1s; transition-timing-function: ease; }
.anim-offmind.is-gentle .om-row.is-in > * { animation: offmind-slide .45s ease both; }
.anim-offmind.is-gentle .om-row.is-in .om-tag { animation-delay: .1s; }
.anim-offmind.is-gentle.is-clear .om-clear, .anim-offmind.is-gentle.is-done .om-list__ok { animation-name: offmind-fade; }
.anim-offmind.is-gentle.is-clear .om-spark { animation: offmind-fade .6s ease var(--sd, .6s) both; }
.anim-offmind.is-gentle.is-done .om-list__ok { scale: 1; }
@keyframes offmind-slide { from { opacity: 0; translate: -12px 0; } to { opacity: 1; translate: 0 0; } }

/* ---------- Phones and narrow frames: cloud on top, list below, caption under the list ----------
   Pea stands on the list's top-right corner, feet on the progress bar, notepad out. The cards
   fly from the cloud past Pea's notepad and into the list (offmind.js), crossing the header on
   Pea's side, so they never cover the "Pea's list" title. The list frame shows from the start
   as a faint skeleton. */
@container (max-width: 799px) {
  .anim-offmind .om-stage { --fs: clamp(10.5px, 3.4cqw, 13.5px); grid-template-columns: minmax(0, 1fr); grid-template-areas: "mind" "list" "cap"; --ph: clamp(74px, 19cqw, 92px); max-width: 500px; margin-inline: auto; padding: 16px 14px 14px; }
  .anim-offmind .om-mind { width: 100%; }
  .anim-offmind .om-wide { display: none; }
  .anim-offmind .om-todo { left: var(--mx, var(--x)); top: var(--my, var(--y)); transform: translate(-50%, -50%) rotate(var(--mr, var(--r))); }
  .anim-offmind .om-list { margin-top: 6px; }
  /* the list header: Pea is the face here, so the little logo steps aside and the done tick sits left of Pea */
  .anim-offmind .om-list__top img { display: none; }
  .anim-offmind .om-list__top { grid-template-columns: 1fr auto; }
  .anim-offmind .om-list__ok { margin-right: calc(var(--ph) * .86 - 6px - 1.05em + 6px); }
  /* Pea on the corner: its feet on the bar (1px border + .95em padding + 1.8em row + .55em gap + 6px bar) */
  .anim-offmind .om-pea { grid-area: list; justify-self: end; align-self: start; z-index: 7; width: calc(var(--ph) * .86); height: var(--ph); margin: calc(6px + 1px + 3.3em + 6px - var(--ph) + 3px) -6px 0 0; font-size: var(--fs); }
  .anim-offmind .om-pea::after { width: 62%; height: 9px; bottom: -2px; }
  .anim-offmind .om-pose { filter: drop-shadow(0 6px 7px rgba(34, 56, 26, .22)); }
  .anim-offmind .om-cap { min-height: 0; padding: 16px 8px 4px; font-size: clamp(19px, 3cqw, 22px); }
  .anim-offmind .om-clear { font-size: 24px; }
  .anim-offmind .om-due { width: 9px; height: 9px; right: -4px; top: -4px; box-shadow: 0 0 0 2px var(--card); }
  .anim-offmind.is-ready .om-list { opacity: .45; translate: 0 0; }
  .anim-offmind.is-list .om-list { opacity: 1; transition: opacity .5s ease; }
}
