/* Halfstack Games site: clean, one screen, Facility's own look.
   Layout: split screen. Left = the alien drifting in a specimen tank (tap the glass). Right = the game pitch.
   Everything scales with the window so it fills a phone, a laptop and a 4K monitor the same way. */
:root {
  --bg: #07090a;
  --panel: #0c1012;
  --line: #1b2226;
  --steel-hi: #313b41;
  --steel-lo: #12171a;
  --text: #f1f4ef;
  --muted: #8b959b;
  --green: #8fe33a;       /* the alien */
  --green-soft: rgba(143, 227, 58, .14);
  --red: #ff3b4a;         /* the Keeper */
  --warn: #ffc93c;
  --ink: #07090a;
  --display: "Russo One", "Arial Black", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 3vw, 64px);
  color-scheme: dark;     /* deliberately dark-only, like the station */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); font: clamp(15px, .45vw + 11px, 19px)/1.65 var(--body);
  background:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px) 0 0 / 32px 100%,
    var(--bg);
}
a { color: var(--text); }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

/* Before going live: set this to display:none (removes the banner on every page). */
.draft-banner { display: block; background: var(--warn); color: #1a1400; text-align: center; font: 700 12px/1.4 var(--body); padding: 5px 16px; }

/* ---------- top bar + footer ---------- */
.bar { display: flex; align-items: center; gap: 24px; padding: clamp(20px, 2vw, 36px) var(--gutter); }
.brand { display: flex; align-items: center; gap: 10px; font: 400 clamp(13px, .4vw + 10px, 17px)/1 var(--display); letter-spacing: 1.5px; text-decoration: none; text-transform: uppercase; }
.brand .mark { width: auto; height: 2em; flex: none; }   /* the Halfstack logo (img/logo.svg) */
.bar nav { margin-left: auto; display: flex; gap: clamp(18px, 1.8vw, 34px); flex-wrap: wrap; }
.bar nav a, .foot a { color: var(--muted); text-decoration: none; font: 500 clamp(11px, .3vw + 9px, 14px)/1 var(--mono); letter-spacing: 1px; text-transform: uppercase; }
.bar nav a:hover, .foot a:hover, .bar nav a[aria-current="page"] { color: var(--text); }
.foot { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 20px var(--gutter); border-top: 1px solid var(--line); font: 500 clamp(10px, .25vw + 8px, 13px)/1.4 var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.foot .links { margin-left: auto; display: flex; gap: 20px; flex-wrap: wrap; }

/* ---------- home: split screen ---------- */
.split { display: grid; grid-template-columns: 46fr 54fr; min-height: calc(100vh - 28px); }
.art {
  position: relative; display: grid; place-items: center; padding: clamp(36px, 4vw, 80px) 24px; overflow: hidden;
  border-right: 1px solid var(--line);
  background: radial-gradient(55% 50% at 50% 52%, var(--green-soft), transparent 75%), #050607;
}
.art::after { /* floor reflection of the tank glow */
  content: ""; position: absolute; left: 20%; right: 20%; bottom: 8%; height: 40px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(143, 227, 58, .16), transparent); pointer-events: none;
}

/* ---------- the specimen tank ---------- */
.tank { width: clamp(240px, 25vw, 560px); display: flex; flex-direction: column; align-items: stretch; position: relative; z-index: 1; }
.tank-lid {
  position: relative; height: clamp(22px, 1.8vw, 36px); margin: 0 7%; border-radius: 12px 12px 4px 4px;
  background: linear-gradient(var(--steel-hi), var(--steel-lo)); border: 1px solid #2a3338; border-bottom: 0;
}
.pipe { position: absolute; bottom: 100%; width: 10%; height: clamp(18px, 2.4vw, 46px); background: linear-gradient(90deg, var(--steel-lo), var(--steel-hi), var(--steel-lo)); border: 1px solid #2a3338; border-bottom: 0; }
.pipe.left { left: 18%; } .pipe.right { right: 18%; height: clamp(12px, 1.5vw, 30px); }
.lamp { position: absolute; top: 50%; right: 8%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulseLed 2.4s ease-in-out infinite; }
.glass {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0; overflow: hidden; cursor: pointer;
  border-radius: 46% 46% 14px 14px / 34% 34% 14px 14px;
  border: 1px solid rgba(143, 227, 58, .38);
  background: linear-gradient(180deg, rgba(143, 227, 58, .04), rgba(143, 227, 58, .17));
  box-shadow: inset 0 0 70px rgba(143, 227, 58, .2), 0 0 90px rgba(143, 227, 58, .14), 0 30px 60px rgba(0, 0, 0, .6);
  font: inherit; color: inherit;
}
.liquid { position: absolute; inset: 0; background: radial-gradient(70% 55% at 50% 62%, rgba(143, 227, 58, .24), transparent 70%); }
.surface { /* waterline near the top, gently sloshing */
  position: absolute; left: -10%; right: -10%; top: 9%; height: 14px; border-radius: 50%;
  border-top: 1px solid rgba(200, 255, 160, .35); background: linear-gradient(rgba(200, 255, 160, .08), transparent);
  animation: slosh 6s ease-in-out infinite;
}
.shine { position: absolute; top: 9%; bottom: 7%; left: 8%; width: 6%; border-radius: 99px; z-index: 5; background: linear-gradient(rgba(255, 255, 255, .17), rgba(255, 255, 255, .02)); }
.shine::after { content: ""; position: absolute; top: 4%; left: 260%; width: 40%; height: 18%; border-radius: 99px; background: rgba(255, 255, 255, .08); }
.scan { position: absolute; inset: 0; z-index: 4; pointer-events: none; background: repeating-linear-gradient(transparent 0 3px, rgba(0, 0, 0, .12) 3px 4px); }

/* ---------- the alien puppet ----------
   Parts share one 361x695 canvas (art/cut_puppet.py); each turns around its own joint (transform-origin in % of it).
   The wrapper drifts around the tank, the alien breathes, arms swing and wave, antennae wobble, eyes look and blink. */
.drift { position: absolute; left: 28%; top: 13%; width: 44%; z-index: 2; animation: drift 11s ease-in-out infinite; }
.alien {
  position: relative; display: block; width: 100%; aspect-ratio: 361 / 695; transform-origin: 50% 60%;
  filter: drop-shadow(0 0 1px rgba(230, 255, 210, .8)) drop-shadow(0 0 22px rgba(143, 227, 58, .35));
  animation: breathe 3.2s ease-in-out infinite;
}
.part { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; }
.arm-l { transform-origin: 23.82% 50.65%; animation: armL 7s ease-in-out infinite; }   /* shoulder pivot (86, 352) */
.arm-r { transform-origin: 76.18% 50.65%; animation: armR 10s ease-in-out infinite; }  /* shoulder pivot (275, 352) */
.ant-l { transform-origin: 28.8% 15.3%; animation: antL 2.3s ease-in-out infinite; }
.ant-r { transform-origin: 70.9% 15%; animation: antR 2.7s ease-in-out infinite .4s; }
.eye { position: absolute; border-radius: 50%; overflow: hidden; }
.eye-l { left: 24.65%; top: 23.3%; width: 16.07%; height: 8.63%; }
.eye-r { left: 59.83%; top: 19.28%; width: 22.71%; height: 12.09%; }
.pupil {
  --lx: 0; --ly: 0;
  position: absolute; left: 50%; top: 50%; border-radius: 50%; background: #0a0a0a;
  transform: translate(calc(-50% + var(--lx) * 100%), calc(-50% + var(--ly) * 100%)) scale(var(--ps, 1));
  transition: transform .35s cubic-bezier(.3, 1.4, .5, 1);
}
.eye-l .pupil { width: 46%; height: 44%; }
.eye-r .pupil { width: 38%; height: 37%; }
.pupil::after { content: ""; position: absolute; left: 22%; top: 18%; width: 26%; height: 26%; border-radius: 50%; background: rgba(255, 255, 255, .85); }
.lid { position: absolute; inset: 0 0 auto; height: 0; background: linear-gradient(#9fe043, #86cc35); animation: blink 5.5s infinite; }
.eye-r .lid { animation-delay: .04s; }

/* tap the glass: arms flail, antennae shoot up, pupils shrink */
.alien.startled { animation: startle .7s cubic-bezier(.2, .8, .3, 1); }
.alien.startled .arm-l { animation: flailL .32s ease-in-out 6; }
.alien.startled .arm-r { animation: flailR .28s ease-in-out 7; }
.alien.startled .ant-l, .alien.startled .ant-r { animation: antPanic .16s linear 12; }
.alien.startled .pupil { --ps: .62; }

@keyframes breathe { 50% { transform: scale(1.025, .975); } }
@keyframes armL {
  0%, 100% { transform: rotate(0deg); } 14% { transform: rotate(13deg); } 28% { transform: rotate(-3deg); }
  42% { transform: rotate(17deg); } 50% { transform: rotate(6deg); } 62% { transform: rotate(24deg); } 80% { transform: rotate(2deg); }
}
@keyframes armR { /* same range as the left arm (never above ~24 degrees out), on its own rhythm */
  0%, 100% { transform: rotate(0deg); } 16% { transform: rotate(-12deg); } 30% { transform: rotate(3deg); }
  46% { transform: rotate(-18deg); } 58% { transform: rotate(-5deg); } 72% { transform: rotate(-23deg); } 86% { transform: rotate(-2deg); }
}
@keyframes antL { 50% { transform: rotate(-11deg); } }
@keyframes antR { 50% { transform: rotate(10deg); } }
@keyframes flailL { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(28deg); } }   /* fast flapping, kept low */
@keyframes flailR { 0%, 100% { transform: rotate(4deg); } 50% { transform: rotate(-28deg); } }
@keyframes antPanic { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(14deg); } }
@keyframes blink { 0%, 93%, 100% { height: 0; } 95.5% { height: 100%; } }
@keyframes drift {
  0%   { transform: translate(0, 0) rotate(-3deg); }
  18%  { transform: translate(16%, -5%) rotate(5deg); }
  40%  { transform: translate(6%, 9%) rotate(0deg); }
  62%  { transform: translate(-15%, 2%) rotate(-7deg); }
  82%  { transform: translate(-6%, -6%) rotate(-2deg); }
  100% { transform: translate(0, 0) rotate(-3deg); }
}
@keyframes startle {
  0% { transform: scale(1); }
  15% { transform: translateY(-14%) scale(1.12, .9) rotate(-8deg); }
  35% { transform: translateY(-8%) scale(.94, 1.08) rotate(7deg); }
  55% { transform: translateX(-4%) rotate(-5deg); }
  75% { transform: translateX(3%) rotate(3deg); }
  100% { transform: none; }
}
.tank.tapped .glass { animation: rattle .35s linear; }
@keyframes rattle { 20% { transform: translateX(-4px) rotate(-.6deg); } 45% { transform: translateX(4px) rotate(.6deg); } 70% { transform: translateX(-2px); } 100% { transform: none; } }
@keyframes slosh { 50% { transform: translateY(3px) rotate(1.2deg); } }
@keyframes pulseLed { 50% { opacity: .25; } }

/* bubbles */
.bubbles i {
  position: absolute; bottom: -14px; width: 8px; height: 8px; border-radius: 50%; z-index: 1;
  border: 1px solid rgba(190, 255, 150, .55); background: rgba(190, 255, 150, .12);
  animation: rise 8s linear infinite;
}
.bubbles i:nth-child(1) { left: 14%; }
.bubbles i:nth-child(2) { left: 24%; width: 5px; height: 5px; animation-delay: 2.2s; animation-duration: 10s; }
.bubbles i:nth-child(3) { left: 38%; animation-delay: 4.1s; }
.bubbles i:nth-child(4) { left: 52%; width: 11px; height: 11px; animation-delay: 1.1s; animation-duration: 9s; }
.bubbles i:nth-child(5) { left: 64%; width: 6px; height: 6px; animation-delay: 3.3s; }
.bubbles i:nth-child(6) { left: 76%; animation-delay: 5.4s; animation-duration: 11s; }
.bubbles i:nth-child(7) { left: 86%; width: 5px; height: 5px; animation-delay: .6s; }
.bubbles i:nth-child(8) { left: 31%; width: 10px; height: 10px; animation-delay: 6.2s; animation-duration: 10s; }
.bubbles i:nth-child(9) { left: 70%; width: 4px; height: 4px; animation-delay: 7.1s; }
.bubbles i:nth-child(10) { left: 46%; width: 6px; height: 6px; animation-delay: 8.4s; animation-duration: 12s; }
.bubbles i.burst { bottom: 30%; animation: burst 1.6s ease-out forwards; }
@keyframes rise {
  0% { transform: translate(0, 0); opacity: 0; }
  8% { opacity: 1; }
  50% { transform: translate(6px, -260%); }
  90% { opacity: 1; }
  100% { transform: translate(-4px, -1000%); opacity: 0; }
}
.bubbles { position: absolute; inset: 0; }
.bubbles i { --h: 0; }
@keyframes burst { 0% { transform: translateY(0) scale(.4); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-1800%) scale(1.1); opacity: 0; } }

/* base with name plate and gauges */
.tank-base {
  margin: -2px 3% 0; padding: clamp(10px, .9vw, 16px) clamp(12px, 1.2vw, 20px); border-radius: 4px 4px 14px 14px;
  border: 1px solid #2a3338; background: linear-gradient(var(--steel-hi), var(--steel-lo));
  display: grid; gap: 8px; font: 600 clamp(10px, .3vw + 8px, 13px)/1 var(--mono); letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted);
}
.plate, .gauges { display: flex; justify-content: space-between; gap: 10px; }
.gauges { font-weight: 500; font-size: .88em; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .06); }
.gauges b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.green { color: var(--green); }
.hint { margin: 14px 0 0; text-align: center; font: 500 clamp(10px, .3vw + 8px, 13px)/1 var(--mono); letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); opacity: .8; }

