:root {
  --ink: #e8f4f8;
  --ink-dim: #8ea6b4;
  --deep: #04070c;
  --line: rgba(140, 220, 245, 0.16);
  --glow: #7df9ff;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--deep);
  color: var(--ink);
  cursor: crosshair;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#water, #veil {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#water { z-index: 0; }

#veil {
  z-index: 1;
  background: var(--deep);
  opacity: 0.28;
  transition: opacity 0.35s ease;
}

/* Held back so the ship is still visible going under as the panel rises. */
body.is-open #veil { opacity: 0.82; transition-delay: 0.95s; }

/* The stage floats over the sea; only its controls take clicks, so the rest of
   the screen stays available for hitting ships. */
#stage {
  position: fixed;
  inset: 0;
  z-index: 2;
  padding: 8vh 6vw 0;
  pointer-events: none;
}

#stage a, #stage button { pointer-events: auto; }

#stage, #credit { transition: opacity 0.35s ease; }
body.is-open #stage, body.is-open #credit { opacity: 0.18; transition-delay: 0.95s; }

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--glow);
  opacity: 0.75;
  margin-bottom: 22px;
}

h1 {
  font-size: clamp(2.6rem, 9vw, 7.5rem);
  font-weight: 700;
  line-height: 0.86;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

h1 span {
  display: block;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(215, 245, 255, 0.55);
}

/* Sits against the right edge so the left column stays short and the water
   below it has more open space. */
.lede {
  position: absolute;
  top: 8vh;
  right: 6vw;
  width: min(34ch, 30vw);
  margin: 0;
  text-align: right;
  color: var(--ink-dim);
  font-size: 1rem;
}

.contact { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px; }

.pill, .contact a, .contact button, #nav button {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  text-decoration: none;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, box-shadow 0.25s;
}

.contact a:hover, .contact button:hover, #nav button:hover,
.contact a:focus-visible, .contact button:focus-visible, #nav button:focus-visible {
  color: var(--glow);
  border-color: var(--glow);
  box-shadow: 0 0 24px rgba(125, 249, 255, 0.22);
}

#nav {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 30px;
}

#nav a {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: none;
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

#nav a:hover { color: var(--ink); }
#nav a.is-active { color: var(--glow); border-bottom-color: var(--glow); }

#credit {
  position: fixed;
  left: 6vw;
  bottom: 3vh;
  z-index: 2;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(142, 166, 180, 0.55);
  pointer-events: none;
}

#playToggle {
  position: fixed;
  right: 4vw;
  bottom: 3vh;
  z-index: 3;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: rgba(6, 14, 22, 0.55);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

#playToggle:hover, #playToggle:focus-visible {
  color: var(--glow);
  border-color: var(--glow);
}

#playToggle[aria-pressed="true"] {
  color: var(--glow);
  border-color: var(--glow);
  box-shadow: 0 0 24px rgba(125, 249, 255, 0.25);
}

/* The intro text describes opening projects, which play mode does not do. */
body.is-playing .lede { display: none; }

/* Centred in the empty sky just above the height the planes fly at. */
#score {
  position: fixed;
  top: 53%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 20px;
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: rgba(6, 14, 22, 0.55);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

#score[hidden] { display: none; }

#score b {
  color: var(--glow);
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  margin-right: 6px;
}

#waveBanner {
  position: fixed;
  top: 70%;
  left: 0;
  right: 0;
  z-index: 3;
  text-align: center;
  font-family: var(--mono);
  font-size: clamp(18px, 4vw, 34px);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--glow);
  pointer-events: none;
  animation: waveIn 2s ease both;
}

@keyframes waveIn {
  0% { opacity: 0; transform: scale(0.9); }
  15% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

#gameOver {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
}

#gameOver[hidden] { display: none; }

#gameOver .sheet {
  animation: surface 0.4s ease both;
  text-align: center;
  width: min(520px, 100%);
  padding: 46px clamp(28px, 5vw, 56px) 48px;
}

#gameOver .sheet__title {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--ink);
  margin-bottom: 32px;
}

#gameOverText {
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1.5;
}

#gameOverAccuracy {
  margin-top: 26px;
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1.5;
}

#gameOverAccuracy span {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

#gameOver b { color: var(--glow); font-size: 1.5em; font-weight: 700; }

.gameOver__buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 40px;
}

.gameOver__buttons button {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  padding: 11px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, box-shadow 0.25s;
}

.gameOver__buttons button:hover,
.gameOver__buttons button:focus-visible {
  color: var(--glow);
  border-color: var(--glow);
  box-shadow: 0 0 24px rgba(125, 249, 255, 0.22);
}

/* Fullscreen panels */

#entry, #index, #entry *, #index * { cursor: auto; }
#entry button, #index button, #entry a, #index a { cursor: pointer; }

#entry, #index {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
  overflow-y: auto;
}

#entry[hidden], #index[hidden] { display: none; }

