/* Fonts loaded via <link> in HTML head for non-blocking rendering */

:root {
  /* -- Palette -- */
  --bg-deep: #0B0E14;
  --bg-panel: #151B25;
  --bg-card: rgba(18, 24, 34, 0.42);
  --bg-glass: rgba(21, 27, 37, 0.4);

  --accent-primary: #38BDF8;
  /* Electric Blue */
  --accent-secondary: #A78BFA;
  /* Soft Purple */
  --accent-glow: rgba(56, 189, 248, 0.5);

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #7C8A9E;

  --border-light: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(56, 189, 248, 0.3);

  /* -- Type -- */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', monospace;

  /* -- Spacing -- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --header-height: 80px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  background-color: var(--bg-deep);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
}

/* Static ambient base on a fixed layer (also avoids the iOS
   background-attachment:fixed bug); pages without the .bg scene
   (cargodzen.html) still get this atmosphere. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 70% at 15% 60%, rgba(56, 189, 248, 0.06), transparent 60%),
    radial-gradient(ellipse 80% 60% at 85% 20%, rgba(167, 139, 250, 0.05), transparent 60%);
}

/* --- Creative Link Buttons (from card.html) --- */
.link-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-btn {
  position: relative;
  display: flex;
  align-items: center;
  padding: 14px 20px;
  text-decoration: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.95rem;
  overflow: hidden;
  cursor: pointer;
  width: 100%;
}

.link-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.link-btn:active {
  transform: translateY(0);
}

.link-icon {
  width: 24px;
  height: 24px;
  margin-right: 14px;
  fill: currentColor;
  opacity: 0.9;
  flex-shrink: 0;
}

.link-arrow {
  margin-left: auto;
  opacity: 0.5;
  transition: transform 0.3s;
}

.link-btn:hover .link-arrow {
  transform: translateX(4px);
  opacity: 1;
}

/* Specific Colors */
.btn-wa {
  color: #4ade80;
}

.btn-wa:hover {
  background: rgba(37, 211, 102, 0.15);
  border-color: rgba(37, 211, 102, 0.3);
}

.btn-tg {
  color: #38BDF8;
}

.btn-tg:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
}

/* Email Copy Utility overrides */
.link-btn.is-copy {
  width: auto;
  padding: 0 16px;
  justify-content: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -- Typography -- */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.1;
  background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* With background-clip:text the gradient only fills the line box, so
     descenders (g, y) that dip below it render transparent. A little
     bottom padding extends the gradient to cover them. */
  padding-bottom: 0.12em;
}

h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

h2::before {
  content: '';
  display: block;
  width: 4px;
  height: 24px;
  background: linear-gradient(to bottom, var(--accent-primary), var(--accent-secondary));
  border-radius: 2px;
}

p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s;
}

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

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* -- Layout -- */
.container {
  width: min(100%, 1100px);
  margin-inline: auto;
  padding-inline: 20px;
}

section {
  padding-block: 80px;
  position: relative;
}

/* -- Components: Buttons -- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(167, 139, 250, 0.1));
  border-color: rgba(56, 189, 248, 0.2);
  color: var(--accent-primary);
  backdrop-filter: blur(8px);
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(167, 139, 250, 0.2));
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.15);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.btn-ghost:hover {
  border-color: var(--text-dim);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* -- Components: Cards -- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-lg);
  padding: 24px;
  /* Frost the motherboard behind the card so it reads through as glass */
  backdrop-filter: blur(16px) saturate(135%);
  -webkit-backdrop-filter: blur(16px) saturate(135%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.04), transparent 40%);
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.glass-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

.glass-card:hover::before {
  opacity: 1;
}

/* -- Hero Section -- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
  padding: 120px 20px 80px;
}

.hero-content {
  max-width: 800px;
  width: 100%;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  font-weight: 300;
  margin-bottom: 32px;
  max-width: 600px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* -- Navigation -- */
.floating-nav {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(16px);
  padding: 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  display: flex;
  gap: 4px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.floating-nav:hover {
  background: rgba(11, 14, 20, 0.95);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  transform: translateX(-50%) translateY(-2px);
}

.nav-link {
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.12);
}

