/* 04 — MORPH / a learning organism
   Scoped entirely to #morph. Added after styles.css. */

#morph {
  --paper: #f3efe1;
  --ink: #12110d;
  --line: rgba(18, 17, 13, .28);
  --morph-accent: #ff3d71;
  --focus-accent: #ff3d71;
  --focus-soft: #ffd2dd;
  --blob-a: #ff4f7b;
  --blob-b: #0dd2b4;
  --blob-c: #826bee;
  --blob-d: #ffd12e;
  --glow: rgba(255, 61, 113, .34);
  --px: 0;
  --py: 0;
  position: relative;
  height: 100vh;
  min-height: 720px;
  overflow: hidden;
  background:
    radial-gradient(circle at 68% 42%, #fffdf4 0 11%, transparent 46%),
    linear-gradient(118deg, #f7f3e8 0%, var(--paper) 48%, #eee8d7 100%);
  color: var(--ink);
  font-family: var(--mono);
  isolation: isolate;
}

#morph[data-mood="flow"] {
  --morph-accent: #245dff;
  --blob-a: #ff875c;
  --blob-b: #2c78ff;
  --blob-c: #19c6d8;
  --blob-d: #ffd84d;
  --glow: rgba(36, 93, 255, .28);
}

#morph[data-mood="play"] {
  --morph-accent: #ff7a00;
  --blob-a: #ffa12c;
  --blob-b: #1cd7a2;
  --blob-c: #ff5b83;
  --blob-d: #e4ff4b;
  --glow: rgba(255, 122, 0, .28);
}

#morph[data-mood="quiet"] {
  --morph-accent: #0b8f77;
  --blob-a: #d9b3a8;
  --blob-b: #99ccbf;
  --blob-c: #b4a8d9;
  --blob-d: #eadfa7;
  --glow: rgba(11, 143, 119, .2);
}

#morph.active {
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr) 80px;
}

/* — field ————————————————————————————— */

#morph .morph-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

#morph .morph-blob {
  position: absolute;
  mix-blend-mode: multiply;
  filter: blur(.4px);
  border-radius: 56% 44% 62% 38% / 49% 61% 39% 51%;
  transition: translate .9s cubic-bezier(.2, .75, .2, 1), background-color .9s ease;
  will-change: transform, translate;
}

#morph .blob-a {
  width: clamp(330px, 42vw, 700px);
  height: clamp(280px, 33vw, 540px);
  left: -17vw;
  top: -18vw;
  background: var(--blob-a);
  opacity: .9;
  translate: calc(var(--px) * 17px) calc(var(--py) * 11px);
  animation: morph-drift-a 23s ease-in-out infinite alternate;
}

#morph .blob-b {
  width: clamp(400px, 51vw, 880px);
  height: clamp(420px, 56vw, 940px);
  right: -16vw;
  top: -15vw;
  background: var(--blob-b);
  opacity: .8;
  translate: calc(var(--px) * -21px) calc(var(--py) * 13px);
  animation: morph-drift-b 27s ease-in-out infinite alternate;
}

#morph .blob-c {
  width: clamp(360px, 48vw, 820px);
  height: clamp(290px, 35vw, 600px);
  left: 39%;
  bottom: -21vw;
  background: var(--blob-c);
  opacity: .68;
  translate: calc(var(--px) * 14px) calc(var(--py) * -16px);
  animation: morph-drift-c 25s ease-in-out infinite alternate;
}

#morph .blob-d {
  width: clamp(190px, 20vw, 350px);
  height: clamp(190px, 20vw, 350px);
  right: 22%;
  top: 23%;
  background: var(--blob-d);
  border-radius: 50%;
  opacity: .7;
  filter: blur(clamp(28px, 3.2vw, 54px));
  translate: calc(var(--px) * -9px) calc(var(--py) * -9px);
  animation: morph-breathe 8s ease-in-out infinite;
}

#morph .morph-glow {
  position: absolute;
  left: 0;
  top: 0;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0 18%, transparent 68%);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  transition: opacity .45s ease;
  will-change: transform;
}

#morph.is-pointing .morph-glow {
  opacity: 1;
}

#morph .morph-noise {
  position: absolute;
  inset: 0;
  opacity: .17;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='m'%3E%3CfeTurbulence baseFrequency='.72' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)' opacity='.42'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

#morph.is-shifting .morph-blob {
  animation-duration: 8s;
}

/* Mood is a change of rhythm, not only a change of colour. */
#morph[data-mood="flow"] .blob-a { animation-duration: 34s; }
#morph[data-mood="flow"] .blob-b { animation-duration: 30s; }
#morph[data-mood="flow"] .blob-c { animation-duration: 32s; }

#morph[data-mood="play"] .blob-a { animation-duration: 17s; }
#morph[data-mood="play"] .blob-b { animation-duration: 16s; }
#morph[data-mood="play"] .blob-c { animation-duration: 18s; }

