/* ==========================================================================
   1. Design Tokens & Global Resets
   ========================================================================== */

:root {
  --bg: #0a0a0a;
  --bg-secondary: #121212;
  --card: #181818;
  --border: #252525;
  --text: #ffffff;
  --text-secondary: #b3b3b3;
  --accent: #2153c1;
  --accent-dark: #2563eb;
  --success: #36d487;
  --danger: #ef4444; /* Fixed typo: originally shared blue color code with accent-dark */
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  --header-height: 82px;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", Arial, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

body.menu-open {
  overflow: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* ==========================================================================
   2. Components & Layouts
   ========================================================================== */

/* --- Site Header & Navigation --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: 100%;
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}

.site-header.scrolled {
  background: rgba(10, 10, 10, 0.76);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 40px, var(--max-width));
  height: var(--header-height);
  margin: 0 auto;
}

.logo {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  font-weight: 900;
  letter-spacing: 0;
  color: var(--text);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 34px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  position: relative;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color 0.25s ease;
}

.nav-link::after {
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.25s ease;
  content: "";
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* --- Mobile Menu Toggle --- */
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 5px auto;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- Global Section Shells --- */
.section {
  position: relative;
  scroll-margin-top: var(--header-height);
}

.section-shell {
  width: min(100% - 40px, var(--max-width));
  margin: 0 auto;
  padding: 110px 0;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 46px;
}

.section-heading h2,
.hero h1 {
  margin: 0;
  line-height: 0.95;
}

.section-heading h2 {
  position: relative;
  display: inline-block;
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  font-weight: 900;
  text-transform: uppercase;
  animation: headingLift 4.8s ease-in-out infinite;
}

.section-heading h2::after {
  position: absolute;
  left: 0;
  bottom: -14px;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 999px;
  transform: scaleX(0.35);
  transform-origin: center;
  animation: headingScan 3.6s ease-in-out infinite;
  content: "";
}

#projectsTitle {
  white-space: nowrap;
  font-size: clamp(2.15rem, 5.2vw, 5.4rem);
}

.section-heading p:not(.eyebrow) {
  max-width: 680px;
  margin: 18px 0 0;
  font-size: 1rem;
  color: var(--text-secondary);
}

.eyebrow {
  margin: 0 0 16px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 26px;
  font-size: 0.92rem;
  font-weight: 800;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.btn:hover {
  transform: translateY(-3px);
}

.btn-primary {
  color: var(--text);
  background: var(--accent);
  box-shadow: 0 18px 40px rgba(53, 83, 255, 0.24);
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-secondary:hover {
  color: var(--accent);
  border-color: rgba(53, 67, 255, 0.7);
}

/* --- Reusable Container Cards --- */
.member-card,
.project-showcase,
.contact-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* --- Right Column Info Card Panel --- */
.contact-info {
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* Aligns content to start from the top edge down */
  padding: 32px;               /* Matches left form padding perfectly */
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.info-group {
  display: flex;
  flex-direction: column;
  align-items: center; /* Centers all content within each info group */
  width: 100%;
}

/* Forces the right-side title to inherit the identical spatial height as form labels */
.social-label {
  display: block;
  margin-bottom: 8px; /* Matches left side label gap */
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  text-align: center; /* Centers only text */
}

.social-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px; /* Minor buffer to balance out input container space */
  justify-content: center; /* Centers the grid of icons within the info group */
}

/* --- Icon Layout Integration --- */
.social-grid .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: 460px;
  min-width: 240px;
  margin: 6px auto 0; /* Centers the entire grid and adds top margin for spacing */
}

/* Base icon sizing parameters */
.btn-icon {
  width: 16px;
  height: 16px;
  transition: fill 0.25s ease, transform 0.25s ease;
}

/* Ensure the icon highlights instantly when hovering over the button */
.social-grid .btn-secondary:hover .btn-icon {
  transform: scale(1.08); /* Tiny dynamic zoom response */
}

/* ==========================================================================
   3. Page Sections
   ========================================================================== */

/* --- Hero Section --- */
.hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 100vh;
  padding: calc(var(--header-height) + 70px) 0 70px;
  overflow: hidden;
}

.hero::after {
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, var(--bg));
  pointer-events: none;
  content: "";
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(10, 10, 10, 0.96), rgba(10, 10, 10, 0.76) 42%, rgba(10, 10, 10, 0.36)),
              url("../assets/images/hero-bg.png") center / cover no-repeat;
  transform: scale(1.02);
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(100% - 40px, var(--max-width));
  margin: 0 auto;
}

