/*
 * hyd-desktop-settings.css - the Personalise dialog (#desktop-personalise).
 *
 * hyd-desktop.js builds the dialog and its Personalise button; hyd-desktop-settings.js validates and saves what the
 * dialog chooses. This file gives the frame, wallpaper and window pickers, toggles, privacy note and action
 * buttons the same plum Aqua look as the startup intro. The picture-effect options and the selected-wallpaper
 * cards inside the dialog are styled in hyd-desktop-effects.css, and the photo picker in hyd-photo-wallpaper.css.
 */

/* A small system-preferences window for this browser's own desktop. */
#desktop-personalise {
  width: 420px;
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 36px);
  padding: 0;
  border: 1px solid #cab4da;
  border-right-color: #695075;
  border-bottom-color: #574060;
  border-radius: 10px;
  background: #271b32;
  color: #f4eaf9;
  box-shadow:
    0 24px 80px #090311b3,
    0 0 0 1px #0c0710;
  font:
    13px/1.45 'Lucida Grande',
    Tahoma,
    Arial,
    sans-serif;
  overflow: hidden;
}
#desktop-personalise[open] {
  display: flex;
  flex-direction: column;
}
#desktop-personalise::backdrop {
  background: #100a196b;
  backdrop-filter: blur(3px);
}

/* Title bar: an Aqua strip with three lights, the title and a round close button. */
.desktop-personalise-bar {
  position: relative;
  flex: none;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
  border-bottom: 1px solid #685273;
  background: linear-gradient(#f0e4f6, #c7b2d4 45%, #a691b5 49%, #d9c6e6);
  color: #281c32;
  text-shadow: 0 1px #f3eafa;
}
.desktop-personalise-bar h2 {
  margin: 0;
  flex: 1;
  font:
    700 12px 'Lucida Grande',
    Tahoma,
    Arial,
    sans-serif;
}
.personalise-lights {
  display: flex;
  gap: 4px;
}
.personalise-lights i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid #825774;
  background: radial-gradient(at 35% 20%, #fff, #d087b1 45%, #704063);
  box-shadow: 0 1px #f3e8fa;
}
.personalise-lights i:nth-child(2) {
  filter: hue-rotate(35deg);
}
.personalise-lights i:nth-child(3) {
  filter: hue-rotate(250deg);
}
#desktop-personalise .desktop-personalise-bar > button {
  width: 26px;
  height: 26px;
  border: 1px solid #806c8c;
  border-radius: 50%;
  background: linear-gradient(#f2e9fa, #b09bbf);
  color: #2e1e37;
  font: 20px/1 Arial;
  padding: 0;
  box-shadow: inset 0 1px #fff;
}

/* Scrolling body; each section is a fieldset separated from the next by a faint rule. */
.desktop-personalise-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 19px;
  background: repeating-linear-gradient(0deg, transparent 0 2px, #dec8ed04 2px 3px);
}
#desktop-personalise fieldset {
  padding: 0 0 17px;
  border: 0;
  margin: 0 0 16px;
  border-bottom: 1px solid #81688c66;
}
#desktop-personalise legend {
  padding: 0;
  margin-bottom: 11px;
  font-weight: 700;
  font-size: 12px;
  color: #f5e8fa;
}

/* Wallpaper choices: a three-column grid of buttons, each showing a gradient swatch; aria-pressed
   marks the current choice. */