#morph[data-mood="quiet"] .blob-a { animation-duration: 42s; }
#morph[data-mood="quiet"] .blob-b { animation-duration: 46s; }
#morph[data-mood="quiet"] .blob-c { animation-duration: 40s; }

#morph[data-mood="flow"] .morph-core { animation-duration: 11s; }
#morph[data-mood="play"] .morph-core { animation-duration: 7.5s; }
#morph[data-mood="quiet"] .morph-core { animation-duration: 15s; }

#morph[data-mood="play"] .morph-core::before { animation-duration: 8s; }
#morph[data-mood="quiet"] .morph-core::before { animation-duration: 20s; }

/* — head ————————————————————————————— */

#morph .morph-head {
  position: relative;
  inset: auto;
  height: auto;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(18px, 2.6vw, 34px);
  border-bottom: 1px solid rgba(18, 17, 13, .22);
}

#morph .morph-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#morph .morph-brand > i {
  flex: none;
  width: 34px;
  height: 34px;
  background: var(--ink);
  border-radius: 62% 38% 51% 49% / 38% 61% 39% 62%;
  animation: morph-seed 7s ease-in-out infinite;
}

#morph .morph-brand > span {
  display: flex;
  flex-direction: column;
  font: 500 10px/1.1 var(--mono);
  letter-spacing: .15em;
}

#morph .morph-brand b {
  margin-top: 3px;
  font: 500 6.5px/1.1 var(--mono);
  letter-spacing: .24em;
  opacity: .82;
}

#morph .morph-brand em {
  margin-top: 3px;
  font: 400 6.5px/1 var(--mono);
  font-style: normal;
  letter-spacing: .16em;
  color: #3d3a30;
  opacity: .82;
}

#morph .morph-head-state {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 11px 5px 12px;
  border: 1px solid rgba(18, 17, 13, .18);
  border-radius: 999px;
  background: rgba(247, 243, 233, .34);
  backdrop-filter: blur(6px);
}

#morph .morph-head-state span {
  font: 500 7px/1 var(--mono);
  letter-spacing: .18em;
  color: #4a473b;
}

#morph .morph-head-state b {
  font: 800 10.5px/1 var(--display);
  letter-spacing: -.015em;
}

#morph .morph-head-state i {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--morph-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--morph-accent) 18%, transparent);
  animation: morph-blink 2.8s ease-in-out infinite;
}

#morph .morph-date {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 5px 10px;
  border: 1px solid rgba(18, 17, 13, .17);
  border-radius: 999px;
  background: rgba(247, 243, 233, .4);
  backdrop-filter: blur(7px);
  color: #302e25;
  font: 400 7.5px/1 var(--mono);
  letter-spacing: .12em;
  white-space: nowrap;
}

#morph .morph-date span {
  opacity: .72;
}

#morph .morph-date b {
  position: relative;
  padding-left: 11px;
  color: var(--ink);
  font: 500 8.5px/1 var(--mono);
  letter-spacing: .08em;
}

#morph .morph-date b::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--morph-accent);
  transform: translateY(-50%);
}

/* — main / copy ————————————————————————— */

#morph .morph-main {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(382px, 34%) minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
}

#morph .morph-copy {
  position: relative;
  inset: auto;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(22px, 4.5vh, 44px) clamp(24px, 3.3vw, 50px) clamp(26px, 4.5vh, 46px) clamp(30px, 4.1vw, 64px);
}

#morph .morph-kicker {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 0 clamp(12px, 2vh, 20px);
  color: #403d33;
  font: 500 8px/1 var(--mono);
  letter-spacing: .21em;
}

#morph .morph-kicker span {
  color: var(--ink);
}

#morph .morph-kicker i {
  padding-left: 13px;
  border-left: 1px solid var(--line);
  font-style: normal;
  letter-spacing: .12em;
  text-transform: lowercase;
}

#morph .morph-copy h1 {
  margin: 0;
  max-width: 6.2ch;
  font: 900 clamp(54px, 5vw, 86px)/.83 var(--display);
  letter-spacing: -.078em;
  word-break: normal;
  overflow-wrap: normal;
}

#morph .morph-copy h1 span {
  color: var(--morph-accent);
  transition: color .5s ease;
}

#morph .morph-lead {
  margin: clamp(16px, 2.6vh, 26px) 0 0 6px;
  max-width: 31ch;
  font: 500 clamp(13px, 1.08vw, 16px)/1.45 var(--sans);
  letter-spacing: -.01em;
  color: #29271f;
}

#morph .morph-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 11px 24px;
  margin-top: clamp(22px, 4vh, 40px);
  color: #484539;
  font: 500 8px/1.3 var(--mono);
  letter-spacing: .08em;
}

#morph .morph-guide span {
  display: flex;
  align-items: center;
  gap: 8px;
}

