/* Precious Cargo: 1990s desktop, 16-bit pixel art. Mobile first. */

:root {
  --teal: #008080;
  --gray: #c0c0c0;
  --gray-light: #dfdfdf;
  --gray-dark: #808080;
  --black: #0a0a0a;
  --white: #ffffff;
  --navy: #000080;
  --navy-2: #1084d0;
  --outline: #13204a;
  --pink: #ff7a9c;
  --yellow: #ffd21f;
  --tip: #ffffe1;

  --font-pixel: 'Press Start 2P', 'Courier New', monospace;
  --font-term: 'VT323', 'Courier New', monospace;
  --font-body: Tahoma, Verdana, 'Segoe UI', 'DejaVu Sans', system-ui, sans-serif;

  --raised: inset -1px -1px var(--black), inset 1px 1px var(--white),
            inset -2px -2px var(--gray-dark), inset 2px 2px var(--gray-light);
  --sunken: inset -1px -1px var(--white), inset 1px 1px var(--black),
            inset -2px -2px var(--gray-light), inset 2px 2px var(--gray-dark);

  --taskbar-h: 44px;
  --maxy-size: min(64vw, 250px);
}

*, *::before, *::after { box-sizing: border-box; }

html { overflow-x: clip; }
body {
  margin: 0;
  background: var(--teal);
  color: var(--black);
  font: 17px/1.55 var(--font-body);
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

[hidden] { display: none !important; }

/* ---------- Desktop shell ---------- */

.desktop {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

.site-header {
  text-align: center;
  padding: 20px 16px 4px;
  color: var(--white);
}
.site-title {
  margin: 0;
  font: 400 clamp(17px, 5.2vw, 30px)/1.3 var(--font-pixel);
  letter-spacing: 1px;
  text-shadow: 3px 3px 0 var(--outline);
}
.site-tagline {
  margin: 8px 0 0;
  font: 24px/1 var(--font-term);
  text-shadow: 2px 2px 0 var(--outline);
}

/* ---------- Wallpaper: pixel Baltimore skyline (city.js) ---------- */

.cityscape {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px));
  height: clamp(140px, 25vw, 42vh);
  z-index: 0;
  pointer-events: none;
}
.cityscape svg { display: block; width: 100%; height: 100%; }
.site-header, .stage { position: relative; z-index: 1; }

/* Cyclists ride the promenade; units are skyline pixels (viewBox 480 wide). */
.rider { animation: ride-right 30s linear infinite; }
.rider-left { animation-name: ride-left; }
@keyframes ride-right { from { transform: translateX(-20px); } to { transform: translateX(500px); } }
@keyframes ride-left  { from { transform: translateX(500px); } to { transform: translateX(-20px); } }
.rider .pedal-b { animation: pedal .4s steps(1) infinite; }
.rider .pedal-a { animation: pedal .4s steps(1) infinite reverse; }
@keyframes pedal { 0% { opacity: 0; } 50% { opacity: 1; } }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 14px;
  border: 0;
  border-radius: 0;
  background: var(--gray);
  color: var(--black);
  box-shadow: var(--raised);
  font: 700 16px/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active,
.btn.is-pressed {
  box-shadow: var(--sunken);
  padding: 9px 13px 7px 15px; /* nudge the contents down-right: "pressed in" */
}
.btn:focus-visible,
.maxy:focus-visible,
.tray-btn:focus-visible,
.tb-close:focus-visible,
summary:focus-visible {
  outline: 2px dashed var(--black);
  outline-offset: -6px;
}

a { color: var(--navy); }
a:focus-visible {
  outline: 3px solid var(--outline);
  outline-offset: 2px;
  background: var(--yellow);
}

.skip-intro {
  position: fixed;
  right: 16px;
  bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  z-index: 5;
  min-height: 44px;
  font: 22px/1 var(--font-term);
}
[data-state="menu"] .skip-intro,
[data-state="section"] .skip-intro { display: none; }

/* ---------- Stage layouts ---------- */

.stage {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px 16px;
  display: grid;
  gap: 18px;
  align-content: center;
  justify-items: center;
}

.maxy-slot {
  position: relative;
  view-transition-name: maxy;
}

