/*Design tokens*/
:root {
  /* Space */
  --space-top: #001D44;     /* deep blue, top of the page */
  --space-mid: #031330;
  --space-bottom: #020817;  /* near the footer */

  /* Surfaces */
  --panel: rgba(3, 18, 48, 0.84);
  --edge: #0B3A82;          /* lighter blue, used for the hard offset shadows */

  /* Text */
  --cream: #FFF9EB;
  --cream-soft: rgba(255, 249, 235, 0.80);
  --cream-line: rgba(255, 249, 235, 0.38);
  --line: rgba(255, 249, 235, 0.16);

  /* Accents */
  --mint: #80FFAB;          /* actions, progress, completed things */
  --mint-line: rgba(128, 255, 171, 0.4);
  --amber: #FFB347;         /* the ship's flame; years and dates */

  /* Type */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, Menlo, Consolas, monospace;

  /* Layout */
  --content-width: 880px;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --border: 2px solid var(--cream-line);
  --shadow: 5px 5px 0 var(--edge);
}

/* Reset + base*/
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--space-bottom);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: linear-gradient(180deg, var(--space-top) 0%, var(--space-mid) 38%, var(--space-bottom) 100%);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 1em; max-width: 62ch; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

::selection { background: var(--mint); color: var(--space-bottom); }

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

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

.skip-link {
  position: absolute; left: -999px; top: auto; z-index: 100;
  background: var(--mint); color: var(--space-bottom);
  padding: 0.75em 1.25em; font-weight: 700;
}
.skip-link:focus { left: var(--gutter); top: var(--gutter); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/*Space backdrop */
.nebula {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 50% at 12% 18%, rgba(255, 111, 165, 0.10), transparent 70%),
    radial-gradient(55% 45% at 92% 72%, rgba(94, 230, 208, 0.09), transparent 70%),
    radial-gradient(45% 40% at 62% 4%,  rgba(90, 130, 255, 0.14), transparent 70%);
}
.space-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
main, .site-footer { position: relative; z-index: 1; }

/*
   Header / nav
 */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(0, 20, 52, 0.9);
  border-bottom: 1px solid var(--line);
}
.nav {
  max-width: 1100px; margin: 0 auto;
  padding: 0.95rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
}
.nav__mark {
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  text-decoration: none;
}
.nav__mark-dot { color: var(--mint); }

.nav__menu { display: flex; gap: clamp(1rem, 2.6vw, 1.9rem); }
.nav__menu a {
  display: inline-block; padding: 0.25rem 0;
  text-decoration: none; font-size: 0.88rem; color: var(--cream-soft);
  transition: color 0.15s ease;
}
.nav__menu a:hover,
.nav__menu a:focus-visible,
.nav__menu a.is-active { color: var(--mint); }

.nav__toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 0 11px; margin-right: -11px;
}
.nav__toggle span { width: 22px; height: 2px; background: var(--cream); display: block; }

.nav__progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; }
.nav__progress span {
  display: block; height: 100%; background: var(--mint);
  transform: scaleX(0); transform-origin: left;
}

@media (max-width: 800px) {
  .nav__toggle { display: flex; }
  .nav__menu {
    position: fixed; top: 0; left: 0; right: 0;
    flex-direction: column; gap: 0.25rem;
    padding: 4.75rem var(--gutter) 1.5rem;
    background: #001434; border-bottom: 1px solid var(--line);
    transform: translateY(-110%); transition: transform 0.25s ease; z-index: -1;
  }
  .nav__menu.is-open { transform: translateY(0); }
  .nav__menu a { font-size: 1.1rem; padding: 0.7rem 0; width: 100%; }
}

