/* ============================================================
   borysbabii.me — "deployment as a launch"
   Dark-first. Light theme is a daylight launch.
   ============================================================ */

:root {
  --bg:        #ffffff;
  --bg-2:      #f4f6fa;
  --surface:   #ffffff;
  --border:    #dfe3ea;
  --text:      #14171d;
  --muted:     #5a6273;
  --accent:    #1f5fd0;
  --accent-2:  #0f9d8f;
  --glow:      rgba(31,95,208,.16);
  --star:      #9fb0cc;
  --shadow:    0 2px 4px rgba(16,24,40,.04), 0 12px 32px rgba(16,24,40,.07);
  --radius:    14px;
  --maxw:      1080px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:      #070912;
    --bg-2:    #0c1020;
    --surface: #10162a;
    --border:  #1e2740;
    --text:    #e9edf6;
    --muted:   #97a2ba;
    --accent:  #5b9bff;
    --accent-2:#3ddbc7;
    --glow:    rgba(91,155,255,.22);
    --star:    #cfe0ff;
    --shadow:  0 2px 4px rgba(0,0,0,.3), 0 18px 48px rgba(0,0,0,.45);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;   /* NOT hidden: hidden makes body a scroll container and breaks position:sticky */
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); }

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: 12px; top: 12px; position: fixed; z-index: 99;
  background: var(--accent); color: #fff; padding: 9px 16px; border-radius: 8px;
}

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

/* ── starfield ───────────────────────────────────────────── */
#stars {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: -2; pointer-events: none;
  opacity: .9;
}
@media (prefers-color-scheme: light) { #stars { opacity: .28; } }

/* ══════════════ HERO ══════════════ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 90px 0 60px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.hero-glow {
  position: absolute; z-index: -1;
  left: 50%; bottom: -30%;
  width: min(1100px, 130vw); aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--glow) 0%, transparent 62%);
  pointer-events: none;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0,1.35fr) minmax(0,.65fr);
  gap: 40px; align-items: center; width: 100%;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  margin: 0 0 18px;
  font-size: .8rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted);
}
.eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 var(--accent-2);
  animation: ping 2.4s ease-out infinite;
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(61,219,199,.55); }
  70%  { box-shadow: 0 0 0 11px rgba(61,219,199,0); }
  100% { box-shadow: 0 0 0 0 rgba(61,219,199,0); }
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -.035em;
  font-weight: 750;
}

.tagline {
  margin: 12px 0 0;
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  font-weight: 600;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

.lede { margin: 18px 0 0; max-width: 46ch; font-size: 1.05rem; color: var(--muted); }
.meta { margin: 14px 0 0; color: var(--muted); font-size: .92rem; }

.links { margin-top: 26px; display: flex; gap: 10px; flex-wrap: wrap; }
.links a {
  padding: 10px 20px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  text-decoration: none; font-size: .92rem; font-weight: 550; color: var(--text);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.links a:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.links a.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ── rocket ─────────────────────────────────────────────── */
.launchpad { position: relative; display: grid; place-items: end center; min-height: 340px; }
.rocket {
  will-change: transform;
  transform: translate3d(0, var(--lift, 0px), 0) rotate(var(--tilt, 0deg));
  filter: drop-shadow(0 22px 42px rgba(0,0,0,.35));
}
.rocket svg { display: block; width: clamp(90px, 16vw, 130px); height: auto; }

.flame { transform-origin: 60px 210px; animation: burn .12s steps(2, end) infinite alternate; }
@keyframes burn {
  from { transform: scaleY(.86) scaleX(.94); opacity: .85; }
  to   { transform: scaleY(1.12) scaleX(1.04); opacity: 1; }
}

.smoke { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); }
.smoke i {
  position: absolute; bottom: 0; left: 0;
  width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle, rgba(150,165,190,.36), transparent 68%);
  animation: puff 3s ease-out infinite;
}
.smoke i:nth-child(2) { animation-delay: 1s;   }
.smoke i:nth-child(3) { animation-delay: 2s;   }
@keyframes puff {
  0%   { transform: translate(-50%, 0) scale(.5); opacity: .75; }
  100% { transform: translate(calc(-50% + var(--drift, 60px)), 26px) scale(2.6); opacity: 0; }
}
.smoke i:nth-child(2) { --drift: -70px; }
.smoke i:nth-child(3) { --drift: 20px;  }