.wallpaper-options > div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
#desktop-personalise .wallpaper-options button {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 7px;
  padding: 7px;
  border: 1px solid #786185;
  border-radius: 6px;
  background: #1c1426;
  color: #e5d5ef;
  font:
    12px 'Lucida Grande',
    Tahoma,
    Arial,
    sans-serif;
  box-shadow: inset 0 1px #c3a4d421;
}
#desktop-personalise .wallpaper-options button[aria-pressed='true'] {
  border-color: #dab6ef;
  background: #574066;
  box-shadow:
    0 0 0 1px #d1a2e8,
    inset 0 1px #f6e8ff33;
}
.wallpaper-swatch {
  display: block;
  width: 100%;
  height: 48px;
  border-radius: 3px;
  border: 1px solid #d6bcdf66;
  box-shadow: inset 0 0 12px #06030d55;
  background:
    radial-gradient(ellipse at 59% 39%, #553068, transparent 70%),
    linear-gradient(145deg, #100b1b, #21142f 62%, #120d20);
}

/* Swatch colours for the dusk and lagoon wallpapers; the base swatch is the plum default. */
.swatch-dusk {
  background:
    radial-gradient(ellipse at 63% 63%, #9c5945, transparent 80%),
    linear-gradient(140deg, #1b1523, #342530 56%, #142835);
}
.swatch-lagoon {
  background:
    radial-gradient(ellipse at 58% 34%, #315e70, transparent 70%),
    linear-gradient(150deg, #0b1421, #143d42 62%, #0a2530);
}

/* The show-on-my-desktop checklist (two columns) and the animation, photo trail and remember toggles. */
#desktop-personalise .window-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
#desktop-personalise .window-options label,
.remember-desktop {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
}
#desktop-personalise input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: #bd90d5;
  flex: none;
  margin: 0;
}
.remember-desktop {
  font-weight: 700;
}
.desktop-privacy {
  font-size: 11px;
  line-height: 1.6;
  margin: 9px 0;
  color: #cab9d4;
}
#desktop-settings-status {
  min-height: 34px;
  font-size: 11px;
  color: #e3c7ef;
  margin: 9px 0 15px;
}

/* Action buttons: Tidy windows and Reset and forget. */
.desktop-preference-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: space-between;
}
#desktop-personalise .desktop-preference-actions button {
  font:
    11px 'Lucida Grande',
    Tahoma,
    Arial,
    sans-serif;
  border: 1px solid #ad8bc1;
  border-radius: 14px;
  padding: 7px 12px;
  min-height: 32px;
  color: #f7edff;
  background: linear-gradient(#7d618d, #4a315e 46%, #392448 49%, #674679);
  box-shadow:
    inset 0 1px #efd7ff55,
    0 2px 3px #0b061166;
}

/* Keyboard focus ring. */
#desktop-personalise button:focus-visible,
#desktop-personalise input:focus-visible {
  outline: 2px solid #edc2f9;
  outline-offset: 3px;
}

/* The Personalise button in the dock: icon size here; on phones the dock tightens and the task list
   scrolls sideways within the viewport width minus 136 px. */
.portal-collage .desktop-taskbar .desktop-personalise-open svg {
  height: 40px;
  width: 40px;
}
@media (max-width: 620px) {
  .portal-collage .desktop-taskbar {
    gap: 1px;
    padding-inline: 4px;
  }
  .portal-collage .desktop-tasks {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: calc(100vw - 136px);
    scrollbar-width: thin;
  }
  .portal-collage .desktop-taskbar .desktop-personalise-open {
    width: 34px;
    flex: none;
  }
  .portal-collage .desktop-taskbar .desktop-personalise-open svg {
    width: 31px;
    height: 34px;
  }
  .desktop-personalise-body {
    padding: 16px;
  }
  .wallpaper-options > div {
    gap: 8px;
  }
  #desktop-personalise .window-options {
    font-size: 12px;
  }
}

/* Open animation, only when motion is allowed: the dialog fades in and rises 6 px over 160 ms. */
@media (prefers-reduced-motion: no-preference) {
  #desktop-personalise[open] {
    animation: desktop-preferences-open 160ms ease-out;
  }
  @keyframes desktop-preferences-open {
    from {
      opacity: 0;
      transform: translateY(6px) scale(0.98);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

/* The Animations toggle (body.motion-off) also turns the open animation off; !important makes the
   off switch absolute. */
body.motion-off #desktop-personalise {
  animation: none !important;
}
