/* Pluto, a pocket pet: the tamagotchi device on the About page board.
   Shell colours reuse the site accents (coral to peach), labels use the
   sparkle colour. Behaviour lives in pluto.js. */

/* ---------- the device ----------
   v2 "glossy plastic": the look is faked with layered gradients and shadows,
   no 3D. Shell = base colour + broad sheen + sharp specular (::before) +
   bounce light from below (::after) + inset rim light. The screen sits in a
   recessed well under a glass layer (.pluto__bezel::after); buttons are domes
   (::after) sitting in sockets (.pluto__btn-cap). v1 is in
   _archive/pluto-v1.css if this needs reverting. */
.pluto {
  --pluto-w: 330px;
  /* colour theme: shell gradient stops, shadow tint (r, g, b), dome colours.
     Themes below override these; the default is the coral-peach shell. */
  --shell-1: #FFD2A0;
  --shell-2: #FCC178;
  --shell-3: #F7907E;
  --shell-4: #F1567F;
  --shell-5: #D9446C;
  --shade: 140, 30, 55;
  --dome-1: #FFF4EE;
  --dome-2: #FFE2D8;
  --dome-3: #F4BBB2;
  --brand: rgba(255, 255, 255, 0.85);
  --label: var(--color-sparkle);
  --lug-1: var(--shell-1);
  --lug-2: var(--shell-2);
  --lug-shade: var(--shade);
  position: relative;
  width: var(--pluto-w);
  max-width: 100%;
  padding-top: 144px; /* room for the key chain */
  transform-origin: 50% 6px; /* sways from the top of the ring (pluto.js) */
  user-select: none;
  -webkit-user-select: none;
}

/* key chain: an eyelet moulded into the top of the shell, a ball chain
   threaded through its hole and a split ring (inline SVG, .pluto__chain) */
.pluto__chain {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -50px;
  pointer-events: none;
  overflow: visible;
}

/* back strand + ring sit behind the eyelet, the front strand drapes over
   the ring's bar and the eyelet and drops into the hole */
.pluto__chain--back { z-index: 1; }
.pluto__chain--front { z-index: 3; filter: drop-shadow(0 1px 0.6px rgba(40, 30, 20, 0.35)); }

.pluto__lug {
  position: absolute;
  z-index: 2; /* over the chain: the chain only shows through the hole */
  top: 120px;
  left: 50%;
  width: 52px;
  height: 46px;
  margin-left: -26px;
  /* a hump that flares out and fades into the shell, so it reads as one
     moulded piece instead of a bump stuck on top */
  border-radius: 50% 50% 0 0 / 64% 64% 0 0;
  background:
    radial-gradient(55% 30% at 38% 16%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, var(--lug-1) 0%, var(--lug-1) 30%, var(--lug-2) 100%);
  box-shadow: inset 0 2px 2px -1px rgba(255, 255, 255, 0.4);
  /* the hole, plus a fade at the bottom where it meets the shell */
  -webkit-mask:
    radial-gradient(circle 5.5px at 50% 14px, transparent 96%, #000 100%),
    linear-gradient(180deg, #000 50%, transparent 78%);
  -webkit-mask-composite: source-in;
  mask:
    radial-gradient(circle 5.5px at 50% 14px, transparent 96%, #000 100%),
    linear-gradient(180deg, #000 50%, transparent 78%);
  mask-composite: intersect;
}

/* rim of the hole: shadow on the upper inner edge, light on the lower lip */
.pluto__lug::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 14px;
  width: 15px;
  height: 15px;
  margin: -7.5px 0 0 -7.5px;
  border-radius: 50%;
  box-shadow:
    inset 0 2px 2px rgba(var(--lug-shade), 0.55),
    inset 0 -1px 1px rgba(255, 255, 255, 0.35);
}

.pluto__shell {
  position: relative;
  isolation: isolate;
  aspect-ratio: 33 / 37;
  border-radius: 50% 50% 46% 46% / 57% 57% 43% 43%;
  background:
    /* broad sheen across the top */
    radial-gradient(90% 55% at 38% 4%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 62%),
    /* soft shade on the right flank */
    radial-gradient(60% 90% at 105% 60%, rgba(var(--shade), 0.24), rgba(var(--shade), 0) 60%),
    linear-gradient(170deg, var(--shell-1) 0%, var(--shell-2) 18%, var(--shell-3) 52%, var(--shell-4) 88%, var(--shell-5) 100%);
  box-shadow:
    /* rim light along the top edge */
    inset 0 3px 2px -1px rgba(255, 255, 255, 0.75),
    inset 6px 0 14px -6px rgba(255, 255, 255, 0.45),
    /* body falls into shadow at the bottom */
    inset 0 -22px 34px -10px rgba(var(--shade), 0.42),
    inset -10px 0 24px -8px rgba(var(--shade), 0.25),
    /* contact + ambient shadow on the board */
    0 2px 3px rgba(var(--shade), 0.18),
    0 24px 40px -14px rgba(var(--shade), 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 52px 46px 36px;
}

/* sharp specular highlight, the "glossy plastic" giveaway */
.pluto__shell::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: 5%;
  left: 17%;
  width: 30%;
  height: 5.5%;
  border-radius: 50%;
  /* thin, soft streak following the curve of the shell */
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.3) 55%, rgba(255, 255, 255, 0));
  transform: rotate(-22deg);
  filter: blur(1.5px);
  opacity: 0.7;
}

/* light bouncing back up from the surface underneath */
.pluto__shell::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: 22%;
  right: 22%;
  bottom: 3%;
  height: 10%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--bounce, 255, 214, 196), 0.55), rgba(var(--bounce, 255, 214, 196), 0));
}

