/* ==========================================================================
   LOW ORBIT — the one and only stylesheet
   Sections:  1. Tokens   2. Base   3. Buttons   4. Home page
              5. Inner pages   6. Astronaut cursor + throwable spaceman
              7. Responsive / a11y
   ========================================================================== */

/* 1. TOKENS — change colours and fonts here and the whole site follows ---- */
:root {
  --void:   #060814;                  /* page background */
  --deep:   #0c1130;                  /* slightly lighter surfaces */
  --text:   #e9ecfa;                  /* main text */
  --muted:  #98a0c4;                  /* secondary text */
  --line:   rgba(190, 200, 255, .18); /* hairlines and outlines */
  --flare:  #ff7a45;                  /* accent: hover + current page */
  --teal:   #46d4c1;                  /* accent: focus rings */

  --font-display: "Unbounded", "Trebuchet MS", system-ui, sans-serif;
  --font-body:    "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --page-width: 1080px;
  --gutter: clamp(1.25rem, 5vw, 3.5rem);
}

/* 2. BASE ---------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--void);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
}

h1, h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

p { margin: 0; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 4px;
  border-radius: 4px;
}

/* 3. BUTTONS ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  padding: .85rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 17, 48, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

.btn:hover {
  background: var(--flare);
  border-color: var(--flare);
  color: var(--void);
}

/* 4. HOME PAGE ----------------------------------------------------------- */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--gutter);
  /* The generated background image. Swap the file in /images to change it. */
  background:
    linear-gradient(to top right, rgba(6, 8, 20, .78) 0%, rgba(6, 8, 20, .25) 45%, rgba(6, 8, 20, 0) 70%),
    url("../images/background.jpg") center right / cover no-repeat;
}

.hero__logo {
  position: absolute;
  inset: 0;                /* stretch to all four edges of the hero (the full screen) */
  width: 35%;
  height: 35%;
  object-fit: contain;     /* whole image always visible, scales with the screen */
  pointer-events: none;    /* clicks pass straight through to the buttons */
  z-index: 0; 
  pointer-events: auto;           /* was "none". The image must receive the mouse to react to hover */
  transform-origin: 50% 60%;
  transition: scale .35s cubic-bezier(.2, .9, .3, 1.4), filter .35s ease;
}

.hero__logo:hover {
  scale: 1.06;                    /* swells slightly, with a little overshoot */
  filter:
    drop-shadow(0 0 14px rgba(255, 122, 69, .75))    /* orange glow tight to the letters */
    drop-shadow(0 0 40px rgba(70, 212, 193, .45));   /* wider teal halo */
  animation: logo-wobble .9s ease-in-out;
}

@keyframes logo-wobble {
  0%   { rotate: 0deg;    translate: 0 0; }
  20%  { rotate: -3deg;   translate: 0 -8px; }
  45%  { rotate: 2.5deg;  translate: 0 -4px; }
  70%  { rotate: -1.2deg; translate: 0 -6px; }
  100% { rotate: 0deg;    translate: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__logo:hover { animation: none; }   /* keeps the glow, skips the wobble */
}

.hero__content {
  position: relative;      /* lifts the text and buttons above the image */
  z-index: 1;
}


.hero__title {
  font-size: clamp(3.25rem, 10vw, 8rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: .95;
}

.hero__lede {
  margin-top: 1.5rem;
  max-width: 30rem;
  color: var(--text);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
}

.hero__nav {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 2.25rem;
}

/* 5. INNER PAGES (about, missions, gallery, contact) ---------------------- */
/* A quiet CSS-only starfield so inner pages feel related to the home image. */
.page-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(1px 1px at 20px 30px,   rgba(255, 255, 255, .8), transparent),
    radial-gradient(1.5px 1.5px at 400px 220px,  rgba(255, 255, 255, .9), transparent),
    radial-gradient(1px 1px at 90px 210px, rgba(190, 210, 255, .7), transparent),
    radial-gradient(1px 1px at 300px 150px,  rgba(255, 220, 190, .7), transparent),
    radial-gradient(1px 1px at 120px 60px,  rgba(255, 255, 255, .6), transparent),
    radial-gradient(60rem 40rem at 90% -10%, rgba(90, 63, 208, .22), transparent 70%),
    radial-gradient(50rem 36rem at -10% 110%, rgba(31, 167, 176, .14), transparent 70%);
  /* different tile sizes per layer so the stars never look like a grid */
  background-size: 233px 233px, 523px 523px, 271px 271px, 397px 397px, 349px 349px, auto, auto;
  background-repeat: repeat, repeat, repeat, repeat, repeat, no-repeat, no-repeat;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 1.75rem var(--gutter);
}

.site-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.5rem;
}

