/*
 * style.css — the portfolio: one long, Apple-style scrolling page.
 * Scroll-linked values (--p, --line, --x, --s, --z, --progress) are set by js/scroll.js.
 */

:root {
  --bg: #000;
  --surface: #111114;
  --surface-2: #1b1b20;
  --panel: rgba(22, 22, 28, 0.85);   /* Gideon's console */
  --text: #f5f5f7;
  --muted: #86868b;
  --accent: #4fc3ff;                 /* Gideon blue */
  --accent-2: #8a7dff;
  --accent-3: #ff7ad9;
  --grad: linear-gradient(90deg, #4fc3ff, #8a7dff 50%, #ff7ad9);
  --speaking: #ffd36e;               /* warm gold while she talks */
  --danger: #ff5c7a;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --bar: 52px;                       /* top bar height */
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* no scrolling behind the boot screen */
body:has(.boot:not(.hidden)) { overflow: hidden; }

p  { line-height: 1.6; margin-bottom: 1rem; max-width: 60ch; }
a  { color: var(--accent); }
kbd {
  border: 1px solid rgba(255,255,255,0.3); border-radius: 6px; padding: 0.05em 0.45em;
  font-family: inherit; font-size: 0.85em; color: var(--text);
}
/* Keyboard users always see where they are */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.skip-link {
  position: fixed; top: 0.5rem; left: 0.5rem; z-index: 200;
  padding: 0.6rem 1rem; border-radius: 8px;
  background: var(--text); color: #000; font-weight: 600; text-decoration: none;
  transform: translateY(-150%); transition: transform 0.2s;
}
.skip-link:focus { transform: none; }

.grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* ---------- Scroll progress + top bar ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 11;
  background: var(--grad);
  transform-origin: left; transform: scaleX(var(--progress, 0));
}

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  height: var(--bar);
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0 1.5rem;
  background: rgba(0,0,0,0.6);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand { color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.topbar nav { position: relative; display: flex; gap: 1.4rem; margin: 0 auto; }
.topbar nav a {
  color: rgba(245,245,247,0.7); text-decoration: none;
  font-size: 0.8rem; padding: 0.35rem 0;
  transition: color 0.2s;
}
.topbar nav a:hover, .topbar nav a.current { color: var(--text); }
.topbar-modes { display: flex; gap: 0.5rem; }

/* gradient bar that slides under the current section's link (positioned by app.js) */
.nav-indicator {
  position: absolute; left: 0; top: 0; height: 2px; width: 0;
  background: var(--grad); border-radius: 2px; pointer-events: none;
  transition: transform 0.45s var(--ease), width 0.45s var(--ease), opacity 0.3s;
}

/* ---------- Sections ---------- */
.section {
  max-width: 1200px; margin: 0 auto;
  padding: 18vh max(6vw, 1.25rem) 6vh;
  scroll-margin-top: var(--bar);
}
.section-head { margin-bottom: 4rem; }
.kicker { font-size: 1.05rem; font-weight: 600; color: var(--accent); margin-bottom: 0.9rem; }
h2 {
  font-size: clamp(2.6rem, 6.5vw, 5.5rem); font-weight: 700;
  letter-spacing: -0.045em; line-height: 1.03;
}

/* Reveal on scroll (js/scroll.js adds .in) */
.reveal {
  opacity: 0;
  transform: translateY(56px) scale(0.97);
  transition: opacity 1s var(--ease), transform 1.2s var(--ease), box-shadow 0.3s, border-color 0.3s;
  transition-delay: calc(var(--d, 0) * 110ms);
}
.reveal.left  { transform: translateX(-70px); }
.reveal.right { transform: translateX(70px); }
.reveal.zoom  { transform: scale(0.86); }
.reveal.in    { opacity: 1; transform: none; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.cards.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 28px; padding: 2rem;
  transition: opacity 1s var(--ease), transform 1.2s var(--ease), translate 0.4s var(--ease), box-shadow 0.3s, border-color 0.3s;
}
.card:hover { translate: 0 -4px; border-color: rgba(255,255,255,0.14); }
.card h3 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 0.6rem; }
.card p, .card li { color: rgba(245,245,247,0.82); }
.card .meta {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.5rem;
}
.card .small { font-size: 0.88rem; color: var(--muted); }
.card > p:last-child { margin-bottom: 0; }
.card ul:not(.chips) { padding-left: 1.1rem; margin: 0.6rem 0; line-height: 1.6; font-size: 0.98rem; }
.card ul:not(.chips) li { margin-bottom: 0.4rem; }
.card.highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 30px 80px rgba(79,195,255,0.25);
}

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.9rem; }
.chips li {
  font-size: 0.8rem; font-weight: 500; padding: 0.3rem 0.8rem; border-radius: 999px;
  background: rgba(255,255,255,0.08); color: var(--text);
}