/* ---------- right side: the pitch ---------- */
.side { display: flex; flex-direction: column; min-width: 0; }
.pitch { margin: auto 0; padding: 30px var(--gutter) clamp(40px, 5vw, 90px); max-width: clamp(480px, 46vw, 900px); }
.status { display: inline-flex; align-items: center; gap: 10px; font: 600 clamp(10px, .3vw + 8px, 13px)/1.3 var(--mono); letter-spacing: 1.6px; text-transform: uppercase; color: var(--green); border: 1px solid rgba(143, 227, 58, .3); background: rgba(143, 227, 58, .06); padding: .7em 1.1em; border-radius: 99px; }
.led { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulseLed 2.4s ease-in-out infinite; }
.pitch > .status { color: var(--red); border-color: rgba(255, 59, 74, .35); background: rgba(255, 59, 74, .07); }
.led.red { background: var(--red); box-shadow: 0 0 10px var(--red); animation-duration: 1.1s; }
.pitch h1 { font: 400 clamp(48px, 6.6vw, 140px)/.92 var(--display); margin: .32em 0 .18em; letter-spacing: .01em; text-transform: uppercase; text-shadow: 0 0 60px rgba(143, 227, 58, .12); }
.pitch .tagline { font: 400 clamp(17px, 1.35vw, 28px)/1.25 var(--display); color: var(--green); margin: 0 0 1em; text-transform: uppercase; letter-spacing: .02em; }