/* 
   Hero
*/
.hero {
  position: relative; display: flex; align-items: center; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  -webkit-tap-highlight-color: transparent;
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__content {
  position: relative; z-index: 1; width: 100%;
  max-width: var(--content-width); margin: 0 auto;
  padding: 5.5rem var(--gutter) 4rem;
  pointer-events: none;  /* lets pointer/taps reach the game underneath */
}
.hero__content > * { pointer-events: auto; }
.hero__title {
  font-size: clamp(2.6rem, 9vw, 5.25rem); line-height: 1.04;
  letter-spacing: -0.025em; max-width: 12ch;
}
.hero__tagline {
  margin-top: 1.5rem; color: var(--cream-soft);
  font-size: clamp(1rem, 2.2vw, 1.15rem); max-width: 40ch;
}

.hero__hud {
  position: absolute; z-index: 1; text-align: right;
  right: var(--gutter);
  bottom: calc(clamp(1.25rem, 3vw, 2.25rem) + env(safe-area-inset-bottom, 0px));
  font-size: 0.78rem; color: var(--cream-soft);
  transition: opacity 0.3s ease; pointer-events: none;
}
.hero__hud.is-idle { opacity: 0.4; }
.hud__score { margin: 0 0 0.7rem; font-size: 1rem; color: var(--mint); font-variant-numeric: tabular-nums; }
.hud__keys { display: grid; gap: 0.4rem; }
.hud__keys li { display: flex; justify-content: flex-end; align-items: center; gap: 0.3rem; }
kbd {
  font: inherit; font-size: 0.72rem; line-height: 1;
  padding: 0.3em 0.5em; border: 1.5px solid var(--cream-line);
  background: rgba(0, 0, 0, 0.25); color: var(--cream);
}
.hud__touch { display: none; max-width: 17ch; margin: 0 0 0 auto; }

@media (pointer: coarse) {
  .hud--desk { display: none; }
  .hud__touch { display: block; }
}

.hero__scroll-cue {
  position: absolute; z-index: 1; width: 1px; height: 48px; overflow: hidden;
  left: var(--gutter);
  bottom: calc(clamp(1.25rem, 3vw, 2.25rem) + env(safe-area-inset-bottom, 0px));
  background: var(--line);
}
.hero__scroll-cue span {
  position: absolute; top: 0; left: -2px; width: 5px; height: 12px;
  background: var(--mint);
  animation: cue 2.2s ease-in-out infinite;
}
@keyframes cue {
  0%   { transform: translateY(-14px); }
  70%  { transform: translateY(50px); }
  100% { transform: translateY(50px); }
}

/* 
   Sections
*/
.section { position: relative; }
.section[id] { scroll-margin-top: 56px; }
.section-inner {
  max-width: var(--content-width); margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 6rem) var(--gutter);
  border-top: 0px dashed var(--line);
}
.section-title { font-size: clamp(1.9rem, 4.6vw, 2.75rem); line-height: 1.1; }
.section-lede {
  margin: 0.6rem 0 clamp(1.75rem, 4.5vw, 2.75rem);
  color: var(--cream-soft); max-width: 52ch;
}
.section-title + .about__grid { margin-top: clamp(1.75rem, 4.5vw, 2.75rem); }
.noscript { padding: 1rem var(--gutter); text-align: center; color: var(--amber); }

/* ---- About ---- */
.about__grid {
  display: grid; grid-template-columns: minmax(180px, 240px) 1fr;
  gap: clamp(1.75rem, 5vw, 4rem); align-items: start;
}
.about__portrait {
  aspect-ratio: 4 / 5; background: var(--panel);
  border: var(--border); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 1rem;
  color: var(--cream-soft); font-size: 0.8rem; line-height: 1.5;
}
.about__text p { color: var(--cream-soft); }
@media (max-width: 640px) {
  .about__grid { grid-template-columns: 1fr; }
  .about__portrait { max-width: 220px; }
}

