body {
  background-color: #0d0d0d;
  color: #e5e5e5;
  font-family: "Ubuntu", sans-serif;
  padding: 2rem;
  /* Ensure proper scrolling */
  min-height: 100vh;
  overflow-x: hidden;
}

html {
  /* Ensure proper scrolling */
  height: 100%;
  overflow-x: hidden;
}

h1 {
  font-family: "ClashGrotesk", sans-serif;
}

a {
  color: #f5c518;
}

body.subpage-body {
  background-image: url('../assets/optimized_images/career/macbook_in_dark.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  /* so it doesn't scroll with content */
  margin: 0;
  color: #ffffff;
  /* Default text color for the page */
  font-family: "Ubuntu", sans-serif;
  /* A default font */
  /* Ensure scrolling works properly */
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

.subpage-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 50vh;
  /* Give it some space */
}

.subpage-title {
  font-family: "ClashGrotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 8vw, 6rem);
  /* Smaller than playground's 11vw, 9rem */
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
  color: #ffffff;
  margin: 0;
  margin-top: -6rem;
  text-shadow:
    -1px -1px 2px rgba(255, 255, 255, 0.2),
    2px 4px 12px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(255, 255, 255, 0.1);
}

.subpage-subtitle {
  font-family: "Ubuntu", sans-serif;
  font-size: clamp(1rem, 2vw, 1.5rem);
  /* Smaller than playground tagline */
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  max-width: clamp(300px, 60vw, 550px);
  margin-top: 1rem;
}

.subpage-body .top-menu {
  justify-content: flex-start;
  left: 2vw;
  width: auto;
  top: 40px;
  /* Make the navigation fixed so it stays in position when scrolling */
  position: fixed;
  z-index: 1000;
}

.subpage-body .top-menu a {
  padding: 1rem 0.8rem;
  font-size: 1rem;
  color: #c5c5c5;
  background-color: #78787840;
  border-radius: 20px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background-color 0.3s ease;
  /* New shadow for a uniform, 4-sided highlight */
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.1), inset 0 0 1px 1px rgba(255, 255, 255, 0.1);
}

/* Disable the mouse-following radial highlight effect */
.subpage-body .top-menu a::before {
  display: none;
}

.subpage-body .top-menu a:hover {
  background-color: rgba(255, 255, 255, 0.6);
}

.subpage-body .top-menu a .button-text {
  display: inline-block;
  margin-left: 0.5em;
  transition: margin-left 0.3s ease;
}

.subpage-body .top-menu a:hover .button-text {
  margin-left: 1em;
}

/* === AI Subpage Customization === */
body.subpage-body.ai-page {
  background-image: url('../assets/images/subpage_images/ai_background.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  /* Remove padding to allow full-width content */
  padding: 0;
  /* Ensure scrolling works properly */
  overflow-x: hidden;
  overflow-y: auto;
}

/* AI page: make the Home button text dark for better contrast on this hero */
.ai-page .top-menu a {
  color: #161616 !important;
}

/* When AI second content page is active, force Home button to bright near-white */
body.ai-page.ai-second-active .top-menu a {
  color: #F5F5F5 !important;
}

/* Dev & Robotics: keep Home button bright near-white consistently */
body.subpage-body.dev-page .top-menu a,
body.subpage-body.robotics-page .top-menu a {
  color: #F5F5F5 !important;
}

/* First page styling */
/* First page uses viewport-safe height to avoid iOS URL bar jumps */
.ai-first-page {
  min-height: 100svh;
  /* match Dev pattern */
  height: 100svh;
  position: relative;
  padding-left: 2rem;
  display: block;
  z-index: 10;
}

/* Sliding page styling */
.ai-sliding-page {
  position: absolute !important;
  inset: 0;
  /* match Dev pattern */
  width: 100vw;
  height: 100%;
  background-color: #057C1A;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateX(100%);
}



/* AI page header styles */
.ai-page .subpage-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  text-align: left;
  min-height: 60svh;
  height: 60svh;
  padding: 3vw 0 3vw 3vw;
  position: relative;
}

.ai-page .subpage-title {
  align-self: flex-end;
  /* move title to right side */
  text-align: left;
  /* right-align text */
  margin-right: 3vw;
  /* slight right inset */
  margin-top: 10vh;
  margin-bottom: auto;
  font-size: clamp(2.5rem, 7vw, 7rem);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  color: rgba(20, 20, 20, 0.92);
  /* darker title color on title page */
}

.ai-page .subpage-subtitle {
  align-self: flex-start;
  text-align: left;
  margin-top: 30vh;
  margin-bottom: 0;
  line-height: 1.6;
  font-size: clamp(1.1rem, 2vw, 1.7rem);
  color: rgba(25, 25, 25, 0.9);
  /* darker subtitle color on title page */
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  max-width: 480px;
}

/* Second page styling */
.ai-second-page {
  min-height: 200vh;
  background-color: #0A0A0A;
  position: relative;
  /* Remove margin-top to connect directly to green page */
  margin-top: 0;
  /* Remove any padding to take full width */
  padding: 6rem 0 7rem 0;
  /* Ensure it takes full width */
  width: 100%;
  left: 0;
  right: 0;
  z-index: 10;
}

/* Noise/grain overlay for AI second page */
.ai-second-page::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("../assets/optimized_images/interactive/moving_noise_optimized.gif");
  background-size: 200px 200px;
  background-repeat: repeat;
  opacity: 0.05;
  z-index: 1;
  pointer-events: none;
}

/* Video noise overlay (removed) */
.noise-overlay {
  display: none;
}

/* Vertical timeline line */
.ai-second-page::after {
  content: '';
  position: absolute;
  top: 0;
  left: 4rem;
  width: 2px;
  height: 100%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.10) 100%);
  z-index: 2;
}

.second-page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.second-page-title {
  font-family: "ClashGrotesk", sans-serif;
  font-weight: 600;
  font-size: clamp(4rem, 7vw, 12rem);
  color: #ffffffde;
  text-align: center;
  margin-bottom: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-shadow:
    -1px -1px 2px rgba(255, 255, 255, 0.2),
    2px 4px 12px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(255, 255, 255, 0.1);
}