.scroll-cue {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid var(--border); border-radius: 14px;
}
.scroll-cue span {
  position: absolute; top: 8px; left: 50%; margin-left: -2px;
  width: 4px; height: 8px; border-radius: 2px; background: var(--accent);
  animation: wheel 1.8s ease-in-out infinite;
}
@keyframes wheel {
  0%,100% { transform: translateY(0);    opacity: 1; }
  60%     { transform: translateY(14px); opacity: 0; }
}

/* ══════════════ SECTIONS ══════════════ */
.band { padding: 96px 0; position: relative; }
.band.alt { background: var(--bg-2); border-block: 1px solid var(--border); }

h2 {
  margin: 0 0 14px;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  letter-spacing: -.02em; font-weight: 700;
  display: flex; align-items: baseline; gap: 14px;
}
h2 .num {
  font-size: .72rem; font-weight: 700; letter-spacing: .14em;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.section-lede { margin: 0 0 38px; max-width: 60ch; color: var(--muted); font-size: 1.02rem; }
h3.sub {
  margin: 30px 0 12px; font-size: .78rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
h3.sub:first-child { margin-top: 0; }

/* reveal on scroll */
[data-reveal] { opacity: 0; transform: translateY(26px); }
[data-reveal].in {
  opacity: 1; transform: none;
  transition: opacity .7s ease, transform .7s cubic-bezier(.16,1,.3,1);
}

/* ── pipeline: pinned, scroll-driven Jenkins run ─────────── */
/* .pipeline-scroll is the runway; .pin is what the reader actually sees.
   Sticky only works because body uses overflow-x: clip (see line 48) and
   this section carries no [data-reveal] transform. */
.pipeline-scroll { height: 340vh; padding: 0; }
.pin {
  position: sticky; top: 0;
  height: 100vh; min-height: 560px;
  display: grid; align-content: center;
}

/* run header — Jenkins build metadata */
.run-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 30px; font-size: .84rem;
}
.run-head span {
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-variant-numeric: tabular-nums;
}
.run-head .build   { font-weight: 700; color: var(--text); }
.run-head .branch  { color: var(--muted); }
.run-head .branch::before { content: "⑂ "; opacity: .7; }
.run-head .elapsed { color: var(--muted); margin-left: auto; }
.run-head .run-status {
  font-weight: 650; letter-spacing: .04em;
  color: var(--accent); border-color: var(--accent);
  background: var(--glow);
}
.pipeline-scroll.done .run-status {
  color: #34d399; border-color: #34d399;
  background: color-mix(in srgb, #34d399 16%, transparent);
}

/* the chain — one column per stage, connector running behind the nodes */
.chain {
  --fill: 0;
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(8, 1fr);
  position: relative;
}

/* connector: same treatment as the old pipe — casing over bore, then flow */
.chain::before, .chain::after {
  content: ""; position: absolute; left: 6.25%; right: 6.25%; top: 17px;
  height: 10px; border-radius: 999px;
}
.chain::before { background: var(--border); }          /* casing */
.chain::after {                                        /* flow */
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(var(--fill)); transform-origin: left center;
  transition: transform .12s linear;
}

.chain li {
  position: relative; text-align: center; padding: 0 6px;
  display: grid; justify-items: center; gap: 2px;
}

/* the node */
.node {
  position: relative; z-index: 1;
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--border); background: var(--bg);
  display: grid; place-items: center;
  transition: border-color .3s ease, background .3s ease, transform .3s ease;
}
.node::after {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  background: var(--border); transition: all .3s ease;
}

.chain li b   { margin-top: 12px; font-size: .86rem; color: var(--muted); transition: color .3s ease; }
.chain li .sub {
  font-size: .72rem; color: var(--muted); opacity: .62;
  min-height: 2.5em;   /* keeps the duration row aligned when a sublabel wraps */
}
.chain li .dur {
  font-size: .72rem; color: var(--muted); opacity: 0;
  font-variant-numeric: tabular-nums; transition: opacity .3s ease;
}

/* ── stage states ── */
.chain li.done .node    { border-color: var(--accent-2); background: var(--accent-2); }
.chain li.done .node::after {
  width: 15px; height: 8px; border-radius: 0; background: transparent;
  border-left: 3px solid var(--bg); border-bottom: 3px solid var(--bg);
  transform: rotate(-45deg) translate(1px, -2px);
}
.chain li.done b   { color: var(--text); }
.chain li.done .dur { opacity: .75; }

.chain li.running .node {
  border-color: var(--accent); background: var(--bg);
  transform: scale(1.14);
  animation: ping 1.6s ease-out infinite;
}
.chain li.running .node::after { background: var(--accent); }
.chain li.running b { color: var(--accent); font-weight: 700; }

.chain li.pending .node { opacity: .5; }
.chain li.pending b, .chain li.pending .sub { opacity: .45; }

/* console line */
.console {
  margin: 34px 0 0; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow-x: auto;
}
.console code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84rem; color: var(--muted); white-space: nowrap;
}
.console .cmd { color: var(--text); }