#index .sheet { animation: surface 0.4s ease both; }

/* The list stays open behind an entry, recessed so the two do not compete. */
#index { transition: opacity 0.3s ease; }
body.entry-open #index { opacity: 0.25; }

@keyframes surface {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}

/* The panel leaves the sunk hull small and slow, holds there, then comes
   forward to full size. */
.entry__inner { animation: fromShip 1.7s linear both; }

@keyframes fromShip {
  0% {
    opacity: 0;
    transform: translate(var(--fx, 0px), var(--fy, 0px)) scale(0.01);
    animation-timing-function: ease-out;
  }
  9% { opacity: 1; }
  42% {
    transform: translate(var(--fx, 0px), calc(var(--fy, 0px) - 72px)) scale(0.1);
    animation-timing-function: linear;
  }
  62% {
    transform: translate(var(--fx, 0px), calc(var(--fy, 0px) - 92px)) scale(0.13);
    animation-timing-function: cubic-bezier(0.5, 0, 0.2, 1);
  }
  100% {
    opacity: 1;
    transform: translate(0px, 0px) scale(1);
  }
}

#entry .close { animation: surface 0.35s ease 1.35s both; }

body.is-quick #entry .entry__inner { animation: quickOpen 0.28s ease both; }
body.is-quick #entry .close { animation: surface 0.25s ease 0.08s both; }
body.is-quick.is-open #veil,
body.is-quick.is-open #stage,
body.is-quick.is-open #credit { transition-delay: 0s; }

@keyframes quickOpen {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.close {
  position: fixed;
  top: 3vh;
  right: 4vw;
  z-index: 11;
  width: 46px;
  height: 46px;
  font-size: 24px;
  line-height: 1;
  color: var(--ink);
  background: rgba(6, 14, 22, 0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.close:hover, .close:focus-visible { color: var(--glow); border-color: var(--glow); }

.entry__inner {
  width: min(820px, 100%);
  background: rgba(6, 14, 22, 0.72);
  border: 1px solid var(--line);
  border-radius: 6px;
  backdrop-filter: blur(18px);
  overflow: hidden;
}

/* Never enlarged past its own pixel dimensions: several of these images are
   only 120 pixels wide and go soft when stretched. */
#entryImage {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 46vh;
  margin: clamp(20px, 3vw, 34px) auto 0;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.entry__body { padding: 28px clamp(24px, 4vw, 48px) 44px; }

#entryTitle {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

#entryTitle a { color: var(--ink); border-bottom: 2px solid var(--glow); }
#entryTitle a:hover { color: var(--glow); }

#entryText { color: var(--ink-dim); font-size: 1.05rem; max-width: 68ch; }
#entryText p + p { margin-top: 14px; }
#entryText ul { margin: 14px 0 0 1.2em; }

a { color: var(--glow); text-decoration: none; }
#entryText a { border-bottom: 1px solid rgba(125, 249, 255, 0.35); }

.sheet {
  width: min(640px, 100%);
  background: rgba(6, 14, 22, 0.78);
  border: 1px solid var(--line);
  border-radius: 6px;
  backdrop-filter: blur(18px);
  padding: 34px clamp(22px, 4vw, 40px) 38px;
}

.sheet__title {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--glow);
  margin-bottom: 20px;
}

#indexList {
  list-style: none;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 249, 255, 0.35) transparent;
}

#indexList::-webkit-scrollbar { width: 6px; }
#indexList::-webkit-scrollbar-track { background: transparent; }

#indexList::-webkit-scrollbar-thumb {
  background: rgba(125, 249, 255, 0.3);
  border-radius: 999px;
}

#indexList::-webkit-scrollbar-thumb:hover { background: rgba(125, 249, 255, 0.55); }

#indexList button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 9px 0;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(140, 220, 245, 0.1);
  cursor: pointer;
  transition: color 0.2s, padding-left 0.2s;
}

#indexList img {
  flex: none;
  width: 56px;
  height: 34px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 3px;
  filter: saturate(0.85);
  transition: filter 0.2s, border-color 0.2s;
}

#indexList button:hover img,
#indexList button:focus-visible img {
  filter: none;
  border-color: rgba(125, 249, 255, 0.5);
}

#indexList button:hover, #indexList button:focus-visible {
  color: var(--glow);
  padding-left: 10px;
}

:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }

@media (max-width: 720px) {
  #stage { padding: 6vh 7vw 0; }
  .lede {
    position: static;
    width: auto;
    text-align: left;
    margin-top: 20px;
    font-size: 0.95rem;
  }
  .contact { margin-top: 20px; }
  #nav { margin-top: 24px; gap: 16px; flex-wrap: wrap; }
  #entryImage { max-height: 32vh; }

  /* Clears the play button, which is wide enough to reach across on a phone. */
  #credit { bottom: 9.5vh; font-size: 9px; }
}

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