/* --- AI intro pinning & overlay --- */
.ai-intro {
  position: relative;
}

/* Keep title exactly where it starts while the intro is pinned (match Dev) */
.ai-first-page {
  position: relative;
  height: 100vh;
  min-height: 100vh;
  z-index: 10;
}

/* Green page overlays the title while pinned (match Dev) */
.ai-sliding-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  transform: translateX(100%);
  /* start off-screen right */
  z-index: 50;
  will-change: transform;
}

/* The content section comes immediately after; no spacer needed */
.ai-second-page {
  margin-top: 0 !important;
}

/* === AI & ML SUBPAGE — CONTENT SECTION === */



/* --- Experience Group (Wrapper) --- */
.experience-group {
  max-width: min(90vw - 5rem, 75rem);
  width: 100%;
  margin-inline: auto;
  position: relative;
  margin-left: 8rem;
  /* Space for timeline */
}

.experience-group+.experience-group {
  margin-top: 10rem;
  /* Vertical gap between experiences */
}

/* --- Heading Block --- */
.experience-heading {
  margin-top: 0rem;
  margin-bottom: 1.5rem;
}

.experience-title {
  font-family: "ClashGrotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(1.4rem, 1.2vw + 1rem, 1.9rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #F5F5F5;
  margin-bottom: 0.5rem;
  position: relative;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* Horizontal connector from vertical line to title */
.experience-title::before {
  content: '';
  position: absolute;
  left: -4rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.10) 100%);
  z-index: 3;
}

.experience-subtitle {
  font-family: "Ubuntu", sans-serif;
  font-weight: 500;
  font-size: clamp(0.95rem, 0.6vw + 0.6rem, 1.1rem);
  color: #B8B8B8;
  margin-bottom: 0.75rem;
}

.experience-summary {
  font-family: "Ubuntu", sans-serif;
  color: rgba(255, 255, 255, 0.55);
  max-width: 45ch;
}

/* --- Cards Grid --- */
.experience-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: stretch;
  /* ensure items fill the track height */
}

/* --- Media Card (Left) --- */
.media-card {
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 1.5rem;
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 10;
  /* Ensure above background noise */

  /* Key: define the track height from this card */
  aspect-ratio: 3 / 2;
  height: auto;
  /* let aspect-ratio set height */
  min-height: 0;
  /* prevent overflow in grid */
  display: flex;
  flex-direction: column;
}

/* Colored glow effects for each experience group */
.exp-chinalit .media-card {
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 30px rgba(124, 58, 237, 0.3);
}

.exp-sjtu .media-card {
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 30px rgba(6, 182, 212, 0.3);
}

.exp-fall .media-card {
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 30px rgba(245, 158, 11, 0.3);
}

.exp-ocr .media-card {
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 30px rgba(236, 72, 153, 0.3);
}

.media-card:hover {
  transform: translateY(-0.125rem);
  box-shadow: 0 1.25rem 2.5rem rgba(0, 0, 0, 0.45);
}

.media-frame {
  width: 100%;
  height: 100%;
  border-radius: 1.125rem;
  overflow: hidden;
  flex: 1 1 auto;
  display: flex;
}

.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1.125rem;
  /* preserve inner radius */
}

/* --- Info Card (Right) --- */
.info-card {
  /* Do not change padding per your request */
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 1.5rem;
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 30px rgba(255, 255, 255, 0.1);
  padding: 1.25rem;

  display: flex;
  flex-direction: column;
  gap: 1.25rem;

  /* Key: stretch to the media-card’s height */
  align-self: stretch;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  /* include padding inside the height */
}

.info-list {
  list-style-type: '✓ ';
  padding-left: 1.25rem;
  font-family: "Ubuntu", sans-serif;
  font-size: clamp(0.95rem, 0.35vw + 0.7rem, 1.05rem);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.8);
  flex-grow: 1;
  /* occupy remaining vertical space */
}

.info-list li+li {
  margin-top: 0.75rem;
}

.info-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  position: relative;
}

.info-tags::before {
  content: '';
  position: absolute;
  top: -1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 6rem;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.3);
}

.info-tags span {
  font-family: "Ubuntu", sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.info-tags span:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}






/* === AI page: medium portrait layout (≤1024px) — stack vertically and center === */
@media (max-width: 1024px) {

  /* Uniform side gutters via container padding */
  .ai-second-page {
    --ai-gutter: clamp(16px, 5vw, 40px);
    padding-left: var(--ai-gutter);
    padding-right: var(--ai-gutter);
  }

  /* Hide the vertical timeline and connector */
  .ai-second-page::after {
    display: none;
  }

  /* Center the whole group; remove desktop left offset */
  .ai-page .experience-group {
    margin-left: 0;
    margin-right: 0;
    margin-inline: auto;
    max-width: 760px;
    width: 100%;
  }

  .ai-page .experience-heading {
    text-align: center;
  }

  .ai-page .experience-title {
    text-align: center;
  }

  .ai-page .experience-title::before {
    display: none;
  }

  .ai-page .experience-subtitle,
  .ai-page .experience-summary {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  /* Stack media and info vertically */
  .ai-page .experience-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    justify-items: center;
  }

  .ai-page .media-card,
  .ai-page .info-card {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    box-sizing: border-box;
  }

  /* Ensure images are centered within their frames */
  .ai-page .media-frame img {
    object-position: center center;
  }

  /* Center content inside the info card */
  .ai-page .info-card {
    align-items: center;
    text-align: center;
  }

  .ai-page .info-list {
    text-align: center;
    padding-left: 0;
    list-style-position: inside;
  }

  .ai-page .info-tags {
    justify-content: center;
  }
}