/* ── blue/green ─────────────────────────────────────────── */
.two-col {
  display: grid; gap: 46px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
}

.ticks { list-style: none; padding: 0; margin: 22px 0 0; }
.ticks li { position: relative; padding-left: 28px; margin-bottom: 10px; color: var(--muted); }
.ticks li::before {
  content: ""; position: absolute; left: 4px; top: .55em;
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent-2);
}

.bg-demo {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
}
.router {
  text-align: center; padding: 11px; border-radius: 10px;
  border: 1px dashed var(--border); color: var(--muted);
  font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
}
.arrows { display: flex; justify-content: center; gap: 46px; height: 40px; }
.arrows i {
  width: 2px; height: 100%;
  background: linear-gradient(var(--border), var(--border));
  position: relative;
}
.arrows i:nth-child(2) { opacity: 0; }
.arrows i::after {
  content: ""; position: absolute; left: -3px; top: 0;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: drip 1.4s linear infinite;
}
.arrows i:nth-child(3)::after { animation-delay: .7s; }
@keyframes drip { from { top: -8px; opacity: 0; } 30% { opacity: 1; } to { top: 40px; opacity: 0; } }

.envs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.env {
  border-radius: 12px; padding: 18px; text-align: center;
  border: 2px solid var(--border);
  transition: border-color .5s ease, box-shadow .5s ease, opacity .5s ease;
}
.env b { display: block; font-size: 1.05rem; }
.env .ver { display: block; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.env .badge {
  display: inline-block; margin-top: 10px;
  font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
}

.env.blue  { --c: #4d9dff; }
.env.green { --c: #34d399; }
.env.live  { border-color: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent); }
.env:not(.live) { opacity: .45; }
.env.live .badge { background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); }
.env:not(.live) .badge { visibility: hidden; }

/* ── cards ──────────────────────────────────────────────── */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.card h3 { margin: 0 0 8px; font-size: 1rem; }
.card p { margin: 0; color: var(--muted); font-size: .93rem; }

/* ── missions ───────────────────────────────────────────── */
.missions {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}
.mission {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  position: relative; overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease;
}
.mission::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(var(--accent), var(--accent-2));
  transform: scaleY(0); transform-origin: top; transition: transform .32s ease;
}
.mission:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.mission:hover::before { transform: scaleY(1); }
.tag {
  display: inline-block; margin-bottom: 10px;
  font-size: .68rem; letter-spacing: .11em; text-transform: uppercase; font-weight: 700;
  color: var(--accent); background: var(--glow); padding: 3px 10px; border-radius: 999px;
}
.mission h3 { margin: 0 0 8px; font-size: 1.08rem; }
.mission p { margin: 0 0 6px; color: var(--muted); font-size: .94rem; }
.stack { font-size: .82rem; opacity: .8; }