/* ---------- Hero ---------- */
.hero { max-width: none; padding: 0; height: 190vh; }
.sticky-frame {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  overflow: hidden;
}
.hero .sticky-frame { text-align: center; padding: 0 6vw; }
.hero-glow {
  position: absolute; width: 80vmax; height: 80vmax; border-radius: 50%;
  background: radial-gradient(circle, rgba(79,195,255,0.32), rgba(138,125,255,0.18) 35%, rgba(255,122,217,0.08) 55%, transparent 70%);
  filter: blur(30px);
  transform: scale(calc(0.55 + var(--p, 0) * 1.1));
  opacity: calc(0.95 - var(--p, 0) * 0.6);
  pointer-events: none;
}
.hero-content {
  position: relative;
  transform: translateY(calc(var(--p, 0) * -80px)) scale(calc(1 - var(--p, 0) * 0.2));
  opacity: calc(1 - var(--p, 0) * 1.7);
}
.eyebrow { font-size: 1.05rem; font-weight: 600; color: var(--muted); margin: 0 auto 1.2rem; max-width: none; }
.hero-title {
  font-size: clamp(3rem, 9vw, 8rem); font-weight: 800;
  letter-spacing: -0.05em; line-height: 1;
  margin-bottom: 1.8rem;
}
.hero-sub { font-size: clamp(1.1rem, 2vw, 1.45rem); color: var(--muted); max-width: 38ch; margin: 0 auto 1.4rem; line-height: 1.45; }
.hero-hint { font-size: 0.95rem; color: var(--muted); margin: 0 auto; max-width: none; }

/* entrance once the boot screen is dismissed (body.loaded) */
.hero-in { opacity: 0; transform: translateY(30px); }
body.loaded .hero-in { animation: hero-rise 1.2s var(--ease) both; animation-delay: calc(var(--d, 0) * 130ms + 150ms); }
@keyframes hero-rise { to { opacity: 1; transform: none; } }

.scroll-cue {
  position: absolute; bottom: 5vh; left: 50%; translate: -50% 0;
  width: 24px; height: 38px; border: 2px solid rgba(255,255,255,0.35); border-radius: 14px;
  opacity: calc(1 - var(--p, 0) * 5);
}
.scroll-cue span {
  position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px; background: var(--text);
  animation: cue 1.8s var(--ease) infinite;
}
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- About statement (words light up) ---------- */
.statement { max-width: none; padding: 0; height: 260vh; }
.statement .sticky-frame { align-items: flex-start; max-width: 1200px; margin: 0 auto; padding: 0 max(6vw, 1.25rem); }
.statement-text {
  font-size: clamp(1.9rem, 4.6vw, 3.9rem); font-weight: 700;
  letter-spacing: -0.035em; line-height: 1.15; max-width: 26ch;
}
.statement-text em { font-style: normal; }
/* unlit words stay readable (≥3:1 contrast for large text) while still clearly "off" */
.statement-text .w { color: rgba(245,245,247,0.42); transition: color 0.35s ease; }
.statement-text .w.lit { color: var(--text); }
.statement-text .w.key.lit { color: var(--accent); } /* solid color (not see-through gradient text) keeps contrast measurable */