/* === AI page: vertical tablets (769px–1024px) — restore timeline and connectors === */
@media (min-width: 769px) and (max-width: 1024px) {

  /* Define layout vars so connectors start exactly at the vertical timeline */
  .ai-second-page {
    --timeline-left: clamp(1.25rem, 4vw, 2.5rem);
    --group-offset: clamp(4rem, 10vw, 7rem);
    /* ai-second-page already defines --ai-gutter in ≤1024 rules; use it here */
    --connector-left: calc(var(--timeline-left) - (var(--ai-gutter) + var(--group-offset)));
    --connector-width: 4rem;
    /* double the previous 2rem */
  }

  /* Show the vertical timeline at its computed left */
  .ai-second-page::after {
    display: block;
    left: var(--timeline-left);
  }

  /* Reintroduce left gutter for the content group relative to timeline */
  .ai-page .experience-group {
    margin-left: var(--group-offset);
    width: 75vw;
    max-width: none;
  }

  /* Connector begins at the vertical line and is longer on tablets */
  .ai-page .experience-title::before {
    display: block;
    left: var(--connector-left);
    width: var(--connector-width);
  }

  /* Left-align headings to suit the tree layout on tablet */
  .ai-page .experience-heading,
  .ai-page .experience-title,
  .ai-page .experience-subtitle,
  .ai-page .experience-summary {
    text-align: left;
  }

  /* Reset centering margins from ≤1024 rules so left edges line up */
  .ai-page .experience-subtitle,
  .ai-page .experience-summary {
    margin-left: 0;
    margin-right: 0;
  }
}

/* === AI page: small screens (≤768px) — 80% width, strict center text === */
@media (max-width: 768px) {

  /* Let the second content page grow with content on small screens */
  .ai-page .ai-second-page,
  .ai-second-page {
    min-height: auto !important;
    height: auto !important;
    padding-bottom: clamp(48px, 10vh, 96px) !important;
    /* extra space below last box */
  }

  .ai-page .media-card,
  .ai-page .info-card {
    width: 80%;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }

  /* Strict center alignment for headings and info text */
  .ai-page .experience-heading,
  .ai-page .experience-title,
  .ai-page .experience-subtitle,
  .ai-page .experience-summary,
  .ai-page .info-card,
  .ai-page .info-list {
    text-align: center;
  }

  /* Constrain title width for better readability */
  .ai-page .experience-title {
    max-width: 85%;
    margin-left: auto;
    margin-right: auto;
  }

  .ai-page .info-list {
    padding-left: 0;
    list-style-position: inside;
  }

  .ai-page .info-tags {
    justify-content: center;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .content-sections {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .ai-second-page,
  .robotics-second-page,
  .dev-second-page {
    padding: 0;
  }

  .second-page-content {
    padding: 2rem 1rem;
  }

  .content-section {
    padding: 1.5rem;
  }

  .experience-group {
    max-width: calc(100vw - 2rem);
    margin-left: 2rem;
  }

  .ai-second-page::after,
  .robotics-second-page::after,
  .dev-second-page::after {
    left: 1rem;
  }

  .experience-title::before {
    left: -2rem;
    width: 1.5rem;
  }
}

/* === Robotics Subpage Customization === */
body.subpage-body.robotics-page {
  background-image: url('../assets/images/subpage_images/Robotics_image.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  /* Remove padding to allow full-width content */
  padding: 0;
  /* Ensure scrolling works properly */
  overflow-x: hidden;
  overflow-y: auto;
}

/* First page styling */
/* Robotics first page also uses viewport-safe units */
.robotics-first-page {
  min-height: 100vh;
  height: 100vh;
  position: relative;
  padding-right: 2rem;
  display: block;
  z-index: 10;
}

/* Sliding page styling */
.robotics-sliding-page {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #E28309;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateX(100%);
}

/* Mobile: avoid background-attachment fixed artifacts (iOS) */
@media (max-width: 768px),
(pointer: coarse) {

  body.subpage-body,
  body.subpage-body.ai-page,
  body.subpage-body.robotics-page,
  body.subpage-body.dev-page {
    background-attachment: scroll !important;
  }
}

/* Robotics page header styles */
.robotics-page .subpage-header {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  /* align right like Dev (mirrored) */
  justify-content: space-between;
  text-align: right;
  min-height: 60vh;
  height: 60vh;
  padding: 3vw 3vw 3vw 0;
  position: relative;
}

.robotics-page .subpage-title {
  align-self: flex-end;
  /* right side */
  text-align: right;
  margin-top: 20vh;
  /* align with Dev spacing */
  margin-right: 15vw;
  /* right inset */
  margin-bottom: 0;
  line-height: 1.1;
  font-size: clamp(2.5rem, 7vw, 7rem);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
  max-width: 30vw;
  /* similar to Dev title width */
}

.robotics-page .subpage-subtitle {
  align-self: flex-end;
  text-align: left;
  margin-top: 20vh;
  margin-right: 0vw;
  margin-bottom: 0;
  line-height: 1.3;
  font-size: clamp(1.1rem, 2vw, 1.7rem);
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  max-width: 45vw;
  /* similar to Dev subtitle width */
}

/* Second page styling */
.robotics-second-page {
  min-height: 200vh;
  background-color: #0A0A0A;
  position: relative;
  /* Remove margin-top to connect directly to green page */
  margin-top: 0;
  /* Remove any padding to take full width */
  padding: 6rem 0 7rem 0;
  /* Ensure it takes full width */
  width: 100%;
  left: 0;
  right: 0;
  z-index: 10;
}

/* Noise/grain overlay for robotics second page */
.robotics-second-page::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("../assets/optimized_images/interactive/moving_noise_optimized.gif");
  background-size: 200px 200px;
  background-repeat: repeat;
  opacity: 0.05;
  z-index: 1;
  pointer-events: none;
}

/* Vertical timeline line - REMOVED */
/* .robotics-second-page::after {
    content: '';
    position: absolute;
    top: 0;
    left: 4rem;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.10) 100%);
    z-index: 2;
} */

/* --- Robotics intro pinning & overlay --- */
.robotics-intro {
  position: relative;
}

/* Keep title exactly where it starts while the intro is pinned */
.robotics-first-page {
  position: relative;
  height: 100svh;
  /* mobile-viewport safe */
  min-height: 100svh;
  /* align with sliding page */
  z-index: 10;
}

/* Green page overlays the title while pinned (no fixed position) */
.robotics-sliding-page {
  position: absolute;
  inset: 0;
  height: 100%;
  transform: translateX(100%);
  /* start off-screen right */
  z-index: 50;
  will-change: transform;
}

/* The content section comes immediately after; no spacer needed */
.robotics-second-page {
  margin-top: 0 !important;
}

/* === Dev Subpage Customization === */
body.subpage-body.dev-page {
  background-image: url('../assets/images/subpage_images/dev_background.jpg');
  background-size: cover;
  background-position: center;
  /* anchor right edge; crop occurs on left */
  background-repeat: no-repeat;
  background-attachment: fixed;
  /* Remove padding to allow full-width content */
  padding: 0;
  /* Ensure scrolling works properly */
  overflow-x: hidden;
  overflow-y: auto;
}

/* First page styling */
.dev-first-page {
  min-height: 100vh;
  position: relative;
  /* Remove the flex properties that were centering content */
  display: block;
  /* Ensure it stays in place during sliding animation */
  z-index: 10;
}

/* Sliding page styling */
.dev-sliding-page {
  position: absolute !important;
  ;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #562ACA;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Start off-screen to the right */
  transform: translateX(100%);
}

/* Dev page header styles */
.dev-page .subpage-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  /* left-align header content */
  justify-content: flex-start;
  text-align: left;
  height: 90vh;
  position: relative;
}

.dev-page .subpage-title {
  align-self: flex-start;
  /* left side */
  text-align: left;
  margin-top: 20vh;
  line-height: 1.1;
  margin-bottom: 0;
  font-size: clamp(2.5rem, 7vw, 7rem);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
  max-width: 30vw;
  margin-left: 5vw;
}

.dev-page .subpage-subtitle {
  align-self: flex-start;
  /* left side */
  text-align: left;
  margin-top: 20vh;
  margin-left: 5vw;
  margin-bottom: 0;
  line-height: 1.3;
  font-size: clamp(1.1rem, 2vw, 1.7rem);
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  max-width: 40vw;
  /* constrain width */
}

/* Second page styling */
.dev-second-page {
  min-height: 200vh;
  background-color: #0A0A0A;
  position: relative;
  /* Remove margin-top to connect directly to green page */
  margin-top: 0;
  /* Remove any padding to take full width */
  padding: 6rem 0 7rem 0;
  /* Ensure it takes full width */
  width: 100%;
  left: 0;
  right: 0;
  z-index: 10;
}

/* Noise/grain overlay for dev second page */
.dev-second-page::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("../assets/optimized_images/interactive/moving_noise_optimized.gif");
  background-size: 200px 200px;
  background-repeat: repeat;
  opacity: 0.05;
  z-index: 1;
  pointer-events: none;
}