#morph .morph-guide i {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  font: 500 6px/1 var(--mono);
  font-style: normal;
  letter-spacing: 0;
}

#morph .morph-aside {
  position: absolute;
  left: clamp(30px, 4.1vw, 64px);
  bottom: 17px;
  margin: 0;
  color: #4c493d;
  font: 500 7px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

#morph .morph-aside span {
  margin-right: 9px;
  color: var(--morph-accent);
}

/* — stage ————————————————————————————— */

#morph .morph-stage {
  position: relative;
  inset: auto;
  z-index: 2;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin: 8px clamp(10px, 2.1vw, 30px) 4px 0;
  /* app.js still moves the stage on pointermove; the field itself now breathes. */
  transform: none !important;
}

#morph .morph-stage-top {
  position: absolute;
  z-index: 5;
  left: clamp(14px, 2.2vw, 30px);
  right: clamp(14px, 2.2vw, 30px);
  top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: rgba(18, 17, 13, .74);
  font: 500 7px/1 var(--mono);
  letter-spacing: .16em;
}

#morph .morph-stage-top span:last-child {
  color: var(--ink);
  text-align: right;
}

#morph .morph-rings {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#morph .morph-rings i {
  position: absolute;
  left: 50%;
  top: 50%;
  aspect-ratio: 1;
  border-radius: 47% 53% 44% 56% / 55% 45% 55% 45%;
  transform: translate(-50%, -50%);
}

#morph .morph-rings i:nth-child(1) {
  width: clamp(224px, 24vw, 330px);
  border: 1px dashed rgba(18, 17, 13, .32);
  animation: morph-orbit 38s linear infinite;
}

#morph .morph-rings i:nth-child(2) {
  width: clamp(320px, 38vw, 520px);
  border: 1px dotted rgba(18, 17, 13, .22);
  border-radius: 52% 48% 56% 44% / 46% 57% 43% 54%;
  animation: morph-orbit-reverse 62s linear infinite;
}

#morph .morph-rings i:nth-child(3) {
  width: clamp(440px, 52vw, 700px);
  border: 1px solid rgba(18, 17, 13, .085);
  border-radius: 55% 45% 49% 51% / 48% 52% 48% 52%;
  animation: morph-orbit 95s linear infinite reverse;
}

#morph .morph-veins {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

#morph .morph-veins .morph-vein-underlay {
  fill: none;
  stroke: var(--paper);
  stroke-width: 4.6;
  stroke-linecap: round;
  stroke-dasharray: none;
  opacity: .64;
  pointer-events: none;
}

#morph .morph-veins path {
  fill: none;
  stroke: rgba(18, 17, 13, .38);
  stroke-width: 1.15;
  stroke-dasharray: 2 7;
  stroke-linecap: round;
  transition: stroke .35s ease, stroke-width .35s ease, opacity .35s ease;
}

#morph .morph-veins path.preview {
  stroke: var(--preview-accent, var(--focus-accent));
  stroke-width: 1.5;
  stroke-dasharray: 2 4;
  opacity: .92;
  filter: drop-shadow(0 0 1.1px rgba(243, 239, 226, .95));
}

#morph .morph-veins path.active {
  stroke: var(--focus-accent);
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
  opacity: .96;
  filter: drop-shadow(0 0 1.2px rgba(243, 239, 226, .95));
  animation: morph-flow 2.8s linear infinite;
}

#morph .morph-impulse {
  fill: var(--focus-accent);
  opacity: 0;
  filter: drop-shadow(0 0 5px var(--focus-accent));
}

#morph .morph-veins .morph-impulse-line {
  fill: none;
  stroke: var(--focus-accent);
  stroke-width: 3.4;
  stroke-linecap: round;
  opacity: 0;
  filter: drop-shadow(0 0 4px var(--focus-accent)) drop-shadow(0 0 1px rgba(243, 239, 226, .95));
}

/* cells */

#morph .morph-cell {
  position: absolute;
  z-index: 3;
  width: clamp(100px, 9.3vw, 136px);
  height: auto;
  min-width: 0;
  aspect-ratio: 1;
  scale: 1;
  padding: 0;
  border: 1px solid rgba(18, 17, 13, .68);
  border-radius: 52% 48% 55% 45% / 47% 55% 45% 53%;
  background: var(--cell);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  isolation: isolate;
  box-shadow:
    inset 0 0 0 6px rgba(255, 255, 255, .27),
    0 14px 26px -19px rgba(18, 17, 13, .62);
  transition:
    transform .45s cubic-bezier(.2, .9, .25, 1),
    box-shadow .35s ease,
    background-color .35s ease,
    border-color .35s ease;
}