/* Phone menu: Maxy on top, 2 x 2 grid of big buttons below. */
.menu {
  width: 100%;
  max-width: 520px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.menu-item {
  flex-direction: column;
  gap: 8px;
  padding: 12px 8px;
  text-align: center;
  min-height: 112px;
  animation: menu-pop .35s cubic-bezier(.3, 1.6, .5, 1) backwards;
  animation-delay: calc(var(--i, 0) * 90ms);
}
.menu-item:active { padding: 13px 7px 11px 9px; }
.menu-icon .px-icon { width: 36px; height: auto; display: block; }
.menu-text { display: flex; flex-direction: column; gap: 6px; }
.menu-label { font: 14px/1.2 var(--font-pixel); }
.menu-caption { font: 21px/1 var(--font-term); }

#menu-learn { view-transition-name: m-learn; }
#menu-buy   { view-transition-name: m-buy; }
#menu-about { view-transition-name: m-about; }
#menu-help  { view-transition-name: m-help; }

@keyframes menu-pop {
  from { opacity: 0; transform: scale(.6); }
}

/* Phone section view: compact strip on top (small Maxy + the other three), window below. */
[data-state="section"] .stage {
  grid-template-columns: auto 1fr;
  align-content: start;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
}
[data-state="section"] .maxy-slot { --maxy-size: 76px; grid-column: 1; grid-row: 1; }
[data-state="section"] .menu {
  grid-column: 2; grid-row: 1;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
[data-state="section"] .menu-item {
  min-height: 64px;
  padding: 6px 2px;
  gap: 5px;
  animation: none;
}
[data-state="section"] .menu-item[aria-current="page"] { display: none; }
[data-state="section"] .menu-caption { display: none; }
[data-state="section"] .menu-label { font-size: 10px; }
[data-state="section"] .menu-icon .px-icon { width: 24px; }
[data-state="section"] .window { grid-column: 1 / -1; grid-row: 2; }
[data-state="section"] .site-tagline { display: none; }
[data-state="section"] .site-header { padding-top: 12px; }

/* ---------- Maxy ---------- */

.maxy {
  display: block;
  width: var(--maxy-size);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.maxy-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.maxy-float { animation: bob 2.6s ease-in-out infinite alternate; }
@keyframes bob {
  from { transform: translateY(4px); }
  to   { transform: translateY(-8px); }
}

.maxy-lean {
  transform: translate(var(--lean-x, 0), var(--lean-y, 0)) rotate(var(--tilt, 0deg));
  transition: transform .35s ease-out;
}

.maxy-svg .sprite,
.maxy-svg .face,
.maxy-svg .glow,
.maxy-svg .buckle {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
.maxy-svg .sprite { transform-origin: 50% 100%; }

.maxy-svg .helmet,
.maxy-svg .strap,
.maxy-svg .glow,
.maxy-svg .face,
.maxy-svg .mouth,
.maxy-svg .eyes-happy { display: none; }

.maxy-svg.has-helmet .helmet,
.maxy-svg.has-strap .strap,
.maxy-svg.has-glow .glow,
.maxy-svg.has-face .face { display: inline; }

.maxy-svg[data-mouth="neutral"] .mouth-neutral,
.maxy-svg[data-mouth="smile"] .mouth-smile,
.maxy-svg[data-mouth="big"] .mouth-big { display: inline; }

.maxy-svg[data-eyes="happy"] .eyes-open { display: none; }
.maxy-svg[data-eyes="happy"] .eyes-happy { display: inline; }

.maxy-svg.has-glow .glow { animation: glow-pulse 1.8s ease-in-out infinite alternate; }
@keyframes glow-pulse {
  from { opacity: .55; transform: scale(.96); }
  to   { opacity: 1;   transform: scale(1.04); }
}

/* "Click me" balloon, like an old system-tray tooltip. */
.bubble {
  position: absolute;
  left: 72%;
  top: -2%;
  padding: 6px 12px 4px;
  background: #f4f4f4;
  border: 2px solid var(--black);
  box-shadow: 3px 3px 0 rgba(19, 32, 74, .55);
  font: 26px/1 var(--font-term);
  white-space: nowrap;
  pointer-events: none;
}
.bubble::before,
.bubble::after {
  content: "";
  position: absolute;
  left: 10px;
  border-style: solid;
}
.bubble::before { bottom: -14px; border-width: 14px 14px 0 0; border-color: var(--black) transparent transparent; }
.bubble::after  { bottom: -9px;  left: 12px; border-width: 9px 9px 0 0; border-color: #f4f4f4 transparent transparent; }
.bubble.pop { animation: bubble-pop .3s steps(4) both; }
@keyframes bubble-pop {
  from { opacity: 0; transform: translateY(6px) scale(.8); }
}

/* ---------- Window ---------- */

.window {
  width: 100%;
  max-width: 780px;
  justify-self: stretch;
  background: var(--gray);
  box-shadow: var(--raised);
  padding: 3px;
  view-transition-name: win;
}
.window.opening { animation: win-open .22s steps(5) both; }
@keyframes win-open {
  from { opacity: .3; transform: scale(.94); }
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 2px 3px 2px 6px;
  background: linear-gradient(90deg, var(--navy), var(--navy-2));
  color: var(--white);
  font: 700 15px/1.2 var(--font-body);
}
.titlebar-text {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
}
.titlebar-text span { overflow: hidden; text-overflow: ellipsis; }
.titlebar-text .px-icon { width: 18px; flex: none; }
.titlebar-buttons { display: flex; gap: 2px; flex: none; }

.tb-btn {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 22px;
  padding: 0;
  border: 0;
  background: var(--gray);
  box-shadow: var(--raised);
}
.tb-min::after {   /* _ */
  content: ""; position: absolute; left: 7px; bottom: 6px; width: 8px; height: 2px; background: var(--black);
}
.tb-max::after {   /* [] */
  content: ""; position: absolute; left: 6px; top: 5px; width: 10px; height: 9px;
  border: 1px solid var(--black); border-top-width: 2px;
}
.tb-close {
  width: 32px;
  height: 26px;
  margin-left: 4px;
  cursor: pointer;
}
.tb-close::before,
.tb-close::after {  /* X */
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 14px; height: 3px; background: var(--black);
  transform: translate(-50%, -50%) rotate(45deg);
}
.tb-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.tb-close:active { box-shadow: var(--sunken); }
.tb-close:active::before, .tb-close:active::after { margin: 1px 0 0 1px; }

.window-body {
  margin: 4px 1px 1px;
  padding: 16px 16px 20px;
  background: var(--white);
  box-shadow: var(--sunken);
}
.win-heading {
  margin: 0 0 14px;
  font: 400 clamp(15px, 4.4vw, 21px)/1.5 var(--font-pixel);
  color: var(--navy);
  outline: none;
}
.win-heading:focus-visible { outline: 2px dashed var(--navy); outline-offset: 4px; }

.win-content h3 {
  margin: 26px 0 8px;
  font: 400 13px/1.6 var(--font-pixel);
  color: var(--navy);
}
.win-content p { margin: 0 0 12px; }
.lead {
  font-size: 19px;
  font-weight: 700;
  color: var(--outline);
}

.px-list { list-style: none; margin: 0 0 12px; padding: 0; }
.px-list li { position: relative; padding-left: 22px; margin-bottom: 6px; }
.px-list li::before {
  content: "";
  position: absolute; left: 2px; top: .55em;
  width: 8px; height: 8px;
  background: var(--pink);
  box-shadow: 0 0 0 2px var(--outline);
}

.steps { list-style: none; margin: 4px 0 16px; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.step-num {
  flex: none;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--yellow);
  color: var(--outline);
  box-shadow: inset 0 0 0 2px var(--outline);
  font: 14px/1 var(--font-pixel);
}
.step-title { color: var(--navy); }

.callout {
  padding: 10px 12px;
  background: var(--tip);
  border: 2px solid var(--black);
}

.card {
  display: flex;
  gap: 14px;
  margin: 4px 0 16px;
  padding: 14px;
  background: var(--gray);
  box-shadow: var(--raised);
}
.card-art { flex: none; }
.card-art .px-icon { width: 40px; display: block; }
.card .card-title { margin-top: 0; }
.card-price { font: 26px/1 var(--font-term); color: var(--outline); }
.card-note { font-size: 16px; margin-bottom: 0; }

.cta { margin: 22px 0 6px; }
.cta .btn-go { min-width: 220px; font-size: 17px; }

.btn-go {
  background: var(--yellow);
  color: var(--outline);
}
.btn-go::after { content: "\2192"; font-weight: 700; }

.faq { margin: 8px 0 16px; display: grid; gap: 4px; }
.faq details { background: var(--gray); box-shadow: var(--raised); }
.faq summary {
  list-style: none;
  display: flex; align-items: center; gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "+";
  flex: none;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  background: var(--white);
  border: 1px solid var(--gray-dark);
  font: 16px/1 var(--font-body);
}
.faq details[open] summary::before { content: "\2212"; }
.faq details[open] summary { box-shadow: inset 0 -1px var(--gray-dark); }
.faq details p { margin: 0; padding: 10px 14px 12px; background: var(--white); box-shadow: var(--sunken); }

.sources {
  margin-top: 26px;
  padding-top: 6px;
  border-top: 2px dotted var(--gray-dark);
}
.sources ul { margin: 0; padding-left: 20px; }
.sources li { margin-bottom: 6px; }


.noscript-window { color: var(--black); }

/* ---------- Taskbar ---------- */

.taskbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  height: calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  background: var(--gray);
  box-shadow: inset 0 1px var(--gray-light), inset 0 2px var(--white);
}
.taskbar-home {
  min-height: 36px;
  padding: 4px 10px;
  gap: 8px;
  font-size: 15px;
}
.taskbar-home:active { padding: 5px 9px 3px 11px; }
.taskbar-home-icon .px-icon { width: 20px; display: block; }
.taskbar-home, .tray-btn { white-space: nowrap; }
@media (max-width: 359px) {
  .taskbar-home #taskbar-home-label {   /* icon-only on very narrow phones */
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
  }
}
.taskbar-spacer { flex: 1; }
.tray {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 8px 0 4px;
  box-shadow: inset -1px -1px var(--white), inset 1px 1px var(--gray-dark);
}
.tray-btn {
  min-height: 32px;
  padding: 2px 6px;
  border: 0;
  background: none;
  font: 20px/1 var(--font-term);
  color: var(--black);
  cursor: pointer;
}
.tray-btn[aria-pressed="false"] { color: #444; }
.clock { font: 22px/1 var(--font-term); white-space: nowrap; }

/* ---------- Desktop: corners around Maxy, sidebar when a window is open ---------- */

/* Short landscape phones keep the phone layout. */
@media (min-width: 820px) and (min-height: 560px) {
  :root { --maxy-size: 300px; }

  [data-state="menu"] .stage {
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: 1fr 1fr;
    column-gap: 40px;
    row-gap: 24px;
  }
  [data-state="menu"] .maxy-slot { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  [data-state="menu"] .menu {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    max-width: none;
    grid-template-columns: subgrid;
    grid-template-rows: subgrid;
    pointer-events: none;
  }
  [data-state="menu"] .menu-item {
    pointer-events: auto;
    width: 250px;
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    min-height: 96px;
    padding: 12px 16px;
  }
  [data-state="menu"] .menu-item:active { padding: 13px 15px 11px 17px; }
  [data-state="menu"] .corner-top-left     { grid-column: 1; grid-row: 1; justify-self: end;   align-self: end; }
  [data-state="menu"] .corner-top-right    { grid-column: 3; grid-row: 1; justify-self: start; align-self: end; }
  [data-state="menu"] .corner-bottom-left  { grid-column: 1; grid-row: 2; justify-self: end;   align-self: start; }
  [data-state="menu"] .corner-bottom-right { grid-column: 3; grid-row: 2; justify-self: start; align-self: start; }

  [data-state="section"] .stage {
    grid-template-columns: 230px 1fr;
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: 28px;
    padding-top: 16px;
  }
  [data-state="section"] .maxy-slot { --maxy-size: 170px; grid-column: 1; grid-row: 1; justify-self: center; }
  [data-state="section"] .menu {
    grid-column: 1; grid-row: 2;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  [data-state="section"] .menu-item {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    min-height: 64px;
    padding: 8px 12px;
    gap: 12px;
  }
  [data-state="section"] .menu-item:active { padding: 9px 11px 7px 13px; }
  [data-state="section"] .menu-caption { display: block; font-size: 19px; }
  [data-state="section"] .menu-label { font-size: 12px; }
  [data-state="section"] .menu-icon .px-icon { width: 30px; }
  [data-state="section"] .window { grid-column: 2; grid-row: 1 / span 2; }
  [data-state="section"] .site-tagline { display: block; }

  .window-body { padding: 22px 28px 26px; }
  .card-art .px-icon { width: 72px; }
}

/* ---------- View transitions (slide to the sidebar) ---------- */

::view-transition-group(*) {
  animation-duration: .42s;
  animation-timing-function: cubic-bezier(.3, .9, .3, 1);
}

/* ---------- Reduced motion: no bobbing, no drops, no slides ---------- */

@media (prefers-reduced-motion: reduce) {
  .maxy-float,
  .rider .pedal-a,
  .menu-item,
  .window.opening,
  .bubble.pop,
  .maxy-svg.has-glow .glow { animation: none !important; }
  .maxy-lean { transition: none; transform: none; }
  .rider { animation-play-state: paused !important; }  /* parked mid-ride */
  .rider .pedal-b { display: none; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}