/* -- App Store Section -- */
/* One app per row: icon, then the name and pitch, then the links */
.app-subhead {
  margin: 28px 0 14px;
  font-size: 1.125rem;
  color: var(--text-muted);
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.app-card {
  display: flex;
  align-items: center;
  gap: 24px;
}

.app-card > div {
  flex: 1 1 auto;
  min-width: 0;
}

/* Phones: the icon sits above the text, so the text and links get the full width */
@media (max-width: 600px) {
  .app-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .app-card .app-icon {
    width: 56px;
    height: 56px;
    border-radius: 13px;
  }
}

/* Wide screens: the links move to the right of the text, like an App Store list */
@media (min-width: 900px) {
  .app-card > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 40px;
    align-items: center;
  }

  .app-card > div > * {
    grid-column: 1;
  }

  .app-card > div > :last-child {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
}

.app-icon-link {
  display: block;
  flex: none;
  line-height: 0;
}

.app-card h4 {
  font-size: 1.17em;
}

.app-card h4 a {
  color: inherit;
  text-decoration: none;
}

/* Not in the store yet: reads like the other store buttons, but does nothing */
.btn-soon {
  opacity: 0.65;
  pointer-events: none;
}

.app-card h4 a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.app-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* -- Projects Grid -- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.project-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.project-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-secondary);
  margin-bottom: 12px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.tag {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  color: var(--text-dim);
}

/* -- Skills -- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.skill-item h3 {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.skill-item p {
  color: var(--text-main);
  font-size: 0.95rem;
  margin: 0;
}

/* -- Experience (Timeline) -- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-primary), transparent);
  border-radius: 2px;
  opacity: 0.5;
}

.role-card {
  position: relative;
}

.role-card::before {
  content: '';
  position: absolute;
  left: -29px;
  /* 24px padding + 2px line/2 + 4px dot/2 approx */
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 2px solid var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-glow);
}

.role-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.role-title {
  font-size: 1.25rem;
  color: #fff;
}

.role-company {
  color: var(--accent-primary);
}

.role-period {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.role-summary {
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.role-env {
  margin: 14px 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.role-env span {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-secondary);
}

.role-bullets li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.role-bullets li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent-secondary);
}

/* -- Footer -- */
.site-footer {
  border-top: 1px solid var(--border-light);
  padding: 40px 0 100px;
  /* Extra bottom padding for floating nav */
  margin-top: 80px;
  text-align: center;
}

.visitor-counter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.visitor-counter svg {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
}

.visitor-counter .count {
  color: #fff;
  font-weight: 700;
}

.project-modal[hidden],
.contact-modal[hidden],
.recruiter-modal[hidden] {
  display: none !important;
}

.project-modal,
.contact-modal,
.recruiter-modal {
  display: grid;
  /* 'hidden' overrides this via !important above when set */
}



/* -- Scroll Reveal -- */
.js .section-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.section-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* -- Staggered Card Animation -- */
.js .app-card,
.js #web-projects .glass-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.app-card.visible,
#web-projects .glass-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.app-card.visible:nth-child(1) { transition-delay: 0.05s; }
.app-card.visible:nth-child(2) { transition-delay: 0.15s; }
.app-card.visible:nth-child(3) { transition-delay: 0.25s; }
.app-card.visible:nth-child(4) { transition-delay: 0.35s; }

/* -- Enhanced Hover on Project Cards -- */
#web-projects .glass-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 40px rgba(56, 189, 248, 0.15);
}

.app-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(56, 189, 248, 0.12);
}

/* -- AEON: The Awakened cards: the game's Memory lens --
   Hovering the title freezes the card into a scene from the game, and around
   the pointer the past shows through the ice. script.js sets the classes and
   feeds --mouse-x/y; the art only downloads when the pointer reaches the card. */
.aeon-card > :not(.aeon-memory) {
  position: relative;
  z-index: 1;
}

.aeon-memory {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.aeon-now,
.aeon-then {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
}

/* A scrim over the frozen scene keeps the card's text readable */
.aeon-now::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 14, 22, 0.84), rgba(8, 14, 22, 0.66) 60%, rgba(8, 14, 22, 0.5));
}