/* the title glitches for a split second every few seconds, like a bad signal */
.glitch { position: relative; }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.glitch::before { color: var(--red); animation: glitchA 6s steps(1) infinite; }
.glitch::after { color: var(--green); animation: glitchB 6s steps(1) infinite; }
@keyframes glitchA { 0%, 91%, 95%, 100% { opacity: 0; transform: none; } 92% { opacity: .8; transform: translate(-6px, 2px); clip-path: inset(10% 0 55% 0); } 93.5% { opacity: .8; transform: translate(5px, -2px); clip-path: inset(60% 0 8% 0); } }
@keyframes glitchB { 0%, 91.5%, 95%, 100% { opacity: 0; transform: none; } 92.5% { opacity: .7; transform: translate(6px, -1px); clip-path: inset(40% 0 30% 0); } 94% { opacity: .7; transform: translate(-4px, 3px); clip-path: inset(0 0 75% 0); } }

/* station log terminal */
.log {
  margin: clamp(22px, 2.2vw, 40px) 0 0; padding: clamp(14px, 1.3vw, 24px) clamp(16px, 1.5vw, 26px); max-width: 34em; min-height: 9.6em;
  font: 500 clamp(11.5px, .35vw + 9px, 15px)/1.65 var(--mono); color: var(--text); white-space: pre-wrap; overflow-x: auto;
  border: 1px solid var(--line); border-left: 2px solid var(--green); border-radius: 10px; background: rgba(5, 7, 8, .85);
}
.log b { font-weight: 700; }
.log .red { color: var(--red); }
.log .dim { color: var(--muted); }
.cursor { display: inline-block; width: .6em; height: 1.1em; margin-left: .3em; vertical-align: -.2em; background: var(--green); animation: pulseLed 1s steps(1) infinite; }
.log.typing::after { content: ""; display: inline-block; width: .6em; height: 1.1em; margin-left: .15em; vertical-align: -.2em; background: var(--green); }
.buttons { display: flex; gap: 12px; flex-wrap: wrap; margin-top: clamp(24px, 2.2vw, 40px); }
.btn {
  display: inline-flex; align-items: center; gap: .7em; padding: 1.1em 1.7em; border-radius: 10px; text-decoration: none;
  font: 700 clamp(11px, .3vw + 9px, 15px)/1 var(--mono); letter-spacing: 1.2px; text-transform: uppercase; border: 1px solid var(--line); color: var(--text); background: rgba(12, 16, 18, .85);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--muted); transform: translateY(-1px); }
