:root {
  --ink: #1d2b3a;
  --ink-soft: #4d6273;
  --backdrop: rgba(240, 248, 253, .72);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: #1f7fbf;
  -webkit-font-smoothing: antialiased;
}

/* One screen: sky above, the projects swimming below. */
.hero {
  position: relative;
  height: 100svh;
  min-height: 320px;
  overflow: hidden;
  background: #cfe9f7;
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.fish { cursor: pointer; outline: none; }
.fish .ring { opacity: 0; }
.fish:focus-visible .ring { opacity: 1; }

.intro {
  position: absolute;
  top: clamp(16px, 5vh, 56px);
  left: 0;
  right: 0;
  padding: 0 16px;
  text-align: center;
  pointer-events: none;
}

.home { transition: opacity .5s ease, transform .5s ease; }

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(29, 43, 58, .14);
  object-fit: cover;
}

h1, h2 {
  margin: 10px 0 4px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.05;
}

h1 { font-size: clamp(1.6rem, min(6vw, 7vh), 3.8rem); }
h2 { margin-top: 0; font-size: clamp(1.5rem, min(4vw, 6vh), 2.6rem); }

/* Phones on their side: a smaller header leaves room for the sea. */
@media (max-height: 500px) {
  .intro { top: 10px; }
  .avatar { width: 44px; height: 44px; }
  h1 { margin-top: 4px; }
}

/* With scripts on, the name waits for the cast. */
.js .home > * {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .8s ease, transform .8s ease;
}
.js .home > h1 { transition-delay: .15s; }
.js.cast .home > * { opacity: 1; transform: none; }

/* What a caught fish is, beside it while the penguin holds it up (or above it on narrow screens).
   scene.js sets its place; the name steps aside meanwhile. */
.catch {
  position: absolute;
  left: 0;
  top: 0;
  width: 360px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .4s ease, visibility .4s;
  pointer-events: none;
  isolation: isolate;
}
/* A soft patch of sky behind the words, so they read over the rays, clouds and stars. */
.catch::before {
  content: '';
  position: absolute;
  inset: -70px -90px;
  z-index: -1;
  background: radial-gradient(farthest-side, var(--backdrop) 62%, transparent);
}
.catch.above { text-align: center; }
.caught .home { opacity: 0; transform: translateY(-8px); }
.caught .catch { opacity: 1; visibility: visible; }
.caught .catch > * { pointer-events: auto; }

#catchAbout {
  margin: 6px 0 0;
  font-size: clamp(.95rem, 1.6vw, 1.1rem);
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink-soft);
}

.actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
}
.above .actions { justify-content: center; }