/* Ensure media and tags render above grain overlay on Dev page */
.dev-second-page .media-block,
.dev-second-page .media-frame,
.dev-second-page .media-frame img {
  position: relative;
  z-index: 2;
}

.dev-second-page .tags-row {
  position: relative;
  z-index: 3;
}

/* Keep media tags inside the image and centered (all widths) */
.dev-second-page .media-block {
  overflow: hidden;
}

.dev-second-page .media-block .tags-row {
  position: absolute !important;
  left: 0;
  right: 0;
  bottom: 0.9rem;
  transform: none;
  width: 100%;
  padding: 0 1rem;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  text-align: center;
  z-index: 3;
}

/* Text-block tags: keep in normal flow and centered on Dev page */
.dev-second-page .text-block .tags-row {
  position: static !important;
  left: auto;
  right: auto;
  bottom: auto;
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
  text-align: center;
}

/* Vertical timeline line - REMOVED */
/* .dev-second-page::after {
    content: '';
    position: absolute;
    top: 0;
    left: 4rem;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.10) 100%);
    z-index: 2;
} */

/* --- Dev intro pinning & overlay --- */
.dev-intro {
  position: relative;
}

/* Keep title exactly where it starts while the intro is pinned */
.dev-first-page {
  position: relative;
  height: 100svh;
  /* mobile-viewport safe */
  min-height: 100vh;
  /* fallback */
  z-index: 10;
}

/* Green page overlays the title while pinned (no fixed position) */
.dev-sliding-page {
  position: absolute;
  inset: 0;
  height: 100%;
  transform: translateX(100%);
  /* start off-screen right */
  z-index: 50;
  will-change: transform;
}

/* The content section comes immediately after; no spacer needed */
.dev-second-page {
  margin-top: 0 !important;
}

/* === Photography Subpage Customization === */
body.subpage-body.photography-page {
  background-color: #0A0A0A;
  /* Fallback background */
  /* background-image properties are moved to the ::before pseudo-element */
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Prevent default macbook image flash on photography page */
body.subpage-body.photography-page {
  background-image: none !important;
}

/* Create a fixed pseudo-element for the background to solve mobile repaint issues */
body.subpage-body.photography-page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url('../assets/images/subpage_images/Photography_subpage_title.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -1;
  /* Place it behind all content */
}

.photography-first-page,
.motorsport-first-page {
  height: 100vh;
  min-height: 100vh;
  position: relative;
  z-index: 10;
}

.photography-page .subpage-header {
  /* Fixed position to make it truly static and out of the pin flow */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 20;
  /* Above the first page, below the second */
  pointer-events: none;
  /* Allow scrolling "through" it */

  /* Position at top with 20vh margin */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  /* Align content to the top */
  text-align: center;
  height: 100%;
  /* Fill the parent */
  padding-top: 20vh;
  /* Add 20vh gap at the top */
  box-sizing: border-box;
  /* Ensure padding is included in height */
}

.photography-second-page,
.motorsport-second-page {
  min-height: 200vh;
  background-color: #0A0A0A;
  position: relative;
  z-index: 50;
  /* Ensure it slides OVER the first page */
  padding: 6rem 2rem 6rem;
  /* Reduced top padding to move title up */
  box-sizing: border-box;
}

/* Noise/grain overlay for photography second page */
.photography-second-page::before,
.motorsport-second-page::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../assets/optimized_images/interactive/moving_noise_optimized.gif');
  background-size: 200px 200px;
  background-repeat: repeat;
  opacity: 0.05;
  z-index: 0;
  /* Behind content, above background color */
  pointer-events: none;
}

