/* ====== Design Tokens ====== */
:root {
  --bg: #0b1220;
  --bg-elev: rgba(255, 255, 255, 0.06);
  --text: #e8eefc;
  --muted: #a7b0c5;
  --primary: #7aa2ff;
  --accent: #7df9ff;
  --chip: rgba(122, 162, 255, 0.15);
  --ring: 0 0 0 3px rgba(122, 162, 255, 0.35);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --font:
    "Inter", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --mono:
    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Logo font (import in <head>) */
  --logo-font: "Bebas Neue", "Orbitron", sans-serif;
}

/* Light theme */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f9fe;
    --bg-elev: rgba(10, 14, 23, 0.05);
    --text: #0b1220;
    --muted: #475069;
    --primary: #2b59ff;
    --accent: #00d4ff;
    --chip: rgba(43, 89, 255, 0.07);
    --ring: 0 0 0 3px rgba(43, 89, 255, 0.25);
    --shadow: 0 12px 40px rgba(17, 24, 39, 0.12);
  }
}

/* Manual overrides via data-theme */
html[data-theme="dark"] {
  --bg: #0b1220;
  --bg-elev: rgba(255, 255, 255, 0.06);
  --text: #e8eefc;
  --muted: #a7b0c5;
  --primary: #7aa2ff;
  --accent: #7df9ff;
  --chip: rgba(122, 162, 255, 0.15);
  --ring: 0 0 0 3px rgba(122, 162, 255, 0.35);
}
html[data-theme="light"] {
  --bg: #f7f9fe;
  --bg-elev: rgba(10, 14, 23, 0.05);
  --text: #0b1220;
  --muted: #475069;
  --primary: #2b59ff;
  --accent: #00d4ff;
  --chip: rgba(43, 89, 255, 0.07);
  --ring: 0 0 0 3px rgba(43, 89, 255, 0.25);
}

/* ====== Base ====== */
/* Local dev look (Live Server): ~75% feel by using a 12px root */
html {
  font-size: 12px;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background:
    radial-gradient(
      75rem 37.5rem at 10% -10%,
      rgba(122, 162, 255, 0.25),
      transparent 60%
    ),
    radial-gradient(
      62.5rem 31.25rem at 120% 10%,
      rgba(0, 212, 255, 0.25),
      transparent 55%
    ),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

/* widths now scale with root size */
.container {
  width: min(68.75rem, 92%);
  margin-inline: auto;
} /* 1100px */
.narrow {
  width: min(50rem, 92%);
  margin-inline: auto;
} /* 800px */

/* ====== Navbar ====== */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(150%) blur(10px);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent);
}
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem; /* 64px */
}
.brand {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.15rem;
  font-size: 2rem;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  color: transparent;
  text-shadow: 0 0 20px rgba(122, 162, 255, 0.4);
}
.brand-dot {
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--bg-elev);
}
.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  padding: 0.5rem;
  border-radius: 0.5rem;
}
.nav-toggle span {
  display: block;
  width: 1.5rem;
  height: 0.125rem;
  background: var(--text);
  margin: 0.3125rem 0;
  border-radius: 0.125rem;
}

.theme-toggle {
  border: 0;
  background: var(--bg-elev);
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}
.theme-icon {
  display: inline-block;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  box-shadow: inset 0.5625rem -0.5625rem 0 0 var(--text);
  background: radial-gradient(
      circle at 60% 40%,
      transparent 55%,
      var(--text) 56% 58%,
      transparent 59%
    )
    no-repeat;
}

/* ====== Hero ====== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5rem 0 2.5rem;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  align-items: center;
}
.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.82rem;
  margin: 0 0 0.375rem;
}
.headline {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.1;
  margin: 0 0 0.625rem;
  font-weight: 800;
}
.welcome {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin: 0.5rem 0 0;
}

.grad {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shift 12s linear infinite;
  background-size: 200% 100%;
}
@keyframes shift {
  to {
    background-position: 200% 0;
  }
}
.subhead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 48ch;
}

.cta {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.btn {
  display: inline-block;
  font-weight: 700;
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  position: relative;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.2s ease;
}
.btn:focus {
  outline: none;
  box-shadow: var(--ring);
}
.btn-primary {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  color: #0b1220;
  box-shadow: var(--shadow);
}
.btn-primary:hover,
.btn-ghost:hover {
  transform: translateY(-1px);
}
.btn-ghost {
  background: var(--bg-elev);
  color: var(--text);
  border-color: transparent;
}

.tech-chips {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin: 1.375rem 0 0.5rem;
  padding: 0;
  list-style: none;
}
.tech-chips li {
  padding: 0.375rem 0.625rem;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--mono);
  font-size: 0.92rem;
}

.links {
  display: flex;
  gap: 1.125rem;
  margin-top: 0.625rem;
  align-items: center;
}
.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
}
.icon-link svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
  opacity: 0.9;
}
.icon-link span {
  font-weight: 600;
  color: var(--muted);
}
.icon-link:hover span {
  color: var(--text);
}

/* Portrait */
.portrait {
  margin: 0;
  padding: 0.625rem;
  border-radius: 1.375rem;
  background: linear-gradient(
    180deg,
    rgba(122, 162, 255, 0.25),
    rgba(0, 212, 255, 0.2)
  );
  box-shadow: var(--shadow);
}
.portrait img {
  border-radius: 1rem;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: saturate(1.05) contrast(1.02);
  transition: transform 0.4s ease;
  will-change: transform;
}
.portrait:hover img {
  transform: translateY(-0.25rem);
}

