/* ============================================= */
/* PART 1: GLOBAL FLUID TYPOGRAPHY & SPACING     */
/* ============================================= */

:root {
  /* Fluid Font Sizes */
  --font-size-xs: clamp(0.75rem, 0.68rem + 0.18vw, 0.875rem); /* 12px -> 14px */
  --font-size-base: clamp(1rem, 0.91rem + 0.23vw, 1.125rem); /* 16px -> 18px */
  --font-size-lg: clamp(1.125rem, 0.98rem + 0.35vw, 1.375rem); /* 18px -> 22px */
  --font-size-xl: clamp(1.25rem, 1.07rem + 0.47vw, 1.625rem); /* 20px -> 26px */
  --font-size-display: clamp(1.875rem, 1.5rem + 0.94vw, 2.5rem); /* 30px -> 40px */

  /* Fluid Spacing Units */
  --space-xs: clamp(0.5rem, 0.41rem + 0.23vw, 0.625rem); /* 8px -> 10px */
  --space-s: clamp(0.75rem, 0.66rem + 0.23vw, 0.875rem); /* 12px -> 14px */
  --space-m: clamp(1rem, 0.82rem + 0.47vw, 1.375rem);   /* 16px -> 22px */
  --space-l: clamp(1.5rem, 1.23rem + 0.7vw, 2rem);      /* 24px -> 32px */
  --space-xl: clamp(2.5rem, 2.05rem + 1.17vw, 3.25rem); /* 40px -> 52px */
}

/* Apply the fluid variables to base elements */
body {
    font-size: var(--font-size-base);
}

h1, .text-2xl {
    font-size: var(--font-size-xl);
}

.text-3xl {
    font-size: var(--font-size-display);
}

.text-xs {
    font-size: var(--font-size-xs);
}

/* Custom styles for a professional, minimalistic feel */
body {
    font-family: 'Red Hat Mono', monospace;
    background-color: #ffffff;
    color: #111827;
    overflow-x: hidden; /* Prevent horizontal scroll on the body */
    /* Add a transition for the content fade-in */
    transition: opacity 0.5s ease-in-out;
}

/* ==== INITIAL STATE: HIDE CONTENT ==== */
/* By default, the body is in a "loading" state. */
/* The header and main content are completely invisible. */
body.loading > header,
body.loading > main {
    opacity: 0;
    visibility: hidden;
}

/* ==== LOADER STYLES (The Veil) ==== */
#loader-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Transition for the fade-out of the loader */
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* ==== NEW LOADER STYLES ==== */
.loader-logo {
  display: flex;
  align-items: center;
  gap: 8px; /* The space between the underscore and the text */
}

.loader-text {
  font-family: 'Red Hat Mono', monospace;
  font-weight: 700; /* Bold */
  font-size: 2.25rem; /* 36px */
  line-height: 1;
  color: #111827;
}

.loader-underscore {
  /* This animation runs for 1s, rotates in the first 0.5s, then pauses for 0.5s */
  animation: spin-underscore 1s linear infinite;
}

/* The new keyframe animation for the SVG underscore */
@keyframes spin-underscore {
  0% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(360deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ==== FINAL STATE: HIDE LOADER ==== */
/* This class is added via JS when the page is fully loaded. */
.loader-hidden {
  opacity: 0;
  visibility: hidden;
}


/* Hide the scrollbar for the projects container but allow scrolling */
#projects-container::-webkit-scrollbar {
    display: none;
}
#projects-container {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

.project-item .project-image,
.project-item .project-video,
.project-item .description-overlay {
    transition: opacity 0.4s ease-in-out;
}

.project-item .project-video {
    opacity: 0;
}

.project-item:hover .project-image {
    opacity: 0;
}

.project-item:hover .project-video {
    opacity: 1;
}

.description-overlay {
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

/* ============================================= */
/* PART 2: HOMEPAGE ASPECT RATIO ADAPTATIONS     */
/* ============================================= */

/* RULE 1: For Ultra-Wide Screens (e.g., > 21:9) */
/* Prevents the header from stretching too far apart. */
@media (min-aspect-ratio: 21/9) {
    header .grid {
        max-width: 1600px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* RULE 2: For Tall/Portrait Screens (e.g., < 4:5) */
/* Stacks the header content vertically for better readability. */
@media (max-aspect-ratio: 4/5) {
    header .grid {
        grid-template-columns: 1fr; /* Switch to a single column layout */
        gap: var(--space-l);
    }
    
    header .grid > div:last-child {
        text-align: left; /* Reset the text-align for the contact info */
    }
}