/* Base styles */
:root {
  --bg: #070a14;
  /* Translucent surfaces for glassmorphism */
  --bg-elev: rgba(255,255,255,0.035);
  --text: #eef1f6;
  --muted: #b8bfd6;
    --muted-txt: #b8bfd6;
  --accent: #6a90ff;
  --accent-2: #8ecf5a;
  --card: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.18);
  --shadow: 0 10px 38px rgba(0,0,0,.45);
  --spotlight-x: -200px;
  --spotlight-y: -200px;
  --spotlight-opacity: 0;
  /* Make bottom of page match preceding color to eliminate the perceived band */
  --bg-grad: linear-gradient(180deg, #050814 0%, #0a1122 65%, #0a1122 100%);
  /* Scroll progress (px) used by animated background; updated via JS */
  --scroll: 0px;
  --scroll-p: 0;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden; /* prevent inadvertent horizontal scrolling on mobile */
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

/* Header */
.site-header {
  position: absolute;
  top: 0; left: 0; right: 0; /* stretch full width when absolutely positioned */
  z-index: 10;
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
}
.brand { color: var(--text); text-decoration: none; font-weight: 700; display: inline-flex; align-items: center; }
.brand .emoji { margin-right: .5rem; }
.brand img { height: 60px; width: auto; display: block; }

nav a { color: var(--muted); text-decoration: none; }
.site-header nav > * + * { margin-left: 18px; }
nav a:hover { color: var(--text); }

/* Mobile menu toggle button */
.menu-toggle {
  display: none;
  align-items: center; justify-content: center;
  height: 40px; width: 44px;
  margin-left: 10px;
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
  cursor: pointer;
}
.menu-toggle:focus { outline: 2px solid color-mix(in oklab, var(--accent) 55%, white 20%); outline-offset: 2px; }

/* Improve nav link tap targets */
.site-header nav a { padding: 8px 10px; border-radius: 8px; display: inline-block; }
.site-header nav a:focus { outline: 2px solid color-mix(in oklab, var(--accent) 55%, white 20%); outline-offset: 2px; }

/* Responsive nav behavior */
@media (max-width: 720px) {
  .menu-toggle { display: inline-flex; }
  .site-header .nav { position: relative; }
  .site-header nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 0; left: 0;
    margin: 0 auto;
    width: min(520px, 92%);
    display: none;
    flex-direction: column;
    gap: 4px;
    background: rgba(7,10,20,0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    backdrop-filter: blur(22px) saturate(160%);
    box-shadow: var(--shadow);
    z-index: 20;
  }
  body.menu-open .site-header nav { display: flex;}
  .site-header nav > * + * { margin-left: 0; }
  .brand img { height: 48px; }
  .nav { padding: 10px 0; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 10px 16px; border-radius: 10px;
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 85%, white 5%), var(--accent));
  color: #0b1020; font-weight: 600; text-decoration: none;
  box-shadow: var(--shadow);
  border: 1px solid color-mix(in oklab, var(--accent) 70%, black 15%);
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-ghost {
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); box-shadow: none;
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  display: grid; grid-template-columns: 1fr; gap: 28px;
  padding: 100px 0 18px;
  align-items: center;
}
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.35)); }
.hero-bg video { width: 100%; height: 100%; object-fit: cover; }
.hero h1 { font-size: clamp(30px, 4vw, 44px); margin: 0 0 8px; }
.accent { color: var(--accent); }
.subtitle { color: var(--muted-txt); margin: 0 0 18px; font-size: 1.05rem; }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }

/* Hero card overlay */
.hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 38px rgba(0,0,0,.45), inset 0 1px rgba(255,255,255,0.08);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  max-width: 680px;
  z-index: 1;
}
.hero-text { position: relative; z-index: 1; }
.hero-media { display: none; }
.avatar { display: none; }

/* Hero side media tall card */
@media (min-width: 900px) {
  .hero { grid-template-columns: 1.2fr .8fr; }
  .hero-media { display: block; }
}
.media-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  aspect-ratio: 9/16;
  max-height: 640px;
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
}
.media-card video { width: 100%; height: 100%; object-fit: cover; display: block; }
.skills-overlay {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
}
.skills-overlay h3 {
  margin: 0 0 6px; font-size: 0.95rem; color: var(--accent);
}
.skills-overlay .chips { margin: 0; }

