@font-face {
  font-family: "Departure Mono";
  src: url("assets/fonts/DepartureMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  color-scheme: light;
  --sky: #7ebcf3;
  --ink: #5a2244;
  --dim: #8f5676;
  --face: #ffe4ee;
  --soft: #fff3f8;
  --shade: #eda4c4;
  --rose: #f0609a;
  --window: inset -2px -2px 0 var(--ink), inset 2px 2px 0 var(--soft), inset -4px -4px 0 var(--shade), inset 4px 4px 0 #fff;
  --raised: inset -2px -2px 0 var(--ink), inset 2px 2px 0 #fff, inset -4px -4px 0 var(--shade), inset 4px 4px 0 var(--soft);
  --pressed: inset -2px -2px 0 #fff, inset 2px 2px 0 var(--ink), inset -4px -4px 0 var(--soft), inset 4px 4px 0 var(--shade);
  --sunken: inset -2px -2px 0 #fff, inset 2px 2px 0 var(--shade), inset -4px -4px 0 var(--soft), inset 4px 4px 0 var(--ink);
  --field: inset -2px -2px 0 #fff, inset 2px 2px 0 var(--shade);
  --sheet: 1152px 144px;
  --perch: 144px;
  --arrow: url("assets/cursors/arrow.png") 0 0, default;
  --hand: url("assets/cursors/hand.png") 10 0, pointer;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-height: 100%;
  background: var(--sky);
  cursor: var(--arrow);
}

body {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0;
  min-height: 100dvh;
  padding: 12px;
  color: var(--ink);
  font: 400 22px/1.5 "Departure Mono", ui-monospace, monospace;
  -webkit-font-smoothing: none;
  font-smooth: never;
  font-synthesis: none;
  image-rendering: pixelated;
}

::selection { background: var(--rose); color: #fff; }

button { font: inherit; }

/* sky: the strips are the still picture, site.js draws the moving one on the canvas */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    url("assets/bank-front.png") 0 100% / 1024px 160px repeat-x,
    url("assets/bank-back.png") 0 100% / 896px 224px repeat-x,
    url("assets/sky.png") 0 100% / 8px 1080px repeat-x,
    var(--sky);
}

html.is-live .sky { background: url("assets/sky.png") 0 100% / 8px 1080px repeat-x, var(--sky); }

.sky canvas {
  position: absolute;
  left: 0;
  bottom: 0;
  display: block;
}

.ico {
  display: block;
  flex: none;
  width: 32px;
  height: 32px;
  background: url("assets/sprites.png") calc(var(--n, 0) * -32px) 0 / var(--sheet) no-repeat;
}

/* window */

main {
  display: grid;
  justify-items: center;
  width: 100%;
}

.win {
  position: relative;
  width: min(100%, 456px);
  margin-top: var(--perch);
  padding: 8px;
  background: var(--face);
  box-shadow: var(--window), 8px 8px 0 rgb(90 34 68 / .22);
}

html.is-ready .win { animation: snap-in 220ms steps(2, end) both; }

.win-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 4px 0 2px;
  color: #fff;
  background: linear-gradient(90deg,
    #d6457f 0 12.5%, #dc5289 0 25%, #e25f93 0 37.5%, #e86b9d 0 50%,
    #ee78a7 0 62.5%, #f385b0 0 75%, #f991ba 0 87.5%, #ff9ec4 0);
  white-space: nowrap;
  user-select: none;
}

.win-title {
  flex: 1;
  min-width: 0;
  line-height: 36px;
  text-shadow: 2px 2px 0 #9c2c62;
}

.win-close {
  flex: none;
  width: 32px;
  height: 28px;
  padding: 0;
  border: 0;
  background: var(--face) url("assets/sprites.png") -128px -2px / var(--sheet) no-repeat;
  box-shadow: var(--raised);
  cursor: var(--arrow);
  touch-action: manipulation;
}

.win-close:active {
  background-position: -126px 0;
  box-shadow: var(--pressed);
}

.win-close:focus-visible {
  outline: 2px dotted #fff;
  outline-offset: 2px;
}

.view {
  margin-top: 8px;
  padding: 26px 12px 22px;
  background: repeating-conic-gradient(#fff 0 25%, #fff1f6 0 50%) 0 0 / 32px 32px;
  box-shadow: var(--sunken);
  text-align: center;
}

h1 {
  margin: 0;
  color: var(--rose);
  font-size: 88px;
  font-weight: 400;
  line-height: 1;
  text-shadow: 4px 4px 0 #ffc4da;
}

h1 small {
  display: block;
  margin-top: 12px;
  color: var(--dim);
  font-size: 22px;
  line-height: 34px;
  text-shadow: none;
}

.links {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 52px;
  padding: 0 16px 0 10px;
  border: 0;
  color: var(--ink);
  background: var(--face);
  box-shadow: var(--raised);
  line-height: 32px;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: var(--hand);
  touch-action: manipulation;
}

.btn:hover { background: #fff; }

.btn:active {
  padding: 2px 14px 0 12px;
  box-shadow: var(--pressed);
}

.btn:focus-visible {
  outline: 2px dotted var(--ink);
  outline-offset: -10px;
}

.who {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.statusbar {
  display: flex;
  padding-top: 6px;
}

.status-text {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  overflow: hidden;
  line-height: 34px;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-shadow: var(--field);
}

/* the two visitors: one climbing up behind the top edge, one sat over the close button */

.climber,
.sitter {
  position: absolute;
  pointer-events: none;
}

.climber img,
.sitter img { display: block; }

.climber {
  left: 8px;
  bottom: 100%;
  width: 112px;
  height: 104px;
}

.peek {
  display: block;
  height: 100%;
  overflow: hidden;
}

.peek img { animation: climb 7s step-end infinite; }

@keyframes climb {
  0% { transform: translateY(72px); }
  10% { transform: translateY(48px); }
  20% { transform: translateY(24px); }
  30% { transform: translateY(0); }
  84% { transform: translateY(16px); }
  89% { transform: translateY(44px); }
  94% { transform: translateY(72px); }
}

.grip {
  position: absolute;
  left: 6px;
  bottom: -12px;
}

.grip:last-child {
  left: auto;
  right: 6px;
}

.sitter {
  right: -8px;
  bottom: calc(100% - 18px);
}

.bubble {
  position: absolute;
  top: 24px;
  right: calc(100% - 14px);
  margin: 0;
  padding: 6px 12px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 0 0 2px var(--ink), 4px 4px 0 2px rgb(90 34 68 / .22);
  line-height: 34px;
  white-space: nowrap;
}

.bubble::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -2px;
  width: 2px;
  height: 2px;
  background: var(--ink);
  box-shadow:
    2px 0 #fff, 4px 0 #fff, 6px 0 #fff, 8px 0 #fff, 10px 0 var(--ink),
    2px 2px var(--ink), 4px 2px #fff, 6px 2px #fff, 8px 2px #fff, 10px 2px var(--ink),
    4px 4px var(--ink), 6px 4px #fff, 8px 4px #fff, 10px 4px var(--ink),
    6px 6px var(--ink), 8px 6px #fff, 10px 6px var(--ink),
    8px 8px var(--ink), 10px 8px var(--ink);
  transform: rotate(-90deg);
}

.panic,
.win:has(.win-close:hover) .calm,
.win:has(.win-close[hidden]) .bubble { display: none; }

.win:has(.win-close:hover) .panic { display: inline; }

/* what is left on the sky when the window is closed */

.shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: none;
  line-height: 26px;
  cursor: var(--hand);
}

.shortcut span:last-child {
  padding: 0 6px;
  background: #fff;
}

.shortcut:hover span:last-child {
  color: #fff;
  background: var(--ink);
}

.shortcut:focus-visible { outline: 0; }

.shortcut:focus-visible span:last-child {
  outline: 2px dotted var(--ink);
  outline-offset: 2px;
}

/* sits on the white of the cloud bank */

.credit {
  position: absolute;
  right: 12px;
  bottom: 8px;
  line-height: 34px;
}

.credit a {
  color: inherit;
  text-decoration: none;
  box-shadow: 0 2px 0 currentColor;
  cursor: var(--hand);
}

.credit a:hover {
  color: #fff;
  background: var(--ink);
}

.credit a:focus-visible {
  outline: 2px dotted var(--ink);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes snap-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (pointer: fine) and (min-width: 700px) {
  .win-bar { touch-action: none; }
}

/* the window reaches the corner here, so keep a strip free under it for the credit */
@media (max-width: 700px) {
  body { padding-bottom: 50px; }
}

@media (max-width: 480px) {
  :root { --perch: 188px; }

  .bubble {
    top: auto;
    right: 14px;
    bottom: calc(100% - 4px);
  }

  .bubble::after {
    top: 100%;
    right: 52px;
    transform: none;
  }
}

@media (max-width: 380px) {
  .where {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .who { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
