/* ============================================================
   ericgang.com — single-screen, no-scroll personal page.
   Shares staqs DNA (dark + neon) with its own signature:
   green→cyan duotone, Space Grotesk, particle field.
   ============================================================ */

:root {
  --bg:        #050505;
  --bg-2:      #0a0a0a;
  --line:      rgba(255, 255, 255, 0.08);
  --line-2:    rgba(255, 255, 255, 0.14);
  --text:      #f4f6f5;
  --muted:     #9aa3a0;
  --muted-2:   #7a847f;   /* 5.0:1 on #050505 — safe AA for fine print */
  --on-duo:    #05140b;   /* dark ink for text on the green→cyan gradient */
  --green:     #4ade80;
  --cyan:      #22d3ee;
  --duo:       linear-gradient(115deg, var(--green) 0%, var(--cyan) 100%);
  --glow-green: rgba(74, 222, 128, 0.5);
  --glow-cyan:  rgba(34, 211, 238, 0.5);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;            /* scroll exists only because .contrib is below the fold */
  position: relative;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--green); color: #05140b; }

.skip-link {
  position: absolute; top: 0; z-index: 100; transform: translateX(-999px);
  background: var(--green); color: var(--on-duo); padding: 0.6rem 1rem;
  font-family: var(--font-mono); font-size: 0.8rem; border-radius: 0 0 8px 0;
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translateX(0); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }

/* ---------- Backdrop ---------- */
#field { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }
body::before {  /* ambient duotone depth even where particles are sparse */
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60vw 60vw at 82% -8%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(55vw 55vw at -8% 108%, rgba(74, 222, 128, 0.10), transparent 58%);
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.035; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Stage (full viewport, no scroll) ---------- */
.stage {
  position: relative; z-index: 2;
  height: 100svh; min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: clamp(1rem, 2.4vh, 2rem);
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(1rem, 2.6vh, 1.8rem) clamp(1.2rem, 5vw, 3rem) clamp(1rem, 2.4vh, 1.6rem);
}

/* ---------- Header ---------- */
.site-header { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem;
  color: var(--on-duo); background: var(--duo); box-shadow: 0 0 18px -4px var(--glow-green);
}
.brand-text { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
.nav-cta {
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--green);
  border: 1px solid rgba(74, 222, 128, 0.3); padding: 0.45rem 0.9rem; border-radius: 999px;
  transition: background 0.25s var(--ease);
}
.nav-cta:hover { background: rgba(74, 222, 128, 0.1); }
.nav-cta:focus-visible { background: rgba(74, 222, 128, 0.12); }
.header-nav { display: inline-flex; align-items: center; gap: 0.55rem; }

/* ---------- Hero ---------- */
.hero {
  align-self: center;
  display: grid; grid-template-columns: 1.25fr 0.85fr;
  gap: clamp(1.5rem, 5vw, 4rem); align-items: center;
}
.kicker {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-mono); font-size: clamp(0.68rem, 1.4vw, 0.8rem); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: clamp(0.8rem, 2vh, 1.5rem);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 10px 1px var(--glow-green); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.hero-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.8rem, 9vw, 6.4rem); line-height: 1; letter-spacing: -0.04em;
  margin-bottom: clamp(0.7rem, 1.8vh, 1.25rem); padding-bottom: 0.12em;
  background: linear-gradient(180deg, #ffffff 0%, #c9d1ce 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-bio {
  font-size: clamp(1rem, 2.1vw, 1.32rem); color: var(--muted);
  max-width: 42ch; margin-bottom: clamp(1.2rem, 3vh, 2.2rem);
}
.hero-bio em { color: var(--text); font-style: normal; font-weight: 600; }
.ilink {
  color: var(--green);
  background-image: linear-gradient(var(--green), var(--green));
  background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size 0.3s var(--ease);
}
.ilink:hover { background-size: 100% 1px; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.9rem; font-weight: 500;
  padding: 0.8rem 1.4rem; border-radius: 999px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn-primary { color: var(--on-duo); background: var(--duo); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 34px -8px var(--glow-cyan); }
.btn-ghost { color: var(--text); border: 1px solid rgba(255, 255, 255, 0.22); }
.btn-ghost:hover { border-color: var(--green); transform: translateY(-2px); }
/* :active rules MUST stay below every .btn*:hover above — equal specificity
   means source order decides, and the pressed state needs to win. */
.btn:active { transform: translateY(0); }
.btn-primary:active { box-shadow: 0 4px 16px -6px var(--glow-cyan); }

/* Portrait */
.hero-portrait {
  position: relative; justify-self: center;
  width: clamp(180px, 26vw, 320px); aspect-ratio: 1;
}
.hero-portrait img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  border: 1px solid var(--line-2); filter: grayscale(0.15) contrast(1.03);
}
.portrait-ring {
  position: absolute; inset: -14px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--green), var(--cyan), var(--green));
  filter: blur(2px); opacity: 0.55; z-index: -1;
  animation: spin 14s linear infinite;
  mask: radial-gradient(circle, transparent 64%, #000 66%);
  -webkit-mask: radial-gradient(circle, transparent 64%, #000 66%);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Links row ---------- */
.links { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; }
.link-card {
  position: relative; display: flex; flex-direction: column; gap: 0.25rem;
  padding: 0.95rem 1.1rem; border-radius: 13px;
  background: rgba(255, 255, 255, 0.02); border: 1px solid var(--line);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease), transform 0.3s var(--ease);
}
.link-card:hover { border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.05); transform: translateY(-3px); }
/* stays below :hover above — equal specificity, source order decides */
.link-card:active { transform: translateY(-1px); }
.link-label {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.link-name { font-family: var(--font-display); font-size: clamp(0.95rem, 1.6vw, 1.15rem); font-weight: 500; }
.link-arrow { position: absolute; top: 0.85rem; right: 1rem; color: var(--green);
  transition: transform 0.25s var(--ease); }
.link-card:hover .link-arrow { transform: translate(3px, -3px); }

/* ---------- Footer ---------- */
.site-footer {
  display: flex; flex-direction: column; gap: 0.4rem;
  border-top: 1px solid var(--line); padding-top: clamp(0.7rem, 1.6vh, 1.1rem);
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted);
}
.foot-bar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 1.2rem; flex-wrap: wrap;
}
.foot-meta { color: var(--muted); }
.foot-tag { color: var(--muted-2); }