/* Sections */
.section { padding: 40px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section h2 { margin: 0 0 8px; font-size: 1.6rem; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters input, .filters select {
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px;
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow: inset 0 1px rgba(255,255,255,0.06);
}

/* Grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  display: grid; grid-template-rows: auto 1fr auto; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; box-shadow: var(--shadow);
  text-decoration: none; color: inherit; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in oklab, var(--accent) 40%, var(--border)); box-shadow: 0 8px 28px rgba(0,0,0,.45); }
.card h3 { margin: 0 0 6px; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); }
.card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tag { font-size: .8rem; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); -webkit-backdrop-filter: blur(8px) saturate(140%); backdrop-filter: blur(8px) saturate(140%); }
.card .links { display: flex; gap: 10px; margin-top: 12px; }
.card .links a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* Chips */
.chips { list-style: none; padding: 0; margin: 10px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }
.chips li { background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 999px; -webkit-backdrop-filter: blur(8px) saturate(140%); backdrop-filter: blur(8px) saturate(140%); }

/* Contact */
.contact-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; justify-content: center; margin-top: 16px; }
/* Card content as a compact media object: icon left, text right */
.contact-cards .card { display: block; padding: 18px; border-radius: 16px; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.contact-cards .card:hover { transform: translateY(-2px); border-color: color-mix(in oklab, var(--accent) 40%, var(--border)); box-shadow: 0 8px 28px rgba(0,0,0,.45); }
.contact-cards .card > div { display: grid; grid-template-columns: 44px 1fr; align-items: center; column-gap: 12px; row-gap: 6px; }
/* Icon tile */
.contact-cards .card > div > span { grid-column: 1; width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.2rem; line-height: 1; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; color: var(--text); position: relative; -webkit-backdrop-filter: blur(8px) saturate(140%); backdrop-filter: blur(8px) saturate(140%); }
.contact-cards .card > div > span::after { content: ""; position: absolute; inset: 6px; border-radius: 8px; background: color-mix(in oklab, var(--bg) 70%, var(--bg-elev)); opacity: .8; }
/* Title and detail stacked in right column */
.contact-cards .card > div > strong { grid-column: 2; margin: 0; font-size: 1.06rem; color: var(--accent); letter-spacing: .1px;}
.contact-cards .card > div > div { grid-column: 2; margin: 0; color: var(--muted); }
/* Optional tags row (pills) inside contact cards */
.contact-cards .tags { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.contact-cards .tag { font-size: .8rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); }

/* Footer */
.site-footer { border-top: 1px solid color-mix(in oklab, var(--border) 60%, transparent); margin-top: auto; background: transparent; position: relative; box-shadow: 0 -8px 24px rgba(0,0,0,0.25) inset; }
/* Mask any residual band above the footer by painting a small strip matching the footer background */
.site-footer::before { content: ""; position: absolute; left: 0; right: 0; top: -22px; height: 22px; background: transparent; pointer-events: none; }
.footer { display: flex; align-items: center; justify-content: space-between; padding: 38px 0 18px; }
.to-top { color: var(--muted); text-decoration: none; }
.to-top:hover { color: var(--text); }

/* Let main grow to fill remaining height so footer sticks to bottom on short pages */
main { flex: 1 0 auto; }

/* Remove extra space above footer by trimming bottom padding on the last section */
.section:last-of-type { padding-bottom: 0; }
/* Also remove any residual bottom margin from the last child within the last section */
.section:last-of-type > *:last-child { margin-bottom: 0; }

/* Responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-ctas { justify-content: center; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .contact-cards { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  nav a { display: none; }
}


/* Patch: ensure no residual margin at the bottom of the last section (contact) */
.section:last-of-type > * { margin-bottom: 0 !important; }
.contact-cards { margin-bottom: 0; }

/* Provide comfortable spacing between contact cards and footer */
#contact.section { padding-bottom: 48px; }

/* Interactive spotlight that brightens only the cards near the cursor */
.card {
  /*display: grid; grid-template-rows: auto 1fr auto; gap: 10px;*/
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,0.06);
  text-decoration: none; color: inherit; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
  position: relative;
  isolation: isolate;
  z-index: 0;
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: var(--spotlight-opacity, 0);
  transition: opacity .12s ease;
  z-index: 1;
  background: radial-gradient(
    240px circle at var(--spotlight-x, -999px) var(--spotlight-y, -999px),
    rgba(255,255,255,0.16) 0%,
    rgba(255,255,255,0.08) 35%,
    rgba(255,255,255,0.04) 60%,
    rgba(255,255,255,0) 85%
  );
  mix-blend-mode: screen; /* dark theme */
}
/* Light theme tuning for light theme: use normal blend for reliable visibility */

/* Footer rebuild styles */
.footer {border-color: var(--border); background: transparent;}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 20px; padding: 28px 0 8px; }
.footer-col h4 { margin: 0 0 10px; font-size: 1rem; color: var(--muted); font-weight: 600; letter-spacing: .2px; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.brand-col .foot-tagline { color: var(--muted); margin: 8px 0 0; max-width: 36ch; }
.socials { display: flex; gap: 10px; align-items: center; }
/* Make social icons image-only: no tile background/border; let the footer background show */
.socials a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; background: transparent; border: none; padding: 0; }
.socials img { display: block; height: 28px; width: 28px; }
.socials a:hover { opacity: .85; }
.foot-cta { margin-top: 12px; }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 28px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.footer-bottom .copy { color: var(--muted); }
.footer-bottom .bottom-links { display: flex; gap: 14px; align-items: center; }
.footer-bottom .bottom-links a { color: var(--muted); text-decoration: none; }
.footer-bottom .bottom-links a:hover { color: var(--text); }

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .site-footer {
    background: rgba(7,10,20,0.45);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    backdrop-filter: blur(10px) saturate(140%);
  }
  /* Hide the desktop footer layout on small screens in favor of a compact layout */
  .footer-grid,
  .footer-bottom { display: none !important; }

  /* Show compact footer on mobile */
  .site-footer .container { width: min(1100px, 96%); }
  .site-footer .footer-compact {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 12px;
    padding: 28px 0 24px;
  }
  .footer-compact .brand-row { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 12px; }
  .footer-compact .brand img { height: 56px; }
  .footer-compact .foot-tagline { color: var(--muted); margin: 4px 0 6px; }
  .footer-compact .copy { color: var(--muted); margin-top: 6px; }
  .footer-compact .socials { justify-content: center; }
  .footer-compact .brand-row .socials { justify-content: flex-end; }
  .footer-compact .foot-cta { display: inline-flex; width: 100%; justify-content: center; }
  .footer-compact .footer-links a { display: inline-block; padding: 8px 10px; border-radius: 10px; background: var(--bg-elev); border: 1px solid var(--border); }
  /* New: make legal and copy sit side-by-side on mobile */
  .footer-compact .legal-copy-row { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 12px; flex-wrap: wrap; }
  .footer-compact .legal-copy-row .copy { margin-top: 0; }
  .footer-compact .bottom-links { display: flex; gap: 12px; align-items: center; }
  .footer-compact .bottom-links a { color: var(--muted); text-decoration: none; padding: 6px 8px; border-radius: 8px; }
  .footer-compact .bottom-links a:hover { color: var(--text); }
}