/* ---- Projects ---- */
.projects {
  display: grid; gap: clamp(1.5rem, 3.4vw, 2.1rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.project-card {
  position: relative; display: flex; flex-direction: column; gap: 0.75rem;
  padding: clamp(1.15rem, 3vw, 1.5rem);
  background: var(--panel); border: var(--border); box-shadow: var(--shadow);
}
.project-card__image {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
  border: 1.5px solid var(--cream-line);
}
.project-card__title { font-size: 1.2rem; line-height: 1.25; }
.project-card__desc { margin: 0; color: var(--cream-soft); font-size: 0.93rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li {
  font-size: 0.72rem; color: var(--mint);
  border: 1px solid var(--mint-line); padding: 0.15em 0.55em;
}
.project-card__link {
  margin-top: auto; padding-top: 0.35rem;
  color: var(--mint); font-weight: 700; font-size: 0.9rem;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.25em;
}
.project-card__link::after { content: ""; position: absolute; inset: 0; } /* whole card is the click target */
.project-card.is-linked:focus-within { outline: 2px solid var(--mint); outline-offset: 4px; }
.project-card__link:focus-visible { outline: none; }

@media (hover: hover) {
  .project-card.is-linked { transition: transform 0.15s ease, box-shadow 0.15s ease; }
  .project-card.is-linked:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--mint); }
}

/* ---- Distinctions ---- */
.distinctions {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}
.distinction {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--panel); border: var(--border); box-shadow: var(--shadow);
}
.distinction__badge {
  position: relative; flex: none; width: 58px; height: 58px;
  display: grid; place-items: center; border-radius: 50%;
  border: 2px solid var(--amber); color: var(--amber);
  font-family: var(--font-display); font-weight: 700; font-size: 0.8rem;
}
.distinction__badge::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  border: 1px dashed rgba(255, 179, 71, 0.55);
}
.distinction__title { font-size: 1.05rem; line-height: 1.3; }
.distinction__title a { text-decoration: underline; text-underline-offset: 0.2em; text-decoration-color: var(--mint-line); }
.distinction__title a:hover { color: var(--mint); }
.distinction__org { margin: 0.15rem 0 0; color: var(--cream-soft); font-size: 0.88rem; }
.distinction__desc { margin: 0.5rem 0 0; color: var(--cream-soft); font-size: 0.85rem; }

/* ---- Story (timeline) ---- */
.timeline { border-left: 2px solid var(--cream-line); padding-left: clamp(1.5rem, 4vw, 2.5rem); margin-left: 5px; }
.timeline__entry {
  position: relative; padding-bottom: clamp(1.75rem, 4vw, 2.5rem);
  display: flex; flex-direction: column; gap: 0.2rem;
}
.timeline__entry:last-child { padding-bottom: 0; }
.timeline__entry::before {
  content: ""; position: absolute; top: 0.35em;
  left: calc(-1 * clamp(1.5rem, 4vw, 2.5rem) - 8px);
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--mint); border: 2px solid var(--space-top);
}
.timeline__date { font-weight: 700; font-size: 0.85rem; color: var(--amber); }
.timeline__title { font-size: 1.15rem; line-height: 1.3; }
.timeline__text { margin: 0.1rem 0 0; color: var(--cream-soft); max-width: 56ch; }

/* ---- Bucket list ---- */
.progress { max-width: 520px; margin-bottom: clamp(1.5rem, 4vw, 2.25rem); }
.progress__label { margin: 0 0 0.5rem; color: var(--cream-soft); font-size: 0.9rem; }
.progress__label span { color: var(--mint); font-weight: 700; }
.progress__bar { height: 12px; border: 2px solid var(--cream-line); background: rgba(0, 0, 0, 0.25); }
.progress__bar span { display: block; height: 100%; width: 0; background: var(--mint); }

.challenges { columns: 2 300px; column-gap: 2.25rem; }
.challenge {
  break-inside: avoid; display: flex; align-items: flex-start; gap: 0.85rem;
  padding: 0.65rem 0; border-bottom: 1px dashed var(--line);
}
.challenge__box {
  position: relative; flex: none; width: 22px; height: 22px; margin-top: 0.12rem;
  border: 2px solid var(--cream-line);
}
.challenge.is-done .challenge__box { background: var(--mint); border-color: var(--mint); }
.challenge.is-done .challenge__box::after {
  content: ""; position: absolute; left: 6px; top: 1px; width: 6px; height: 11px;
  border: solid var(--space-bottom); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.challenge__text { color: var(--cream-soft); }
.challenge.is-done .challenge__text { color: var(--cream); }
.challenge__note { display: block; margin-top: 0.1rem; font-size: 0.78rem; color: var(--amber); }

/* ---- Contact ---- */
.contact__email {
  display: inline-block; margin: 0 0 1.75rem; padding: 0.6em 1em;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.15rem, 4.6vw, 2rem); text-decoration: none;
  background: var(--panel); border: var(--border); box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}
