/* Habits (Повадки): four slots in the menu, and the Mycelium (Грибница) they grow in. */

/* The four slots: wooden sockets on the menu sheet. */
:root #overlay.menu .habit-slots { display: flex; justify-content: space-between; gap: clamp(6px, .8vw, 14px); padding: 0 4px 6px; }
:root #overlay.menu .habit-slot {
  --slot: clamp(44px, 6vh, 66px);
  position: relative; flex: none; width: var(--slot); height: var(--slot); box-sizing: border-box;
  display: grid; place-items: center; padding: 3px; border-radius: 50%; overflow: visible;
  border: 3px solid #3a2716; background: radial-gradient(#2a3a22, #172015 70%); box-shadow: inset 0 2px 8px #000a, 1px 2px 0 #3a271688;
  color: #d8c89a; font: 700 clamp(18px, 1.6vw, 30px)/1 var(--title-font); cursor: pointer;
  transition: filter .18s ease-out, box-shadow .18s ease-out;
}
:root #overlay.menu .habit-slot .icon { --size: calc(var(--slot) - 12px); width: var(--size); height: var(--size); border-radius: 50%; }
:root #overlay.menu .habit-slot small {
  position: absolute; right: -2px; bottom: -4px; padding: 1px 6px; border-radius: 8px; border: 2px solid #3a2716;
  background: #efdfb8; color: #3a2716; font: 700 clamp(9px, .65vw, 13px)/1.2 var(--title-font);
}
:root #overlay.menu .habit-slot.full { box-shadow: inset 0 2px 8px #000a, 0 0 10px #b9f34f88, 1px 2px 0 #3a271688; border-color: #4f5e20; }
:root #overlay.menu .habit-slot:hover { filter: brightness(1.15) drop-shadow(0 0 8px #b9f34f); }
:root #overlay.menu .habit-slot span { opacity: .55; }