/* Ensure direct children (like the title) appear above the grain */
.photography-second-page>*,
.motorsport-second-page>* {
  position: relative;
  z-index: 1;
}

/* === Motorsport Subpage Customization === */
body.subpage-body.motorsport-page {
  background-color: #0A0A0A;
  /* Fallback background */
  background-image: none !important;
  /* Prevent default macbook image flash */
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Create a fixed pseudo-element for the background to solve mobile repaint issues */
body.subpage-body.motorsport-page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url('../assets/optimized_images/motorsport/track_background.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -1;
  /* Place it behind all content */
}

.motorsport-page .subpage-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  height: 100%;
  box-sizing: border-box;
}

.motorsport-page .subpage-title {
  margin-top: 60vh;
}

.motorsport-page .top-menu a {
  color: #111 !important;
  background-color: #e5e5e583 !important;
}

/* === DEV SUBPAGE — CONTENT SECTION === */

/* --- Page Layout --- */
.dev-second-page {
  background-color: #0D0D0D;
  padding: 6rem 0 7rem 0;
}

/* --- Experience Row (Wrapper) --- */
.experience-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 2rem;
  align-items: start;
  max-width: 72rem;
  width: 90vw;
  margin-inline: auto;
  position: relative;
}

.experience-row+.experience-row {
  margin-top: 8rem;
  /* Vertical gap between rows */
}

/* Add a little extra space above the first experience only */
.dev-second-page>.experience-row:first-of-type {
  margin-top: 3rem;
}

.experience-row.image-left {
  grid-template-columns: 1fr 1.15fr;
  gap: 4rem;
  /* increase gap between image (left) and text (right) */
}

.experience-row.image-left .media-block {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
}

.experience-row.image-left .text-block {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  margin-left: 4rem;
  /* push text a bit further right */
}

/* --- Text Block --- */
.text-block {
  display: flex;
  flex-direction: column;
  margin-left: 1rem;
  gap: 1rem;
  height: 100%;
}

.text-block .row-title {
  font-family: "ClashGrotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(1.4rem, 1.2vw + 1rem, 1.9rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #F5F5F5;
  margin: 0 0 0.1rem 0;
  position: relative;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.text-block .subtitle {
  font-family: "Ubuntu", sans-serif;
  font-weight: 500;
  font-size: clamp(0.95rem, 0.6vw + 0.6rem, 1.1rem);
  color: #B8B8B8;
  margin: 0 0 0.1rem 0;
  text-align: left;
}

.text-block .summary {
  font-family: "Ubuntu", sans-serif;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 1rem 0;
  max-width: 40ch;
}

.text-block .bullets {
  list-style-type: '✓ ';
  padding-left: 1.25rem;
  font-family: "Ubuntu", sans-serif;
  font-size: clamp(0.95rem, 0.35vw + 0.7rem, 1.05rem);
  line-height: 1.55;
  color: #B8B8B8;
  margin: 1rem 0 1rem 0;
  position: relative;
}

.text-block .bullets::before {
  content: '';
  position: absolute;
  top: -0.75rem;
  margin-bottom: 1rem;
  left: 0;
  width: 8vw;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
}

.text-block .bullets li+li {
  margin-top: 0.5rem;
}

.text-block .tags-row,
.media-block .tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-self: flex-start;
  margin-top: auto;
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 10;
}

.text-block .tags-row span,
.media-block .tags-row span {
  font-family: "Ubuntu", sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: #B8B8B8;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  padding: 0.25rem 0.6rem;
  transition: background-color 0.2s ease;
}

.text-block .tags-row span:hover,
.media-block .tags-row span:hover {
  background: rgba(255, 255, 255, 0.20);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

/* --- Media Block --- */
.media-block {
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 1.5rem;
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35);
  padding: 0;
  aspect-ratio: 3 / 2;
  /* horizontal rectangle */
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Remove any extra spacing that may appear around the image */
.media-frame {
  padding: 0;
  margin: 0;
}

.media-frame img {
  display: block;
}

/* Expand media blocks to bleed slightly off-screen while keeping inner edge aligned */
.experience-row:not(.image-left) .media-block {
  /* bleed to the right beyond viewport safely while keeping inner edge fixed */
  --bleed: clamp(8px, 2vw, 25px);
  width: calc(100% + 6vw + var(--bleed));
  margin-right: calc(-8vw - var(--bleed));
}

.experience-row.image-left .media-block {
  /* bleed to the left beyond viewport safely while keeping inner edge fixed */
  --bleed: clamp(8px, 2vw, 25px);
  width: calc(100% + 6vw + var(--bleed));
  margin-left: calc(-6vw - var(--bleed));
}

.media-block:hover {
  transform: translateY(-0.125rem);
  box-shadow: 0 1.25rem 2.5rem rgba(0, 0, 0, 0.45);
}

.media-frame {
  width: 100%;
  height: 100%;
  border-radius: 1.125rem;
  overflow: hidden;
}

.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.25s ease;
}

.media-block:hover .media-frame img {
  opacity: 1.05;
}

.media-caption {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  font-family: "Ubuntu", sans-serif;
  color: rgba(255, 255, 255, 0.70);
  font-size: 1rem;
}

/* --- Dev: Stronger, less transparent skill tags --- */
.dev-second-page .tags-row span {
  color: #f9f9f9f4;
  /* brighter for readability */
  background: rgba(160, 160, 160, 0.5);
  /* deeper, like back button */
  border-color: rgba(255, 255, 255, 0.33);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.1), inset 0 0 1px 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(2px) saturate(120%);
}

.dev-second-page .tags-row span:hover {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.25);
}