.visit {
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.visit:hover { background: #2c4157; }

.soon {
  font-weight: 700;
  color: var(--ink-soft);
}

.release {
  padding: 4px 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.visit:focus-visible, .release:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.tip {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  white-space: nowrap;
  text-shadow: 0 1px 8px rgba(10, 50, 80, .5);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
}
.tip.on { opacity: 1; }

/* Without scripts there are no fish, so the projects show as a list. */
.projects {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 56px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
  color: #fff;
  text-align: center;
}
.projects a { color: #fff; }
.projects span { display: block; opacity: .8; }
.js .projects { display: none; }

/* ------- Skip the fishing (list.js): the fish swim off and the projects show as a list in the water ------- */
.mode {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--backdrop);
  color: var(--ink);
  font: inherit;
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform .15s ease;
}
.js .mode { display: inline-flex; }
.mode:hover { transform: translateY(-1px); }
.mode:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.mode svg { width: 18px; height: 18px; flex: none; }
.mode .to-fish, .listing .mode .to-list { display: none; }
.listing .mode .to-fish { display: block; }

#fishes { transition: opacity .6s ease; }
.listing #fishes { opacity: 0; pointer-events: none; }
.listing .tip { display: none; }
#waves { transition: opacity .6s ease; }
.listing #waves { opacity: .3; }

/* The scene keeps its size, and below it the page carries on in the same deep water (sky.js sets --deep). */
.listing .hero { height: auto; min-height: max(100svh, 320px); background: var(--deep, #2f95d1); }
.listing .scene { height: max(100svh, 320px); }
.js.listing .projects {
  display: block;
  position: relative;
  inset: auto;
  z-index: 2;
  isolation: isolate;
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--water, 55svh) + clamp(40px, 10vh, 96px)) 16px 0;
  text-align: left;
}
/* A soft patch of deeper water behind the words */
.listing .projects::before {
  content: '';
  position: absolute;
  z-index: -1;
  left: -12%;
  right: -12%;
  top: calc(var(--water, 55svh) + 4px);
  bottom: -40px;
  background: radial-gradient(farthest-side, rgba(6, 36, 72, .32) 55%, transparent);
  pointer-events: none;
}
.listing .projects li {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 2px 18px;
  align-items: start;
  padding: 16px 4px;
}
.listing .projects li + li { border-top: 1px solid rgba(255, 255, 255, .18); }
.projects .icon {
  grid-row: span 2;
  width: 56px;
  height: 56px;
  border-radius: 23%;
  box-shadow: 0 8px 16px -6px rgba(4, 28, 58, .45);
  transition: transform .25s ease;
}
.listing .projects a { text-decoration: none; }
/* The whole row is the link. */
.listing .projects a::after { content: ''; position: absolute; inset: 0; border-radius: 14px; }
.listing .projects a:focus-visible { outline: none; }
.listing .projects a:focus-visible::after { outline: 3px solid #fff; outline-offset: 2px; }
.listing .projects strong { font-size: 1.2rem; font-weight: 800; line-height: 1.3; }
.listing .projects span { font-size: 1rem; line-height: 1.45; opacity: .85; text-wrap: pretty; }
.listing .projects li:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.listing .projects li:hover .icon { transform: rotate(-6deg) scale(1.05); }

.hello { display: none; }
.listing .hello {
  display: block;
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 26px 16px 72px;
  color: rgba(255, 255, 255, .8);
  font-weight: 700;
  text-align: center;
}
.hello a { color: #fff; }

@media (prefers-reduced-motion: reduce) {
  #fishes, #waves, .mode, .projects .icon { transition: none; }
}

footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  color: rgba(255, 255, 255, .6);
  font-size: .8rem;
  font-weight: 600;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .home, .catch, .js .home > * { transition: none; }
}

/* Above the prize on narrow screens, kept compact so it clears the fish. */
.above #catchAbout { margin-top: 4px; }
.above .actions { margin-top: 12px; }

/* At night the text turns light against the dark sky (sky.js sets .night). */
.night {
  --ink: #eef3f8;
  --ink-soft: #b9c8d6;
  --backdrop: rgba(14, 24, 46, .7);
}
.night .visit { background: #eef3f8; color: #1d2b3a; }
.night .visit:hover { background: #fff; }

#bottle { cursor: pointer; outline: none; }
#bottle:focus-visible #bottleBody { stroke: #fff; stroke-width: 2; }

/* The note from the bottle: a slip of paper over the sky, light even at night. */
.note {
  position: absolute;
  left: 50%;
  top: clamp(16px, 8vh, 90px);
  width: min(380px, calc(100% - 32px));
  padding: 22px 24px 20px;
  border-radius: 6px;
  background: #fffaf0;
  color: #1d2b3a;
  box-shadow: 0 10px 34px rgba(10, 40, 70, .22);
  transform: translateX(-50%) rotate(-1.5deg) scale(.92);
  transform-origin: var(--from, 80% 100%);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, transform .35s ease, visibility .35s;
}
.note-open .note { opacity: 1; visibility: visible; transform: translateX(-50%) rotate(-1.5deg); }
.note-open .home { opacity: 0; transform: translateY(-8px); }
.note p { margin: 0 0 8px; font-weight: 600; line-height: 1.45; color: #4d6273; }
.note .note-hi { font-size: 1.6rem; font-weight: 800; color: #1d2b3a; margin-bottom: 4px; }
.note .note-email { font-weight: 800; color: #1d2b3a; word-break: break-all; }
.note .visit { background: #1d2b3a; color: #fff; }
.note .release { color: #4d6273; }
.note .actions { margin-top: 14px; }
.note-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  color: #8a9aa8;
  cursor: pointer;
}