.aeon-then {
  filter: saturate(0.85) brightness(0.82);
  -webkit-mask-image: radial-gradient(circle 118px at var(--mouse-x, 50%) var(--mouse-y, 50%), #000 70%, transparent 100%);
  mask-image: radial-gradient(circle 118px at var(--mouse-x, 50%) var(--mouse-y, 50%), #000 70%, transparent 100%);
}

.aeon-card.is-near .aeon-now { background-image: url('../media/aeon-the-awakened/s01-now-1170.webp'); }
.aeon-card.is-near .aeon-then { background-image: url('../media/aeon-the-awakened/s01-then-1170.webp'); }
.aeon-card-observatory.is-near .aeon-now { background-image: url('../media/aeon-the-awakened/s14-now-1170.webp'); }
.aeon-card-observatory.is-near .aeon-then { background-image: url('../media/aeon-the-awakened/s14-then-1170.webp'); }

.aeon-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 236px;
  height: 236px;
  margin: -118px 0 0 -118px;
  border: 1px solid rgba(127, 224, 255, 0.6);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(63, 169, 255, 0.35), inset 0 0 22px rgba(63, 169, 255, 0.28);
  translate: var(--mouse-x, 0) var(--mouse-y, 0);
  scale: 0.7;
  transition: scale 0.3s ease;
}

.aeon-card.is-remembering {
  border-color: rgba(127, 224, 255, 0.45);
  box-shadow: 0 8px 34px rgba(63, 169, 255, 0.22);
}

.aeon-card.is-remembering .aeon-memory {
  opacity: 1;
}

.aeon-card.is-remembering .aeon-ring {
  scale: 1;
}

.aeon-card.is-remembering p {
  color: #DCE7F2;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.85);
}

.aeon-card.is-remembering .btn-ghost {
  background: rgba(8, 14, 22, 0.72);
}

/* One glint runs across the letters as the title wakes */
.aeon-card.is-remembering h4 a {
  color: transparent;
  text-decoration: none;
  background: linear-gradient(100deg, #BFE6F2 38%, #FFB45C 47%, #FFFFFF 52%, #7FE0FF 58%, #BFE6F2 68%) 0 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(127, 224, 255, 0.55));
  animation: aeon-title-wake 0.9s ease-out both;
}

@keyframes aeon-title-wake {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

/* -- Projects Grid: staggered reveal, cursor-lit border, tag wave -- */

/* 1. Reveal. Driven by an animation with `backwards` fill (not a held
   transition) so that once it finishes the card falls back to its normal
   styles and the hover transform below is free to take over. */
.js .project-card {
  opacity: 0;
}

.project-card.visible {
  opacity: 1;
  animation: project-rise 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
  animation-delay: calc(var(--stagger, 0) * 70ms);
}

@keyframes project-rise {
  from {
    opacity: 0;
    translate: 0 22px;
    scale: 0.985;
  }
  to {
    opacity: 1;
    translate: none;
    scale: none;
  }
}

/* 2. Hover: lift, accent shadow, stronger spotlight, cursor-lit border ring */
.project-card {
  transition:
    transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.35s ease,
    border-color 0.35s ease;
}

.project-card:hover,
.project-card:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(56, 189, 248, 0.22);
  /* Index 0 stays inset to match the .glass-card resting shadow; shadow lists
     only interpolate when inset-ness lines up, otherwise the glow pops. */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 44px -14px rgba(0, 0, 0, 0.65),
    0 10px 36px -8px rgba(56, 189, 248, 0.16);
}

/* The global :focus-visible rule reshapes any button to --radius-sm; keep the
   card (and its overflow clip) at its own radius instead of snapping to 8px. */
.project-card:focus-visible {
  border-radius: var(--radius-lg);
}

/* Spotlight (the .glass-card::before radial), brighter and tinted on these cards */
.project-card::before {
  background: radial-gradient(
    560px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(56, 189, 248, 0.10),
    rgba(255, 255, 255, 0.03) 35%,
    transparent 62%
  );
}

/* Border ring: a 1px gradient frame masked out of the padding box, lit
   where the cursor is. Sits just inside the card's own border. */
.project-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(
    380px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(56, 189, 248, 0.6),
    rgba(167, 139, 250, 0.28) 38%,
    transparent 72%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.project-card:hover::after {
  opacity: 1;
}

/* Affordance: the card opens a dialog, so say so with a small arrow chip
   that is always faintly present and lights up on hover / keyboard focus */
.project-cta {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.45;
  transition:
    opacity 0.3s ease,
    transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
    color 0.3s ease,
    border-color 0.3s ease,
    background-color 0.3s ease;
  pointer-events: none;
}

.project-card:hover .project-cta,
.project-card:focus-visible .project-cta {
  opacity: 1;
  color: var(--accent-primary);
  border-color: rgba(56, 189, 248, 0.45);
  background-color: rgba(56, 189, 248, 0.10);
  transform: translate(2px, -2px);
}

/* Keep the meta line clear of the arrow chip */
.project-card .project-meta {
  padding-right: 40px;
}

/* 3. Tag wave: on hover the chips light up left-to-right; on leave they
   settle together (the delay only applies while hovered) */
.project-card .tag {
  box-shadow: inset 0 0 0 1px transparent;
  transition:
    color 0.25s ease,
    background-color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.25s ease;
}

.project-card:hover .tag,
.project-card:focus-visible .tag {
  color: var(--text-muted);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.32);
  transform: translateY(-1px);
}

.project-card:hover .tag:nth-child(1),
.project-card:focus-visible .tag:nth-child(1) { transition-delay: 0s; }
.project-card:hover .tag:nth-child(2),
.project-card:focus-visible .tag:nth-child(2) { transition-delay: 45ms; }
.project-card:hover .tag:nth-child(3),
.project-card:focus-visible .tag:nth-child(3) { transition-delay: 90ms; }
.project-card:hover .tag:nth-child(4),
.project-card:focus-visible .tag:nth-child(4) { transition-delay: 135ms; }
.project-card:hover .tag:nth-child(n+5),
.project-card:focus-visible .tag:nth-child(n+5) { transition-delay: 180ms; }

/* -- Timeline Draw Animation -- */
.timeline::before {
  animation: drawLine 1.5s ease forwards;
  transform-origin: top;
}

@keyframes drawLine {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

/* -- Skill Tag Hover -- */
.skill-tag:hover {
  background: rgba(56, 189, 248, 0.15);
  transform: translateY(-1px);
  transition: all 0.2s ease;
}

@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }

  .floating-nav {
    bottom: 20px;
    width: 90%;
    justify-content: center;
    overflow-x: auto;
  }

  .hero {
    min-height: auto;
    padding-block: 120px 60px;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Accessibility & UI enhancements (audit, phase 2) ===== */

/* Visually-hidden utility (form labels, etc.) */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip-to-content link (revealed on focus) */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2000;
  padding: 10px 16px;
  background: var(--accent-primary);
  color: #04121d;
  font-weight: 600;
  border-radius: var(--radius-sm);
  /* Far off-screen AND transparent: rubber-band overscroll can peek
     past the viewport edge, so distance alone isn't enough */
  transform: translateY(-300%);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
  opacity: 1;
  color: #04121d;
}

/* Visible keyboard focus on all interactive elements */
:where(a, button, input, textarea, select, [tabindex], .project-card):focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Hero tagline */
.hero-tagline {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent-secondary);
  margin: -16px 0 32px;
  max-width: 600px;
}

/* Inline link-styled button (e.g. location) */
.link-inline {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent-primary);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}

