/* hyd-desktop.css
   The home-page desktop scene (behaviour in hyd-desktop.js): the .desktop-corner section with its
   intro, the .web-desktop surface (wallpaper and icons), the draggable .desktop-window panels
   (#desk-photos, #desk-places, #desk-notes, #desk-stickers, #desk-view) and the taskbar.
   Window offsets come from --wx and --wy (set by the script while dragging); each window colours its
   titlebar through --bar-dark and --bar-light (last block).
   Later blocks restate positions for the same ids on purpose: the last rule wins, so read to the
   end of the file for the final layout. */

/* --- Desktop section: frame and intro --- */
.desktop-corner {
  background: #100b19;
  padding: 35px 27px 24px;
  border-block: 1px solid #6c497b;
}

.desktop-intro {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
  margin: 0 8px 22px;
}

.desktop-intro h2 {
  font: 700 clamp(25px, 3.5vw, 46px)/1 'Space Grotesk';
  letter-spacing: -2px;
  color: #ecdced;
  margin: 0;
}

.desktop-intro p {
  font: 10px/1.6 'IBM Plex Mono';
  color: #b39fc5;
  max-width: 235px;
  margin: 0;
}

/* --- Desktop surface and wallpaper --- */
.web-desktop {
  position: relative;
  height: 626px;
  overflow: hidden;
  isolation: isolate;
  border: 2px solid #9887b0;
  border-right-color: #302138;
  border-bottom-color: #302138;
  box-shadow:
    0 0 0 1px #040108,
    6px 7px #030106;
  background:
    radial-gradient(ellipse at 58% 26%, #45305e66, transparent 75%),
    repeating-linear-gradient(115deg, #171223 0 1px, #22152f 1px 3px);
}

.desktop-wallpaper {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.desktop-wallpaper > span {
  position: absolute;
  right: 20px;
  top: 24px;
  font: bold 40px sans-serif;
  color: #967ba344;
  transform: rotate(3deg);
}

.desktop-wallpaper > b {
  position: absolute;
  right: 8%;
  bottom: 116px;
  font: 700 80px/0.8 'Space Grotesk';
  letter-spacing: -6px;
  color: transparent;
  -webkit-text-stroke: 1px #97749c77;
  transform: rotate(-7deg);
}

.desktop-wallpaper > img {
  position: absolute;
  width: 198px;
  right: 0;
  top: 182px;
  opacity: 0.74;
}

/* --- Desktop icons --- */
.desktop-icons {
  position: absolute;
  left: 13px;
  top: 23px;
  width: 88px;
  display: grid;
  gap: 18px;
  z-index: 3;
}

.desktop-icons > button {
  padding: 0;
  border: 0;
  background: none;
  color: #ead9ef;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-height: 66px;
}

.desktop-icons b {
  font: calc(10 * var(--px))/1.3 'IBM Plex Mono';
  text-shadow: 1px 2px #08040f;
  padding: 2px 4px;
  max-width: 100%;
}

.desktop-icons > button:hover b,
.desktop-icons > button:focus-visible b {
  background: #714d88;
  outline: 1px dotted #dfcee9;
}

.desktop-icons > button:active > span {
  transform: scale(0.9);
}

/* --- Icon art: folders, photo, note, sticker and sound icons drawn in CSS --- */
.folder-art {
  display: flex;
  position: relative;
  width: 51px;
  height: 34px;
  border: 1px solid #d8c9f0;
  border-right: 2px solid #443660;
  border-bottom: 3px solid #554368;
  border-radius: 2px;
  background: linear-gradient(160deg, #bab3e7, #7b70b6 45%, #8074b0 46%, #4d4272);
  align-items: center;
  justify-content: center;
  color: #ead5f0;
  font: 22px Georgia;
  box-shadow: 2px 3px #080510;
  margin-top: 10px;
  transition: transform 0.3s;
}

.folder-art:before {
  content: '';
  position: absolute;
  width: 25px;
  height: 9px;
  left: 0;
  top: -9px;
  background: linear-gradient(#c3b9df, #8c7eac);
  border: 1px solid #cdbfe0;
  border-radius: 3px 7px 0 0;
  z-index: -1;
}

.pink-folder {
  background: linear-gradient(160deg, #df95bf, #a86b9b 45%, #9d577f 46%, #682447);
}

.photo-icon {
  width: 45px;
  height: 42px;
  background: #c9b8d6;
  border: 1px solid white;
  padding: 4px;
  transform: rotate(-9deg);
  box-shadow:
    3px 3px #35293e,
    4px 4px #a894b1;
}

.photo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.note-icon {
  width: 35px;
  height: 42px;
  display: grid;
  place-items: center;
  font: 36px/1 Georgia;
  background: linear-gradient(135deg, #f2e5ef, #a79ab1);
  color: #6b5274;
  border: 1px solid white;
  box-shadow: 4px 4px #171021;
  clip-path: polygon(0 0, 72% 0, 100% 20%, 100% 100%, 0 100%);
}

.sticker-icon {
  font: 49px/0.85 Arial;
  color: #ca679f;
  filter: drop-shadow(2px 2px #c0a4d0);
}

.sound-icon {
  width: 43px;
  height: 43px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 30px/1 Georgia;
  color: #3c2547;
  background: conic-gradient(#eee6ef, #a0b2d0, #ddb7d5, #e3e6c8, #9590b4, #eee6ef);
  border: 1px solid #e5d6ed;
  box-shadow: 3px 3px #090511;
}

/* --- Windows: frame, titlebar and drag handle --- */
.desktop-window {
  position: absolute;
  border: 2px solid #b6a2c7;
  border-right-color: #52405c;
  border-bottom-color: #52405c;
  background: #211528;
  color: #eadbec;
  box-shadow:
    1px 1px 0 #08040c,
    8px 8px #06030b99;
  padding: 3px;
  transform: translate(var(--wx,0px),var(--wy,0px));
  z-index: 4;
  max-width: calc(100% - 24px);
  margin: 0;
  isolation: isolate;
}

/* Script toggles hidden on windows (opening, closing); !important stops any display rule from
   keeping a closed window visible. */
.desktop-window[hidden] {
  display: none !important;
}

.desktop-window.is-front {
  box-shadow:
    1px 1px #08040c,
    10px 10px #05020bbb,
    0 0 0 1px #bd84b9;
}

.desktop-titlebar {
  height: 31px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, #594276, #8b6b9f 78%, #544069);
  padding: 3px;
  gap: 8px;
  user-select: none;
}

.desktop-window.is-front .desktop-titlebar {
  background: linear-gradient(90deg, #6f3b69, #a46791 78%, #634372);
}

.window-grab {
  border: 0;
  background: none;
  color: #fff;
  font: 11px 'IBM Plex Mono';
  padding: 4px 6px;
  text-align: left;
  flex: 1;
  min-width: 0;
  cursor: grab;
  touch-action: none;
}

.window-grab:active {
  cursor: grabbing;
}

.window-grab:disabled {
  opacity: 1;
  cursor: default;
}

.desktop-titlebar > div {
  display: flex;
  gap: 3px;
}

.desktop-titlebar > div > button {
  width: 24px;
  height: 23px;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 1;
  font: 17px Arial;
  background: linear-gradient(#e0d4e5, #9d8fab);
  color: #22162b;
  border: 1px solid #e4d6ec;
  border-right: 2px solid #45324c;
  border-bottom: 2px solid #45324c;
  box-shadow: 1px 1px #201123;
}

/* --- Window contents: menu, photos, folders, links, note and badge --- */
.desktop-menu {
  display: flex;
  gap: 14px;
  font: calc(9 * var(--px)) 'IBM Plex Mono';
  color: #cdbbd9;
  padding: 7px;
  border-bottom: 1px solid #54435f;
}

.desktop-status {
  font: calc(8 * var(--px))/1.4 'IBM Plex Mono';
  color: #b7a1c4;
  padding: 5px 7px;
  border: 1px solid #52405d;
  background: #1a1021;
}

.desk-photos {
  padding: 9px;
  display: grid;
  gap: 8px;
}

.desk-photos button {
  padding: 0;
  border: 0;
  background: #09060f;
  color: #dfcfe8;
  overflow: hidden;
}

.desk-photo-main {
  position: relative;
  width: 100%;
  height: 171px;
}

.desk-photo-main > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.7);
  transition: scale 0.5s;
}

.desk-photo-main:hover > img {
  scale: 1.08;
}

.desk-photo-main > span {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: #160b22d9;
  font: 8px 'IBM Plex Mono';
  padding: 5px;
}

.desk-photos > div {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 7px;
}

.desk-photos > div > button {
  height: 65px;
}

.desk-photos > div > button > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.desk-photos .all-photos {
  font: 9px/1.5 'IBM Plex Mono';
  padding: 6px;
  color: #d1bddc;
  border: 1px solid #7a598a;
}

.all-photos b {
  display: block;
  font: 22px Arial;
}

.folder-address {
  font: 9px 'IBM Plex Mono';
  padding: 8px;
  background: #110c19;
  margin: 7px;
  border: 1px inset #897095;
  color: #baa7c8;
}

.folder-address span {
  color: #e9abcb;
}

.desk-folders {
  display: flex;
  align-items: start;
  justify-content: space-around;
  gap: 12px;
  padding: 23px 12px 16px;
}

.desk-folders > button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font: 11px/1.4 'IBM Plex Mono';
  color: #e3d2ed;
  background: none;
  border: 0;
  max-width: 140px;
  padding: 0;
  text-align: center;
}

.desk-folders > button > small {
  font: 8px 'IBM Plex Mono';
  color: #ab8abd;
}

.desk-folders > button:hover .folder-art {
  transform: translateY(-6px) rotate(-7deg);
}

.desktop-link {
  margin: 5px 7px 10px;
  width: calc(100% - 14px);
  padding: 10px;
  border: 1px solid #7d658c;
  background: #2b1f37;
  color: #e2c9e6;
  font: 10px 'IBM Plex Mono';
  text-align: left;
}

.desk-note {
  position: relative;
  padding: 22px 17px;
  background: linear-gradient(120deg, #361a31, #1e1229);
  overflow: hidden;
  min-height: 217px;
}

.desk-note > b {
  position: relative;
  z-index: 1;
  display: block;
  font: 700 34px/0.99 'Space Grotesk';
  letter-spacing: -1.8px;
  color: #eac8e1;
}

.desk-note > button {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  padding: 5px 0;
  border: 0;
  border-bottom: 1px dotted #ae7bb2;
  font: 9px 'IBM Plex Mono';
  color: #c6acde;
  background: none;
}

.desk-note > svg {
  position: absolute;
  right: -8px;
  bottom: 12px;
  width: 124px;
  height: 110px;
  transform: rotate(-19deg);
  opacity: 0.75;
}

.note-caret {
  position: absolute;
  right: 14px;
  top: 12px;
  color: #ba91c4;
}

.desktop-badge {
  position: absolute;
  bottom: 55px;
  left: 148px;
  transform: rotate(-9deg);
  font: 700 18px/0.98 'Space Grotesk';
  color: #d792b6;
  border: 2px solid #996382;
  border-radius: 50%;
  padding: 22px 25px;
  opacity: 0.8;
  text-align: center;
}

/* --- Default window positions; later blocks adjust them --- */
#desk-photos {
  width: 365px;
  left: 135px;
  top: 44px;
  z-index: 5;
  rotate: -2deg;
}

#desk-places {
  width: 328px;
  right: 57px;
  top: 88px;
  z-index: 6;
  rotate: 2deg;
}

#desk-notes {
  width: 302px;
  left: 41%;
  top: 324px;
  z-index: 7;
  rotate: -3deg;
}

#desk-stickers {
  width: 320px;
  left: 22%;
  top: 173px;
  z-index: 8;
  rotate: 2deg;
}

#desk-stickers .sticker-play {
  padding: 9px;
  background: #1c1127;
}

#desk-stickers .sticker-board {
  height: 188px;
  border: 1px dashed #806088;
}

#desk-stickers .sticker-board > span {
  font-size: 35px;
}

#desk-stickers .sticker-controls {
  gap: 4px;
  margin-top: 9px;
}

#desk-stickers .sticker-controls button {
  padding: 4px;
  min-width: 32px;
}

