/* ============================================
   LAITH JAROUDI PORTFOLIO - STYLE SYSTEM
   Palette: Blue-tinted near-blacks
   Fonts: Satoshi (display) + General Sans (body)
   ============================================ */

/* Dither Background */
.dither-background {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Oversized to ensure coverage during zoom out */
  width: 120vw;
  height: 120vh;
  min-width: 120%;
  min-height: 120%;
  z-index: -10;
  opacity: 0.3;
  pointer-events: none;
}

/* CSS Variables */
:root {
  /* Refined black palette (blue-tinted) */
  --bg-primary: #18191f;
  --bg-secondary: #1f2128;
  --bg-elevated: #282a33;

  /* Text */
  --text-primary: #f0f0f3;
  --text-secondary: #8b8fa3;
  --text-tertiary: #9ca3af;

  /* Accent */
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: #93c5fd;

  /* Borders */
  --border: rgba(240, 240, 243, 0.08);
  --border-hover: rgba(240, 240, 243, 0.15);

  /* Legacy tokens (kept for loader.js compatibility) */
  --black: #0b0d11;
  --white: #f0f0f3;

  /* Pixel art color palette (loader) */
  --pixel-blue: #0901fd;
  --pixel-purple: #672de5;
  --pixel-green: #2af423;
  --pixel-red: #ec2111;
  --pixel-teal: #386e97;
  --pixel-pink: #dd54a1;
  --pixel-deep-purple: #422a8b;
  --pixel-yellow: #f6f928;
  --pixel-cyan: #6ff6ea;
  --pixel-magenta: #f81cf6;

  /* Typography */
  --font-display: 'Satoshi', 'Arial Black', sans-serif;
  --font-body: 'General Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  /* Type scale */
  --text-hero: clamp(3.5rem, 10vw, 7rem);
  --text-page: clamp(2.5rem, 8vw, 5rem);
  --text-section: clamp(2rem, 5vw, 3rem);
  --text-card: clamp(1.5rem, 3vw, 2rem);
  --text-lead: 1.125rem;
  --text-body: 1rem;
  --text-nav: 0.875rem;
  --text-label: 0.75rem;
  --text-tag: 0.625rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  --space-2xl: 8rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Global overflow prevention */
:root {
  overflow-x: hidden;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

html, body {
  max-width: 100vw;
  overflow-x: hidden;
  /* Prevent horizontal scroll from any source */
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Ensure content doesn't exceed viewport */
  width: 100%;
  position: relative;
}

/* Prevent scroll during loader */
body.loading {
  overflow: hidden;
}

/* Styled highlight - italic blue */
.italic-blue {
  font-style: italic;
  color: var(--accent);
}

/* Selection */
::selection {
  background: var(--accent);
  color: var(--white);
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* SVGs */
svg {
  max-width: 100%;
  height: auto;
  overflow: visible;
}

/* Ensure all media respects container width */
img, video, iframe, canvas, svg, object, embed {
  max-width: 100%;
}

/* Media elements */
video, iframe {
  max-width: 100%;
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--narrow {
  max-width: 900px;
}

.page {
  min-height: 100vh;
  padding-top: 100px;
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-lg);
  background: linear-gradient(to bottom, var(--bg-primary) 0%, transparent 100%);
  pointer-events: none;
  transition: background var(--transition-base), backdrop-filter var(--transition-base);
}

.nav--scrolled {
  background: rgba(11, 13, 17, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  pointer-events: auto;
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  transition: color 0.3s ease;
}

.nav__logo:hover {
  color: var(--accent);
}

.nav__logo span {
  color: var(--accent);
  display: inline-block;
  transition: transform 0.3s ease, color 0.3s ease;
}

.nav__logo:hover span {
  transform: scale(1.3);
  color: var(--accent-light);
}

.nav__links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
}

.nav__link {
  font-family: var(--font-body);
  font-size: var(--text-nav);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  position: relative;
  padding: var(--space-xs) 0;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav__link:hover,
.nav__link.active {
  color: var(--text-primary);
}

.nav__link:hover::after,
.nav__link.active::after {
  transform: scaleX(1);
}

/* Mobile nav toggle */
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.nav__toggle span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: var(--transition-fast);
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding: var(--space-2xl) 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(59, 130, 246, 0.06), transparent 60%);
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-xl);
  align-items: center;
}

.hero__content {
  position: relative;
  z-index: 2;
}

.hero__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--text-label);
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: var(--space-lg);
}