/* ---------- Stats ---------- */
.stats {
  max-width: 1200px; margin: 0 auto; padding: 4vh max(6vw, 1.25rem);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem;
}
.stat { background: var(--surface); border-radius: 28px; padding: 2rem; }
.stat-num {
  display: block; font-size: clamp(3.2rem, 6vw, 4.8rem); font-weight: 800; letter-spacing: -0.05em; line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}
.stat-label { display: block; margin-top: 0.8rem; color: var(--muted); line-height: 1.4; font-size: 1rem; }

/* ---------- Education timeline ---------- */
.timeline-v { position: relative; max-width: 860px; padding-left: 3.2rem; }
.timeline-line { position: absolute; left: 0.95rem; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.1); border-radius: 2px; }
.timeline-line span {
  display: block; width: 100%; height: calc(var(--line, 0) * 100%);
  background: linear-gradient(180deg, #4fc3ff, #8a7dff, #ff7ad9);
  box-shadow: 0 0 12px rgba(79,195,255,0.6); border-radius: 2px;
}
.tl-item { position: relative; margin-bottom: 1.5rem; }
.tl-item::before {
  content: ""; position: absolute; left: -2.75rem; top: 2.2rem;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}

/* ---------- Skills marquee ---------- */
.marquee {
  width: 100vw; margin: 0 0 4rem calc(50% - 50vw);
  overflow: hidden; pointer-events: none;
}
.marquee-row {
  white-space: nowrap;
  font-size: clamp(3rem, 9vw, 8rem); font-weight: 800; letter-spacing: -0.045em; line-height: 1.12;
  transform: translateX(var(--x, 0px));
  will-change: transform;
}
.marquee-row.outline { color: transparent; -webkit-text-stroke: 1.5px rgba(245,245,247,0.35); }

.skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
.skill-groups > div { background: var(--surface); border-radius: 28px; padding: 1.8rem; }
.skill-groups h3 { font-size: 1rem; color: var(--muted); font-weight: 600; }
.skill-groups .chips li { font-size: 0.95rem; padding: 0.45rem 1rem; }

/* ---------- Projects: stacking cards ---------- */
.stack { max-width: 920px; margin: 0 auto; }
.stack-card {
  position: sticky; top: calc(var(--bar) + 4vh + var(--n, 0) * 22px);
  min-height: 56vh; margin-bottom: 24vh;
  padding: clamp(1.8rem, 4vw, 3.2rem);
  border-radius: 36px;
  background: linear-gradient(160deg, #18181d, #0b0b0e);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 -24px 60px rgba(0,0,0,0.65);
  transform-origin: center top;
  transform: scale(var(--s, 1));
  filter: brightness(var(--b, 1));
  transition: box-shadow 0.3s, border-color 0.3s; /* scale follows the scroll directly, no easing lag */
}
.stack-card:last-child { margin-bottom: 10vh; }
.stack-card:hover { translate: none; }
.stack-num {
  font-size: clamp(3rem, 8vw, 6rem) !important; font-weight: 800; letter-spacing: -0.06em; line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent !important;
  margin-bottom: 1.2rem;
}
.stack-card h3 { font-size: clamp(1.5rem, 3vw, 2.2rem); letter-spacing: -0.03em; line-height: 1.15; max-width: 22ch; }

/* ---------- Experience feature ---------- */
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: stretch; }
.eq-visual {
  display: flex; align-items: flex-end; justify-content: center; gap: 10px;
  min-height: 340px; padding: 2.5rem; border-radius: 28px;
  background: radial-gradient(circle at 50% 120%, rgba(138,125,255,0.35), transparent 60%), var(--surface);
}
.eq-visual span {
  width: 14px; height: 30%; border-radius: 8px;
  background: linear-gradient(180deg, #ff7ad9, #8a7dff, #4fc3ff);
  animation: eq 1.1s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.17s);
}
@keyframes eq { 0%, 100% { height: 16%; } 50% { height: 88%; } }

/* ---------- Awards ---------- */
.award { text-align: center; }
.award .kicker { margin: 0 auto 0.9rem; }
.award-word {
  font-size: clamp(5rem, 24vw, 19rem); font-weight: 800; letter-spacing: -0.07em; line-height: 0.95;
  margin: 0 auto 3rem; max-width: none;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  transform: scale(calc(0.55 + var(--z, 1) * 0.45));
  opacity: calc(var(--z, 1) * 1.3 - 0.1);
}
.award-card { max-width: 560px; margin: 0 auto; text-align: left; }

/* ---------- Contact ---------- */
.contact { text-align: center; padding-bottom: 22vh; }
.contact-title { font-size: clamp(3.6rem, 13vw, 11rem); letter-spacing: -0.06em; margin-bottom: 1.5rem; }
.contact p { margin-left: auto; margin-right: auto; color: var(--muted); font-size: 1.25rem; }
.pill {
  display: inline-block; margin: 1rem 0 1.5rem;
  padding: 1rem 2.2rem; border-radius: 999px;
  background: var(--text); color: #000; text-decoration: none;
  font-weight: 600; font-size: 1.1rem;
  transition: opacity 1s var(--ease), transform 1.2s var(--ease), scale 0.25s var(--ease);
}
.pill:hover { scale: 1.04; }
.contact-links { font-size: 1rem !important; }
.contact-links a { color: var(--text); }

.footer {
  max-width: 1200px; margin: 0 auto; padding: 2.5rem 1.25rem 10rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: var(--muted); font-size: 0.8rem; text-align: center;
}

/* ---------- Gideon panel ---------- */
.gideon {
  position: fixed; right: 1.5rem; bottom: 1.5rem;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.8rem;
  z-index: 20;
}

.orb {
  position: relative; width: 96px; height: 96px;
  border: none; background: none; cursor: pointer;
  --level: 0; /* 0..1, set from JS based on mic volume */
}
.orb .core {
  position: absolute; inset: 30%;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--accent) 40%, transparent 70%);
  box-shadow: 0 0 40px var(--accent);
  transform: scale(calc(1 + var(--level) * 0.6));
  transition: transform 0.08s linear, background 0.3s, box-shadow 0.3s;
}
.orb .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--accent); opacity: 0.4;
}
.orb .r1 { animation: spin 8s linear infinite; border-style: dashed; }
.orb .r2 { inset: 10%; animation: spin 5s linear infinite reverse; border-color: var(--accent-2); }
.orb .r3 { inset: -8%; opacity: 0.15; }
.orb-label {
  position: absolute; right: 108%; top: 50%; translate: 0 -50%;
  white-space: nowrap; padding: 0.4rem 0.85rem; border-radius: 999px;
  background: rgba(30,30,36,0.9); color: var(--text); font-size: 0.8rem; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.gideon.collapsed .orb:hover .orb-label,
.gideon.collapsed .orb:focus-visible .orb-label { opacity: 1; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.12); opacity: 0.6; } }