/* Animated blobs (px OK here) */
.blob {
  position: absolute;
  filter: blur(70px);
  opacity: 0.35;
  pointer-events: none;
}
.b1 {
  width: 420px;
  height: 420px;
  background: #7aa2ff;
  top: -80px;
  left: -120px;
  animation: float 18s ease-in-out infinite;
}
.b2 {
  width: 360px;
  height: 360px;
  background: #00d4ff;
  right: -120px;
  top: 40px;
  animation: float 16s ease-in-out infinite reverse;
}
.b3 {
  width: 280px;
  height: 280px;
  background: #9d72ff;
  left: 40%;
  bottom: -120px;
  animation: float 20s ease-in-out infinite;
}
@keyframes float {
  50% {
    transform: translateY(20px) scale(1.05);
  }
}

/* ====== About ====== */
.about {
  padding: 2.5rem 0 5rem;
}
.about h2 {
  font-size: 1.4rem;
  margin: 0 0 0.375rem;
}
.about p {
  color: var(--muted);
  font-size: 1.05rem;
}

/* ====== Footer ====== */
.footer {
  border-top: 1px solid var(--bg-elev);
  padding: 1.75rem 0;
  color: var(--muted);
  text-align: center;
}

/* ====== Reveal Animation ====== */
.reveal {
  opacity: 0;
  transform: translateY(1rem);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ====== Responsive ====== */
@media (max-width: 880px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .hero {
    padding-top: 3.75rem;
  }
  .portrait img {
    aspect-ratio: 1 / 1;
  }
  .nav-toggle {
    display: inline-block;
  }
  .nav-links {
    position: absolute;
    inset: 4rem 0 auto 0;
    background: rgba(15, 20, 35, 0.75);
    backdrop-filter: blur(10px);
    transform: translateY(-1.25rem);
    opacity: 0;
    pointer-events: none;
    transition:
      opacity 0.25s ease,
      transform 0.25s ease;
    padding: 0.75rem 1rem;
    margin: 0;
    flex-direction: column;
    gap: 0.375rem;
  }
  .nav-links.open {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
  .nav-links li {
    width: 100%;
  }
  .nav-links a,
  .theme-toggle {
    display: block;
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== Carousel ===== */
.project-carousel {
  margin: 1.25rem 0 2.5rem;
}
.carousel-frame {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: clamp(0.75rem, 2vw, 1.125rem);
}
.carousel-media {
  display: block;
  text-align: center;
}
.carousel-media img {
  width: min(100%, 68.75rem); /* 1100px */
  max-height: 33.75rem; /* 540px */
  object-fit: contain;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, 0.02);
}

/* Arrows */
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  border-radius: 999px;
  width: 2.625rem;
  height: 2.625rem;
  background: var(--bg-elev);
  color: var(--text);
  font-size: 1.625rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.carousel-nav.prev {
  left: 0.625rem;
}
.carousel-nav.next {
  right: 0.625rem;
}
.carousel-nav:hover {
  filter: brightness(1.1);
}
.carousel-nav:focus {
  outline: none;
  box-shadow: var(--ring);
}

/* Dots */
.carousel-dots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
}
.carousel-dots .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  cursor: pointer;
}
.carousel-dots .dot.active {
  background: var(--text);
}

/* Caption */
.carousel-caption {
  text-align: center;
  margin-top: 0.875rem;
}
.carousel-caption .project-title {
  margin: 0 0 0.375rem;
  font-weight: 800;
}
.carousel-caption .project-summary {
  margin: 0;
  color: var(--muted);
}

/* Mobile tweaks */
@media (max-width: 880px) {
  .carousel-nav {
    width: 2.375rem;
    height: 2.375rem;
    font-size: 1.5rem;
  }
  .carousel-media img {
    max-height: 26.25rem;
  } /* 420px */
}

/* ===== Production-only 75% scale =====
   Triggered by <html class="scale-75"> (add with a tiny script in your HTML).
   Locally, you won't have the class, so your 12px base remains. */
html.scale-75 {
  font-size: 16px; /* neutral baseline; zoom -> ~12px effective */
  zoom: 0.75; /* Chromium (crisp) */
}

/* Firefox/Safari fallback (no 'zoom' support) */
@supports not (zoom: 1) {
  html.scale-75,
  html.scale-75 body {
    height: 100%;
  }

  html.scale-75 body {
    transform: scale(0.75);
    transform-origin: top left;
    width: calc(100% / 0.75); /* expand canvas so content fills viewport */
    min-height: calc(100% / 0.75);
    overflow-x: hidden; /* avoid horizontal scrollbars */
  }
}