.hero__label::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-lg);
}

.hero__title em {
  font-style: italic;
  color: var(--accent);
}

.hero__subtitle {
  font-family: var(--font-body);
  font-size: var(--text-lead);
  color: var(--text-secondary);
  max-width: 540px;
  line-height: 1.6;
  margin-bottom: var(--space-xl);
}

.hero__cta {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* Glass card (hero right column) */
.hero__glass {
  background: rgba(240, 240, 243, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
}

.hero__glass-label {
  font-family: var(--font-body);
  font-size: var(--text-label);
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: var(--space-md);
}

.hero__glass-text {
  font-family: var(--font-display);
  font-size: var(--text-card);
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
}

.hero__glass-text em {
  color: var(--accent);
  font-style: italic;
}

/* ============================================
   HERO AVATAR - Minimal Portrait Accent
   ============================================ */

.hero__avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: var(--space-lg);
  position: relative;
}

.hero__avatar::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), rgba(59, 130, 246, 0.3));
  z-index: -1;
}

.hero__avatar::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
  z-index: -2;
  animation: avatarGlow 3s ease-in-out infinite;
}

.hero__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  border-radius: 50%;
  transition: transform 0.4s ease;
}

.hero__avatar:hover img {
  transform: scale(1.05);
}

@keyframes avatarIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes avatarGlow {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* ============================================
   DISCIPLINES STRIP
   ============================================ */

.disciplines {
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.disciplines__inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.disciplines__item {
  font-family: var(--font-body);
  font-size: var(--text-nav);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-primary);
  opacity: 0.7;
}

.disciplines__dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  font-family: var(--font-body);
  font-size: var(--text-nav);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn--primary {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--white);
  transform: translateY(-2px);
}

.btn--outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* Match chaos button size for hero CTA */
.hero__cta .btn--outline {
  width: 200px;
  height: 56px;
  justify-content: center;
}

.btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn__arrow {
  transition: transform var(--transition-fast);
}

.btn:hover .btn__arrow {
  transform: translateX(4px);
}

/* ============================================
   CHAOS BUTTON (WebGL Shader Effect)
   ============================================ */

.chaos-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--accent);
  padding: 0;
  cursor: pointer;
  width: 200px;
  height: 56px;
  border-radius: 150px;
  overflow: hidden;
  transition: transform 0.2s, background-color 0.2s;
  text-decoration: none;
}

.chaos-button:hover {
  transform: scale(1.02);
  background: var(--accent-hover);
}

.chaos-button:active {
  transform: scale(0.98);
}

.chaos-canvas {
  position: absolute;
  inset: 2px;
  display: block;
  height: calc(100% - 4px);
  width: calc(100% - 4px);
  border-radius: inherit;
}

.chaos-button:hover .chaos-label {
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.8),
    0 0 20px rgba(255, 255, 255, 0.6),
    0 0 30px rgba(255, 255, 255, 0.4);
}

.chaos-label {
  position: relative;
  z-index: 1;
  display: block;
  color: white;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* ============================================
   SECTION HEADERS
   ============================================ */

.section {
  padding: var(--space-2xl) 0;
}

.section__header {
  margin-bottom: var(--space-xl);
}

.section__label {
  font-family: var(--font-body);
  font-size: var(--text-label);
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: var(--space-sm);
}

.section__title {
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ============================================
   PROJECT CARDS (Home featured work)
   ============================================ */

.projects-grid {
  display: grid;
  /* Use min() to prevent overflow on small screens */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: var(--space-lg);
}

.project-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  aspect-ratio: 16 / 10;
  cursor: pointer;
  transition: transform var(--transition-base), border-color var(--transition-base);
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: var(--border-hover);
}

.project-card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.project-card:hover .project-card__image {
  transform: scale(1.05);
}

.project-card__svg {
  width: 100%;
  height: 100%;
}

.project-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.project-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(11, 13, 17, 0.95) 0%,
    rgba(11, 13, 17, 0.5) 50%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-lg);
  opacity: 0;
  transition: opacity var(--transition-base);
}

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

