/* Sticky-note menu, wall note, music player and sound toggle. */

@property --peel {
  syntax: '<length>';
  inherits: true;
  initial-value: 0px;
}

/* ---------- Sticky note ---------- */

.sticky {
  --peel: 12px;
  left: 54px;
  top: 40px;
  z-index: 60;
  transition: --peel .35s var(--ease-out);
}

.sticky__note {
  position: relative;
  display: block;
  width: 168px;
  height: 168px;
  padding: 22px 20px;
  text-align: left;
  color: #3b3210;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .06), transparent 22%),
    linear-gradient(160deg, #fff7a8, #fbe56a 60%, #f0d24e);
  /* the cut corner the fold is drawn into */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--peel)), calc(100% - var(--peel)) 100%, 0 100%);
  filter: drop-shadow(3px 8px 7px rgba(0, 0, 0, .55));
  transform: rotate(-3deg);
  transition: transform .35s var(--ease-spring);
}

/* Folded-over corner showing the paler back of the note. */
.sticky__note::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--peel);
  height: var(--peel);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  background: linear-gradient(135deg, #c9b445 0%, #f3e79a 45%, #fffbd6 100%);
  box-shadow: -3px -3px 6px rgba(0, 0, 0, .25);
}

.sticky:hover,
.sticky:focus-within { --peel: 48px; }
.sticky:hover .sticky__note { transform: rotate(-1deg) translateY(-3px); }
.sticky.is-open { --peel: 64px; }

.sticky__title {
  display: block;
  font-family: var(--font-hand);
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
}

.sticky__scribble {
  display: block;
  width: 92px;
  height: 40px;
  margin-top: 16px;
  background:
    linear-gradient(#5a4a14, #5a4a14) 0 2px / 86px 3px no-repeat,
    linear-gradient(#5a4a14, #5a4a14) 0 18px / 68px 3px no-repeat,
    linear-gradient(#5a4a14, #5a4a14) 0 34px / 78px 3px no-repeat;
  border-radius: 2px;
  opacity: .55;
}

/* ---------- Notepad page (opened menu) ---------- */

.sticky__page,
.sticky__sub {
  font-family: var(--font-hand);
  color: #1d2a4a;
  background:
    linear-gradient(90deg, transparent 34px, rgba(230, 80, 80, .5) 34px 36px, transparent 36px),
    repeating-linear-gradient(180deg, transparent 0 33px, rgba(110, 150, 210, .35) 33px 34px),
    #fffdf4;
  box-shadow: 4px 10px 24px rgba(0, 0, 0, .55);
  border-radius: 2px;
}

.sticky__page {
  position: absolute;
  left: 10px;
  top: 150px;
  width: 250px;
  padding: 18px 16px 14px 46px;
  transform: rotate(-1.5deg);
  transform-origin: top left;
  animation: page-in .3s var(--ease-out);
}

.sticky__page[hidden],
.sticky__sub[hidden] { display: none; }

@keyframes page-in {
  from { opacity: 0; transform: rotate(-6deg) translateY(-14px); }
}

.sticky__page ul { margin: 0; padding: 0; list-style: none; }
.sticky__page li { position: relative; }

.sticky__link {
  display: block;
  width: 100%;
  padding: 0;
  font-family: inherit;
  font-size: 27px;
  line-height: 34px;
  text-align: left;
  text-decoration: none;
  color: inherit;
}

.sticky__link:hover,
.sticky__link:focus-visible {
  color: #b0232f;
  text-decoration: underline wavy rgba(176, 35, 47, .6);
  text-underline-offset: 4px;
  outline: none;
}

.sticky__link--sub::after { content: ' ›'; }
.sticky__link--sub[aria-expanded="true"] { color: #b0232f; }

/* "Jump to" flyout */
.sticky__sub {
  position: absolute;
  left: calc(100% + 26px);
  top: -14px;
  display: flex;
  gap: 22px;
  width: max-content;
  padding: 14px 22px 14px 46px;
  transform: rotate(1deg);
  animation: page-in .25s var(--ease-out);
}

.sticky__col h3 {
  margin: 0;
  font-size: 26px;
  line-height: 34px;
  color: #b0232f;
}

.sticky__col .sticky__link { font-size: 23px; white-space: nowrap; }

/* ---------- Wall note ---------- */

.wall-note {
  left: 92px;
  top: 262px;
  z-index: 10;
  width: 222px;
  padding: 26px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-hand);
  color: #1d2a4a;
  background:
    repeating-linear-gradient(180deg, transparent 0 27px, rgba(110, 150, 210, .3) 27px 28px) 0 64px / 100% calc(100% - 64px) no-repeat,
    linear-gradient(170deg, #fffdf6, #efe8d6);
  box-shadow: 2px 8px 14px rgba(0, 0, 0, .5);
  transform: rotate(2.5deg);
  transition: transform .3s var(--ease-spring), box-shadow .3s;
}

.wall-note:hover {
  transform: rotate(.5deg) scale(1.04);
  box-shadow: 4px 16px 26px rgba(0, 0, 0, .55);
}

.wall-note__pin {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff8a8a, #c41a2a 60%, #6a0a12);
  box-shadow: 2px 4px 4px rgba(0, 0, 0, .5);
}

.wall-note__cta {
  margin: 0 0 6px;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: #b0232f;
}

.wall-note__link {
  font-size: 21px;
  line-height: 28px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.wall-note__link:hover { color: #b0232f; text-decoration: underline; }

/* ---------- Music player (screen space) ---------- */

.player {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 900;
  width: min(340px, calc(100vw - 32px));
  border: 1px solid var(--holo-dim);
  border-radius: 6px;
  background: var(--holo-bg);
  box-shadow: 0 0 24px rgba(110, 243, 255, .25), 0 16px 40px rgba(0, 0, 0, .6);
  overflow: hidden;
  animation: hud-in .3s var(--ease-out);
}

.player[hidden] { display: none; }

.player__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--holo);
}

.player__close { font-size: 22px; line-height: 1; color: var(--holo); padding: 0 4px; }
.player__screen { aspect-ratio: 16 / 9; background: #000; }
.player__screen iframe { width: 100%; height: 100%; border: 0; display: block; }

.item--speaker.is-playing .spk__cone {
  transform-box: fill-box;
  transform-origin: center;
  animation: woofer .23s ease-in-out infinite alternate;
}
.item--speaker.is-playing .spk__led { fill: #45ff8a; filter: drop-shadow(0 0 3px #45ff8a); }
@keyframes woofer { to { transform: scale(1.07); } }

/* ---------- Sound toggle (screen space) ---------- */

.sound-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 900;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--holo);
  background: rgba(8, 10, 20, .7);
  border: 1px solid var(--holo-dim);
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.sound-toggle[aria-pressed="false"] { color: #8a8fa0; border-color: #3a3f50; }