.hero h1 {
  max-width: 1280px;
  font-size: 6rem;
  font-weight: 900;
  text-shadow: 0 0 26px rgba(53, 73, 255, 0.18);
  animation: heroTitleLoop 4.5s ease-in-out infinite;
}

.hero-subtitle {
  max-width: 760px;
  margin: 22px 0 0;
  font-size: clamp(1.24rem, 2.4vw, 2.15rem);
  font-weight: 700;
}

.cursor {
  padding-right: 4px;
  border-right: 3px solid #2153c1;
  animation: blink-cursor 0.75s step-end infinite;
}

.hero-description {
  max-width: 620px;
  margin: 20px 0 0;
  color: var(--text-secondary);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.hero-stats {
  position: absolute;
  right: max(20px, calc((100vw - var(--max-width)) / 2));
  bottom: 54px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
}

.hero-stats article {
  padding: 18px;
  background: rgba(18, 18, 18, 0.68);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
}

.hero-stats strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
}

.hero-stats span {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* --- About & Team Section --- */
.about {
  background: var(--bg);
}

.about .section-shell {
  display: flex;
  align-items: center;      /* Centers the card vertically next to your text block */
  justify-content: space-between;
  gap: 50px;                /* Balanced breathing room between text and photo */
}

.about .section-heading {
  flex: 1;
  margin-bottom: 0;         /* Removes old bottom spacing since it's now side-by-side */
}

.about .team-grid {
  flex: 1;
  display: flex;
  justify-content: center;  /* Keeps your member card centered inside its half of the row */
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
}

.member-card {
  max-width: 320px;
  margin: 0 auto;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.member-card:hover {
  border-color: rgba(53, 67, 255, 0.55);
  transform: translateY(-8px);
}

.member-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.member-card div {
  padding: 18px;
}

.member-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.member-card p {
  margin: 0 0 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.member-card span {
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
}

/* --- Projects & Showcases --- */
.projects,
.contact {
  background: var(--bg-secondary);
}

.project-showcase {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(0, 1fr);
  align-items: center;
  gap: 34px;
  padding: 24px;
  margin-bottom: 34px;
}

.project-showcase-alt .project-banner {
  order: 2;
}

.project-banner {
  overflow: hidden;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  justify-self: center;
}

.project-banner img,
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.project-banner:hover img,
.gallery-item:hover img {
  transform: scale(1.05);
}

.project-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 10px 4px;
}

.project-genre {
  margin: 0 0 10px;
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent);
}

.project-content h3 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1;
  text-transform: uppercase;
}

.project-content p:not(.project-genre) {
  margin: 18px 0 0;
  color: var(--text-secondary);
}

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0;
}

.tools span {
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

/* --- Media Gallery Grid --- */
.gallery-grid {
  display: grid;
  grid-auto-flow: dense;
  grid-auto-rows: 170px;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  min-height: 170px;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.gallery-item::after {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0);
  transition: background 0.25s ease;
  content: "";
}

.gallery-item:hover::after {
  background: rgba(10, 10, 10, 0.26);
}

.gallery-item.tall {
  grid-row: span 2;
}

.gallery-item.wide {
  grid-column: span 2;
}

/* --- Contact Section & Form --- */
.contact-shell {
  padding-bottom: 96px;
}

.contact-layout {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* Splits the section into 2 equal columns */
  gap: 40px; /* Space between the form and whatever sits next to it */
  max-width: var(--max-width); /* Allows it to span the full site alignment width */
  margin: 0 auto;
}

.contact-form {
  padding: 32px;
  background: linear-gradient(145deg, rgba(73, 53, 255, 0.11), transparent 42%),
              var(--card);
}

.form-field {
  margin-bottom: 17px;
}

.form-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.88rem;
  font-weight: 800;
}