#desk-stickers .sticker-play > small {
  font-size: calc(8 * var(--px));
  color: #baa5cc;
  display: block;
  margin: 9px 0 2px;
}

/* --- Taskbar --- */
.desktop-taskbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 39px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  background: linear-gradient(#9785a7, #685772 9%, #43334e 50%, #3b2c45);
  border-top: 1px solid #c3b1cd;
}

.desktop-taskbar button {
  color: #eddaef;
  background: linear-gradient(#766383, #3d2d49);
  border: 1px solid #b5a0c2;
  border-right: 2px solid #2b1c34;
  border-bottom: 2px solid #2b1c34;
  font: 9px 'IBM Plex Mono';
  height: 28px;
  padding: 0 9px;
}

.desktop-taskbar button[aria-pressed='true'] {
  background: #281b33;
  border-style: inset;
}

.desktop-taskbar button.is-minimised {
  opacity: 0.65;
}

.desktop-tasks {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow: auto;
}

.desktop-taskbar > span {
  margin-left: auto;
  white-space: nowrap;
  padding: 4px 7px;
  font: 9px 'IBM Plex Mono';
  color: #d1c3d8;
}

/* The reset button is a taskbar button, and .desktop-taskbar button has higher specificity than
   .desk-reset, so its font size needs !important to apply. */
.desk-reset {
  font-size: 14px !important;
  white-space: nowrap;
}

.desk-reset > b {
  font: 10px 'IBM Plex Mono';
}

/* --- Medium screens (up to 1000px) --- */
@media (max-width: 1000px) {
  .web-desktop {
    height: 704px;
  }

  #desk-photos {
    left: 116px;
    top: 30px;
    width: 330px;
  }

  #desk-places {
    right: 24px;
    top: 257px;
    width: 305px;
  }

  #desk-notes {
    left: 126px;
    top: 417px;
    width: 280px;
  }

  .desktop-wallpaper > b {
    font-size: 68px;
    right: 5%;
    bottom: 134px;
  }

  .desktop-badge {
    left: auto;
    right: 20px;
    bottom: 58px;
  }

  .desktop-wallpaper > img {
    width: 162px;
    top: 62px;
  }

  .desktop-wallpaper > span {
    font-size: 29px;
  }

  .desktop-icons {
    gap: 23px;
  }

  .desktop-intro p {
    font-size: 9px;
    max-width: 180px;
  }
}