/* Dev: Center tags for all images, including left-column layouts */
.dev-second-page .experience-row.image-left .media-block .tags-row {
  left: 0 !important;
  right: 0 !important;
  transform: none !important;
  width: 100% !important;
  padding: 0 1rem !important;
  justify-content: center !important;
  text-align: center !important;
}

/* Dev page: mobile stacking (≤768px) image → text, center everything */
@media (max-width: 768px) {

  /* Stack each experience row into a single column and center items */
  .dev-second-page .experience-row {
    display: grid;
    grid-template-columns: 1fr !important;
    justify-items: center;
    align-items: start;
    width: 100%;
    row-gap: 1.1rem;
    column-gap: 0;
    margin-inline: 0;
  }

  /* Order: image (row 1) then text (row 2) for every row */
  .dev-second-page .experience-row .media-block {
    grid-row: 1;
    grid-column: 1;
    width: min(92vw, 720px);
    margin: 0 auto;
  }

  .dev-second-page .experience-row .text-block {
    grid-row: 2;
    grid-column: 1;
    margin-left: 0;
    align-items: center;
    text-align: center;
    max-width: min(92vw, 720px);
  }

  /* Center inner text layout */
  .dev-second-page .text-block .row-title,
  .dev-second-page .text-block .subtitle,
  .dev-second-page .text-block .summary {
    text-align: center;
  }

  /* Increase gap between image and experience title */
  .dev-second-page .experience-row .text-block .row-title {
    margin-top: 2.5rem;
  }

  .dev-second-page .text-block .bullets {
    text-align: center;
    padding-left: 0;
    list-style-position: inside;
  }

  .dev-second-page .text-block .bullets::before {
    display: none;
  }

  /* EXCEPTION: Info blocks within text should be left-aligned on mobile */
  .dev-second-page .experience-row .text-block .info-blocks {
    justify-items: start;
  }

  .dev-second-page .experience-row .text-block .info-block {
    align-items: flex-start;
    text-align: left;
  }

  .dev-second-page .experience-row .text-block .info-block__title,
  .dev-second-page .experience-row .text-block .info-block__description {
    text-align: left;
  }

  /* Center skill tags; place in normal flow under blocks */
  .dev-second-page .experience-row .media-block {
    position: relative;
  }

  .dev-second-page .experience-row .media-block .tags-row {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.9rem;
    transform: none;
    width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
    margin-top: 0;
    display: flex;
    justify-content: center;
    text-align: center;
    z-index: 3;
    /* above image and grain */
  }

  .dev-second-page .experience-row .text-block .tags-row {
    position: static;
    transform: none;
    left: auto;
    right: auto;
    bottom: auto;
    margin-top: 0.75rem;
    justify-content: center;
    text-align: center;
  }

  /* Neutralize desktop special-case gap */
  .dev-second-page .experience-row.image-left {
    gap: 1.25rem !important;
  }
}

/* --- Dev: Color-matched media glows (similar to AI page) --- */
.dev-second-page .experience-row:nth-of-type(1) .media-block {
  /* Tencent — cyan/teal glow */
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 30px rgba(245, 190, 11, 0.32);
}

.dev-second-page .experience-row:nth-of-type(2) .media-block {
  /* Portfolio — purple glow matching dev theme */
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 30px rgba(86, 42, 202, 0.35);
}

.dev-second-page .experience-row:nth-of-type(3) .media-block {
  /* Apple LMS — soft blue glow */
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 30px rgba(216, 144, 19, 0.32);
}

.dev-second-page .experience-row:nth-of-type(4) .media-block {
  /* Pygame — warm amber glow */
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 30px rgba(245, 144, 11, 0.232);
}

/* --- New Info Block Styles --- */
.info-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  /* Gap between the two blocks */
  margin: 2rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
  max-width: 85%;
}

.info-block {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.info-block__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-block__icon {
  width: 1.6rem;
  height: 1.6rem;
  stroke: rgba(255, 255, 255, 0.9);
  /* brighter, less transparent */
  stroke-width: 2.25px;
  margin-right: 0.2rem;
  flex-shrink: 0;
}

.info-block__title {
  font-family: "Ubuntu", sans-serif;
  font-weight: 500;
  font-size: 1rem;
  color: #E5E5E5;
  margin: 0;
}

.info-block__description {
  font-family: "Ubuntu", sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #B8B8B8;
  margin: 0;
}




/* === Robotics Second Page — New Grids === */
/* Module A: Past Works — three-column rows */
.robotics-second-page .tri-feature {
  display: grid;
  gap: 4rem;
  max-width: 80rem;
  /* larger to allow bigger media */
  width: 92vw;
  /* slightly wider on viewport */
  margin-inline: auto;
  position: relative;
}

.robotics-second-page .tri-feature__row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
  align-items: start;
  position: relative;
}

/* Row title that always sits above image tops, regardless of wrap */
.robotics-second-page .tri-feature__title {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, calc(-100% - clamp(1.5rem, 3vw, 3rem)));
  /* ensure bottom is well above image tops, even when wrapped */
  margin: 0;
  padding: 0;
  text-align: center;
  font-family: "ClashGrotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(1.4rem, 1.2vw + 1rem, 1.9rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #F5F5F5;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  z-index: 2;
}

/* Make Robotics images square and visually larger */
.robotics-second-page .tri-feature .media-block,
.robotics-second-page .more-grid .media-block {
  aspect-ratio: 1 / 1;
}