.form-field input,
.form-field textarea {
  width: 100%;
  color: var(--text);
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.form-field input {
  min-height: 52px;
  padding: 0 16px;
}

.form-field textarea {
  min-height: 120px;
  padding: 14px 16px;
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: rgba(53, 56, 255, 0.8);
  box-shadow: 0 0 0 4px rgba(53, 56, 255, 0.12);
}

.form-field.error input,
.form-field.error textarea {
  border-color: var(--danger);
}

.error-message {
  display: block;
  min-height: 20px;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--danger);
}

.form-status {
  min-height: 24px;
  margin: 16px 0 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--success);
}

/* --- Media Lightbox Module --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: rgba(0, 0, 0, 0.86);
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: min(100%, 980px);
  max-height: 82vh;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.lightbox-close {
  position: absolute;
  top: 22px;
  right: 22px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  font-size: 2rem;
  line-height: 1;
  color: var(--text);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
}

/* --- Global Footer --- */
.site-footer {
  display: grid;
  gap: 6px;
  padding: 34px 20px;
  text-align: center;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.site-footer .footer-brand {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text);
}

/* --- Scroll Animations Trigger Classes --- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* ==========================================================================
   4. CSS Keyframe Animations
   ========================================================================== */

@keyframes blink-cursor {
  from, to { border-color: transparent; }
  50% { border-color: #2153c1; }
}

@keyframes heroTitleLoop {
  0%, 100% {
    transform: translateY(0) scale(1);
    text-shadow: 0 0 22px rgba(53, 73, 255, 0.16);
  }
  50% {
    transform: translateY(-8px) scale(1.012);
    text-shadow: 0 0 40px rgba(53, 56, 255, 0.34);
  }
}

@keyframes headingLift {
  0%, 100% {
    transform: translateY(0);
    text-shadow: 0 0 0 rgba(255, 92, 53, 0);
  }
  50% {
    transform: translateY(-5px);
    text-shadow: 0 0 24px rgba(53, 67, 255, 0.24);
  }
}

@keyframes headingScan {
  0%, 100% {
    transform: scaleX(0.28);
    opacity: 0.55;
  }
  50% {
    transform: scaleX(1);
    opacity: 1;
  }
}

/* ==========================================================================
   Combined Dashboard Custom Modules (Fixed Alignment Overrides)
   ========================================================================== */

/* Force center alignment and break free from global max-width restrictions */
.dashboard-section .section-heading {
  max-width: 100% !important; /* Overrides the global 560px width restriction */
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;    /* Centers items horizontally in flexbox */
  justify-content: center !important;
  text-align: center !important;       /* Centers multi-line text baselines */
  margin-bottom: 56px !important;     /* Creates a prominent gap above selectors */
}

/* Explicitly target internal children to prevent text layout inheritance bugs */
.dashboard-section .section-heading .eyebrow,
.dashboard-section .section-heading h2 {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  width: 100% !important;
}

.dashboard-section .section-heading h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  margin-top: 8px;
}

/* --- Category Switcher (Education vs Achievements) --- */
.main-toggle-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.main-toggle-nav {
  display: inline-flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: var(--radius);
}

.category-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 24px;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: calc(var(--radius) - 2px);
  transition: all 0.25s ease;
}

.category-btn.active {
  color: var(--text);
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(33, 83, 193, 0.3); /* Adds a subtle blue ambient glow */
}

/* --- View Switching Mechanics --- */
.category-view {
  display: none; /* Hide when inactive */
}

.category-view.active-view {
  display: block;
  animation: dashboardFadeIn 0.4s ease forwards;
}

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

/* --- Semester Navigation Pills --- */
.tabs-outer-wrapper {
  width: 100%;
  margin-bottom: 20px;
}

.tabs-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 4px 0;
}

.tabs-nav::-webkit-scrollbar { display: none; }

.tabs-nav .tab-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.25s ease;
}

.tabs-nav .tab-btn.active {
  color: var(--text);
  background: var(--accent);
  border-color: var(--accent);
}

/* --- Carousel Slider Viewport Mechanics --- */
.dashboard-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
}