#morph .cell-math { --cell: #ffd0db; --cell-strong: #ff5c83; left: 4.5%; top: 11%; }
#morph .cell-bio { --cell: #b9f0e3; --cell-strong: #22d6b7; right: 4%; top: 8%; }
#morph .cell-language { --cell: #ffe39a; --cell-strong: #ffc62d; left: 4%; bottom: 11%; }
#morph .cell-code { --cell: #d2c8ff; --cell-strong: #9b82ff; right: 3.5%; bottom: 8%; }

#morph .morph-cell > i {
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(18, 17, 13, .27);
  border-radius: 47% 53% 44% 56% / 55% 45% 55% 45%;
  pointer-events: none;
  animation: morph-cell-orbit 30s linear infinite;
}

#morph .morph-cell > span {
  position: relative;
  z-index: 1;
  font: 500 clamp(7.6px, .6vw, 9px)/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

#morph .morph-cell > b {
  position: relative;
  z-index: 1;
  margin-top: 1px;
  font: 700 clamp(27px, 2.5vw, 36px)/1 var(--serif);
  letter-spacing: -.03em;
}

#morph .morph-cell > em {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  padding: 0;
  font: 400 clamp(6.7px, .5vw, 7.5px)/1 var(--mono);
  font-style: normal;
  letter-spacing: .01em;
  color: rgba(18, 17, 13, .74);
  white-space: nowrap;
  transition: background-color .3s ease, color .3s ease, padding .3s ease;
}

#morph .morph-cell:hover {
  z-index: 4;
  transform: translateY(-4px) scale(1.035) rotate(-2deg);
  box-shadow:
    inset 0 0 0 6px rgba(255, 255, 255, .35),
    0 23px 34px -21px rgba(18, 17, 13, .66);
}

#morph .morph-cell.active {
  z-index: 4;
  background: var(--cell-strong);
  border-color: var(--ink);
  transform: scale(1.045) rotate(-2deg);
  box-shadow:
    0 0 0 2px var(--ink),
    0 0 0 7px rgba(255, 255, 255, .18),
    0 20px 34px -23px rgba(18, 17, 13, .72),
    inset 0 0 0 6px rgba(255, 255, 255, .2);
}

#morph .morph-cell.active > i {
  inset: -11px;
  border: 1px dashed rgba(18, 17, 13, .64);
  animation-duration: 17s;
}

#morph .morph-cell.active > em {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(18, 17, 13, .9);
  color: var(--paper);
}

#morph .morph-cell:active {
  transform: scale(.985);
}

#morph .morph-cell:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
  box-shadow:
    0 0 0 6px var(--ink),
    0 22px 34px -22px rgba(18, 17, 13, .72);
}

/* core */

#morph .morph-core-wrap {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: clamp(204px, 19.8vw, 284px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

#morph .morph-ring {
  position: absolute;
  inset: -14%;
  z-index: 0;
  pointer-events: none;
  opacity: .92;
}

#morph .morph-ring svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

#morph .morph-ring circle {
  fill: none;
}

#morph .ring-track {
  stroke: rgba(243, 239, 226, .55);
  stroke-width: .5;
  stroke-dasharray: 1 2.3;
  transition: stroke .4s ease;
}

#morph[data-session="running"] .ring-track {
  stroke: color-mix(in srgb, var(--focus-accent) 52%, var(--paper));
  animation: morph-track-run 5s linear infinite;
}

#morph[data-session="running"] .morph-head-state i {
  animation-duration: 1.6s;
}

#morph .ring-fill {
  stroke: var(--focus-accent);
  stroke-width: .65;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--focus-accent) 58%, transparent));
  transition: stroke-dashoffset .55s linear, stroke .4s ease;
}

#morph .morph-core {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 44% 56% 39% 61% / 57% 43% 57% 43%;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  isolation: isolate;
  box-shadow:
    0 27px 58px -28px rgba(18, 17, 13, .8),
    inset 0 0 0 1px rgba(243, 239, 226, .13),
    inset 0 0 64px rgba(255, 255, 255, .04);
  animation: morph-core-breathe 10s ease-in-out infinite;
  transition: transform .35s ease, box-shadow .45s ease, background-color .5s ease;
}

#morph .morph-core::before {
  content: '';
  position: absolute;
  inset: -23px;
  z-index: -1;
  border: 1px dashed rgba(18, 17, 13, .26);
  border-radius: 46% 54% 49% 51% / 52% 48% 52% 48%;
  opacity: .7;
  pointer-events: none;
  animation: morph-halo 13s ease-in-out infinite;
}

#morph .morph-core::after {
  display: none;
}

#morph .morph-core > span {
  position: relative;
  z-index: 1;
  max-width: 82%;
  color: rgba(243, 239, 226, .68);
  font: 500 8px/1.2 var(--mono);
  letter-spacing: .13em;
  text-align: center;
}

#morph .morph-core > b {
  position: relative;
  z-index: 1;
  font: 800 clamp(40px, 3.95vw, 58px)/1 var(--display);
  letter-spacing: -.065em;
  font-variant-numeric: tabular-nums;
  color: var(--paper);
}