.pluto__brand {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  /* debossed into the plastic */
  color: var(--brand);
  text-shadow: 0 -1px 0 rgba(var(--shade), 0.35), 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* recessed well the screen sits in */
.pluto__bezel {
  position: relative;
  width: 100%;
  background: linear-gradient(180deg, #F3E4DA 0%, #FFF6EE 22%, #FFF8F2 100%);
  border-radius: 28px;
  padding: 12px 12px 10px;
  box-shadow:
    /* depth: shadow cast by the shell's top lip */
    inset 0 5px 8px -2px rgba(var(--shade), 0.38),
    inset 0 -2px 3px rgba(255, 255, 255, 0.9),
    inset 2px 0 4px -2px rgba(var(--shade), 0.18),
    inset -2px 0 4px -2px rgba(var(--shade), 0.18),
    /* lit lower lip + dark upper lip of the opening */
    0 1px 0 1px rgba(255, 255, 255, 0.45),
    0 -1px 0 1px rgba(var(--shade), 0.22);
}

.pluto__screen {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  border-radius: 12px;
  cursor: pointer;
  image-rendering: pixelated;
}

/* glass over the LCD: inner shadow at the rim + a diagonal reflection */
.pluto__bezel::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  width: calc(100% - 24px);
  aspect-ratio: 3 / 2;
  border-radius: 12px;
  pointer-events: none;
  background:
    linear-gradient(128deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.12) 26%, rgba(255, 255, 255, 0) 27%),
    linear-gradient(128deg, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.08) 71%, rgba(255, 255, 255, 0) 82%);
  box-shadow:
    inset 0 3px 6px rgba(40, 20, 10, 0.32),
    inset 0 0 0 1px rgba(40, 20, 10, 0.12);
}

.pluto__status {
  margin: 8px 2px 0;
  min-height: 1.4em;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  color: var(--color-desc);
}

.pluto__buttons {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 26px;
}

/* middle button sits a little lower, like the real thing */
.pluto__btn:nth-child(2) { margin-top: 10px; }

.pluto__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* socket moulded into the shell */
.pluto__btn-cap {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(var(--shade), 0.32), rgba(var(--shade), 0.16) 70%);
  box-shadow:
    inset 0 3px 4px rgba(var(--shade), 0.5),
    inset 0 -1px 1px rgba(255, 255, 255, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.5);
}

/* the dome itself */
.pluto__btn-cap::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, #FFFFFF 0 14%, rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at 50% 40%, var(--dome-1) 0%, var(--dome-2) 58%, var(--dome-3) 100%);
  box-shadow:
    inset 0 -3px 4px rgba(var(--shade), 0.22),
    inset 0 2px 1px rgba(255, 255, 255, 0.9),
    0 3px 2px rgba(var(--shade), 0.35),
    0 5px 8px rgba(var(--shade), 0.22);
  transition: transform 90ms ease, box-shadow 90ms ease;
}

.pluto__btn:hover .pluto__btn-cap::after { transform: translateY(-0.5px); }

.pluto__btn:active .pluto__btn-cap::after,
.pluto__btn.is-pressed .pluto__btn-cap::after {
  transform: translateY(2px);
  box-shadow:
    inset 0 -2px 3px rgba(var(--shade), 0.22),
    inset 0 2px 1px rgba(255, 255, 255, 0.8),
    0 1px 1px rgba(var(--shade), 0.35);
}

.pluto__btn:focus-visible { outline: none; }
.pluto__btn:focus-visible .pluto__btn-cap {
  outline: 2px solid #FFFFFF;
  outline-offset: 2px;
}

.pluto__btn-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* ---------- two-tone themes: white body, Pluto's floppy ears on top ----------
   .pluto__cap is the coloured top of the shell, .pluto__ear--l/r hang off it.
   Both are hidden on the default shell. */
.pluto__cap,
.pluto__ear { display: none; }

.pluto--eared .pluto__shell,
.pluto--capped .pluto__shell { overflow: clip; }

.pluto--eared,
.pluto--capped {
  --lug-1: var(--cap-1);
  --lug-2: color-mix(in srgb, var(--cap-1) 72%, var(--cap-2));
  --lug-shade: var(--cap-shade);
}