.link-inline:hover {
  color: var(--accent-secondary);
}

/* Copy-email button: larger touch target */
.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 8px;
  vertical-align: middle;
}

/* Buttons: comfortable touch height */
.btn {
  min-height: 44px;
}

/* Project cards rendered as <button> */
button.project-card {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.project-card>p {
  margin-bottom: auto;
}

/* Form status message (replaces alert) */
.form-status {
  margin: 0;
  font-size: 0.9rem;
}

.form-status.is-success {
  color: #4ade80;
}

.form-status.is-error {
  color: #f87171;
}

/* Body scroll-lock while a modal is open */
body.no-scroll {
  overflow: hidden;
}

/* An overlay is open: get the floating nav out from over its controls */
body.no-scroll .floating-nav {
  opacity: 0;
  pointer-events: none;
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }

  /* Keep reveal-on-scroll content visible without motion */
  .section-reveal,
  .app-card,
  #web-projects .glass-card,
  .project-card {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Project cards: no rise animation (its delay would otherwise hold them
     invisible), no hover lift, no tag wave, no cursor ring */
  .project-card,
  .project-card.visible {
    animation: none !important;
  }

  .project-card:hover,
  .project-card:focus-visible {
    transform: none !important;
  }

  .project-card .tag,
  .project-cta {
    transition-delay: 0s !important;
    transform: none !important;
  }

  .project-card::after {
    display: none !important;
  }

  .bg-blob,
  .btn-cta,
  .btn-cta::after {
    animation: none !important;
  }

  /* Boot choreography resolves to its final frame instantly */
  .boot .hero-content > * {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
}

/* =========================================================
   Mission Control: ambient background & deploy choreography
   ========================================================= */

/* Layer stack (back to front): body::before base glow (-3),
   .bg scene (-2): aurora blobs → dot grid → ops canvas → vignette → grain */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.bg i {
  position: absolute;
  display: block;
}

/* Aurora depth field: softness baked into gradient stops, so the
   compositor animates pre-blurred layers (no runtime filter cost) */
.bg-blob {
  width: 75vmax;
  height: 75vmax;
  border-radius: 50%;
  will-change: transform;
}

.bg-blob--cyan {
  left: -22vmax;
  bottom: -30vmax;
  background: radial-gradient(closest-side, rgba(56, 189, 248, 0.10), rgba(56, 189, 248, 0.04) 45%, transparent 72%);
  animation: blob-drift-a 75s ease-in-out infinite alternate;
}

.bg-blob--violet {
  right: -25vmax;
  top: -25vmax;
  background: radial-gradient(closest-side, rgba(167, 139, 250, 0.09), rgba(167, 139, 250, 0.03) 45%, transparent 72%);
  animation: blob-drift-b 90s ease-in-out infinite alternate;
}

/* Third light source: deep teal fill breaks the predictable blue/purple duet */
.bg-blob--teal {
  left: 28vw;
  top: 18vh;
  width: 55vmax;
  height: 55vmax;
  background: radial-gradient(closest-side, rgba(14, 116, 144, 0.08), transparent 70%);
  animation: blob-drift-c 60s ease-in-out infinite alternate;
}

@keyframes blob-drift-a {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(9vw, -7vh, 0) scale(1.18);
  }

  100% {
    transform: translate3d(-4vw, 5vh, 0) scale(0.95);
  }
}

@keyframes blob-drift-b {
  0% {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }

  50% {
    transform: translate3d(-8vw, 6vh, 0) scale(1.12) rotate(12deg);
  }

  100% {
    transform: translate3d(5vw, -4vh, 0) scale(0.92) rotate(-8deg);
  }
}

@keyframes blob-drift-c {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(-10vw, 9vh, 0) scale(1.25);
  }

  100% {
    transform: translate3d(6vw, -6vh, 0) scale(1.05);
  }
}