.dashboard-slider {
  display: flex;
  width: 400%;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.semester-panel {
  width: 25% !important;
  flex: 0 0 25%;
  opacity: 0.2;
  transition: opacity 0.4s ease;
}

.semester-panel.active { opacity: 1; }

/* --- Compact Grade Table Layout --- */
.table-container {
  width: 100%;
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.grade-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.grade-table th {
  padding: 12px 20px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}

.grade-table td {
  padding: 12px 20px;
  font-size: 0.9rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

/* --- Embedded Summary Stats Row --- */
.metrics-row td {
  padding: 16px;
  border-bottom: none;
  background: rgba(0, 0, 0, 0.12);
}

.metrics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

.metric-card {
  flex: 1 1 calc(33.333% - 8px);
  min-width: 130px;
  display: flex;
  flex-direction: column;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.metric-card.highlight {
  border-color: rgba(33, 83, 193, 0.3);
  background: linear-gradient(145deg, rgba(33, 83, 193, 0.08), transparent);
}

.metric-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-secondary);
}

.metric-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

/* --- Achievements Unified Card Component --- */
.achievements-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 0;
  width: 100%;
  max-width: 1080px;
  min-width: 320px;
  margin: 0 auto;
}

.achievement-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding: 2px 20px;
  transition: background-color 0.2s ease;
}

.achievement-row:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.achievement-row p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.achievement-year {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

/* --- Breakpoint Clean Adjustments --- */
@media (max-width: 820px) {
  .tabs-nav {
    justify-content: flex-start;
    padding-left: 4px;
  }
}

@media (max-width: 600px) {
  .metric-card { flex: 1 1 100%; }
  .achievement-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 7px 20px;
  }
}

/* ==========================================================================
   5. Responsive Media Queries
   ========================================================================== */

/* --- Desktop/Tablet Scale-down Breakpoint --- */
@media (max-width: 1040px) {
  .team-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .project-showcase,
  .project-showcase-alt {
    grid-template-columns: minmax(280px, 440px) minmax(0, 1fr);
  }

  .project-showcase-alt .project-banner {
    order: 0;
  }

  .project-banner {
    max-width: 440px;
  }
}

/* --- Tablet Mobile Base Breakpoint --- */
@media (max-width: 820px) {
  :root {
    --header-height: 72px;
  }

  .navbar {
    width: min(100% - 28px, var(--max-width));
  }

  .menu-toggle {
    display: block;
    position: relative;
    z-index: 1002;
  }

  .nav-menu {
    position: fixed;
    inset: 0;
    z-index: 1001;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
    background: rgba(10, 10, 10, 0.96);
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }

  .nav-menu.open {
    transform: translateX(0);
  }

  .nav-link {
    font-size: 1.25rem;
  }

  .section-shell {
    flex-direction: column; /* Stacks text on top of the card on smaller screens */
    gap: 34px;
    width: min(100% - 28px, var(--max-width));
    padding: 82px 0;
  }

  .about .section-heading {
    text-align: center;     /* Centers text alignment nicely for mobile view */
  }

  .team-grid {
    display: flex;
    justify-content: center;
  }

  .hero {
    min-height: auto;
    padding: 140px 0 38px;
  }

  .hero h1 {
    font-size: clamp(3rem, 11vw, 5rem);
  }

  .hero-content {
    width: min(100% - 28px, var(--max-width));
  }

  .hero-stats {
    position: relative;
    inset: auto;
    width: min(100% - 28px, var(--max-width));
    margin: 44px auto 0;
    grid-template-columns: 1fr;
  }

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

  .project-showcase,
  .project-showcase-alt {
    grid-template-columns: 1fr;
  }

  .project-banner,
  .contact-layout {
    grid-template-columns: 1fr; /* Reverts to a single column on tablets/phones */
    max-width: 560px; /* Keeps the form looking tightly framed on smaller screens */
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 150px;
  }

  .gallery-item.wide {
    grid-column: span 1;
  }
}

/* --- Small Screen/Mobile Mobile Breakpoint --- */
@media (max-width: 760px) {
  .hero h1 {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  .hero-actions,
  .project-actions,
  .tools {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .team-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-item.tall {
    grid-row: span 1;
  }

  .project-showcase,
  .contact-form {
    padding: 20px;
  }
  
  .project-banner {
    max-width: 100%;
  }

  .section-heading h2 {
    font-size: 2.55rem;
  }

  #projectsTitle {
    font-size: clamp(1.75rem, 8.2vw, 2.25rem);
  }
}