/* state-driven visuals */
.gideon[data-state="listening"] .r3 { animation: pulse 1.2s ease-in-out infinite; opacity: 0.6; }
.gideon[data-state="listening"] .status .dot { background: var(--danger); }

.gideon[data-state="speaking"] .core {
  background: radial-gradient(circle, #fff 0%, var(--speaking) 40%, transparent 70%);
  box-shadow: 0 0 50px var(--speaking);
  animation: pulse 0.5s ease-in-out infinite;
}
.gideon[data-state="speaking"] .ring { border-color: var(--speaking); }

.console {
  width: 320px; background: var(--panel);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 18px;
  padding: 0.9rem 1rem; font-size: 0.85rem;
  transform-origin: bottom right;
  animation: console-in 0.35s var(--ease);
}
.gideon.collapsed .console { display: none; }
@keyframes console-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } }
.status { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); margin-bottom: 0.5rem; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.console-close {
  margin-left: auto; width: 24px; height: 24px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.08); color: var(--text);
  cursor: pointer; font-size: 1rem; line-height: 1;
}
.console-close:hover { background: rgba(255,255,255,0.16); }

.transcript { max-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.6rem; }
.transcript .line { line-height: 1.4; }
.transcript .user   { color: var(--text); }
.transcript .user::before   { content: "YOU › "; color: var(--muted); }
.transcript .gideon-line { color: var(--accent); }
.transcript .gideon-line::before { content: "GIDEON › "; color: var(--accent-2); }
.transcript .interim { opacity: 0.5; font-style: italic; }