@media (hover: hover) {
  .contact__email { transition: transform 0.15s ease, box-shadow 0.15s ease; }
  .contact__email:hover { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--mint); }
}
.contact__social { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; }
.contact__social a {
  display: inline-block; padding: 0.5rem 0;
  text-decoration: none; font-weight: 700; font-size: 0.92rem; color: var(--cream-soft);
  transition: color 0.15s ease;
}
.contact__social a:hover,
.contact__social a:focus-visible { color: var(--mint); text-decoration: underline; text-underline-offset: 0.25em; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px dashed var(--line);
  padding: 2rem var(--gutter) calc(2rem + env(safe-area-inset-bottom, 0px));
  text-align: center; color: var(--cream-soft); font-size: 0.8rem;
}
.site-footer p { margin: 0 auto; max-width: none; }


/* ---- Achievements bar  ---- */
.ticker {
  position: relative; display: flex; align-items: stretch; overflow: hidden;
  background: var(--panel);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.ticker__label {
  position: relative; z-index: 1; flex: none; margin: 0; max-width: none;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0 1.1rem 0 var(--gutter);
  background: var(--panel); border-right: 1px solid var(--line);
  font: 700 0.78rem/1.3 var(--font-mono); color: var(--cream-soft);
}
.ticker__count {
  display: grid; place-items: center; min-width: 2.4rem; height: 2.4rem; padding: 0 0.4rem;
  background: var(--mint); color: var(--space-top);
  font: 700 1.05rem/1 var(--font-display);
}
.ticker__viewport {
  flex: 1; min-width: 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.ticker__track {
  display: flex; width: max-content;
  animation: ticker-scroll var(--ticker-duration, 60s) linear infinite;
  will-change: transform;
}
@keyframes ticker-scroll { to { transform: translateX(-50%); } }
.ticker__group { display: flex; flex: none; margin: 0; padding: 0.85rem 0; list-style: none; }

/* One achievement card. Rarity picks the accent color: common, rare, ultra. */
.ticker__item {
  --tier: var(--cream-soft);
  flex: none; display: flex; align-items: center; gap: 0.85rem;
  margin-right: 1rem; padding: 0.7rem 1rem 0.7rem 0.75rem;
  background: rgba(255, 249, 235, 0.04); border: 1.5px solid var(--line);
  white-space: nowrap;
}
.ticker__item[data-tier="rare"]  { --tier: var(--mint); }
.ticker__item[data-tier="ultra"] { --tier: var(--amber); }
.ticker__badge {
  flex: none; width: 2.1rem; height: 2.1rem;
  background: var(--tier) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23001D44' stroke-width='3.2'/%3E%3C/svg%3E") center / 72% no-repeat;
}
.ticker__body { display: flex; flex-direction: column; gap: 0.12rem; }
.ticker__kicker { font-size: 0.7rem; color: var(--tier); }
.ticker__name { font: 700 1rem/1.2 var(--font-display); color: var(--cream); }
.ticker__desc { font-size: 0.8rem; color: var(--cream-soft); }
.ticker__rarity {
  display: flex; flex-direction: column; align-items: flex-end;
  margin-left: 0.2rem; padding-left: 0.85rem; border-left: 1px solid var(--line);
}
.ticker__pct { font: 700 1rem/1.2 var(--font-display); color: var(--tier); }
.ticker__pct-label { font-size: 0.68rem; color: var(--cream-soft); }

@media (max-width: 520px) {
  .ticker__label-text { display: none; }
  .ticker__label { padding-right: 0.9rem; }
  .ticker__item { gap: 0.7rem; padding: 0.6rem 0.8rem 0.6rem 0.6rem; }
  .ticker__name { font-size: 0.92rem; }
  .ticker__desc { font-size: 0.74rem; }
}

/* Reduced motion: no scrolling. Show the achievements as a still, wrapped list. */
@media (prefers-reduced-motion: reduce) {
  .ticker { flex-wrap: wrap; }
  .ticker__label { width: 100%; padding: 0.8rem var(--gutter); border-right: 0; border-bottom: 1px solid var(--line); }
  .ticker__viewport { flex-basis: 100%; -webkit-mask-image: none; mask-image: none; }
  .ticker__track { animation: none; display: block; width: auto; }
  .ticker__group { flex-wrap: wrap; gap: 0.75rem 0; padding: 0.85rem var(--gutter); }
}