/* --- Phones (up to 620px): windows stack in normal flow instead of floating --- */
@media (max-width: 620px) {
  .desktop-corner {
    padding: 27px 12px 20px;
  }

  .desktop-intro {
    display: block;
    margin: 0 8px 19px;
  }

  .desktop-intro h2 {
    font-size: 29px;
    letter-spacing: -1.5px;
  }

  .desktop-intro p {
    margin-top: 8px;
    max-width: none;
  }

  .web-desktop {
    height: auto;
    min-height: 600px;
    padding: 111px 12px 76px;
    overflow: hidden;
  }

  .desktop-icons {
    top: 16px;
    left: 8px;
    right: 8px;
    width: auto;
    display: flex;
    justify-content: space-around;
    gap: 4px;
  }

  .desktop-icons > button {
    width: 20%;
    min-height: 66px;
    gap: 8px;
  }

  .desktop-icons b {
    font-size: calc(8 * var(--px));
  }

  .desktop-icons .folder-art {
    width: 37px;
    height: 29px;
  }

  .desktop-icons .photo-icon {
    width: 35px;
    height: 35px;
  }

  .desktop-icons .sound-icon {
    width: 34px;
    height: 34px;
  }

  .desktop-icons .sticker-icon {
    font-size: 41px;
  }

  .desktop-icons .note-icon {
    width: 29px;
    height: 36px;
  }

  /* On phones the windows stack in normal flow, so the drag offset transform (--wx, --wy) must never
     apply, whatever other rules set; hence !important. */
  .desktop-window,
  #desk-photos,
  #desk-places,
  #desk-notes,
  #desk-stickers {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: calc(100% - 15px);
    max-width: none;
    transform: none !important;
    margin: 0 0 23px;
    rotate: -1.5deg;
  }

  #desk-places {
    margin-left: 15px;
    rotate: 1.5deg;
  }

  #desk-notes {
    width: calc(100% - 40px);
    margin-left: 8px;
  }

  #desk-stickers {
    margin-left: 12px;
  }

  .desktop-wallpaper > span {
    display: none;
  }

  .desktop-wallpaper > b {
    font-size: 47px;
    right: 6px;
    bottom: 37px;
  }

  .desktop-badge {
    display: none;
  }

  .desktop-intro h2 {
    color: #e7d3e7;
  }

  .desktop-taskbar {
    height: 40px;
  }

  .desktop-tasks button {
    padding-inline: 6px;
    font-size: 8px;
  }

  .desktop-taskbar > span {
    display: none;
  }

  /* Same specificity reason as the reset button's font size above. */
  .desk-reset {
    padding-inline: 6px !important;
  }

  .desktop-taskbar button {
    height: 29px;
  }

  .window-grab {
    cursor: default;
    touch-action: auto;
  }

  .desk-note {
    min-height: 185px;
  }

  .desk-note > b {
    font-size: 32px;
  }

  .desk-note > svg {
    width: 110px;
    height: 100px;
  }

  .desk-folders {
    padding-top: 17px;
  }
}