.text-form input {
  width: 100%; padding: 0.55rem 0.8rem;
  background: rgba(0,0,0,0.35); color: var(--text);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 10px;
  font: inherit;
}
.text-form input:focus { outline: none; border-color: var(--accent); }

.wake-toggle { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.6rem; color: var(--muted); cursor: pointer; }

/* hide portfolio chrome while a game mode is running */
body.in-game .scroll-progress, body.in-midnight .scroll-progress { display: none; }

/* ---------- Boot screen ---------- */
.boot {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #0b1626 0%, #000 65%);
  transition: opacity 0.8s ease, visibility 0.8s;
}
.boot.hidden { opacity: 0; visibility: hidden; pointer-events: none; } /* stop catching clicks immediately, not after the fade */
.boot-inner { text-align: center; padding: 0 1.25rem; }
.boot-label {
  font-weight: 600; letter-spacing: 0.3em; font-size: 0.85rem;
  color: var(--muted); margin: 0 auto 1.5rem; max-width: none;
}
.boot-btn {
  font-family: inherit; font-size: 1.05rem; font-weight: 600; letter-spacing: 0.02em;
  color: #000; background: var(--text);
  border: 1px solid var(--text); border-radius: 999px;
  padding: 0.95rem 2.2rem; cursor: pointer;
  transition: scale 0.2s var(--ease);
}
.boot-btn:hover { scale: 1.04; }
.boot-hint { color: var(--muted); margin: 1.5rem auto 0; font-size: 0.9rem; }

@keyframes materialize {   /* used by the game's memory cards */
  from { opacity: 0; transform: translateY(12px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* ---------- Reduced motion: everything visible, nothing scroll-linked ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal, .hero-in { opacity: 1 !important; transform: none !important; transition: none !important; animation: none !important; }
  .hero-content, .hero-glow, .award-word, .stack-card, .marquee-row { transform: none !important; opacity: 1 !important; filter: none !important; }
  .eq-visual span, .scroll-cue span { animation: none; }
  .statement-text .w { color: var(--text); }
}

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .feature-grid, .cards.grid-2 { grid-template-columns: 1fr; }
  .eq-visual { min-height: 200px; }
}
@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; gap: 0.4rem 1rem; padding: 0.6rem 1rem 0.3rem; }
  .topbar nav {
    order: 3; width: 100%; margin: 0; gap: 1.1rem;
    overflow-x: auto; scrollbar-width: none;
  }
  .topbar nav a { white-space: nowrap; }
  .topbar-modes { margin-left: auto; }
  .topbar-modes .enter-game { font-size: 0.7rem; padding: 0.2rem 0.6rem; }
  .section { padding-top: 14vh; scroll-margin-top: 92px; }
  .stack-card { top: calc(100px + var(--n, 0) * 16px); min-height: 0; margin-bottom: 18vh; }
  .timeline-v { padding-left: 2.4rem; }
  .tl-item::before { left: -2rem; }
  .timeline-line { left: 0.55rem; }
  .gideon { right: 1rem; bottom: 1rem; }
  .gideon:not(.collapsed) { left: 1rem; }
  .console { width: 100%; }
  .orb { width: 72px; height: 72px; }
}