#morph .morph-core > em {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  padding: 7px 12px;
  border: 1px solid var(--paper);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 600 8.5px/1 var(--mono);
  font-style: normal;
  letter-spacing: .09em;
  white-space: nowrap;
  transition: background-color .3s ease, color .3s ease, border-color .3s ease, transform .3s ease;
}

#morph .morph-core > i {
  position: absolute;
  bottom: 16%;
  right: 21%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--focus-soft);
  box-shadow:
    0 0 0 3px var(--focus-accent),
    0 0 0 8px color-mix(in srgb, var(--focus-accent) 16%, transparent);
  transition: background-color .4s ease;
}

#morph .morph-core:hover {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--focus-accent) 32%, transparent),
    0 27px 58px -28px rgba(18, 17, 13, .8),
    inset 0 0 0 1px rgba(243, 239, 226, .22),
    inset 0 0 64px rgba(255, 255, 255, .055);
}

#morph .morph-core:hover > em {
  border-color: var(--focus-accent);
  transform: scale(1.025);
}

#morph .morph-core:focus-visible {
  outline: 3px solid var(--paper);
  outline-offset: 5px;
  box-shadow:
    0 0 0 10px var(--ink),
    0 27px 58px -28px rgba(18, 17, 13, .8);
}

#morph .morph-core.running {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--focus-accent) 38%, transparent),
    0 0 55px -8px color-mix(in srgb, var(--focus-accent) 28%, transparent),
    0 27px 58px -28px rgba(18, 17, 13, .8),
    inset 0 0 0 1px rgba(243, 239, 226, .16);
  animation: morph-core-breathe 7s ease-in-out infinite;
}

#morph .morph-core.running::before {
  opacity: .9;
  animation-duration: 5s;
}

#morph .morph-core.running > em {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--ink);
}

#morph[data-session="paused"] .morph-core > em {
  background: transparent;
  border-color: rgba(243, 239, 226, .45);
  color: var(--paper);
}

#morph .morph-core.running > i {
  animation: morph-blink 1.8s ease-in-out infinite;
}

#morph[data-session="paused"] .morph-core {
  background: #222017;
  box-shadow:
    0 0 0 1px rgba(243, 239, 226, .18),
    0 27px 58px -30px rgba(18, 17, 13, .8),
    inset 0 0 64px rgba(255, 255, 255, .02);
}

#morph[data-session="paused"] .morph-core > i {
  opacity: .45;
}

#morph[data-session="complete"] .morph-core > i {
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--focus-accent) 24%, transparent);
  animation: morph-blink 2.2s ease-in-out infinite;
}

#morph .morph-core.is-fed {
  animation: morph-core-breathe 10s ease-in-out infinite, morph-core-fed .62s cubic-bezier(.2, .9, .2, 1) both;
}

#morph .morph-core.is-fed::before {
  animation: morph-feed .62s cubic-bezier(.2, .8, .2, 1) both;
}

#morph .morph-notice {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 9px;
  transform: translateX(-50%);
  max-width: 78%;
  margin: 0;
  padding: 5px 11px;
  border: 1px solid rgba(18, 17, 13, .15);
  border-radius: 999px;
  background: rgba(247, 243, 233, .62);
  backdrop-filter: blur(8px);
  color: #353228;
  font: 500 7px/1.25 var(--mono);
  letter-spacing: .06em;
  text-align: center;
  white-space: nowrap;
  transition: background-color .3s ease;
}

/* — footer / vitals ————————————————————— */

#morph .morph-footer {
  position: relative;
  inset: auto;
  height: auto;
  z-index: 6;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(14px, 2.4vw, 32px);
  padding: 0 clamp(18px, 2.6vw, 34px);
  border-top: 1px solid rgba(18, 17, 13, .22);
  background: linear-gradient(90deg, rgba(243, 239, 226, .8), rgba(243, 239, 226, .54));
  backdrop-filter: blur(12px);
}

#morph .morph-vitals {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.5vw, 34px);
  min-width: 0;
}

#morph .morph-vital {
  display: grid;
  grid-template-columns: auto 90px auto;
  align-items: center;
  column-gap: 11px;
  min-width: 0;
}

#morph .morph-vital > span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font: 500 8px/1 var(--mono);
  letter-spacing: .13em;
  white-space: nowrap;
}

#morph .morph-vital > span small {
  font: 400 7px/1 var(--mono);
  letter-spacing: .01em;
  color: #4a473b;
  opacity: .9;
  text-transform: lowercase;
}

#morph .morph-vital > b {
  position: relative;
  display: block;
  width: 90px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(18, 17, 13, .13);
}

#morph .morph-vital > b > i {
  display: block;
  width: var(--w, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--morph-accent), var(--ink));
  transition: width .8s cubic-bezier(.2, .8, .2, 1);
}

