:root {
  color-scheme: dark;
  --bg: #06110f;
  --panel-strong: #102928;
  --line: #8fcfc3;
  --line-soft: rgba(143, 207, 195, 0.24);
  --text: #e5f7f1;
  --muted: #9bbdb4;
  --accent: #f2c879;
  --coral: #e89ca4;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  /* the app manages its own scrolling; avoid mobile rubber-band / pull-to-refresh */
  overflow: hidden;
  overscroll-behavior: none;
}

#scene-root {
  height: 100vh;
  height: 100dvh; /* track the visible viewport on mobile (address-bar safe) */
}

.perf-toggle {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 20;
  border: 1px solid rgba(143, 207, 195, 0.36);
  border-radius: 4px;
  background: rgba(8, 22, 21, 0.78);
  color: var(--muted);
  font: inherit;
  font-size: 9px;
  padding: 5px 7px;
  cursor: pointer;
}

.perf-toggle:hover {
  border-color: rgba(242, 200, 121, 0.48);
  color: var(--accent);
}

.perf-toggle[aria-pressed="true"] {
  border-color: rgba(143, 207, 195, 0.56);
  color: var(--line);
}

/* ---------- Homepage (full-bleed) ---------- */

.home-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none; /* let the canvas own touch input (follow/tap), no scroll/zoom */
}

.home-overlay {
  position: fixed;
  top: clamp(15px, 5vh, 42px);
  left: clamp(15px, 5vw, 48px);
  pointer-events: none;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
}

.home-name {
  margin: 0;
  font-size: clamp(22px, 6vw, 48px);
  font-weight: 800;
  letter-spacing: 1px;
  color: #b6ded5;
}

.home-tag {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: clamp(10px, 1.8vw, 13px);
}

.home-hint {
  margin: 14px 0 0;
  color: var(--accent);
  font-size: 11px;
  opacity: 1;
}

/* Banana "item get" popup — fires once when the monkey hands over the banana. */
.pickup {
  position: fixed;
  left: 50%;
  bottom: clamp(36px, 14vh, 105px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  background: rgba(8, 22, 21, 0.92);
  box-shadow:
    0 9px 22px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(242, 200, 121, 0.22);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 14px);
  transition:
    opacity 0.45s ease,
    transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.35);
}

.pickup.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pickup-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(242, 200, 121, 0.1);
}

.pickup-icon svg {
  width: 28px;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 4px rgba(242, 200, 121, 0.4));
}

.pickup.is-shown .pickup-icon {
  animation: pickup-pop 0.5s ease both;
}

@keyframes pickup-pop {
  0% {
    transform: scale(0.4) rotate(-12deg);
  }
  60% {
    transform: scale(1.15) rotate(6deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

.pickup-title {
  display: block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}

.pickup-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

/* ---------- Shared section / terminal chrome ---------- */

.scene {
  height: 100vh;
  height: 100dvh;
}

.terminal-panel {
  display: flex;
  flex-direction: column;
  background: rgba(8, 22, 21, 0.96);
}

.terminal-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 10px;
}

.terminal-bar p {
  margin: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-bar > :last-child {
  justify-self: end;
}

.signal {
  padding: 2px 7px;
  border: 1px solid rgba(143, 207, 195, 0.4);
  border-radius: 3px;
  background: rgba(143, 207, 195, 0.08);
  color: var(--line);
  font-size: 9px;
  letter-spacing: 1px;
}

.link-btn {
  justify-self: start;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 3px 4px;
}

.link-btn:hover {
  color: var(--text);
}

.feed-button {
  border: 1px solid rgba(242, 200, 121, 0.45);
  background: rgba(16, 41, 40, 0.72);
  color: var(--accent);
  font: inherit;
  padding: 5px 12px;
  cursor: pointer;
}

.feed-button:hover {
  background: var(--accent);
  color: #1b1710;
}

/* ---------- Aquarium scene ---------- */

.aquarium-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #071b1b;
}

.aquarium-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.hud {
  position: absolute;
  left: 9px;
  bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: rgba(229, 247, 241, 0.72);
  font-size: 9px;
  pointer-events: none;
}

.hud span {
  border: 1px solid rgba(143, 207, 195, 0.2);
  background: rgba(7, 27, 27, 0.68);
  padding: 4px 5px;
}

/* ---------- Content sections (about / projects / contact) ---------- */

.section-scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 207, 195, 0.3) transparent;
}