.project-card__tags {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.project-card__tag {
  font-family: var(--font-body);
  font-size: var(--text-tag);
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--space-xs) var(--space-sm);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.project-card__tag:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

.project-card__title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.project-card__desc {
  font-size: var(--text-nav);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Static card info (visible by default) */
.project-card__info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-lg);
  padding-top: var(--space-2xl);
  background: linear-gradient(
    to top,
    rgba(11, 13, 17, 0.95) 0%,
    rgba(11, 13, 17, 0.85) 40%,
    rgba(11, 13, 17, 0.4) 70%,
    transparent 100%
  );
}

.project-card__info .project-card__title {
  font-size: 1.25rem;
}

/* ============================================
   PHILOSOPHY SECTION (2-col)
   ============================================ */

.philosophy {
  padding: var(--space-2xl) 0;
  background: transparent;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.philosophy__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: start;
}

.philosophy__left .section__label {
  margin-bottom: var(--space-md);
}

.philosophy__heading {
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.philosophy__body {
  font-family: var(--font-body);
  font-size: var(--text-lead);
  color: var(--text-secondary);
  line-height: 1.7;
  padding-left: var(--space-lg);
  border-left: 2px solid var(--accent);
}

/* ============================================
   FOOTER (new: display name + links)
   ============================================ */

/* Site Footer - Minimal */
.site-footer {
  padding: 3rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: var(--space-2xl);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.copyright {
  font-size: 0.85rem;
  color: #a1a1aa;
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 2rem;
}

.footer-links a {
  font-size: 0.85rem;
  color: #d1d5db;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: #e8e8ed;
}

/* ============================================
   ABOUT PAGE (shared base styles)
   ============================================ */

.about-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: center;
  min-height: 70vh;
}

.about-hero__image {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-secondary);
}

.about-hero__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-hero__image::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  pointer-events: none;
}

.about-hero__content h1 {
  font-family: var(--font-display);
  font-size: var(--text-page);
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

.about-hero__content p {
  font-family: var(--font-body);
  font-size: var(--text-lead);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-md);
}

.about-hero__content p:last-of-type {
  margin-bottom: var(--space-xl);
}

/* Stats */
.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: var(--space-xl) 0;
}

.about-stat__number {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: var(--space-sm);
}

.about-stat__label {
  font-family: var(--font-body);
  font-size: var(--text-nav);
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Skills */
.skills-section {
  padding: var(--space-xl) 0;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
}

.skill-category h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: var(--space-md);
  color: var(--accent);
}

.skill-category ul {
  list-style: none;
}

.skill-category li {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

/* ============================================
   CONTACT PAGE (shared base styles)
   ============================================ */

.contact-hero {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.contact-hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 900;
  margin-bottom: var(--space-lg);
}

.contact-hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.contact-hero__subtitle {
  font-family: var(--font-body);
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin-bottom: var(--space-xl);
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 1.5rem;
  color: var(--text-primary);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition-base);
}

.contact-link:hover {
  color: var(--accent);
  padding-left: var(--space-md);
  border-color: var(--accent);
}

.contact-link__icon {
  width: 24px;
  height: 24px;
  opacity: 0.5;
}