/* ---------- Scroll cue (revealed only once contributions load) ---------- */
.scroll-cue {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted-2);
  transition: color 0.25s var(--ease);
}
.scroll-cue:hover, .scroll-cue:focus-visible { color: var(--green); }
.scroll-cue-arrow { display: inline-block; transition: transform 0.25s var(--ease); }
.scroll-cue:hover .scroll-cue-arrow, .scroll-cue:focus-visible .scroll-cue-arrow { transform: translateY(4px); }

/* ---------- Open source contributions ---------- */
.contrib {
  position: relative; z-index: 2;
  border-top: 1px solid var(--line);
  padding: clamp(3rem, 8vh, 5rem) clamp(1.2rem, 5vw, 3rem);
}
.contrib-inner { max-width: var(--maxw); margin: 0 auto; }
.contrib-head { margin-bottom: clamp(1.6rem, 4vh, 2.4rem); max-width: 62ch; }
#contrib-heading {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em;
  font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 0.6rem;
}
.contrib-sub { color: var(--muted); font-size: clamp(0.92rem, 1.6vw, 1.05rem); margin-bottom: 1rem; }
.contrib-verify { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; margin-bottom: 0.9rem; }
.contrib-head .nav-cta { display: inline-flex; }
.contrib-badge { display: inline-flex; border-radius: 5px; transition: opacity 0.2s var(--ease); }
.contrib-badge:hover { opacity: 0.85; }
.contrib-badge img { height: 22px; display: block; border-radius: 5px; }
.contrib-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.contrib-chip {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.02em;
  color: var(--green); border: 1px solid rgba(74, 222, 128, 0.25);
  background: transparent; padding: 0.3rem 0.7rem; border-radius: 999px;
}