#morph .morph-vital > em {
  display: flex;
  align-items: baseline;
  gap: 1px;
  min-width: 29px;
  font: 800 14px/1 var(--display);
  font-style: normal;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}

#morph .morph-vital > em small {
  font: 500 7px/1 var(--mono);
  letter-spacing: 0;
  color: #4a473b;
}

#morph .morph-vital.bump > em {
  animation: morph-value-bump .8s cubic-bezier(.2, .9, .2, 1);
}

#morph .morph-footer-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  color: #4a473b;
  font: 400 7px/1 var(--mono);
  letter-spacing: .06em;
  white-space: nowrap;
}

#morph .morph-footer-hint i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--morph-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--morph-accent) 15%, transparent);
  animation: morph-blink 3.4s ease-in-out infinite;
}

#morph .morph-mood {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  width: auto;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--ink);
  border-radius: 16px 20px 17px 21px;
  background: var(--ink);
  color: var(--paper);
  text-align: left;
  cursor: pointer;
  transition: box-shadow .3s ease, transform .3s ease;
}

#morph .morph-mood:hover {
  box-shadow: inset 0 0 0 1px var(--morph-accent), 0 7px 18px -12px rgba(18, 17, 13, .55);
  transform: translateY(-1px);
}

#morph .morph-mood:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

#morph .morph-mood-dots {
  display: grid;
  grid-template-columns: repeat(2, 5px);
  gap: 3px;
}

#morph .morph-mood-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff3d71;
  opacity: .34;
  transition: opacity .3s ease, box-shadow .3s ease, transform .3s ease;
}

#morph .morph-mood-dots i:nth-child(2) { background: #245dff; }
#morph .morph-mood-dots i:nth-child(3) { background: #ff7a00; }
#morph .morph-mood-dots i:nth-child(4) { background: #0b8f77; }

#morph .morph-mood-dots i.active {
  opacity: 1;
  transform: scale(1.2);
  box-shadow: 0 0 0 2px rgba(243, 239, 226, .2);
}

#morph .morph-mood-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#morph .morph-mood-copy small {
  font: 400 7px/1 var(--mono);
  letter-spacing: .13em;
  color: rgba(243, 239, 226, .66);
}

#morph .morph-mood-copy b {
  font: 800 8.5px/1.1 var(--display);
  letter-spacing: -.01em;
  white-space: nowrap;
}

#morph .morph-mood-copy em {
  font: 400 7px/1 var(--mono);
  font-style: normal;
  letter-spacing: .01em;
  color: rgba(243, 239, 226, .68);
  white-space: nowrap;
}

#morph .morph-mood-arrow {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(243, 239, 226, .3);
  border-radius: 50%;
  color: var(--morph-accent);
  font: 500 11px/1 var(--mono);
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), border-color .3s ease;
}

#morph .morph-mood:hover .morph-mood-arrow {
  transform: rotate(180deg);
  border-color: var(--morph-accent);
}

#morph .morph-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* — motion ————————————————————————————— */

@keyframes morph-drift-a {
  0% { transform: rotate(0deg) scale(1); }
  100% { transform: rotate(22deg) scale(1.055) translate(3vw, 2.5vw); }
}

@keyframes morph-drift-b {
  0% { transform: rotate(0deg) scale(1); }
  100% { transform: rotate(-26deg) scale(1.04) translate(-2.5vw, 2vw); }
}

@keyframes morph-drift-c {
  0% { transform: rotate(0deg) scale(1); }
  100% { transform: rotate(17deg) scale(1.07) translate(2vw, -2vw); }
}

@keyframes morph-breathe {
  0%, 100% { transform: scale(1); opacity: .62; }
  50% { transform: scale(1.14); opacity: .78; }
}

@keyframes morph-seed {
  0%, 100% { border-radius: 62% 38% 51% 49% / 38% 61% 39% 62%; transform: rotate(0deg); }
  50% { border-radius: 38% 62% 37% 63% / 62% 38% 62% 38%; transform: rotate(24deg); }
}

@keyframes morph-cell-orbit {
  to { transform: rotate(360deg); }
}

@keyframes morph-orbit {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes morph-orbit-reverse {
  to { transform: translate(-50%, -50%) rotate(-360deg); }
}

@keyframes morph-flow {
  to { stroke-dashoffset: -36; }
}

@keyframes morph-track-run {
  to { stroke-dashoffset: -33; }
}

@keyframes morph-feed {
  0% { transform: scale(.97); opacity: .9; border-color: var(--focus-accent); }
  100% { transform: scale(1.09); opacity: 0; border-color: var(--focus-accent); }
}

@keyframes morph-core-breathe {
  0%, 100% { border-radius: 44% 56% 39% 61% / 57% 43% 57% 43%; }
  36% { border-radius: 57% 43% 55% 45% / 42% 58% 42% 58%; }
  68% { border-radius: 47% 53% 63% 37% / 58% 36% 64% 42%; }
}

@keyframes morph-core-fed {
  0% { filter: brightness(1); }
  38% { filter: brightness(1.16); }
  100% { filter: brightness(1); }
}

@keyframes morph-halo {
  0%, 100% { transform: rotate(0deg) scale(1); opacity: .45; }
  50% { transform: rotate(9deg) scale(1.035); opacity: .72; }
}

@keyframes morph-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .42; }
}

