/* Animatable hue for the title colour cycle */
@property --hue {
  syntax: "<number>";
  inherits: true;
  initial-value: 190;
}

/* Light theme is the default */
:root {
  --bg: #ffffff;
  --muted: #6b6b6b;
  --text: #1c1c22;
  /* Primary follows the slowly shifting title hue; secondary is a fixed violet */
  --primary: hsl(var(--hue) var(--title-sat) var(--title-light));
  --secondary: #7c3aed;
  --line: rgba(0, 0, 0, 0.12);
  --panel: rgba(30, 30, 60, 0.035);
  --panel-hover: rgba(30, 30, 60, 0.07);
  --title-sat: 75%;
  --title-light: 42%;
  /* Star colours (RGB), read by script.js */
  --particle: 60, 60, 70;
  --star-tints: 37, 99, 235 | 217, 119, 6 | 220, 38, 38 | 124, 58, 237;
  --shooting: 8, 145, 178;
  --pad: clamp(8px, 1.2vw, 16px);
  animation: hue-shift 40s ease-in-out infinite alternate;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #05060d;
    --muted: #8a8c99;
    --text: #e6e7ee;
    --secondary: #a78bfa;
    --line: rgba(255, 255, 255, 0.14);
    --panel: rgba(255, 255, 255, 0.04);
    --panel-hover: rgba(255, 255, 255, 0.08);
    --title-sat: 95%;
    --title-light: 72%;
    --particle: 255, 255, 255;
    --star-tints: 170, 200, 255 | 255, 220, 160 | 255, 170, 150 | 205, 175, 255;
    --shooting: 150, 230, 255;
  }

  /* Neon glow in dark mode */
  .title {
    text-shadow:
      0 0 0.12em hsl(var(--hue) 100% 60% / 0.6),
      0 0 0.45em hsl(var(--hue) 100% 55% / 0.35);
  }
}

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

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  overflow: hidden;
  font-family: "Audiowide", "Helvetica Neue", Arial, system-ui, sans-serif;
  transition: background-color 0.4s ease;
}

/* Picture frame: a thin border close to the screen edge, with the sky inside it */
.stage {
  position: fixed;
  inset: var(--pad);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

#bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: manipulation;
}

/* Everything above the sky scrolls inside the frame */
.scroll {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
}

/* Top bar */
.topbar {
  /* Stays put while the page scrolls under it */
  position: sticky;
  top: 0;
  z-index: 4;
  background: linear-gradient(var(--bg), transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(14px, 2.5vw, 24px) clamp(16px, 3vw, 32px);
}

.brand,
.nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.brand {
  font-family: "Audiowide", system-ui, sans-serif;
  letter-spacing: 0.1em;
  font-size: 0.95rem;
}

.nav {
  display: flex;
  gap: clamp(16px, 4vw, 32px);
  margin-left: auto;
}

.nav a {
  padding: 6px 2px;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
}

.brand:hover,
.nav a:hover,
.nav a:focus-visible,
.nav a[aria-current="page"] {
  color: var(--text);
}

.nav a[aria-current="page"] {
  border-bottom-color: var(--primary);
}

/* Home: the word sits in the middle of the frame */
.hero {
  --logo-size: min(62vh, 92vw, 640px);
  /* Small enough to fit the gap between the wing tips (well under half the bird's width) */
  --title-size: calc(var(--logo-size) * 0.07);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 4vw;
  pointer-events: none;
}

/* The bird sits in the middle of the frame, the word sits in the gap between its wings */
.hero-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  height: var(--logo-size);
  object-fit: contain;
}

.home .footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border: 0;
}

/* Inner pages */
.content {
  /* Grows with the screen so big monitors are not left with a thin strip */
  width: min(100%, clamp(44rem, 62vw, 72rem));
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 32px) 32px;
  flex: 1;
  /* Short pages sit in the middle of the frame, long ones simply scroll */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-title {
  margin: 8px 0 24px;
  font-family: "Audiowide", system-ui, sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--primary);
}

.prose {
  font-size: clamp(0.95rem, 0.88rem + 0.2vw, 1.1rem);
  line-height: 1.7;
}

.prose p + p {
  margin-top: 1.1em;
}

.prose a {
  color: var(--primary);
}
.title {
  /* Fluid size: relatively larger on small screens, capped by width and height so it always fits */
  font-family: "Audiowide", "Helvetica Neue", Arial, system-ui, sans-serif;
  font-size: var(--title-size);
  /* Placed by the bird's size: near the top of it, between the wings */
  position: absolute;
  left: 50%;
  top: calc(50% - var(--logo-size) * 0.34);
  /* Not `transform`: the click animation in script.js owns that property */
  translate: -50% -50%;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  color: var(--primary);
  /* Clickable for the easter egg (hero itself ignores pointer events) */
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Each letter is its own box so it can fly around */
.letter {
  display: inline-block;
  will-change: transform;
}

/* Slowly drift cyan -> violet -> pink and back */
@keyframes hue-shift {
  from { --hue: 180; }
  to   { --hue: 330; }
}

@media (prefers-reduced-motion: reduce) {
  :root { animation: none; }
}

/* Projects */
.project-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.project {
  display: flex;
  gap: clamp(14px, 3vw, 28px);
  align-items: flex-start;
  padding: clamp(12px, 2.2vw, 20px) clamp(16px, 3vw, 28px);
  border-radius: 12px;
  background: var(--panel);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.project:hover,
.project:focus-visible {
  background: var(--panel-hover);
}

.project:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.project-icon {
  flex: none;
  width: clamp(48px, 9vw, 72px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 16px;
}

.project-body {
  min-width: 0;
}

.project-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Audiowide", system-ui, sans-serif;
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--secondary);
}

.project-desc {
  margin-top: 8px;
  font-size: clamp(0.9rem, 0.84rem + 0.15vw, 1rem);
  line-height: 1.55;
}

.project-origin {
  margin-top: 12px;
  font-size: clamp(0.9rem, 0.84rem + 0.15vw, 1rem);
  line-height: 1.55;
  color: var(--muted);
}

/* Small label in front of the origin text, sized to sit on the same line as it */
.project-origin span {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.7em;
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  vertical-align: 0.1em;
}

.project-origin b {
  font-weight: 600;
  color: var(--text);
}

/* Footer */
.footer {
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  text-align: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(11px, 1.2vw, 13px);
  letter-spacing: 0.02em;
  color: var(--muted);
  user-select: none;
}