/* Center text for Robotics page blocks */
.robotics-second-page .tri-feature__row .text-block,
.robotics-second-page .tri-feature__row .text-block .row-title,
.robotics-second-page .tri-feature__row .text-block .subtitle,
.robotics-second-page .tri-feature__row .text-block .summary,
.robotics-second-page .more-item .text-block,
.robotics-second-page .more-item .text-block .row-title,
.robotics-second-page .more-item .text-block .subtitle,
.robotics-second-page .more-item .text-block .summary {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* Center the dividing line and bullets for Robotics tri-feature text */
.robotics-second-page .tri-feature .text-block .bullets {
  text-align: center;
  padding-left: 0;
  list-style-position: inside;
}

.robotics-second-page .tri-feature .text-block .bullets::before {
  left: 50%;
  transform: translateX(-50%);
  width: 8rem;
  /* slightly shorter, centered */
}

/* Keep tags below text (don’t absolutely position inside Robotics tri features) */
.robotics-second-page .tri-feature .text-block {
  position: relative;
}

.robotics-second-page .tri-feature .text-block .tags-row {
  position: static;
  margin-top: 0.5rem;
  margin-bottom: 8rem;
}

/* Module B: More — two-column gallery */
.robotics-second-page .more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 80rem;
  /* larger gallery */
  width: 92vw;
  margin: 6rem auto 0 auto;
}

.robotics-second-page .more-item {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 1rem;
}

/* Restrict twin 2-column images to reasonable sizes and center them */
.robotics-second-page .more-grid .more-item .media-block {
  width: 100%;
  max-width: 40vw;
  /* desktop cap */
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 1024px) {
  .robotics-second-page .more-grid .more-item .media-block {
    max-width: 24rem;
    /* tablet cap */
  }
}

@media (max-width: 768px) {
  .robotics-second-page .more-grid .more-item .media-block {
    max-width: 22rem;
    /* mobile cap */
  }
}

/* Center the section title and make it slightly smaller than .second-page-title */
.robotics-second-page .more-works-title {
  text-align: center;
  margin: 4rem 0 1.5rem 0;
  font-size: clamp(2.25rem, 5.5vw, 4.5rem);
}

/* Ensure text chips are in normal flow here as well */
.robotics-second-page .more-item .text-block .tags-row {
  position: static;
  margin-top: 0.5rem;
}