.btn.solid { background: var(--green); color: var(--ink); border-color: var(--green); box-shadow: 0 0 28px rgba(143, 227, 58, .25); }
.btn.solid:hover { box-shadow: 0 0 40px rgba(143, 227, 58, .45); }
.btn.soon { cursor: default; background: rgba(143, 227, 58, .1); color: var(--green); border-color: rgba(143, 227, 58, .4); box-shadow: none; }
.btn.soon:hover { transform: none; }
.lost { min-height: 60vh; display: grid; align-content: center; }
.lost .status { margin-bottom: 10px; }
.tri { width: 0; height: 0; border-left: .75em solid currentColor; border-top: .45em solid transparent; border-bottom: .45em solid transparent; }

/* ---------- text pages ---------- */
.doc { max-width: 780px; margin: 0 auto; padding: 30px var(--gutter) 80px; }
.doc h1 { font: 400 clamp(34px, 4vw, 60px)/1.05 var(--display); text-transform: uppercase; margin: 10px 0 14px; letter-spacing: .01em; }
.doc h2 { font: 400 clamp(18px, 1.2vw, 23px)/1.3 var(--display); text-transform: uppercase; margin: 2.2em 0 .5em; letter-spacing: .02em; }
.doc h3 { font-size: 1.05em; margin: 1.6em 0 .4em; }
.doc .lead { font-size: 1.12em; color: var(--muted); }
.doc a { color: var(--green); }
.updated { font: 600 12px/1 var(--mono); letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); margin-bottom: 26px; }
ul, ol { padding-left: 22px; }
li { margin: 4px 0; }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .93em; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 600 11px/1.4 var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.table-scroll { overflow-x: auto; }
.media { aspect-ratio: 16 / 9; max-width: 100%; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; color: var(--muted); margin-top: 20px; text-align: center; padding: 16px; }

/* Placeholder text to replace before launch. Search the src files for class="fill". */
.fill { background: rgba(255, 201, 60, .16); color: var(--warn); border-radius: 3px; padding: 0 4px; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .bubbles i, .led, .lamp, .drift, .surface, .tank.tapped .glass, .alien, .part, .lid, .cursor,
  .alien.startled, .alien.startled .part, .glitch::before, .glitch::after { animation: none; }
}

/* ---------- phones and narrow windows ---------- */
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; min-height: 0; }
  .side { display: contents; }          /* top bar above the tank on phones */
  .bar { order: -1; flex-wrap: wrap; gap: 14px; }
  .bar nav { margin-left: 0; gap: 18px; }
  .art { order: 0; border-right: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 34px 24px 26px; }
  .tank { width: min(68vw, 270px); }
  .pitch { order: 1; max-width: none; padding-top: 28px; }
  .foot { order: 2; }
  .foot .links { margin-left: 0; }
}