/* The list of habits for a slot. */
:root #overlay.menu .menu-sheet .habit-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* The Mycelium: a round web of roots on dark earth, the seeds in its heart. */
:root #overlay.menu .mycelium {
  position: relative; width: 100%; aspect-ratio: 1; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle, #2b3a1f 0, #1a2414 45%, #10160c 70%, transparent 71%);
  box-shadow: 0 0 40px #b9f34f22 inset;
}
:root #overlay.menu .mycelium svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
:root #overlay.menu .mycelium .ring { fill: none; stroke: #55603a; stroke-width: .5; stroke-dasharray: 1.5 2.5; }
:root #overlay.menu .mycelium .root { fill: none; stroke: #4a3b26; stroke-width: 1.4; stroke-linecap: round; }
:root #overlay.menu .mycelium .root.grown { stroke: #b9f34f; stroke-width: 1.6; filter: drop-shadow(0 0 1.5px #b9f34f); animation: sap 2.8s ease-in-out infinite; }
@keyframes sap { 50% { stroke: #e2ff9a; } }
:root #overlay.menu .mycelium .heart {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 15%; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-content: center; text-align: center; color: #e8ffb0;
  background: radial-gradient(circle, #6f9a12 0, #2e4410 70%); border: 3px solid #b9f34f; box-shadow: 0 0 24px #b9f34f99;
  animation: heartbeat 2.2s ease-in-out infinite;
}
:root #overlay.menu .mycelium .heart b { font: 700 clamp(14px, 1.4vw, 26px)/1 var(--title-font); }
:root #overlay.menu .mycelium .heart small { font: 400 clamp(9px, .6vw, 12px)/1 var(--hud-font); text-transform: uppercase; }
@keyframes heartbeat { 50% { box-shadow: 0 0 38px #b9f34fcc; scale: 1.04; } }
:root #overlay.menu .mycelium .node {
  position: absolute; translate: -50% -50%; width: 7.6%; aspect-ratio: 1; padding: 2px; border-radius: 50%;
  border: 2px solid #3a2716; background: #1b2014; cursor: default; transition: scale .15s ease-out, filter .15s ease-out;
}
:root #overlay.menu .mycelium .node .icon { --size: 100%; border-radius: 50%; }
:root #overlay.menu .mycelium .node small {
  position: absolute; left: 50%; bottom: -8px; translate: -50% 0; padding: 0 4px; border-radius: 6px;
  background: #efdfb8; color: #3a2716; font: 700 9px/1.3 var(--title-font); border: 1px solid #3a2716;
}
:root #overlay.menu .mycelium .node.far .icon { filter: grayscale(1) brightness(.35); }
:root #overlay.menu .mycelium .node.grown { border-color: #b9f34f; box-shadow: 0 0 10px #b9f34faa; }
:root #overlay.menu .mycelium .node.next { cursor: pointer; border-color: #e8d27a; animation: ready-node 1.6s ease-in-out infinite; }
:root #overlay.menu .mycelium .node:not(.grown):not(.next):not(.far) .icon { filter: grayscale(.6) brightness(.7); }
:root #overlay.menu .mycelium .node.own { border-style: double; border-width: 3px; }
:root #overlay.menu .mycelium .node:hover { scale: 1.25; z-index: 2; filter: drop-shadow(0 0 6px #e8ffb0); }
@keyframes ready-node { 50% { box-shadow: 0 0 14px #e8d27a; } }

/* The card for the habit under the pointer. */
:root #overlay.menu .habit-info { min-height: clamp(84px, 12vh, 130px); padding: 8px 12px; border: 2px solid #3a271655; border-radius: 6px; background: #f3e6c544; }
:root #overlay.menu .habit-info .head { display: flex; align-items: center; gap: 10px; }
:root #overlay.menu .habit-info .head .icon { --size: clamp(30px, 3vw, 46px); }
:root #overlay.menu .habit-info .head b { font: 700 clamp(15px, 1.1vw, 22px)/1.1 var(--title-font); }
:root #overlay.menu .habit-info .head em { margin-left: auto; font: italic 400 clamp(10px, .7vw, 14px)/1.2 var(--hud-font); color: #7a4a16; }
:root #overlay.menu .habit-info p { margin: 4px 0 0; font: 400 clamp(11px, .8vw, 16px)/1.3 var(--hud-font); text-align: left; }
:root #overlay.menu .habit-info .lore { font-style: italic; color: var(--paper-muted); }
:root #overlay.menu .habit-info .next { color: #3c5a10; font-weight: 600; }

/* The web sits in a round window that can be zoomed and dragged. */
:root #overlay.menu .mycelium-frame { position: relative; width: min(100%, 64vh); aspect-ratio: 1; margin: 0 auto; cursor: grab; touch-action: none; }
:root #overlay.menu .mycelium-clip { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 4px #3a2716, 0 0 0 7px #6f9a12aa, 0 8px 30px #0008; }
:root #overlay.menu .mycelium-frame:active { cursor: grabbing; }
:root #overlay.menu .mycelium-frame .mycelium { width: 100%; transform-origin: 50% 50%; transition: transform .12s ease-out; }
:root #overlay.menu .mycelium-tools { position: absolute; right: -46px; bottom: 6%; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
:root #overlay.menu .mycelium-tools button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #3a2716; background: #efdfb8; color: #3a2716; font: 700 18px/1 Georgia, serif; cursor: pointer; box-shadow: 1px 2px 0 #3a271688; }
:root #overlay.menu .mycelium-tools button:hover { background: #fff3cf; }

/* Growth: sap runs out along the root, the heart pumps, the node blooms and throws spores. */
:root #overlay.menu .mycelium .sap { fill: none; stroke: #f2ffb0; stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 3px #b9f34f) drop-shadow(0 0 6px #b9f34f); }
:root #overlay.menu .mycelium .heart.pump { animation: pump .5s ease-out; }
@keyframes pump { 30% { scale: 1.18; box-shadow: 0 0 60px #e2ff9a; } }
:root #overlay.menu .mycelium .node.bloom { animation: bloom .7s ease-out forwards; z-index: 2; }
@keyframes bloom { 0% { filter: brightness(1); } 30% { scale: 1.7; filter: brightness(2.2) drop-shadow(0 0 14px #e2ff9a); } 100% { scale: 1.15; filter: brightness(1.3) drop-shadow(0 0 8px #b9f34f); } }
:root #overlay.menu .mycelium .node.just-grown { animation: settle .6s ease-out; }
@keyframes settle { 0% { scale: 1.3; filter: brightness(1.8) drop-shadow(0 0 12px #e2ff9a); } }
:root #overlay.menu .mycelium .spore {
  position: absolute; width: 1.2%; aspect-ratio: 1; border-radius: 50%; translate: -50% -50%; pointer-events: none; z-index: 3;
  background: radial-gradient(#f2ffb0, #8fd12a 60%, transparent 70%);
  animation: spore .9s ease-out forwards;
}
@keyframes spore { from { opacity: 1; transform: translate(0, 0) scale(1.4); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.4); } }

/* The habit medallions (habit-icons.webp, four to a row) in place of the general icon sheet. */
.icon.hicon { background: url(assets/habit-icons.webp) calc(var(--hx) / 3 * 100%) calc(var(--hy) / 3 * 100%) / 400% auto no-repeat; border-radius: 50%; }