/* Default: compact footer hidden on larger screens */
@media (min-width: 561px) {
  .site-footer .footer-compact { display: none; }
}

/* Ensure social icons remain visible in dark mode when SVGs are dark by default */
.socials img {
  filter: invert(1) brightness(1.3) contrast(1.1);
}

/* Preserve original appearance in light mode */


/* Light theme variables override */

/* DEBUG: force spotlight visible when body has .debug-spot */
.debug-spot .card::after { opacity: 1 !important; background: rgba(255,0,0,0.4) !important; mix-blend-mode: normal !important; }
/* Fallback spotlight: render as background on card hover (no pseudo-element required) */
.card:hover {
  background-image: radial-gradient(260px circle at var(--spotlight-x, -200px) var(--spotlight-y, -200px), rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.08) 35%, rgba(255,255,255,0.04) 60%, rgba(255,255,255,0) 85%);
  background-blend-mode: normal;
  background-repeat: no-repeat;
}
/* Background video layer */
.scroll-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.scroll-bg video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scroll-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.35));
}

/* Ensure content paints above the background layer */
/* Keep header above main and footer, and preserve its earlier absolute positioning */
.site-header { z-index: 30; }
main, .site-footer { position: relative; z-index: 5; }

/* Respect reduced motion: freeze the background */
@media (prefers-reduced-motion: reduce) {
  .scroll-bg video { display: none; }
  .scroll-bg { background: var(--bg); }
}

/* Light theme tuning so the texture remains subtle */

/* Blur hero text when mobile menu is open (keep buttons crisp) */
.hero-card h1,
.hero-card .subtitle { transition: filter .18s ease; }
@media (max-width: 720px) {
  body.menu-open .hero-card h1,
  body.menu-open .hero-card .subtitle {
    filter: blur(3.5px);
  }
}

/* 404-specific compact footer */
.page-404 .site-footer .footer-compact {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
  padding: 28px 0 24px;
}
.page-404 .site-footer .footer-compact .brand img { height: 56px; }
.page-404 .site-footer .footer-compact .foot-tagline { color: var(--muted); margin: 4px 0 6px; }
.page-404 .site-footer .footer-compact .copy { color: var(--muted); margin-top: 6px; }

/* Remove grid/footer-bottom spacing just for 404 page */
.page-404 .site-footer .footer-grid,
.page-404 .site-footer .footer-bottom { display: none !important; }



/* Home page (index) minimal compact footer */
@media (max-width: 560px) {
  .page-home .site-footer .footer-compact {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 10px;
    padding: 24px 0 22px;
  }
  .page-home .site-footer .footer-compact .brand img { height: 56px; }
  .page-home .site-footer .footer-compact .foot-actions {
    display: flex;
    gap: 40px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .page-home .site-footer .footer-compact .btn { min-width: 44%; }
  .page-home .site-footer .footer-compact .compact-legal {
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--muted);
    font-size: .95rem;
  }
  .page-home .site-footer .footer-compact .compact-legal a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 8px;
  }
  .page-home .site-footer .footer-compact .compact-legal a:hover { color: var(--text); }
  .page-home .site-footer .footer-compact .socials { justify-content: center; }
  .page-home .site-footer .footer-compact .brand-row .socials { justify-content: flex-end; }
}

/* Keep footer-compact actions inline for ≥300px viewports */
@media (min-width: 300px) and (max-width: 560px) {
  .page-home .site-footer .footer-compact .foot-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .page-home .site-footer .footer-compact .foot-actions .btn {
    min-width: 0;
    width: auto;
    white-space: nowrap;
  }
}