@keyframes morph-value-bump {
  0% { transform: translateY(0); }
  35% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

/* — tablet / stacked ————————————————————— */

@media (max-width: 1100px) {
  #morph.active {
    grid-template-rows: 62px minmax(0, 1fr) 78px;
  }

  #morph .morph-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  #morph .morph-copy {
    display: block;
    padding: 18px 26px 0;
  }

  #morph .morph-kicker {
    margin-bottom: 10px;
  }

  #morph .morph-copy h1 {
    max-width: none;
    font-size: clamp(48px, 7.2vw, 76px);
    line-height: .82;
  }

  #morph .morph-lead {
    margin: 11px 0 0 4px;
    max-width: 46ch;
    font-size: 13px;
  }

  #morph .morph-guide,
  #morph .morph-aside {
    display: none;
  }

  #morph .morph-stage {
    margin: 2px 8px 4px;
    min-height: 0;
  }

  #morph .morph-cell {
    width: clamp(104px, 11.5vw, 132px);
  }

  #morph .morph-core-wrap {
    width: clamp(215px, 22.5vw, 236px);
  }

  #morph .morph-rings i:nth-child(3) {
    display: none;
  }

  #morph .morph-footer {
    grid-template-columns: 1fr auto;
  }

  #morph .morph-footer-hint {
    display: none;
  }

  #morph .morph-vital {
    grid-template-columns: auto 70px auto;
  }

  #morph .morph-vital > b {
    width: 70px;
  }
}

/* — phone ——————————————————————————————— */

@media (max-width: 850px) {
  #morph {
    height: calc(100vh - 64px);
    min-height: 640px;
  }
}

@media (min-width: 601px) and (max-width: 850px) and (min-height: 900px) {
  #morph .morph-core-wrap {
    width: clamp(226px, 30vw, 248px);
  }

  #morph .morph-cell {
    width: clamp(112px, 14vw, 124px);
  }
}