.contrib-grid {
  list-style: none;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
}
.contrib-card {
  display: flex; flex-direction: column; gap: 0.55rem;
  height: 100%; padding: 1.15rem 1.25rem;
  background: rgba(255, 255, 255, 0.02); border: 1px solid var(--line); border-radius: 13px;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease), transform 0.3s var(--ease);
}
.contrib-card:hover, .contrib-card:focus-visible {
  border-color: rgba(74, 222, 128, 0.4); background: rgba(74, 222, 128, 0.05);
  transform: translateY(-3px);
}
/* stays below :hover/:focus-visible above — equal specificity, source order decides */
.contrib-card:active { transform: translateY(-1px); }
.contrib-recency {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.03em;
  color: var(--muted);
}
.contrib-repo { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.contrib-repo-name { font-family: var(--font-display); font-size: 1.05rem; font-weight: 500; color: var(--text); }
.contrib-arrow { color: var(--green); transition: transform 0.25s var(--ease); }
.contrib-card:hover .contrib-arrow, .contrib-card:focus-visible .contrib-arrow { transform: translate(3px, -3px); }
.contrib-title {
  font-family: var(--font-body); font-size: 0.92rem; color: var(--text); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.contrib-blurb {
  font-family: var(--font-body); font-size: 0.82rem; color: var(--muted); line-height: 1.4;
  margin-top: 0.4rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.contrib-meta {
  margin-top: auto; padding-top: 0.3rem;
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted-2);
}
.contrib-footnote {
  margin-top: clamp(1.2rem, 3vh, 1.8rem);
  font-family: var(--font-mono); font-size: 0.76rem; color: var(--muted-2);
}

@media (max-width: 1024px) { .contrib-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .contrib-grid { grid-template-columns: 1fr; } }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .stage { gap: clamp(0.8rem, 2vh, 1.4rem); }
  .hero { grid-template-columns: 1fr; gap: clamp(1rem, 4vh, 2rem); align-items: start; }
  .hero-portrait { grid-row: 1; width: clamp(120px, 30vw, 180px); justify-self: start; }
  .links { grid-template-columns: repeat(2, 1fr); }
  .brand-text { display: none; }
}
@media (max-width: 560px) {
  .hero-bio { max-width: none; }
  .foot-tag { display: none; }
  .link-name { font-size: 0.92rem; }
  /* stacked so .scroll-cue never lands under the fixed .lookup-pill's corner */
  .foot-bar { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
}
@media (max-height: 680px) and (min-width: 881px) {
  .hero-name { font-size: clamp(2.4rem, 7vw, 4.6rem); }
  .hero-bio { margin-bottom: 1rem; }
}

/* Asset attribution for the "Look up" room — quiet, but present */
.foot-credits {
  margin-top: 0;
  font-size: 0.68rem; color: var(--muted); opacity: 0.7;
}
.foot-credits a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Look up (3D world reveal) ----------
   The pill stays OUTSIDE the 3D-wrapped DOM so it floats above the world
   and doubles as the "Look back down" control. Everything heavy loads
   lazily from /lookup/lookup.js on first click. */
.lookup-pill {
  position: fixed; z-index: 60;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--cyan);
  background: rgba(5, 5, 5, 0.55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(34, 211, 238, 0.3);
  padding: 0.5rem 1rem; border-radius: 999px; cursor: pointer;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.lookup-pill:hover { background: rgba(34, 211, 238, 0.12); border-color: rgba(34, 211, 238, 0.55); transform: translateY(-2px); }
.lookup-pill[data-busy] { opacity: 0.55; pointer-events: none; }

#lookup-root { position: fixed; inset: 0; z-index: 50; background: var(--bg); }
#lookup-root .lookup-css { position: absolute; inset: 0; }
#lookup-root canvas { position: absolute; inset: 0; touch-action: none; cursor: grab; }
#lookup-root canvas:active { cursor: grabbing; }

/* The live page, transplanted onto the device screen */
#site-root {
  position: relative; background: var(--bg);
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: none;
  transition: border-radius 1.6s var(--ease);
}
#site-root::before { /* stand-in for body::before, which can't follow the DOM into the 3D plane */
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60vw 60vw at 82% -8%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(55vw 55vw at -8% 108%, rgba(74, 222, 128, 0.10), transparent 58%);
}
#site-root[data-world] { border-radius: 26px; }

.lookup-hint {
  position: absolute; left: 50%; top: max(22px, env(safe-area-inset-top));
  transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.06em;
  color: var(--muted); background: rgba(5, 5, 5, 0.55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); padding: 0.4rem 0.9rem; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity 0.6s var(--ease);
}
.lookup-hint.show { opacity: 1; }

/* Floating name chip that follows the hovered object in the room */
.lookup-label {
  position: absolute; left: 0; top: 0; margin: 0 0 14px;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.05em;
  color: var(--fg); background: rgba(5, 5, 5, 0.72);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(34, 211, 238, 0.35); padding: 0.3rem 0.75rem; border-radius: 999px;
  opacity: 0; pointer-events: none; white-space: nowrap;
  transition: opacity 0.25s var(--ease); will-change: transform;
}
.lookup-label.show { opacity: 1; }

/* Ambience toggle, bottom-left so the "Look back down" pill keeps
   the bottom-right corner to itself */
.lookup-audio {
  position: absolute; left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em;
  color: var(--muted); background: rgba(5, 5, 5, 0.55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); padding: 0.4rem 0.85rem; border-radius: 999px;
  cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity 0.6s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.lookup-audio.show { opacity: 1; pointer-events: auto; }

/* Buzzer wayfinder — appears while someone is on the intercom downstairs, and
   points you at it: sits on the intercom when it's on-screen, pins to the screen
   edge with an arrow toward it when it isn't. */
.lookup-buzz {
  position: absolute; left: 0; top: 0;
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.05em;
  color: #ffd9c2; background: rgba(28, 6, 2, 0.74);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 90, 48, 0.7); padding: 0.32rem 0.72rem; border-radius: 999px;
  opacity: 0; pointer-events: none; white-space: nowrap; will-change: transform;
  transition: opacity 0.2s var(--ease);
}
.lookup-buzz.show { opacity: 1; animation: buzz-pulse 0.66s ease-in-out infinite; }
.lookup-buzz .arrow { display: inline-block; font-size: 0.86rem; line-height: 1; will-change: transform; }
@keyframes buzz-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 90, 48, 0.28); }
  50% { box-shadow: 0 0 22px rgba(255, 90, 48, 0.7); }
}
@media (prefers-reduced-motion: reduce) {
  .lookup-buzz.show { animation: none; }
}
.lookup-audio[aria-pressed="true"] { color: var(--accent, #22d3ee); border-color: rgba(34, 211, 238, 0.55); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  #field { display: none; }
}