.pluto--eared .pluto__cap,
.pluto--capped .pluto__cap {
  display: block;
  position: absolute;
  z-index: -2; /* under the specular highlight, over the body colour */
  top: 0;
  left: 0;
  right: 0;
  height: 19%;
  border-radius: 0 0 50% 50% / 0 0 34% 34%;
  background:
    radial-gradient(70% 90% at 35% 0%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, var(--cap-1), var(--cap-2));
  box-shadow:
    inset 0 -4px 6px -2px rgba(var(--cap-shade), 0.45),
    0 3px 5px -2px rgba(var(--shade), 0.3);
}

.pluto--eared .pluto__ear {
  display: block;
  position: absolute;
  z-index: 0; /* behind the body: only the part outside the egg shows */
  top: 44px;
  width: 66px;
  height: 122px;
  border-radius: 50% 50% 46% 46% / 30% 30% 70% 70%;
  background:
    radial-gradient(60% 35% at 40% 18%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, var(--cap-1) 0%, var(--cap-2) 70%, var(--cap-3) 100%);
  box-shadow:
    inset 0 -10px 16px -4px rgba(var(--cap-shade), 0.5),
    inset 4px 0 8px -4px rgba(255, 255, 255, 0.45),
    0 6px 10px -4px rgba(var(--cap-shade), 0.45);
}

.pluto--eared .pluto__shell { z-index: 1; }
.pluto--eared .pluto__ear--l { left: -12px; transform: rotate(26deg); transform-origin: 80% 8%; }
.pluto--eared .pluto__ear--r { right: -12px; transform: rotate(-26deg) scaleX(-1); transform-origin: 20% 8%; }

/* Pearl & Pluto: white plastic, apricot ears in Pluto's fur colour */
.pluto--pearl-pluto {
  --shell-1: #FFFFFF; --shell-2: #FCFBFC; --shell-3: #F3F0F3; --shell-4: #E4DEE5; --shell-5: #D2CAD4;
  --shade: 95, 75, 100;
  --dome-1: #FFF1EF; --dome-2: #FFCFCB; --dome-3: #EE9C9F;
  --cap-1: #EDB27C; --cap-2: #D0844C; --cap-3: #B96A35; --cap-shade: 120, 60, 25;
  --brand: rgba(255, 255, 255, 0.92);
  --label: #9A7B86;
  --bounce: 255, 255, 255;
}

/* Pearl & Coral: white plastic, coral ears in the site accent */
.pluto--pearl-coral {
  --shell-1: #FFFFFF; --shell-2: #FCFBFC; --shell-3: #F3F0F3; --shell-4: #E4DEE5; --shell-5: #D2CAD4;
  --shade: 95, 75, 100;
  --dome-1: #FFF4EA; --dome-2: #FFDDB5; --dome-3: #F5B57A;
  --cap-1: #FB9E8C; --cap-2: #F1567F; --cap-3: #D63E68; --cap-shade: 150, 30, 60;
  --brand: rgba(255, 255, 255, 0.92);
  --label: #9A7B86;
  --bounce: 255, 255, 255;
}

/* Pearl & Blush: white plastic, blush-pink top matching the buttons */
.pluto--pearl-blush {
  --shell-1: #FFFFFF; --shell-2: #FCFBFC; --shell-3: #F3F0F3; --shell-4: #E4DEE5; --shell-5: #D2CAD4;
  --shade: 95, 75, 100;
  --dome-1: #FFF1EF; --dome-2: #FFCFCB; --dome-3: #EE9C9F;
  --cap-1: #FFD6D6; --cap-2: #F4AEB3; --cap-3: #E68F98; --cap-shade: 170, 70, 90;
  --brand: rgba(255, 255, 255, 0.95);
  --label: #9A7B86;
  --bounce: 255, 255, 255;
}

/* Pearl: all white plastic, pink buttons */
.pluto--pearl {
  --shell-1: #FFFFFF; --shell-2: #FCFBFC; --shell-3: #F3F0F3; --shell-4: #E4DEE5; --shell-5: #D2CAD4;
  --shade: 95, 75, 100;
  --dome-1: #FFF1EF; --dome-2: #FFCFCB; --dome-3: #EE9C9F;
  --brand: rgba(150, 120, 135, 0.55);
  --label: #9A7B86;
  --bounce: 255, 255, 255;
}

/* Butter & Cocoa: warm cream plastic, brown ears */
.pluto--butter-cocoa {
  --shell-1: #FFFBEE; --shell-2: #FFF3D2; --shell-3: #FBE4AE; --shell-4: #F0CF8A; --shell-5: #DDB46C;
  --shade: 140, 95, 40;
  --dome-1: #FFFFFF; --dome-2: #FFF6EA; --dome-3: #EBD7C0;
  --cap-1: #A97955; --cap-2: #7C5236; --cap-3: #5F3D27; --cap-shade: 60, 30, 15;
  --brand: rgba(255, 255, 255, 0.9);
  --label: #8A6236;
  --bounce: 255, 250, 235;
}

@media (max-width: 360px) {
  .pluto__shell { padding: 40px 30px 28px; }
  .pluto__buttons { gap: 18px; }
}
