/*
 * Preloader — rising bubbles
 * ---------------------------------------------------------------------------
 * Same visual language as the Experience section's glass bubbles, but this
 * copy lives here in sections.css (not the deferred animations.css) so it's
 * guaranteed to be present the instant the preloader itself paints — the
 * preloader is the very first thing a visitor sees, so it can't be waiting
 * on anything.
 *
 * #preloader is a flex container, and per the Flexbox spec flex items paint
 * as if they were positioned with z-index:auto regardless of their actual
 * `position` value — so .preloader-decor (placed first in the DOM, in
 * index.html) naturally paints behind .loader-blob and the progress bar
 * without needing z-index gymnastics. The explicit z-index below is just
 * belt-and-suspenders so this doesn't silently break if someone reorders
 * the markup later.
 *
 * bubbleRise is defined once here (rather than duplicated) because it's
 * also used by the Experience section's bubbles in animations.css — CSS
 * keyframes are global, so a rule in one stylesheet can reference a
 * @keyframes block defined in another without any import machinery, as
 * long as both are eventually part of the page's CSSOM, which they always
 * are here (base/sections load unconditionally, animations.css always
 * follows once its preload swap fires).
 *
 * #preloader's own overflow:hidden (needed so rising bubbles don't cause
 * a stray scrollbar edge-case) lives with its main rule block in base.css,
 * not forked into a second file just because this comment is here.
 */
.preloader-decor {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.preloader-bubble {
  position: absolute;
  bottom: -60px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation-name: bubbleRise;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.preloader-bubble--primary {
  background: rgba(var(--color-primary-rgb), 0.3);
}

.preloader-bubble--secondary {
  background: rgba(var(--color-secondary-rgb), 0.3);
}

.preloader-bubble--1 {
  left: 8%;
  width: 22px;
  height: 22px;
  animation-duration: 9s;
  animation-delay: 0s;
}

.preloader-bubble--2 {
  left: 20%;
  width: 14px;
  height: 14px;
  animation-duration: 12s;
  animation-delay: -5s;
}

.preloader-bubble--3 {
  left: 35%;
  width: 18px;
  height: 18px;
  animation-duration: 8s;
  animation-delay: -2s;
}

.preloader-bubble--4 {
  right: 35%;
  width: 16px;
  height: 16px;
  animation-duration: 10s;
  animation-delay: -6s;
}

.preloader-bubble--5 {
  right: 20%;
  width: 24px;
  height: 24px;
  animation-duration: 11s;
  animation-delay: -3s;
}

.preloader-bubble--6 {
  right: 8%;
  width: 15px;
  height: 15px;
  animation-duration: 9.5s;
  animation-delay: -7s;
}

@keyframes bubbleRise {
  0% {
    transform: translateY(0) scale(0.85);
    opacity: 0;
  }

  12% {
    opacity: 0.95;
  }

  82% {
    opacity: 0.78;
  }

  100% {
    transform: translateY(-640px) scale(1.1);
    opacity: 0;
  }
}

/* Header & Nav */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  padding: 1rem 0;
  transition: background 0.3s ease;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-jetbrains-mono);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-container {
  position: relative;
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0);
}

.logo-container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(transparent, transparent, transparent, var(--color-primary));
  animation: rotateLogo 3s linear infinite;
  z-index: -1;
}

.logo-container::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: var(--bg-base);
  border-radius: 6px;
  z-index: -1;
  transition: background 0.3s ease;
}

@keyframes rotateLogo {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

nav ul {
  display: flex;
  gap: 1.5rem;
}

nav a {
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  padding: 0.5rem 0;
  transition: color var(--dur-fast) ease;
}

nav a:hover,
nav a.active {
  color: var(--color-primary);
}

nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--color-primary);
  transition: width var(--dur-fast) ease;
}

nav a.active::after,
nav a:hover::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  display: none;
}

.theme-toggle-pill {
  display: flex !important;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  border-radius: 30px;
  padding: 4px;
  width: 90px;
  height: 36px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 500;
  outline: none;
}

.theme-toggle-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
  left: 3px;
}

.theme-toggle-text {
  margin-left: 36px;
  font-size: 0.8rem;
  transition: all 0.3s ease;
}

/* When dark mode */
[data-theme="dark"] .theme-toggle-icon {
  left: calc(100% - 31px);
  background: var(--color-secondary);
}

[data-theme="dark"] .theme-toggle-text {
  margin-left: 8px;
  margin-right: 36px;
}

.mobile-menu-btn {
  display: none;
  font-size: 1.5rem;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 10000;
}

.mobile-nav-panel {
  display: none;
}