.contact-link:hover .contact-link__icon {
  opacity: 1;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Scroll reveal animation class */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

/* Work items and project cards are animated by GSAP, not CSS reveal */
.work-item.reveal,
.project-card.reveal,
.page-header.reveal,
.work-filters.reveal,
/* About page elements animated by GSAP */
.about-hero__bio,
.about-hero__image,
.about-hero__details,
.about-stats,
.education-section,
.skills-section,
.timeline-section,
.about-personal,
/* Contact page elements animated by GSAP */
.contact-section,
.contact-photo-wrapper,
.contact-info,
.contact-footer,
.contact-banner {
  opacity: 1;
  transform: none;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .hero__grid {
    grid-template-columns: 1fr;
  }

  .hero__glass {
    display: none;
  }

  .hero__avatar {
    width: 80px;
    height: 80px;
  }

  .about-hero {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .about-hero__image {
    max-width: 400px;
    order: -1;
  }

  .philosophy__grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

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

  .project-card {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 768px) {
  :root {
    --space-lg: 1.5rem;
    --space-xl: 3rem;
    --space-2xl: 5rem;
  }

  .hero__avatar {
    width: 70px;
    height: 70px;
  }

  .nav__links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-primary);
    padding: var(--space-lg);
    gap: var(--space-md);
    border-bottom: 1px solid var(--border);
  }

  .nav__links.open {
    display: flex;
  }

  .nav__toggle {
    display: flex;
  }

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

  .footer-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .footer-links {
    gap: 1.5rem;
  }

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

  .project-card {
    min-height: 300px;
  }

  .project-card__overlay {
    opacity: 1;
  }

  .disciplines__inner {
    gap: var(--space-md);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-md);
  }

  .hero__cta {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .contact-link {
    font-size: 1.125rem;
  }

  /* Ensure project cards don't overflow */
  .project-card {
    min-width: 0;
  }

  /* Ensure hero title doesn't overflow */
  .hero__title {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Constrain chaos button on small screens */
  .chaos-button {
    width: 100%;
    max-width: 100%;
  }

  .hero__cta .btn--outline {
    width: 100%;
    max-width: 100%;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
.font-display { font-family: var(--font-display); }

/* ============================================
   PIXEL SNAKE LOADING ANIMATION
   ============================================ */

/* Prevent scroll during loading */
body.loading {
  overflow: hidden;
}

/* --- Hero Title & Animation Adjustment --- */

.hero__title {
  display: flex;
  flex-wrap: wrap; 
  align-items: baseline;
  
  /* REDUCED GAP: Brings "Design" and "for you" closer vertically when wrapped */
  gap: 0.2em; /* Was 0.3em */
  
  font-family: 'Satoshi', sans-serif; 
  font-weight: 900;
  line-height: 1.1;
  padding: 0;
  
  /* NEW: Pushes the subtitle down so the 'y' doesn't overlap it */
  margin-bottom: 0.5em; 
}

/* The Mask Window */
.text-swap {
  display: inline-flex;
  height: 1.4em; 
  overflow: hidden; 
  position: relative;
  
  padding-right: 0.5em; 
  margin-right: -0.5em; 
  
  vertical-align: bottom;
  /* ADJUSTED: Less negative margin so it doesn't pull the subtitle up too high */
  margin-bottom: -0.25em; 
}

/* The Moving Track */
.text-swap__track {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

/* Individual Items */
.text-swap__item {
  height: 1.4em; 
  display: flex;
  align-items: center; 
  white-space: nowrap;
  
  padding-bottom: 0.2em; 
  box-sizing: border-box;
}

/* Blue Accent */
.text-blue {
  display: inline-block;
  color: #1a75ff;
  font-style: italic;
  margin-left: 0.25em;
  padding-right: 0.1em;
  padding-bottom: 0.15em;
}

/* Animated Gradient Text - for "you" */
@property --gradient-1 {
  syntax: "<color>";
  initial-value: #1a75ff;
  inherits: false;
}

@property --gradient-2 {
  syntax: "<color>";
  initial-value: #68f3e4;
  inherits: false;
}

@property --gradient-3 {
  syntax: "<color>";
  initial-value: #f724ea;
  inherits: false;
}

.gradient-text {
  display: inline-block;
  font-style: italic;
  margin-left: 0.25em;
  padding-right: 0.1em;
  padding-bottom: 0.15em;
  background: linear-gradient(
    90deg,
    var(--gradient-1),
    var(--gradient-2),
    var(--gradient-3)
  );
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: gradient-flow 4s ease infinite;
}

@keyframes gradient-flow {
  0%, 100% {
    --gradient-1: #1a75ff;
    --gradient-2: #68f3e4;
    --gradient-3: #f724ea;
  }
  33% {
    --gradient-1: #68f3e4;
    --gradient-2: #f724ea;
    --gradient-3: #1a75ff;
  }
  66% {
    --gradient-1: #f724ea;
    --gradient-2: #1a75ff;
    --gradient-3: #68f3e4;
  }
}

/* Fallback for browsers without @property support */
@supports not (background: linear-gradient(in oklch, red, blue)) {
  .gradient-text {
    background: linear-gradient(90deg, #1a75ff, #68f3e4, #f724ea, #1a75ff);
    background-size: 300% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    animation: gradient-shift 3s ease infinite;
  }

  @keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
  }
}

/* Mobile Fix */
@media (max-width: 768px) {
  .hero__title {
    display: block;
    /* Ensure subtitle has room on mobile too */
    margin-bottom: 0.8em;
  }
  .text-swap {
    display: block;
    height: 1.5em;
    margin-bottom: 0;
  }
}

/* ============================================
   ENHANCED ANIMATIONS & HOVER EFFECTS
   ============================================ */

/* Primary button - lift + glow + shine */
.btn--primary {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Shine effect */
.btn--primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 20px rgba(59, 130, 246, 0.4),
    0 0 40px rgba(59, 130, 246, 0.2);
}

.btn--primary:hover::after {
  left: 100%;
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow:
    0 2px 10px rgba(59, 130, 246, 0.3);
}

/* Outline button - fill from left */
.btn--outline {
  position: relative;
  overflow: hidden;
  z-index: 1;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.btn--outline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--text-primary);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

.btn--outline:hover::before {
  transform: scaleX(1);
}

.btn--outline:hover {
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

/* Philosophy card hover - lift + shadow */
.hero__glass {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hero__glass:hover {
  transform: translateY(-5px);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.3),
    0 0 0 1px var(--border-hover);
}

/* Project card enhanced hover */
.project-card {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s ease,
              box-shadow 0.4s ease;
  overflow: hidden;
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.25),
    0 10px 30px rgba(26, 117, 255, 0.15);
}

.project-card__image {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover .project-card__image {
  transform: scale(1.05);
}

.project-card__svg {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover .project-card__svg {
  transform: scale(1.05);
}


/* ============================================
   LAYERED BACKGROUND SYSTEM
   ============================================ */

/* Background container */
.background-layers {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  /* Ensure it doesn't contribute to scrollable width */
  max-width: 100vw;
}

/* Gradient Orbs Container */
.gradient-orbs {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Base orb styles */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.1;
  will-change: transform;
}

/* Orb variations - positioned in corners/edges */
.orb--blue {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #1a75ff 0%, transparent 70%);
}

.orb--cyan {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #68f3e4 0%, transparent 70%);
}

.orb--magenta {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #f724ea 0%, transparent 70%);
}

.orb--purple {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #a855f7 0%, transparent 70%);
}

/* Home page orb positions */
.orb--home-1 {
  top: -200px;
  left: -200px;
  animation: floatOrb1 35s ease-in-out infinite;
}

.orb--home-2 {
  top: -100px;
  right: -150px;
  animation: floatOrb2 30s ease-in-out infinite;
}

.orb--home-3 {
  bottom: 20%;
  right: -100px;
  animation: floatOrb3 40s ease-in-out infinite;
}

.orb--home-4 {
  bottom: -150px;
  left: 10%;
  animation: floatOrb4 28s ease-in-out infinite;
}

/* Work page orb positions */
.orb--work-1 {
  top: -150px;
  left: -100px;
  animation: floatOrb1 35s ease-in-out infinite;
}

.orb--work-2 {
  top: 30%;
  right: -200px;
  animation: floatOrb2 30s ease-in-out infinite;
}

/* About page orb positions */
.orb--about-1 {
  top: -100px;
  left: -150px;
  animation: floatOrb1 35s ease-in-out infinite;
}

.orb--about-2 {
  top: 50%;
  right: -200px;
  animation: floatOrb3 40s ease-in-out infinite;
}

/* Contact page orb positions */
.orb--contact-1 {
  top: 0;
  left: -100px;
  animation: floatOrb1 35s ease-in-out infinite;
}

/* Subtle floating animations */
@keyframes floatOrb1 {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(30px, 20px); }
  50% { transform: translate(20px, 40px); }
  75% { transform: translate(-10px, 20px); }
}

@keyframes floatOrb2 {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-25px, 15px); }
  50% { transform: translate(-15px, 35px); }
  75% { transform: translate(10px, 15px); }
}

@keyframes floatOrb3 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(20px, -25px); }
  66% { transform: translate(-15px, -15px); }
}

@keyframes floatOrb4 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(25px, -30px); }
}