/* ── timeline ───────────────────────────────────────────── */
.timeline { list-style: none; padding: 0 0 0 26px; margin: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 34px 18px; }
.timeline li::before {
  content: ""; position: absolute; left: -33px; top: 9px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg);
  box-shadow: 0 0 0 3px var(--glow);
}
.years {
  display: block; color: var(--muted);
  font-size: .8rem; letter-spacing: .05em; font-variant-numeric: tabular-nums;
}
.timeline h3 { margin: 4px 0 6px; font-size: 1.05rem; }
.timeline p { margin: 0; color: var(--muted); font-size: .95rem; max-width: 66ch; }

/* ── lists / article ────────────────────────────────────── */
.oss { list-style: none; padding: 0; margin: 0; }
.oss li {
  padding: 10px 0; border-bottom: 1px solid var(--border);
  color: var(--muted); font-size: .95rem;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
}
.oss li:last-child { border-bottom: 0; }
.oss em { font-style: normal; font-size: .82rem; opacity: .75; margin-left: auto; }

.article {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.article:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.article b { display: block; margin: 6px 0 8px; font-size: 1.05rem; }
.article > span:last-child { color: var(--muted); font-size: .92rem; }

/* ── footer ─────────────────────────────────────────────── */
footer { border-top: 1px solid var(--border); padding: 40px 0 64px; }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .93rem; }
.foot p { margin: 0; }

/* ══════════════ RESPONSIVE ══════════════ */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .launchpad { order: -1; min-height: 220px; place-items: center; }
  .rocket svg { width: 92px; }
  .band { padding: 70px 0; }
  .pipeline-scroll { padding: 0; }
}
@media (max-width: 520px) {
  .run-head .elapsed { margin-left: 0; }
}


/* pipeline goes vertical when eight columns no longer fit */
@media (max-width: 720px) {
  .pipeline-scroll { height: 240vh; }
  .pin { align-content: center; }
  .chain { grid-template-columns: 1fr; gap: 2px; }
  .chain::before, .chain::after {
    left: 21px; right: auto; top: 22px; bottom: 22px;
    width: 10px; height: auto;
  }
  .chain::after { transform: scaleY(var(--fill)); transform-origin: center top; }
  .chain li {
    grid-template-columns: 44px 1fr auto;
    grid-template-areas: "node name dur" "node sub dur";
    justify-items: start; text-align: left;
    align-items: center; gap: 0 14px; padding: 5px 0;
  }
  .node { grid-area: node; width: 44px; height: 44px; }
  .chain li b   { grid-area: name; margin-top: 0; }
  .chain li .sub { grid-area: sub; }
  .chain li .dur { grid-area: dur; }
  .console { margin-top: 22px; }
  .section-lede { margin-bottom: 24px; }
}

/* ══════════════ REDUCED MOTION ══════════════ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  /* pipeline: no pin, no run — show the finished build */
  .pipeline-scroll { height: auto; padding: 96px 0; }
  .pin { position: static; height: auto; min-height: 0; }
  .chain { --fill: 1 !important; }
  .chain li .node { border-color: var(--accent-2); background: var(--accent-2); opacity: 1; }
  .chain li b, .chain li .sub { opacity: 1; color: var(--text); }
  .chain li .dur { opacity: .75; }
  .rocket { transform: none !important; }
  #stars { display: none; }
  .env:not(.live) { opacity: 1; }
}