/* Reduced motion: the wildcard has lower specificity than the class rules inside the desktop, so
   !important is what makes it cancel their transitions. */
@media (prefers-reduced-motion: reduce) {
  .desktop-corner * {
    scroll-behavior: auto;
    transition: none !important;
  }
}

/* --- Revised layout: restates positions for some of the same ids, and wins by coming later --- */

/* Cascaded windows and a small loose photograph keep the desktop visibly collected. */
#desk-places {
  right: 15%;
  top: 118px;
  width: 350px;
}

#desk-notes {
  left: 43%;
  top: 331px;
  width: 292px;
}

#desk-view {
  left: 148px;
  top: 405px;
  width: 235px;
  rotate: 4deg;
  z-index: 7;
}

.desktop-sky {
  display: block;
  padding: 6px;
  border: 0;
  background: #201029;
  width: 100%;
  color: #e0c4dd;
}

.desktop-sky img {
  width: 100%;
  height: 112px;
  object-fit: cover;
  display: block;
}

.desktop-sky span {
  display: block;
  font: italic calc(17 * var(--px))/1.4 Georgia;
  margin: 5px 0;
}

.desktop-icons {
  gap: 12px;
}

.desktop-icons .sky-desktop-icon {
  display: flex;
}

.desktop-badge {
  left: auto;
  right: 35px;
  bottom: 62px;
}