/* Responsive: stack to one column on mobile & portrait tablets */
@media (max-width: 1024px) {
  .robotics-second-page .tri-feature__row {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .robotics-second-page .more-grid {
    grid-template-columns: 1fr;
  }

  /* Bring right-column image closer to tags and away from next row title */
  .robotics-second-page .tri-feature .text-block .tags-row {
    margin-bottom: 0.75rem;
  }

  .robotics-second-page .tri-feature__row>.media-block:last-of-type {
    margin-top: 0.5rem;
    /* closer to preceding tags */
    margin-bottom: 3rem;
    /* more space before next row title */
  }

  /* Robotics: make media 80% of viewport width on tablets */
  .robotics-second-page .tri-feature__row .media-block,
  .robotics-second-page .more-grid .more-item .media-block {
    width: 80vw;
    max-width: 80vw;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Robotics: enlarge text sizes on iPad/vertical tablets */
@media (min-width: 769px) and (max-width: 1024px) {

  /* Header subtitle larger */
  .robotics-page .subpage-subtitle {
    font-size: clamp(1.3rem, 2.6vw, 2.1rem);
  }

  /* Tri-feature titles larger */
  .robotics-second-page .tri-feature__title {
    font-size: clamp(1.7rem, 1.8vw + 1rem, 2.4rem);
  }

  /* Text block typography scale-up */
  .robotics-second-page .text-block .row-title {
    font-size: clamp(1.8rem, 2vw + 1rem, 2.4rem);
  }

  .robotics-second-page .text-block .subtitle {
    font-size: clamp(1.1rem, 1vw + 0.7rem, 1.35rem);
  }

  .robotics-second-page .text-block .summary {
    font-size: clamp(1.1rem, 0.9vw + 0.6rem, 1.3rem);
  }

  .robotics-second-page .text-block .bullets {
    font-size: clamp(1.1rem, 0.9vw + 0.75rem, 1.25rem);
  }

  .robotics-second-page .text-block .tags-row span,
  .robotics-second-page .media-block .tags-row span {
    font-size: 1rem;
  }

  /* Add top spacing for Tennis Ball Robot title (row 2) */
  .robotics-second-page .tri-feature__row:nth-of-type(2) .tri-feature__title {
    top: clamp(0.75rem, 2vw, 2rem);
  }

  /* Add top spacing for the second More item (Maze Robot) */
  .robotics-second-page .more-grid .more-item:nth-of-type(2) {
    margin-top: 2.5rem;
  }
}

/* Robotics: portrait iPad — make media 70% of viewport width */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {

  .robotics-second-page .tri-feature__row .media-block,
  .robotics-second-page .more-grid .more-item .media-block {
    width: 70vw;
    max-width: 70vw;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 768px) {
  .robotics-second-page .tri-feature {
    gap: 3rem;
  }

  .robotics-second-page .more-grid {
    gap: 1.5rem;
    margin-top: 3.5rem;
  }

  /* Increase vertical gap before the second More item (Maze Robot) */
  .robotics-second-page .more-grid .more-item:nth-of-type(2) {
    margin-top: 4rem;
  }

  /* Center Robotics title and move slightly upward on mobile */
  .robotics-page .subpage-header {
    align-items: center;
    text-align: center;
    padding: 3vw;
  }

  .robotics-page .subpage-title {
    align-self: center;
    text-align: center;
    margin-top: 10vh;
    margin-left: 30vw;
    max-width: 85vw;
  }

  /* Keep tri-feature titles on one line on mobile and size to fit */
  .robotics-second-page .tri-feature__title {
    white-space: nowrap;
    font-size: clamp(1.1rem, 4.2vw, 1.5rem);
  }

  /* Add larger top margin for the second row (Tennis Ball Robot) */
  .robotics-second-page .tri-feature__row:nth-of-type(2) {
    margin-top: 2.5rem;
  }

  /* Robotics: make media 80% of viewport width on mobile */
  .robotics-second-page .tri-feature__row .media-block,
  .robotics-second-page .more-grid .more-item .media-block {
    width: 80vw;
    max-width: 80vw;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Ensure Robotics media sits above the grain overlay for a clean look */
.robotics-second-page .media-block,
.robotics-second-page .media-frame,
.robotics-second-page .media-frame img {
  position: relative;
  z-index: 2;
}

.robotics-second-page .tags-row {
  position: relative;
  z-index: 3;
}

/* Neutralize any previous negative margin on inner titles */
@media (min-width: 1025px) {
  .robotics-second-page .tri-feature__row .text-block .row-title {
    margin-top: 0 !important;
  }
}

@media (max-width: 768px) {
  .robotics-second-page .tri-feature__title {
    transform: translate(-50%, calc(-100% - clamp(1rem, 3vw, 2rem)));
  }
}

/* Photography Title Split Animation */
.photography-second-page .photography-title {
  overflow: hidden;
  /* Prevent horizontal scrollbar during animation */
  white-space: nowrap;
  /* Keep words on the same line */
  font-size: clamp(5rem, 9vw, 12rem);
  /* Adjusted font size */
  line-height: 1;
  /* Ensure the container is tall enough for the font */
  margin: 2rem 0;
  /* Reduced top margin to move title up */
}

.photography-second-page .photography-title .word-left {
  display: inline-block;
  transform: none;
  /* Visible by default; GSAP handles animation */
  position: relative;
  left: -0.8rem;
  /* Creates a small gap from the center */
}

.photography-second-page .photography-title .word-right {
  display: inline-block;
  transform: none;
  /* Visible by default; GSAP handles animation */
  position: relative;
  right: -0.8rem;
  /* Creates a small gap from the center */
}

/* Mobile responsive styles for the photography title */
@media (max-width: 768px) {
  .photography-second-page .photography-title {
    font-size: clamp(3.5rem, 12vw, 5rem);
    /* Smaller font size for mobile */
    text-align: center;
    /* Center the words */
  }

  .photography-second-page .photography-title .word-left,
  .photography-second-page .photography-title .word-right {
    display: block;
    /* Stack the words vertically */
    position: static;
    /* Reset positioning */
    transform: none !important;
    /* Ensure GSAP transform is overridden for layout */
  }

  .photo-gallery {
    margin-left: 0;
    margin-right: 0;
  }
}

/* Motorsport Title Split Animation */
.motorsport-second-page .motorsport-title {
  overflow: hidden;
  /* Prevent horizontal scrollbar during animation */
  white-space: nowrap;
  /* Keep words on the same line */
  font-size: clamp(5rem, 9vw, 12rem);
  /* Adjusted font size */
  line-height: 1;
  /* Ensure the container is tall enough for the font */
  margin: 2rem 0;
  /* Reduced top margin to move title up */
}

.motorsport-second-page .motorsport-title .word-left {
  display: inline-block;
  transform: none;
  /* Visible by default; GSAP handles animation */
  position: relative;
  left: -0.8rem;
  /* Creates a small gap from the center */
}

.motorsport-second-page .motorsport-title .word-right {
  display: inline-block;
  transform: none;
  /* Visible by default; GSAP handles animation */
  position: relative;
  right: -0.8rem;
  /* Creates a small gap from the center */
}

/* Mobile responsive styles for the motorsport title */
@media (max-width: 768px) {
  .motorsport-second-page .motorsport-title {
    font-size: clamp(3.5rem, 12vw, 5rem);
    /* Smaller font size for mobile */
    text-align: center;
    /* Center the words */
  }

  .motorsport-second-page .motorsport-title .word-left,
  .motorsport-second-page .motorsport-title .word-right {
    display: block;
    /* Stack the words vertically */
    position: static;
    /* Reset positioning */
    transform: none !important;
    /* Ensure GSAP transform is overridden for layout */
  }
}

/* === Motorsport Content Styles === */
.motorsport-content {
  max-width: 880px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.content-row {
  margin-bottom: 5rem;
  /* Increased vertical gap */
}

.text-row {
  text-align: center;
}

.row-title {
  font-family: "ClashGrotesk", sans-serif;
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #F5F5F5;
  margin-bottom: 1rem;
}

.row-paragraph {
  font-family: "Ubuntu", sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.75);
  max-width: 60ch;
  margin: 0 auto;
}

.image-row img {
  width: 100%;
  height: auto;
  border-radius: 1rem;
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35);
}

/* Custom glows for each image */
.image-row-1 img {
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 40px rgba(0, 170, 255, 0.25);
  /* Orange glow */
}

.image-row-2 img {
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 40px rgba(3, 38, 191, 0.25);
  /* Blue glow */
}

.image-row-3 img {
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 40px rgba(30, 135, 62, 0.3);
  /* Green glow */
}

.image-row-4 img {
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 40px rgba(220, 100, 40, 0.3);
  /* Red glow */
}

.image-row-5 img {
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35), 0 0 40px rgba(68, 43, 227, 0.25);
  /* Purple glow */
}

/* === Photo Gallery Styles === */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.5rem;
  /* Increased gap */
  padding: 6rem 0;
  margin-left: 5vw;
  margin-right: 5vw;
  /* Control zoom globally for consistency */
  --zoom-start: 1.1;
  /* slightly larger than box so no perceived shrink */
  --zoom-end: 1.6;
  /* final hover scale */
  --zoom-end-square: 1.3;
  /* More subtle zoom for 1:1 images */
}

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 15px;
  overflow: hidden;
  transition: transform 0.4s ease;
}

/* Overlay that renders original aspect ratio without cropping */
.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--img-url);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  /* preserve original aspect */
  transform: scale(var(--zoom-start));
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.35s ease;
  pointer-events: none;
  z-index: 15;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
  /* keep only fade-in on load */
}

.gallery-item:hover {
  overflow: visible;
  /* Allow the scaled overlay to overflow */
  z-index: 10;
}

/* On hover: cross-fade base image and scale overlay */
.gallery-item:hover::after {
  opacity: 1;
  transform: scale(var(--zoom-end));
}

/* Use the more subtle zoom for square images */
.gallery-item.is-square:hover::after {
  transform: scale(var(--zoom-end-square));
}

.gallery-item:hover img {
  opacity: 0;
  /* fade base cover image out so no visual conflict */
}

.gallery-item img.is-loaded {
  opacity: 1;
}

@media (min-width: 768px) {
  .photo-gallery {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* iPad portrait: use 3 columns for better density */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .photo-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}