/* ============================================================
   ORBIT — Systems Engineer
   Monochrome. Geist everywhere. Hero + project grid.
   ============================================================ */

:root {
  --bg: #0a0a0a;
  --bg-2: #111111;
  --fg: #ededed;
  --dim: #9a9a9a;
  --faint: #6b6b6b;
  --line: #242424;
  --line-2: #383838;
  --inv-bg: #ededed;
  --inv-fg: #0a0a0a;

  --radius: 4px;
  --maxw: 940px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* `auto`, not `smooth` — the JS glide (useSmoothAnchors) does its own per-frame
   scrollTo; CSS smooth here would turn each of those into a nested animation */
html { scroll-behavior: auto; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* `clip` (not `hidden`) — `hidden` makes body a scroll container, which on
     iOS Safari makes position:fixed children jitter/flicker during scroll */
  overflow-x: clip;
}

@media (hover: hover) and (pointer: fine) {
  body, body * { cursor: none; }
}

::selection { background: var(--inv-bg); color: var(--inv-fg); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* faint static scanlines + vignette — painted once, no animation */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.016) 0 1px,
    transparent 1px 3px
  );
}
.vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}
/* Both are full-screen position:fixed layers. On touch devices (iOS) they
   resize + repaint every time the URL bar animates — that's the scroll flicker.
   They add almost nothing on a phone, so drop them there. */
@media (pointer: coarse) {
  .scanlines, .vignette { display: none; }
}

/* ---------- Custom cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10001;
  mix-blend-mode: difference;
  will-change: transform;
}
.cursor-dot {
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  background: #fff;
}
.cursor-ring {
  width: 32px; height: 32px;
  margin: -16px 0 0 -16px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  transition: width 0.22s var(--ease), height 0.22s var(--ease), margin 0.22s var(--ease);
}
.cursor-ring.on {
  width: 50px; height: 50px;
  margin: -25px 0 0 -25px;
}
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* ---------- Title bar ---------- */
.titlebar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(14px, 4vw, 28px);
  font-family: var(--mono);
  font-weight: 400;
  font-size: 12px;
  color: var(--dim);
  border-bottom: 1px solid transparent;
  background: transparent;
  transition: background 0.2s linear, border-color 0.2s linear;
}
.titlebar.scrolled { background: var(--bg); border-bottom: 1px solid var(--line); }
.tb-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dots { display: flex; gap: 6px; flex-shrink: 0; }
.dots i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--line-2); display: block; }
.tb-path { color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-links a { padding: 4px 8px; color: var(--dim); }
.tb-links a:hover { color: var(--inv-fg); background: var(--inv-bg); }
.tb-links a::before { content: "["; color: var(--faint); margin-right: 4px; }
.tb-links a::after { content: "]"; color: var(--faint); margin-left: 4px; }
.tb-links a:hover::before, .tb-links a:hover::after { color: var(--inv-fg); }

/* ---------- Layout ---------- */
main { padding-top: 46px; }
section {
  max-width: var(--maxw);
  margin: 0 auto;
  /* NO viewport-height unit anywhere — vw only. A vh/svh here reflows every
     section each time the iOS URL bar animates. */
  padding: clamp(56px, 12vw, 96px) clamp(14px, 4vw, 28px);
  scroll-margin-top: 54px;
}

/* the one remaining terminal line */
.cmd {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 13px;
  color: var(--faint);
  margin-bottom: 18px;
}
.cmd .u { color: var(--dim); }
.cmd .p { color: var(--fg); }

.section-title {
  font-family: var(--sans);
  font-size: clamp(1.7rem, 4.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--fg);
  margin-bottom: 30px;
}

/* ---------- Reveal (projects only) ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

.caret {
  display: inline-block;
  width: 7px; height: 1em;
  background: var(--fg);
  vertical-align: -2px;
  margin-left: 3px;
  animation: blink 1.1s infinite;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ---------- Hero ---------- */
.hero {
  min-height: calc(100svh - 46px);           /* fallback before the JS measure lands */
  min-height: calc(var(--app-h, 100svh) - 46px);   /* frozen px — never reflows on scroll */
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero h1 {
  font-family: var(--sans);
  font-size: clamp(2.6rem, 9vw, 5rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--fg);
}
.hero h1 .line { display: block; }
.hero-role {
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  color: var(--dim);
  margin: 14px 0 5px;
}
.hero-clock {
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(0.72rem, 1.7vw, 0.82rem);
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  margin: 0 0 30px;
}
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 13px;
  padding: 10px 18px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--fg);
  transition: background 0.15s linear, color 0.15s linear, border-color 0.15s linear;
}
.btn:hover { background: var(--inv-bg); color: var(--inv-fg); border-color: var(--inv-bg); }