/* Abstract shapes container */
.abstract-shapes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Abstract shape styles */
.shape {
  position: absolute;
  pointer-events: none;
  opacity: 0.04;
}

/* Ring shapes */
.shape--ring {
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
}

.shape--ring-1 {
  width: 400px;
  height: 400px;
  top: 15%;
  right: 8%;
  animation: rotateShape 60s linear infinite;
}

.shape--ring-2 {
  width: 250px;
  height: 250px;
  bottom: 25%;
  left: 5%;
  animation: rotateShape 45s linear infinite reverse;
}

.shape--ring-3 {
  width: 180px;
  height: 180px;
  top: 60%;
  right: 15%;
  animation: rotateShape 50s linear infinite;
}

/* Subtle rotation animation */
@keyframes rotateShape {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Grain/Noise Overlay */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  animation: grain 0.8s steps(1) infinite;
  /* Clip to viewport to prevent overflow */
  overflow: hidden;
}

@keyframes grain {
  0%, 100% { background-position: 0 0; }
  10% { background-position: -5px -5px; }
  20% { background-position: 5px 5px; }
  30% { background-position: -3px 5px; }
  40% { background-position: 5px -3px; }
  50% { background-position: -5px 3px; }
  60% { background-position: 3px -5px; }
  70% { background-position: -3px 3px; }
  80% { background-position: 3px -3px; }
  90% { background-position: 5px 5px; }
}