/* Fogged motherboard layer: taller than the viewport by 10% of the
   page's scrollable height; JS parallax-translates it as you scroll.
   The blur is baked into the bitmap once, so zero runtime filter cost. */
#pcbCanvas {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}

/* Packet layer: viewport-sized, redrawn each frame in screen space */
#opsCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.bg-vignette {
  inset: 0;
  background: radial-gradient(125% 95% at 50% 40%, transparent 62%, rgba(4, 6, 10, 0.42) 100%);
}

/* Static film grain: dithers low-alpha gradients so they don't band */
.bg-grain {
  inset: 0;
  opacity: 0.035;
  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' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* Scroll progress: the deploy pipeline across the top edge */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 1500;
  pointer-events: none;
}

.scroll-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  box-shadow: 0 0 8px var(--accent-glow);
  transform: scaleX(0);
  transform-origin: left;
  will-change: transform;
}

/* --- Deploy sequence (html.boot is set once per session by a guard
       script in <head>; without it the hero renders fully, instantly).
       The tagline is excluded: its slot-machine reveal handles itself. --- */
.boot .hero-subtitle,
.boot .hero-actions,
.boot .hero .contact {
  opacity: 0;
  animation: boot-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.boot .name {
  opacity: 0;
  animation: boot-wipe 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.05s;
}

.boot .hero-subtitle {
  animation-delay: 0.4s;
}

.boot .hero-actions {
  animation-delay: 0.65s;
}

.boot .hero .contact {
  animation-delay: 0.8s;
}

@keyframes boot-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes boot-wipe {
  from {
    opacity: 0;
    clip-path: inset(-4px 100% -4px 0);
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    clip-path: inset(-4px -4px -4px 0);
    transform: translateY(0);
  }
}

/* --- Slot-machine tagline: letters roll down and land --- */
.hero-tagline .slot-word {
  display: inline-block;
  white-space: nowrap;
}

.slot-cell {
  display: inline-block;
  overflow: hidden;
  height: 1.6em;
  vertical-align: top;
}

.slot-strip {
  display: block;
  will-change: transform;
}

.slot-strip>span {
  display: block;
  height: 1.6em;
  line-height: 1.6;
}

/* --- Hiring? The one loud button on the page --- */
.btn-cta {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #38BDF8, #A78BFA);
  color: #06121F;
  font-weight: 700;
  border: none;
  padding: 10px 26px;
  box-shadow: 0 4px 18px rgba(56, 189, 248, 0.3);
  animation: cta-breathe 3.2s ease-in-out infinite;
}

.btn-cta:hover {
  transform: translateY(-2px) scale(1.03);
  color: #04121d;
  box-shadow: 0 8px 28px rgba(56, 189, 248, 0.5);
}

/* Periodic sheen sweep across the face of the button */
.btn-cta::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: translateX(-160%) skewX(-20deg);
  animation: cta-sheen 4.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none;
}