.site-nav a {
  padding: .25rem 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  transition: color .18s ease, border-color .18s ease;
}

.site-nav a:hover { color: var(--text); }

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

.page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: clamp(3rem, 9vh, 6rem) var(--gutter) clamp(3rem, 8vh, 5rem);
}

.page__title {
  max-width: 14ch;
  font-size: clamp(2.5rem, 7vw, 5rem);
}

.page__lede {
  max-width: 34rem;
  margin-top: 1.75rem;
  color: var(--muted);
  font-size: 1.2rem;
}

.columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  margin-top: clamp(3rem, 8vh, 5rem);
}

.column {
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.column__title {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.column p {
  margin-top: .75rem;
  color: var(--muted);
}

.page__actions { margin-top: clamp(3rem, 8vh, 5rem); }

.site-footer {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 2rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
}

/* 6. ASTRONAUT CURSOR ---------------------------------------------------- */
/* js/cursor.js adds the "has-custom-cursor" class and builds .astro-cursor.
   If JavaScript is off, the normal cursor stays, so nothing breaks. */
.has-custom-cursor,
.has-custom-cursor * {
  cursor: none !important;
}

.astro-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
  will-change: transform;
}

.astro-cursor.is-visible { opacity: 1; }

.astro-cursor__img {
  position: absolute;
  /* --hx / --hy = the "hot spot" (where the click lands), set by cursor.js */
  left: calc(var(--hx, 0px) * -1);
  top: calc(var(--hy, 0px) * -1);
  width: var(--cursor-size, 72px);
  height: var(--cursor-size, 72px);
  transform-origin: var(--hx, 0px) var(--hy, 0px);
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45));
}

/* Small nudge while the mouse button is held down */
.astro-cursor.is-down .astro-cursor__img { scale: .9; }
.astro-cursor__img { transition: scale .12s ease; }

/* 6b. THROWABLE SPACEMAN ------------------------------------------------- */
/* js/spaceman.js creates this <img>. Size, physics and images live in that file. */
.spaceman {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 500;                 /* above the page, below the astronaut cursor */
  transform-origin: 50% 50%;
  touch-action: none;           /* lets a finger drag him instead of scrolling */
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
  will-change: transform;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .45));
}

.spaceman.is-dragging { cursor: grabbing; }

/* ---- Image button row ---- */
.menu {
  /* Change these two values to move the whole group. */
  --menu-x: 50%;
  --menu-y: 35%;
  --menu-gap: clamp(.5rem, 1.5vw, 1.5rem);

  position: absolute;
  left: var(--menu-x);
  top: var(--menu-y);
  transform: translate(-50%, -50%);
  z-index: 1;                       /* above the title image, below the spaceman and cursor */

  display: flex;
  flex-wrap: wrap;                  /* buttons drop to the next line when there's no room */
  justify-content: center;          /* a short last row stays centred */
  align-items: center;
  gap: var(--menu-gap);
  width: min(1000px, 94vw);
}

.menu__item {
  flex: 1 1 0;                      /* desktop: five equal slots in one row */
  min-width: 0;
  max-width: 180px;
  transition: transform .2s ease;
}

.menu__item:hover,
.menu__item:focus-visible {
  transform: translateY(-10px);
}

.menu__img {
  display: block;
  width: 100%;
  height: auto;
}

/* Tablets and large phones: 3 buttons on the first row, 2 centred underneath */
@media (max-width: 800px) {
  .menu__item {
    flex: 0 0 calc((100% - 2 * var(--menu-gap)) / 3);
  }
}

/* Small phones: 2 buttons per row (2 + 2 + 1) */
@media (max-width: 480px) {
  .menu__item {
    flex: 0 0 calc((100% - var(--menu-gap)) / 2);
  }
}
/* 7. RESPONSIVE + ACCESSIBILITY ------------------------------------------ */
@media (max-width: 800px) {
  .columns {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero {
    background-position: 72% center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
}