.desktop-wallpaper > img {
  right: 18px;
  top: 220px;
}

.desktop-window.is-dragging {
  rotate: 0deg;
}

/* Revised layout, medium screens. */
@media (max-width: 1000px) {
  #desk-places {
    right: 24px;
    top: 241px;
    width: 305px;
  }

  #desk-notes {
    left: 116px;
    top: 421px;
    width: 280px;
  }

  #desk-view {
    right: 20px;
    left: auto;
    top: 512px;
    width: 176px;
  }

  .desktop-sky img {
    height: 81px;
  }

  .desktop-sky span {
    font-size: calc(13 * var(--px));
  }

  .desktop-badge {
    display: none;
  }
}

/* Revised layout, phones. */
@media (max-width: 620px) {
  #desk-places,
  #desk-notes,
  #desk-view {
    position: relative;
    right: auto;
    top: auto;
    left: auto;
    width: calc(100% - 15px);
    margin-bottom: 23px;
  }

  #desk-places {
    margin-left: 15px;
  }

  #desk-notes {
    width: calc(100% - 40px);
    margin-left: 8px;
  }

  #desk-view {
    width: 75%;
    margin-left: 17%;
    rotate: 3deg;
  }

  .desktop-sky img {
    height: 130px;
  }

  .desktop-icons {
    gap: 4px;
  }

  .desktop-icons > button {
    width: 16.666%;
  }

  .desktop-taskbar .desk-reset > b {
    display: none;
  }
}

/* --- Per-window titlebar colours --- */
#desk-photos {
  --bar-dark: #302e68;
  --bar-light: #7270b1;
  background: #16182d;
}

#desk-places {
  --bar-dark: #5e2a63;
  --bar-light: #a1699b;
}

#desk-notes {
  --bar-dark: #652236;
  --bar-light: #a45972;
}

#desk-view {
  --bar-dark: #244b52;
  --bar-light: #5f9696;
  background: #14252c;
}

#desk-stickers {
  --bar-dark: #544129;
  --bar-light: #9a8570;
}

/* Titlebars read the per-window colours above; windows behind the front one are slightly desaturated. */
.desktop-window .desktop-titlebar,
.desktop-window.is-front .desktop-titlebar {
  background: linear-gradient(90deg,var(--bar-dark),var(--bar-light));
}

.desktop-window:not(.is-front) .desktop-titlebar {
  filter: saturate(0.75);
}