@keyframes cta-breathe {

  0%,
  100% {
    box-shadow: 0 4px 18px rgba(56, 189, 248, 0.3);
  }

  50% {
    box-shadow: 0 6px 26px rgba(167, 139, 250, 0.45);
  }
}

@keyframes cta-sheen {

  0%,
  55% {
    transform: translateX(-160%) skewX(-20deg);
  }

  100% {
    transform: translateX(420%) skewX(-20deg);
  }
}

/* --- High-Impact Interactive Case Study CTA Button --- */
.btn-case-study {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.92rem;
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  background: linear-gradient(135deg, #024873 0%, #0284c7 35%, #ca8a04 70%, #f59e0b 100%);
  border: 1px solid rgba(254, 240, 138, 0.45);
  box-shadow: 0 0 20px rgba(2, 132, 199, 0.45), 0 0 25px rgba(245, 158, 11, 0.35), 0 4px 15px rgba(0, 0, 0, 0.4);
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: caseStudyPulse 3.5s infinite ease-in-out;
  z-index: 1;
}

.btn-case-study:hover {
  transform: translateY(-2.5px) scale(1.04);
  box-shadow: 0 0 32px rgba(2, 132, 199, 0.7), 0 0 35px rgba(245, 158, 11, 0.75), 0 8px 25px rgba(0, 0, 0, 0.5);
  color: #ffffff !important;
  border-color: rgba(254, 240, 138, 0.85);
}

.btn-case-study .study-ticker {
  position: relative;
  display: inline-block;
  height: 1.35em;
  line-height: 1.35em;
  overflow: hidden;
  vertical-align: middle;
  min-width: 185px;
  text-align: left;
}

.btn-case-study .ticker-slide {
  display: block;
  white-space: nowrap;
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
}

/* State 0: Slide 1 active */
.btn-case-study:not([data-slide]) .slide-1,
.btn-case-study[data-slide="0"] .slide-1 {
  position: relative;
  transform: translateY(0%);
  opacity: 1;
}

/* State 1: Slide 2 active */
.btn-case-study[data-slide="1"] .slide-1 {
  transform: translateY(-120%);
  opacity: 0;
}
.btn-case-study[data-slide="1"] .slide-2 {
  transform: translateY(0%);
  opacity: 1;
}

/* State 2: Slide 3 active */
.btn-case-study[data-slide="2"] .slide-1,
.btn-case-study[data-slide="2"] .slide-2 {
  transform: translateY(-120%);
  opacity: 0;
}
.btn-case-study[data-slide="2"] .slide-3 {
  transform: translateY(0%);
  opacity: 1;
}

.btn-case-study .study-arrow {
  display: inline-block;
  transition: transform 0.25s ease;
  font-weight: 900;
  color: #fef08a;
}

.btn-case-study:hover .study-arrow {
  transform: translateX(4px);
}

/* Light sheen sweep across button */
.btn-case-study::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 45%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  transform: translateX(-180%) skewX(-20deg);
  animation: caseStudySheen 3.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none;
}