.section-inner {
  max-width: 690px;
  margin: 0 auto;
  padding: clamp(21px, 5vw, 48px) clamp(15px, 5vw, 36px) clamp(36px, 8vw, 72px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.section-inner h1 {
  margin: 0 0 9px;
  font-size: clamp(26px, 6vw, 45px);
  line-height: 1;
  color: #b6ded5;
}

.section-inner h2 {
  margin: 28px 0 10px;
  font-size: 15px;
  color: #b6ded5;
}

.lead {
  max-width: 62ch;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: clamp(11px, 2vw, 14px);
  line-height: 1.65;
}

/* About */

.about-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(15px, 4vw, 30px);
  align-items: start;
}

.avatar {
  display: grid;
  place-content: center;
  gap: 6px;
  width: clamp(90px, 30vw, 126px);
  aspect-ratio: 1;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background:
    repeating-linear-gradient(0deg, rgba(143, 207, 195, 0.05) 0 1.5px, transparent 1.5px 6px),
    linear-gradient(135deg, #102928, #0a1f1c);
  text-align: center;
}

.avatar-initials {
  font-size: clamp(24px, 9vw, 39px);
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 14px rgba(242, 200, 121, 0.25);
}

.avatar-tag {
  color: rgba(155, 189, 180, 0.6);
  font-size: 8px;
}

.about-copy p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.75;
}

.currently span {
  color: var(--accent);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 4px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: rgba(16, 41, 40, 0.5);
  color: var(--muted);
  font-size: 10px;
}

.chips.small li {
  padding: 2px 6px;
  font-size: 8px;
}

/* Projects */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(8, 22, 21, 0.6);
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(143, 207, 195, 0.5);
}

.card-thumb {
  height: 87px;
  border-bottom: 1px solid var(--line-soft);
  image-rendering: pixelated;
}

.card h3 {
  margin: 10px 12px 4px;
  font-size: 13px;
  color: #cdeee5;
}

.card p {
  flex: 1;
  margin: 0 12px 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.card .chips {
  margin: 0 12px 9px;
}

.card-links {
  display: flex;
  gap: 12px;
  margin: 0 12px 12px;
}

.card-links a {
  color: var(--accent);
  font-size: 10px;
  text-decoration: none;
}

.card-links a:hover {
  text-decoration: underline;
}

/* Contact */

.contact-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
  margin-bottom: 26px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(16, 41, 40, 0.45);
  text-decoration: none;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.contact-card:hover {
  transform: translateY(-2px);
  border-color: rgba(242, 200, 121, 0.5);
}

.contact-card .k {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.contact-card .v {
  color: #cdeee5;
  font-size: 11px;
}

/* Under-construction placeholder */

.uc {
  max-width: 56ch;
  margin: clamp(18px, 9vh, 68px) auto 0;
  text-align: center;
}

.uc-gif {
  display: block;
  width: clamp(150px, 60vw, 225px);
  height: auto;
  margin: 0 auto 8px;
  border: 0;
}

.uc h1 {
  margin: 9px 0 10px;
}

.uc .lead {
  margin: 0 auto;
}

.uc-tape {
  max-width: 34ch;
  margin: 20px auto;
  padding: 7px 9px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-image: repeating-linear-gradient(45deg, var(--accent) 0 9px, #1b1710 9px 18px) 4;
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.uc-foot {
  margin-top: 16px;
  color: var(--muted);
  font-size: 11px;
}

.uc-foot a {
  color: var(--accent);
  text-decoration: none;
}

.uc-foot a:hover {
  text-decoration: underline;
}

@media (max-width: 420px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

/* Honour reduced-motion for DOM UI too (the canvas scenes handle their own). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .card:hover,
  .contact-card:hover {
    transform: none;
  }
}