/* Hero Section */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 80px;
  position: relative;
  overflow: hidden;
}

#hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 4rem 2rem;
  max-width: 800px;
  width: 100%;
}

.hero-greeting {
  font-size: 1.8rem;
  font-weight: 500;
  letter-spacing: 1px;
}

.typewriter-container {
  color: var(--text-secondary);
}

.typewriter .cursor {
  display: inline-block;
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero-ctas {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

/* About Section */
#about {
  position: relative;
}

#about .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  position: relative;
  z-index: 2;
}

.about-card,
.skills-card {
  padding: 2.5rem;
}

.skill-group {
  margin-bottom: 1.5rem;
}

.skill-group h4 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
  color: var(--text-secondary);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.skill-tag {
  padding: 0.5rem 1rem;
  background: rgba(var(--color-primary-rgb), 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(var(--color-primary-rgb), 0.3);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  transition: all 0.2s ease;
  cursor: pointer;
}

.skill-tag:hover {
  background: var(--gradient-brand);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
}

/*
 * Floating Glyphs — refined
 * ---------------------------------------------------------------------------
 * Original bug: font-family referenced var(--font-mono), a token that was
 * never declared in variables.css, so every glyph silently rendered in the
 * inherited body font instead of monospace. Fixed below.
 *
 * Original animation: all 8 glyphs shared one `float` keyframe with identical
 * timing, so they all swung in perfect lockstep — reads as robotic, not
 * organic. Refactored into a single parameterized keyframe (`codeDrift`)
 * driven by per-element custom properties (--fx / --fy / --frot / --fdur /
 * --fdelay), with each glyph getting its own drift vector, duration, and a
 * NEGATIVE animation-delay. Negative delays make the animation act as if it
 * had already been running for that long — so on first paint, all 8 glyphs
 * are already mid-flight at different points in their cycle instead of all
 * starting from the same pose in sync. That one trick is what sells the
 * "ambient, alive" feel instead of "8 clones swinging together."
 */
.code-glyph {
  position: absolute;
  font-family: var(--font-jetbrains-mono);
  color: var(--color-primary);
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
  will-change: transform, opacity;
  --fx: 12px;
  --fy: -14px;
  --frot: 10deg;
  animation: codeDrift var(--fdur, 9s) ease-in-out var(--fdelay, 0s) infinite alternate;
}

@keyframes codeDrift {
  0% {
    transform: translate(calc(var(--fx) * -1), calc(var(--fy) * -1)) rotate(calc(var(--frot) * -1)) scale(0.94);
    opacity: 0.5;
  }

  50% {
    opacity: 0.95;
  }

  100% {
    transform: translate(var(--fx), var(--fy)) rotate(var(--frot)) scale(1.05);
    opacity: 0.55;
  }
}

.code-glyph:nth-of-type(1) {
  --fx: 14px;
  --fy: -18px;
  --frot: 12deg;
  --fdur: 9s;
  --fdelay: 0s;
}

.code-glyph:nth-of-type(2) {
  --fx: -16px;
  --fy: -12px;
  --frot: -14deg;
  --fdur: 11s;
  --fdelay: -2s;
  filter: blur(0.4px);
  font-size: 0.9rem;
}

.code-glyph:nth-of-type(3) {
  --fx: 10px;
  --fy: 16px;
  --frot: 8deg;
  --fdur: 8s;
  --fdelay: -4s;
}

.code-glyph:nth-of-type(4) {
  --fx: -12px;
  --fy: 14px;
  --frot: -10deg;
  --fdur: 10s;
  --fdelay: -1s;
  filter: blur(0.4px);
  font-size: 0.85rem;
}

.code-glyph:nth-of-type(5) {
  --fx: 16px;
  --fy: -10px;
  --frot: 16deg;
  --fdur: 9.5s;
  --fdelay: -3s;
}

.code-glyph:nth-of-type(6) {
  --fx: -14px;
  --fy: -16px;
  --frot: -12deg;
  --fdur: 12s;
  --fdelay: -5s;
  filter: blur(0.5px);
  font-size: 0.9rem;
}

.code-glyph:nth-of-type(7) {
  --fx: 12px;
  --fy: 12px;
  --frot: 10deg;
  --fdur: 8.5s;
  --fdelay: -2.5s;
}

.code-glyph:nth-of-type(8) {
  --fx: -10px;
  --fy: 18px;
  --frot: -8deg;
  --fdur: 10.5s;
  --fdelay: -4.5s;
  filter: blur(0.4px);
  font-size: 0.85rem;
}

/* Services Carousel */
.services-carousel-wrapper {
  position: relative;
  overflow: hidden;
  padding: 3rem 0;
  width: 100%;
  height: 450px;
}

.services-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.service-card {
  position: absolute;
  width: 320px;
  padding: 2.5rem 2rem;
  text-align: center;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  pointer-events: none;
  filter: grayscale(80%);
}

.service-card.active {
  transform: translate(-50%, -50%) scale(1.1);
  opacity: 1;
  z-index: 3;
  pointer-events: auto;
  filter: grayscale(0%);
  border-color: var(--color-primary);
  box-shadow: 0 0 30px rgba(var(--color-primary-rgb), 0.2);
}

.service-card.active:hover {
  background: var(--gradient-brand);
  border-color: transparent;
}

.service-card.active:hover h3,
.service-card.active:hover p,
.service-card.active:hover .service-icon {
  color: #fff !important;
}

.service-card.prev {
  transform: translate(calc(-50% - 350px), -50%) scale(0.9);
  opacity: 0.5;
  z-index: 2;
  filter: grayscale(80%);
}

.service-card.next {
  transform: translate(calc(-50% + 350px), -50%) scale(0.9);
  opacity: 0.5;
  z-index: 2;
  filter: grayscale(80%);
}

.service-icon {
  font-size: 3rem;
  color: var(--color-primary);
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.carousel-bullets {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 2rem;
}

.carousel-bullet {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(var(--color-primary-rgb), 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-bullet.active {
  width: 24px;
  border-radius: 12px;
  background: var(--color-primary);
}

/* Portfolio */
#portfolio {
  position: relative;
}

/*
 * NOTE: the old .portfolio-blob (CSS border-radius morph, centered behind
 * the grid) has been removed entirely — it was invisible under the cards
 * 99% of the time, which was the exact complaint that kicked off this pass.
 * Its replacement (.portfolio-decor, bubbles rising inward from both side
 * walls) lives in the deferred animations.css and is positioned in the
 * section's actual empty space instead of behind the content.
 */

.portfolio-filters {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.3s;
  font-family: var(--font-body);
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.portfolio-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.portfolio-card {
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.portfolio-thumb {
  aspect-ratio: 16/9;
  background: var(--border-glass);
  position: relative;
  overflow: hidden;
}

.portfolio-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.portfolio-card:hover .portfolio-thumb img {
  transform: scale(1.1);
}

.portfolio-info {
  padding: 1.5rem;
  flex-grow: 1;
}

.portfolio-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.portfolio-tag {
  font-size: 0.75rem;
  background: rgba(var(--color-primary-rgb), 0.1);
  color: var(--color-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.portfolio-actions {
  text-align: center;
  margin-top: 3rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.5rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 10;
}

.modal-carousel {
  aspect-ratio: 16/9;
  background: var(--bg-base);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  position: relative;
  cursor: pointer;
}

.modal-carousel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.5s;
}

.modal-carousel img.active {
  opacity: 1;
}

/* Tier 2 Modal (Fullscreen viewer)
 * ---------------------------------------------------------------------------
 * ROOT-CAUSE FIX for a real UX bug: scrolling a tall image used to scroll
 * the ENTIRE .fullscreen-viewer box, taking the "fixed" close/prev/next
 * buttons along with it — so at the bottom of a tall screenshot, those
 * controls were off-screen and you had to scroll all the way back up to
 * use them.
 *
 * Why this happened: `backdrop-filter` (like `filter`, `transform`, and
 * `perspective`) makes an element the CONTAINING BLOCK for any
 * `position:fixed` descendant, per spec. .fullscreen-viewer has
 * `backdrop-filter: blur(10px)`, so .fs-close/.fs-prev/.fs-next were never
 * actually fixed to the viewport — they were fixed relative to
 * .fullscreen-viewer's own box. That's invisible as long as that box never
 * moves/scrolls, which is exactly the fix below: .fullscreen-viewer no
 * longer scrolls at all (`overflow: hidden`), and scrolling is scoped
 * entirely to .fullscreen-content instead. The buttons' box now never
 * moves, so their fixed position holds correctly no matter how far the
 * image inside is scrolled.
 */
.fullscreen-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 100001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.fullscreen-viewer.active {
  opacity: 1;
  visibility: visible;
}

.fullscreen-content {
  width: 90vw;
  height: 100vh;
  padding: 2rem 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  /* Scrollbar hidden cross-browser: the custom .fs-scroll-hint below is the
    intentional scrollability affordance for this viewer, so a second,
    native scrollbar track alongside it is visual noise rather than a
    second source of information. */
  scrollbar-width: none;
}

.fullscreen-content::-webkit-scrollbar {
  display: none;
}

.fullscreen-content img {
  width: 100%;
  height: auto;
}

/* Close & scroll-hint share the brand's primary (crimson); prev/next share
  the secondary (purple) — gives the two button "families" (dismiss vs.
  navigate) distinct, on-brand identities instead of both defaulting to
  the same generic black-overlay circle. */
.fs-close,
.fs-prev,
.fs-next {
  position: fixed;
  border: none;
  color: #fff;
  font-size: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 100002;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.2s ease;
}

.fs-close,
.fs-prev,
.fs-next {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.fs-close:hover,
.fs-prev:hover,
.fs-next:hover {
  filter: brightness(1.15);
}

.fs-close {
  top: 1rem;
  right: 1rem;
  background: rgba(var(--color-primary-rgb), 0.9);
}

.fs-prev {
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  background: rgba(var(--color-secondary-rgb), 0.9);
}

.fs-next {
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  background: rgba(var(--color-secondary-rgb), 0.9);
}

/* Scroll-down hint — a non-interactive nudge telling the visitor the image
  keeps going below the fold. Positioned fixed at the bottom-center of the
  viewport (same anchoring pattern as .scroll-up-btn) rather than inside
  the scrolling content, since it needs to stay put while the image moves
  under it. `pointer-events: none` keeps it purely advisory: it must never
  intercept a click meant for the image or the buttons behind/around it.
  Visibility is toggled by JS (see js/portfolio.js) using the exact same
  "has the user reached the end of the scrollable area" check that drives
  .scroll-up-btn's own show/hide, just measured against the bottom instead
  of the top. */
.fs-scroll-hint {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  color: var(--color-primary);
  font-size: 2.25rem;
  pointer-events: none;
  z-index: 100002;
  opacity: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
  transition: opacity 0.3s ease;
  animation: scrollHintBounce 4s ease-in-out infinite;
}

.fs-scroll-hint.hidden {
  opacity: 0;
}

/* Two quick bounces (0s–1s) then a 3s hold, repeating on a 4s cycle — an
  intentionally "tap tap... pause" rhythm rather than a continuous bob, so
  it reads as a deliberate nudge instead of restless background motion. */
@keyframes scrollHintBounce {

  0%,
  25%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  6.25%,
  18.75% {
    transform: translateX(-50%) translateY(10px);
  }

  12.5% {
    transform: translateX(-50%) translateY(0);
  }
}

/* Experience & Testimonials */
#experience .container {
  /* Stacking guard: .experience-decor (bubbles, added below section content
    in the DOM but position:absolute) needs an explicit lower z-index than
    the real content. Without this, an unpositioned .container paints in
    the "in-flow" stacking layer, which — perhaps counter-intuitively —
    sits BEHIND any positioned sibling with z-index:auto, so the bubbles
    would render on top of the testimonial/experience cards. */
  position: relative;
  z-index: 1;
}

.experience-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 4rem;
}

.exp-card {
  padding: 2rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.exp-card.glass:hover {
  background: var(--gradient-brand);
  border-color: transparent;
  color: #fff;
}

.exp-card.glass:hover h3,
.exp-card.glass:hover p,
.exp-card.glass:hover .exp-date {
  color: #fff !important;
}

.exp-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-brand);
}

.exp-date {
  font-size: 0.85rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.testimonial-carousel {
  margin-bottom: 4rem;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
}

.testimonial-carousel.glass:hover {
  background: var(--gradient-brand);
  border-color: transparent;
  color: #fff;
}

.testimonial-carousel.glass:hover h4,
.testimonial-carousel.glass:hover span,
.testimonial-carousel.glass:hover p {
  color: #fff !important;
}

/* Social */
#social .container {
  /* Same stacking guard as #experience — required so .social-decor-frame
     (the rotating "snake" light) sits behind the capsule row, not over it. */
  position: relative;
  z-index: 1;
}

.social-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  justify-items: center;
}

.social-capsule {
  display: flex;
  align-items: center;
  padding: 0;
  border-radius: 50px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  text-decoration: none;
  transition: all 0.4s ease;
  overflow: hidden;
  width: auto;
  padding-right: 20px;
}

.social-circle {
  width: 50px;
  height: 50px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-color);
  color: #fff;
  font-size: 1.5rem;
  margin-right: 15px;
  transition: all 0.4s ease;
}

.social-capsule span {
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.4s ease;
}

.social-capsule:hover {
  background: var(--brand-color);
  border-color: var(--gradient-brand);
}

.social-capsule:hover .social-circle {
  transform: scale(1.1);
}

.social-capsule:hover span {
  color: #fff;
}

/* Contact */
#contact .container {
  /* Same stacking guard — keeps the contact cards above the pulsing glow
     added in animations.css. */
  position: relative;
  z-index: 1;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.contact-card-new {
  padding: 2.5rem 2rem;
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.contact-card-new h3 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.contact-card-new .contact-icon {
  font-size: 3rem;
  color: var(--color-primary);
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.contact-card-new:hover {
  background: var(--hover-color);
  color: #fff;
  transform: translateY(-5px);
  border-color: transparent;
}

.contact-card-new:hover .contact-icon {
  color: #fff;
}

/* Footer */
footer {
  position: relative;
  overflow: hidden;
  padding: 4rem 0 2rem;
  margin-top: 4rem;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}

footer .container {
  /* Stacking guard for the same reason as the sections above. */
  position: relative;
  z-index: 1;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-col h4 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-col a:hover {
  color: var(--color-primary);
}

.map-container {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-card);
  overflow: hidden;
}

/* Scroll to Top */
.scroll-up-btn {
  position: fixed;
  height: 45px;
  width: 42px;
  background: var(--color-primary);
  right: 30px;
  bottom: 10px;
  text-align: center;
  line-height: 45px;
  color: #fff;
  z-index: 999;
  font-size: 30px;
  border-radius: 6px;
  border-bottom-width: 2px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}

.scroll-up-btn.show {
  bottom: 30px;
  opacity: 1;
  pointer-events: auto;
}

.scroll-up-btn:hover {
  filter: brightness(90%);
}

/* Utilities */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal[data-reveal="fade-left"] {
  transform: translateX(-30px);
}

.reveal[data-reveal="fade-right"] {
  transform: translateX(30px);
}

.reveal[data-reveal="scale"] {
  transform: scale(0.9);
}

.reveal.active[data-reveal] {
  transform: translate(0) scale(1);
}

/*
 * Decor-layer FOUC guard
 * ---------------------------------------------------------------------------
 * animations.css (Services blobs, Portfolio balls, Experience bubbles,
 * Social snake frame) is loaded non-render-blocking via preload+swap, which
 * means for a brief window after first paint it hasn't arrived yet. Without
 * this rule, the plain <div>/<svg> decor markup would flash as unstyled,
 * default-positioned elements before animations.css applies real positioning
 * and opacity. This single rule keeps them invisible until that stylesheet
 * loads and overrides it — zero flash, and it costs nothing on the critical
 * path since it's a single trivial selector.
 *
 * Deliberately only targets the OUTER .decor-layer element, not `.decor-layer *`.
 * opacity is not an inherited property, but it IS compositing: a parent at
 * opacity:0 renders its entire subtree invisible regardless of any opacity
 * a descendant sets on itself. Zeroing every descendant individually would
 * mean animations.css would need to re-override each one by name (fragile,
 * easy to miss one — e.g. an SVG <path> with no class of its own would stay
 * invisible forever). One rule on the parent is enough and can't drift.
 */
.decor-layer {
  opacity: 0;
}

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

  .experience-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #about .container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .social-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-col {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .footer-col ul {
    align-items: center;
  }

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

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

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

  nav ul,
  .nav-actions {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .typewriter-container {
    font-size: 2.5rem !important;
  }

  .mobile-nav-panel {
    display: flex;
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: var(--bg-elevated);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    z-index: 9998;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: right 0.4s ease;
  }

  .mobile-nav-panel.open {
    right: 0;
  }

  .mobile-nav-panel ul {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    font-size: 1.5rem;
    text-align: center;
  }

  .mobile-nav-panel .theme-toggle {
    margin-top: 2rem;
  }

  .service-card {
    width: 280px;
  }

  .service-card.active {
    transform: translate(-50%, -50%) scale(1.05);
  }

  .service-card.prev {
    transform: translate(calc(-50% - 200px), -50%) scale(0.8);
  }

  .service-card.next {
    transform: translate(calc(-50% + 200px), -50%) scale(0.8);
  }

  /* Layout centering for mobile */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p {
    text-align: center !important;
  }

  .about-card,
  .skills-card {
    padding: 1.5rem;
  }

  .section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
  }

  .portfolio-tags,
  .skill-tags {
    justify-content: center;
  }

  .contact-card-new {
    padding: 1.5rem;
  }

  .social-circle {
    width: 35px;
    height: 35px;
    border-radius: 35px;
    font-size: 1.2rem;
    margin-right: 15px;
  }

  .social-capsule span {
    font-size: 13px;
  }
}

.about-content {
  display: flex;
  flex-wrap: wrap;
  gap: 3rem;
  align-items: stretch;
  position: relative;
  z-index: 2;
}