@keyframes caseStudyPulse {
  0%, 100% {
    box-shadow: 0 0 16px rgba(2, 132, 199, 0.4), 0 0 18px rgba(245, 158, 11, 0.3), 0 4px 15px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow: 0 0 28px rgba(2, 132, 199, 0.65), 0 0 30px rgba(245, 158, 11, 0.55), 0 6px 20px rgba(0, 0, 0, 0.45);
  }
}

@keyframes caseStudySheen {
  0%, 65% { transform: translateX(-180%) skewX(-20deg); }
  100% { transform: translateX(320%) skewX(-20deg); }
}

@media (max-width: 768px) {

  /* Cut background overdraw on small screens */
  .bg-blob {
    width: 60vmax;
    height: 60vmax;
  }

  .bg-blob--teal {
    display: none;
  }
}

/* =========================================================
   Screenshot gallery + lightbox
   Used on index.html (project cards) and project case pages
   ========================================================= */

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.shot-grid--wide {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
}

/* One screenshot = a small app window: chrome bar, shot, caption */
.shot {
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #0A0D13;
  overflow: hidden;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
  text-align: left;
  width: 100%;
  transition:
    transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
    border-color 0.3s ease,
    box-shadow 0.35s ease;
}

.shot:hover,
.shot:focus-visible {
  transform: translateY(-4px);
  border-radius: var(--radius-md);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow:
    0 16px 40px -14px rgba(0, 0, 0, 0.7),
    0 8px 30px -10px rgba(56, 189, 248, 0.18);
}

.shot-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.035);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.shot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  flex: none;
}

.shot-url {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-left: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shot-media {
  position: relative;
  display: block;
  overflow: hidden;
  background: #0A0D13;
}

.shot-media picture {
  display: block;
  width: 100%;
  aspect-ratio: 1920 / 1111;
  background: #0A0D13;
}

.shot-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1), filter 0.4s ease;
}

.shot:hover .shot-media img,
.shot:focus-visible .shot-media img {
  transform: scale(1.03);
  filter: brightness(1.06) saturate(1.05);
}

/* Zoom affordance */
.shot-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(10, 13, 19, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  pointer-events: none;
}

.shot:hover .shot-zoom,
.shot:focus-visible .shot-zoom {
  opacity: 1;
  transform: none;
  color: var(--accent-primary);
  border-color: rgba(56, 189, 248, 0.4);
}

.shot-caption {
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.shot-caption b {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 3px;
}

.shot-caption span {
  display: block;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-dim);
}

/* -- Lightbox (built by gallery.js) -- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  gap: 12px;
  padding: clamp(12px, 4vw, 40px);
  background: rgba(6, 8, 12, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: lb-in 0.25s ease;
}

.lightbox[hidden] {
  display: none;
}

@keyframes lb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lb-stage {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.lb-stage img {
  max-width: min(1600px, 100%);
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
  background: #0A0D13;
}

.lb-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 900px;
  text-align: center;
}

.lb-text b {
  display: block;
  color: var(--text-main);
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.lb-text span {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.lb-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  white-space: nowrap;
}

.lb-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: rgba(21, 27, 37, 0.7);
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease, transform 0.25s ease;
}

.lb-btn:hover {
  color: #fff;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.12);
}

.lb-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.lb-close {
  position: absolute;
  top: clamp(12px, 3vw, 28px);
  right: clamp(12px, 3vw, 28px);
}

@media (max-width: 640px) {
  .shot-grid,
  .shot-grid--wide {
    grid-template-columns: 1fr;
  }

  /* Controls on one row, caption wrapped onto its own line below */
  .lightbox {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .lb-bar {
    gap: 12px;
    row-gap: 10px;
  }

  .lb-text {
    order: 3;
    flex: 1 0 100%;
  }

  .lb-text b {
    font-size: 0.9rem;
  }

  .lb-text span {
    font-size: 0.8rem;
  }

  .lb-btn {
    width: 38px;
    height: 38px;
  }

  .lb-close {
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shot,
  .shot-media img,
  .shot-zoom {
    transition: none !important;
    transform: none !important;
  }

  .shot:hover .shot-media img {
    transform: none !important;
  }

  .shot-zoom {
    opacity: 1;
  }

  .lightbox {
    animation: none !important;
  }
}