@media (max-width: 600px) {
  #morph {
    height: calc(100vh - 64px);
    min-height: 600px;
  }

  #morph.active {
    grid-template-rows: 56px minmax(0, 1fr) 72px;
  }

  #morph .morph-head {
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    padding: 0 13px;
    background: linear-gradient(180deg, rgba(243, 239, 225, .62), rgba(243, 239, 225, .24));
    backdrop-filter: blur(7px);
  }

  #morph .morph-brand {
    gap: 9px;
  }

  #morph .morph-brand > i {
    width: 28px;
    height: 28px;
  }

  #morph .morph-brand > span {
    font-size: 8.5px;
    letter-spacing: .12em;
  }

  #morph .morph-brand b {
    display: none;
  }

  #morph .morph-brand em {
    display: none;
  }

  #morph .morph-head-state {
    gap: 6px;
    padding: 4px 8px;
  }

  #morph .morph-head-state span {
    display: none;
  }

  #morph .morph-head-state b {
    font-size: 9px;
  }

  #morph .morph-head-state i {
    width: 6px;
    height: 6px;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--morph-accent) 18%, transparent);
  }

  #morph .morph-date span {
    display: none;
  }

  #morph .morph-date {
    gap: 0;
    padding: 4px 8px;
    font-size: 8px;
  }

  #morph .morph-date b {
    padding-left: 0;
    font-size: 8px;
  }

  #morph .morph-date b::before {
    display: none;
  }

  #morph .morph-copy {
    padding: 12px 17px 0;
  }

  /* A soft clearing keeps the manifesto readable over the living field. */
  #morph .morph-copy::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: -10px -10px 0 -16px;
    pointer-events: none;
    background:
      radial-gradient(125% 118% at 31% 42%,
        rgba(243, 239, 225, .97) 0 40%,
        rgba(243, 239, 225, .86) 58%,
        rgba(243, 239, 225, .34) 78%,
        rgba(243, 239, 225, 0) 97%);
  }

  #morph .morph-kicker {
    gap: 9px;
    margin-bottom: 8px;
    font-size: 7px;
    letter-spacing: .16em;
  }

  #morph .morph-kicker i {
    padding-left: 9px;
    font-size: 6.5px;
  }

  #morph .morph-copy h1 {
    font-size: clamp(45px, 13vw, 56px);
    line-height: .82;
    letter-spacing: -.072em;
  }

  #morph .morph-lead {
    margin: 8px 0 0 3px;
    max-width: 32ch;
    font-size: 11px;
    line-height: 1.35;
  }

  #morph .morph-stage {
    margin: 0 7px 3px;
    min-height: 0;
  }

  #morph .morph-stage-top {
    left: 12px;
    right: 12px;
    top: 7px;
    font-size: 6px;
    letter-spacing: .13em;
  }

  #morph .morph-stage-top span:first-child {
    display: none;
  }

  #morph .morph-stage-top span:last-child {
    margin-left: auto;
  }

  #morph .morph-cell {
    width: 94px;
  }

  #morph .morph-cell > span {
    font-size: 7.5px;
    letter-spacing: .09em;
  }

  #morph .morph-cell > b {
    font-size: 27px;
  }

  #morph .morph-cell > em {
    font-size: 6.4px;
    margin-top: 2px;
  }

  #morph .cell-math { left: 1.5%; top: 8%; }
  #morph .cell-bio { right: 1.5%; top: 6%; }
  #morph .cell-language { left: 1.5%; bottom: 8%; }
  #morph .cell-code { right: 1.5%; bottom: 6%; }

  #morph .morph-core-wrap {
    width: clamp(168px, 46vw, 186px);
  }

  #morph .morph-ring {
    inset: -12%;
  }

  #morph .morph-core > span {
    max-width: 76%;
    font-size: 6.8px;
    letter-spacing: .1em;
  }

  #morph .morph-core > b {
    font-size: clamp(33px, 9.6vw, 40px);
  }

  #morph .morph-core > em {
    margin-top: 1px;
    padding: 5px 8px;
    font-size: 7px;
    letter-spacing: .06em;
  }

  #morph .morph-core > i {
    width: 8px;
    height: 8px;
  }

  #morph .morph-core::after {
    inset: -30px;
  }

  #morph .morph-rings i:nth-child(1) {
    width: 205px;
  }

  #morph .morph-rings i:nth-child(2) {
    width: 300px;
  }

  #morph .morph-rings i:nth-child(3) {
    display: none;
  }

  #morph .morph-notice {
    bottom: 3px;
    max-width: 78%;
    padding: 4px 8px;
    font-size: 6.5px;
    white-space: normal;
  }

  #morph .morph-footer {
    grid-template-columns: 1fr auto;
    gap: 7px;
    padding: 0 11px;
  }

  #morph .morph-vitals {
    gap: 11px;
  }

  #morph .morph-vital {
    grid-template-columns: auto 43px auto;
    column-gap: 6px;
  }

  #morph .morph-vital > span {
    font-size: 6.8px;
    letter-spacing: .07em;
  }

  #morph .morph-vital > span small {
    display: none;
  }

  #morph .morph-vital > b {
    width: 43px;
    height: 5px;
  }

  #morph .morph-vital > em {
    min-width: 22px;
    font-size: 12px;
  }

  #morph .morph-vital > em small {
    font-size: 6.5px;
  }

  #morph .morph-mood {
    gap: 6px;
    padding: 5px 8px;
    border-radius: 12px 15px 13px 16px;
  }

  #morph .morph-mood-dots {
    grid-template-columns: repeat(2, 4px);
    gap: 2px;
  }

  #morph .morph-mood-dots i {
    width: 4px;
    height: 4px;
  }

  #morph .morph-mood-copy em {
    display: none;
  }

  #morph .morph-mood-copy small {
    font-size: 6.8px;
    letter-spacing: .08em;
  }

  #morph .morph-mood-copy b {
    font-size: 7.8px;
  }

  #morph .morph-mood-arrow {
    width: 16px;
    height: 16px;
    font-size: 9px;
  }
}

@media (max-width: 380px) {
  #morph .morph-cell {
    width: 86px;
  }

  #morph .morph-core-wrap {
    width: 162px;
  }

  #morph .morph-vital {
    grid-template-columns: auto 34px auto;
    column-gap: 5px;
  }

  #morph .morph-vital > b {
    width: 34px;
  }

  #morph .morph-mood-copy b {
    font-size: 6.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #morph .morph-blob,
  #morph .morph-glow,
  #morph .morph-brand > i,
  #morph .morph-head-state i,
  #morph .morph-cell > i,
  #morph .morph-rings i,
  #morph .morph-core,
  #morph .morph-core::before,
  #morph .morph-core::after,
  #morph .morph-core > i,
  #morph .morph-veins path.active,
  #morph .morph-footer-hint i {
    animation: none !important;
  }

  #morph .morph-veins path.active {
    stroke-dasharray: 2 4;
  }

  #morph[data-session="running"] .ring-track {
    animation: none !important;
  }

  #morph .morph-blob {
    translate: none !important;
  }

  #morph .morph-core,
  #morph .morph-cell,
  #morph .morph-mood,
  #morph .morph-vital > b > i,
  #morph .ring-fill {
    transition-duration: .01ms !important;
  }
}