/* Mobile: Reduce orb sizes and disable some animations */
@media (max-width: 768px) {
  .orb {
    filter: blur(80px);
    opacity: 0.08;
  }

  .orb--blue { width: 400px; height: 400px; }
  .orb--cyan { width: 350px; height: 350px; }
  .orb--magenta { width: 300px; height: 300px; }
  .orb--purple { width: 280px; height: 280px; }

  .shape--ring-1,
  .shape--ring-3 {
    display: none;
  }

  .grain-overlay {
    opacity: 0.025;
  }
}

/* ============================================
   MICRO-INTERACTIONS & POLISH
   ============================================ */

/* Text links in paragraphs - underline slides in */
.page p a:not(.btn),
.case-study__content a:not(.btn) {
  color: var(--accent);
  text-decoration: none;
  position: relative;
}

.page p a:not(.btn)::after,
.case-study__content a:not(.btn)::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.3s ease;
}

.page p a:not(.btn):hover::after,
.case-study__content a:not(.btn):hover::after {
  width: 100%;
}

/* External link indicator */
a[target="_blank"]:not(.btn):not(.nav__link):not(.footer-links a):not(.project-card):not(.contact-link)::after {
  content: ' \2197';
  font-size: 0.75em;
  opacity: 0.6;
  margin-left: 2px;
}

/* Section labels - subtle animation */
.section__label {
  transition: color 0.3s ease;
}

.section__label:hover {
  color: var(--accent);
}

/* Availability badge hover */
.availability-badge {
  transition: transform 0.3s ease;
}

.availability-badge:hover {
  transform: translateX(4px);
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Selection styling */
::selection {
  background: rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
}

/* Smooth image loading */
img {
  opacity: 1;
  transition: opacity 0.3s ease;
}

img[loading="lazy"] {
  opacity: 0;
}

img[loading="lazy"].loaded,
img:not([loading="lazy"]) {
  opacity: 1;
}

/* ============================================
   REDUCED MOTION PREFERENCES
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-anim {
    opacity: 1 !important;
    transform: none !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  html {
    scroll-behavior: auto;
  }

  /* Disable background animations */
  .orb {
    animation: none !important;
  }

  .shape {
    animation: none !important;
  }

  .grain-overlay {
    animation: none !important;
  }

  /* Gradient text - show static gradient */
  .gradient-text {
    animation: none !important;
    background: linear-gradient(90deg, #1a75ff, #68f3e4, #f724ea);
  }
}