/* ---------- Wave grid ---------- */
.wavegrid {
  --cols: 24;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 5px;
  width: 100%;
  max-width: 560px;
  margin-top: 44px;
}
.wavecell {
  aspect-ratio: 1;
  /* each square is beveled toward the moving light source (--light, set in JS) */
  background: linear-gradient(
    var(--light, 130deg),
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 255, 0.55) 42%,
    rgba(255, 255, 255, 0.12) 100%
  );
  opacity: 0.04;
  border-radius: 1px;
}

.scroll-hint {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--faint);
  margin-top: 42px;
}

/* ---------- Chips (shared: skills strip + project tags) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: 0.3px;
  line-height: 1.5;
  padding: 2px 7px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  color: var(--dim);
  white-space: nowrap;
}

/* ---------- Skills mini-strip (under the hero) ---------- */
.skills {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px clamp(14px, 4vw, 28px);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
}
.skill-row {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 16px;
  align-items: start;
}
.skill-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--faint);
  padding-top: 3px;
}
@media (max-width: 560px) {
  .skill-row { grid-template-columns: 1fr; gap: 7px; }
}

/* ---------- Projects grid ---------- */
.projects { border-top: 1px solid var(--line); }
.tile-tags { margin-top: -2px; }
.proj-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 640px) { .proj-grid { grid-template-columns: 1fr; } }

.tile { display: flex; flex-direction: column; gap: 12px; }
.tile-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #0d0d0d;
  border: 1px solid #ffffff;
  border-radius: 12px;
  transition: transform 0.3s var(--ease);
}
/* hover lift — pointer devices only, so a tap on touch never nudges the image */
@media (hover: hover) {
  .tile:hover .tile-img { transform: translateY(-3px); }
}
/* desktop: photos are click-to-expand */
@media (min-width: 600px) and (hover: hover) and (pointer: fine) {
  .tile:hover .tile-img.expandable { transform: translateY(-3px) scale(1.008); }
}

/* ---------- Lightbox (desktop only) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
  background: rgba(6, 6, 6, 0.94);
  animation: lb-in 0.35s ease both;
}
.lightbox.closing { animation: lb-out 0.4s ease both; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-out { from { opacity: 1; } to { opacity: 0; } }

.lightbox-wrap {
  width: min(1600px, 94vw, calc(90vh * 16 / 9));
  aspect-ratio: 16 / 9;
  transform-origin: center center;
  transition: transform 0.46s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.lightbox-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 1px solid #ffffff;
  border-radius: 10px;
}
.lightbox-hint {
  position: fixed;
  bottom: 22px;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--faint);
}
.tile-title {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.tile-desc {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.6;
  color: var(--dim);
  flex: 1;
}
.tile-link {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11.5px;
  color: var(--faint);
  align-self: flex-start;
  transition: color 0.15s linear;
}
.tile-link:hover { color: var(--fg); }

.tile.soon {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  min-height: 140px;
  padding: 30px 18px;
  color: var(--faint);
  font-family: var(--mono);
  font-weight: 400;
  font-size: 13px;
}
.tile.soon .caret { height: 0.9em; }

/* ---------- Footer ---------- */
footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px clamp(14px, 4vw, 28px) 48px;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 12px;
  color: var(--faint);
  text-align: center;
  border-top: 1px solid var(--line);
}
.footer-links {
  display: flex;
  gap: 22px;
  justify-content: center;
}
.footer-links a { color: var(--dim); transition: color 0.15s linear; }
.footer-links a:hover { color: var(--fg); }
.footer-links a::before { content: "["; color: var(--faint); margin-right: 5px; }
.footer-links a::after { content: "]"; color: var(--faint); margin-left: 5px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .scanlines { display: none; }
  /* keep these two: a blinking text caret and the slow ambient wave (JS slows
     it further under reduced motion) are both mild and purely decorative */
  .caret { animation: blink 1.1s infinite !important; }
}
