/* Template Style Customizations */
.section {
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.title.is-3 {
  background: #eeeeeea2;
  padding: 3%;
}
a {
  color: #66b7c0;
}
.footer {
  background-color: #7cd8d742;
}
/* End Template Style Customizations */

/* FIT Teaser */
.teaser-image {
  display: block;
  margin: 0 auto;
  width: 90vw;
  max-width: 1100px;
  height: auto;
}
/* End FIT Teaser */

/* Dataset Comparison Table*/
.table-wrapper {
  width: 70%;
  margin: 2rem auto; /* Centers horizontally and adds vertical spacing */
}

/* Optional: Ensure it expands to 90% or 100% on small mobile screens */
@media (max-width: 768px) {
  .table-wrapper {
    width: 95%;
  }
}
/* End Dataset Comparison Table*/

/* VTO Demo (NEW) */
.triplet-slider-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

.triplet-viewport {
  overflow: hidden; /* This hides Example 2 while Example 1 is visible */
  width: 100%;
  position: relative;
}

.triplet-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
  width: 100%; /* The track grows based on children */
}

.triplet-set {
  /* This ensures each example takes up EXACTLY the full width of the viewport */
  flex: 0 0 100%; 
  width: 100%;
  
  display: grid;
  grid-template-columns: 0.75fr 1fr;
  gap: 15px;
  align-items: stretch;
  box-sizing: border-box; /* Prevents padding from adding to width */

  justify-content: center;
}

/* The Right Image Anchor */
.triplet-result {
  height: 100%;
  justify-self: start;
}

/* The Images */
.triplet-result img {
  width: 100%;
  height: 100%; /* Forces the image to fill its grid slot */
  max-height: 500px;
  max-width: 384px;
  /* 'cover' ensures the image fills the box. 'contain' will leave gaps. */
  object-fit: contain; 
  background-color: #f9f9f9;
  border-radius: 8px;
  display: block;
}

/* Force the inputs to match that exact height */
.triplet-inputs {
  display: grid;
  grid-template-rows: 1.5fr 1fr; 
  gap: 10px;
  /* This ensures the grid is exactly the height of the .triplet-set row */
  height: 100%; 
  /* Crucial: prevents the grid from expanding past the parent */
  max-height: 500px; 
  justify-self: end;
}

/* Ensure the image wrappers fill the grid slots */
.input-upper {
  height: 100%;
  width: 100%;
  min-height: 0; /* Important: allows grid items to shrink/fit */
}

.input-lower {
  height: 100%;
  width: 100%;
  min-height: 0; /* Important: allows grid items to shrink/fit */
  overflow: hidden; /* Safety net for the crop */
  border-radius: 8px; /* Move the radius here if the image crop hides it */
}

.triplet-inputs img {
  width: 100%;
  height: 100%; 
  object-fit: contain; 
  background-color: #f9f9f9;
  border-radius: 8px;
  display: block;
}

.input-lower img {
  /* This crops the image to fill the 1fr grid space */
  object-fit: cover;
}

@media (max-width: 768px) {
  .triplet-set {
    grid-template-columns: 1fr; /* Stack on mobile */
  }
  .triplet-inputs {
    grid-template-columns: 1fr 1fr; /* Side-by-side inputs on mobile */
    grid-template-rows: auto;
  }
}
/* End VTO Demo (NEW) */

/* VTO Demo */
/* 1. Force Horizontal Layout */
.columns.is-mobile {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important; /* Prevents stacking */
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* 2. Grid Definitions */
.garment-grid, .person-grid {
  display: grid;
  grid-template-columns: repeat(3, 100px); /* Consistent width */
  gap: 8px;
  justify-content: center;
}

/* 3. Thumbnail Styling (Consolidated) */
.thumb {
  width: 100px; 
  height: 125px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  display: block;
}

.thumb:hover {
  border-color: #eee;
}

.thumb.is-active {
  border-color: #7cd8d7;
  box-shadow: 0 0 8px rgba(0, 209, 178, 0.3);
}

/* 4. Column Sizing */
.column.is-narrow {
  flex: 0 0 auto; /* Prevents side columns from shrinking */
}

.main-display-column {
  flex: 0 1 auto;
  min-width: 300px; /* Ensures center image stays visible */
  max-width: 500px;
}

/* 5. Odd Number Centering */
.garment-grid .image-container:last-child:nth-child(odd),
.person-grid .image-container:last-child:nth-child(odd) {
  grid-column: span 2;
  justify-self: center;
}

.image-container {
  margin: 0 !important;
}
/* End VTO Demo */


/* Resizing Demo */
/* 1. Turn the scroll box into a 2-column grid */
.vertical-scroll-box {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr; /* Two equal columns */
  gap: 10px;
  /*max-height: 550px;*/ /* Match the 500px result image + some padding */
  overflow-y: auto;
  padding-right: 10px; /* Space for the scrollbar */
  width: 400px; /* Adjust this to control how wide the sidebar is */
}

/* 2. Ensure the figure doesn't have extra margins */
.vertical-scroll-box .image-container {
  margin: 0 !important;
  padding: 0;
  cursor: pointer;
  text-align: center;
}

/* 3. Style the thumbnails to fit the new smaller width */
.vertical-scroll-box .garment-thumb {
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  display: block;
}

/* 4. Active state for the currently selected person */
.vertical-scroll-box .image-container.is-active img {
  border-color: #7cd8d7; /* Bulma Turquoise */
  box-shadow: 0 0 8px rgba(124, 216, 215, 0.5);
}

/* 5. Custom scrollbar for a cleaner look */
.vertical-scroll-box::-webkit-scrollbar {
  width: 6px;
}
.vertical-scroll-box::-webkit-scrollbar-thumb {
  background: #eee;
  border-radius: 10px;
}

/* Style the tick labels to span the width of the slider */
#size-settings {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 5px; /* Adjust this to match your slider's thumb offset */
}

#size-settings option {
  padding: 0;
  font-size: 0.75rem;
  color: #4a4a4a;
  font-weight: 600;
  /* Ensure the text centers under the tick mark */
  display: flex;
  justify-content: center;
  width: 1px; 
  white-space: nowrap;
}

/* Optional: Customize the slider color to match Nerfies */
input[type=range] {
  accent-color: #7cd8d7;
}

.size-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 10px;
}

.size-labels-container {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 5px;
  margin-top: 8px;
}

.size-labels-container span {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4a4a4a;
  transition: opacity 0.3s ease;
  width: 30px;
  text-align: center;
}

/* This will now definitely work because spans are standard elements */
.is-unavailable {
  opacity: 1.00 !important;
  color: #ccc !important;
}

/* End Resizing Demo*/

/* Browse Dataset */
.dataset-grid {
  display: flex;
  flex-flow: column wrap; /* Stack in columns, then wrap to the right */
  align-content: flex-start;

  /* Calculate height: (4 rows * 150px) + (3 gaps * 15px) = 645px */
  height: 700px; 
  
  overflow-x: auto; /* Enable horizontal scroll */
  overflow-y: hidden; /* Disable vertical scroll */
  padding: 20px;
  gap: 15px;
  
  /* Custom scrollbar styling for a cleaner look */
  scrollbar-width: thin;
  scrollbar-color: #7cd8d7 #f5f5f5;
}

/* For Chrome/Safari scrollbar */
.dataset-grid::-webkit-scrollbar {
  height: 8px;
}
.dataset-grid::-webkit-scrollbar-thumb {
  background: #7cd8d7;
  border-radius: 10px;
}

/* Ensure the grid item is the reference point for absolute positioning */
.grid-item {
  position: relative;
  flex: 0 0 200px; /* Do not grow, do not shrink, stay at 200px */
  width: 150px;
  height: 200px;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensures the image fills the 150x150 square */
  display: block;    /* Removes bottom whitespace ghosting */
}

/* Expansion state */
.grid-item.is-expanded {
  /* To keep it within 4 rows, don't exceed 600px */
  width: 450px; 
  height: 600px;
  flex: 0 0 600px;
}

/* Container for the two small images */
.extra-assets {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column; /* Stack them vertically */
  gap: 5px;
  opacity: 0; /* Hidden by default */
  transition: opacity 0.3s ease;
  z-index: 5;
}

/* Style for the small overlay images */
.asset-img {
  width: 100px !important;  /* Small size */
  object-fit: cover;
  border: 2px solid white;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Specific styling for the garment (square) */
.garment-asset {
  height: 100px !important;
}

/* Specific styling for the triplet (tall) */
.triplet-asset {
  /* This makes it 1.5x taller than it is wide (150px tall) */
  height: 150px !important; 
}

/* ONLY show the assets when expanded */
.grid-item.is-expanded .extra-assets {
  opacity: 1;
}

/* Ensure the main image still fills the background */
.main-sample {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Container for the measurements */
.measurements-list {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.358); /* Dark semi-transparent background */
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.7rem;
  text-align: left;
  line-height: 1.4;
  opacity: 0; /* Hidden by default */
  transition: opacity 0.3s ease;
  z-index: 5;
  pointer-events: none; /* Allows clicks to pass through to the image if needed */
}
.measure-header {
  text-align: center;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  color: #7cd8d7; /* Using your signature turquoise */
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.2);
  width: 100%; /* Ensures it centers relative to the whole box */
}

/* Individual lines */
.measure-item {
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 0;
}

.measure-item:last-child {
  border-bottom: none;
}

/* ONLY show when the grid item is expanded */
.grid-item.is-expanded .measurements-list {
  opacity: 1;
}

/* Base state for the grid item */
.grid-item {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: 2px solid transparent; /* Prevents layout "jump" when border appears */
}

/* Hover effects */
.grid-item:hover {
  transform: translateY(-5px); /* Subtle lift effect */
  border-color: #7cd8d7; /* Bulma's primary turquoise */
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
  z-index: 2; /* Ensures the hover shadow sits above neighbors */
}

/* Zoom the image slightly on hover */
.grid-item:hover .main-sample {
}

/* Ensure the main image transitions smoothly */
.main-sample {
  transition: transform 0.5s ease, filter 0.5s ease;
}

/* Optional: Add a "Click to Expand" icon that appears ONLY on hover */
.grid-item::after {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.grid-item:hover::after {
  opacity: 1;
}

/* Disable hover effects when already expanded */
.grid-item.is-expanded:hover {
  transform: none;
  border-color: transparent;
}

.fit-scale-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: 1250px; /* Match your grid's max-width */
  margin: 0 auto;
  margin-left: 6%;
  padding: 5 5px;
  padding-bottom: 10px;
}

.fit-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #7cd8d7;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.fit-arrow-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex-grow: 1; /* Makes the arrow stretch between labels */
}

.fit-center-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%); /* Centers it perfectly */
  
  /* Styling */
  background-color: #fdfdfd; /* Match your page/container background */
  padding: 0 10px;           /* Creates space so the line doesn't touch the text */
  font-size: 0.9rem;
  font-weight: 500;
  color: #7cd8d7;            /* Matches your arrow color */
  letter-spacing: 0.5px;
  white-space: nowrap;
  z-index: 2;                /* Sits on top of the line */
}

.fit-line {
  height: 2px;
  background: linear-gradient(to right, #7cd8d7, #5bbdbb); /* Your turquoise theme */
  width: 100%;
  border-radius: 2px;
}

.fit-arrow-head {
  position: absolute;
  right: -2px;
  color: #5bbdbb;
  font-size: 1.2rem;
}

.person-scale-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 80px; /* Match the margin-left of the top scale */
  padding: 20px 0;
  /* Match this to the height of your dataset-grid */
  height: 700px; 
}

.person-arrow-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin: 10px 0;
}

.person-arrow-head {
  color: #7cd8d7;
  font-size: 1.1rem;
  line-height: 1; /* Prevents extra spacing around the icon */
  margin-top: -5px; /* Pulls the arrow head up to 'swallow' the end of the line */
  display: block;
}

.person-line {
  width: 2px;
  background: #7cd8d7;
  height: 100%;
  margin-bottom: -2px; /* Slight overlap to ensure no gap is visible */
}

.person-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); /* Perfectly centered on the line */
  
  /* Text Rotation */
  writing-mode: vertical-rl;
  transform: translate(-50%, -50%) rotate(180deg); /* Centers AND rotates */
  
  /* Styling to match the top arrow */
  background-color: #fdfdfd; /* Match your background to "cut" the line */
  padding: 10px 0;           /* Vertical padding creates the gap in the line */
  font-size: 0.9rem;
  font-weight: 500;
  color: #7cd8d7;
  letter-spacing: 0.5px;
  white-space: nowrap;
  z-index: 2;
}

.person-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #7cd8d7;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* End Browse Dataset */

/* SOTA Comparisons */
.comparison-slider-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 10px;
  width: 100%;
  max-width: 100%;
}

.slider-viewport {
  overflow: hidden;
  flex-grow: 1; /* Forces the viewport to take up all available space between arrows */
  width: 100%;
}

.slider-track {
  display: flex;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.comparison-set {
  display: grid;
  /* 8 columns: Sidebar(0.6), Inputs(INCREASED to 1.2), 6 Results(1.0 each) */
  grid-template-columns: 0.6fr 0.85fr repeat(6, 1fr);
  grid-template-rows: auto auto; 
  min-width: 100%;
  gap: 5px 5px;
  padding: 20px 10px;
  align-items: stretch;
}

/* Allow children to participate in the grid */
.input-media-item, .comparison-item {
  display: contents;
}

.comparison-item img {
  grid-row: 1; /* Match the sidebar row */
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  aspect-ratio: 3 / 4;
  display: block;
  min-height: 0px;
}

/* Row 1: The Stacked Inputs and the Results */
.input-stack {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  /* Top image gets 2 parts of space, bottom gets 1 part */
  grid-template-rows: 2fr 1fr; 
  gap: 5px;
  height: 100%;
  max-height: 300px; /* Limits the total height of the stack */
  overflow: hidden; /* Prevents children from pushing the box larger */
}

/* Person Input Image */
.input-img-tall, .input-img-square {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #f0f0f0;
  border-radius: 4px;
  /* Forces the image to respect the grid row height instead of its own natural height */
  min-height: 0; 
}

/* --- Row 2: The Subtitles --- */
.input-media-item .subtitle, 
.comparison-item .subtitle {
  grid-row: 2;
  text-align: center;
  margin: 0 !important;
  padding-top: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- COLUMN MAPPING FIX --- */
.input-media-item .subtitle { grid-column: 2; }

/* We target the nth comparison-item and lock them to columns 3 through 8 */
.comparison-item:nth-of-type(3) img, .comparison-item:nth-of-type(3) .subtitle { grid-column: 3; }
.comparison-item:nth-of-type(4) img, .comparison-item:nth-of-type(4) .subtitle { grid-column: 4; }
.comparison-item:nth-of-type(5) img, .comparison-item:nth-of-type(5) .subtitle { grid-column: 5; }
.comparison-item:nth-of-type(6) img, .comparison-item:nth-of-type(6) .subtitle { grid-column: 6; }
.comparison-item:nth-of-type(7) img, .comparison-item:nth-of-type(7) .subtitle { grid-column: 7; }
.comparison-item:nth-of-type(8) img, .comparison-item:nth-of-type(8) .subtitle { grid-column: 8; }

/* Optional: Make your method stand out */
.ours-highlight {
  outline: 2px solid #00d1b2;
  outline-offset: 2px;
}

/* Arrow adjustments for wide layouts */
.slider-arrow {
  background: none;
  color: #333;
  border: none;
  font-size: 2.5rem;
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s;
}

.slider-arrow:hover { color: #00d1b2; }

/* Sidebar: Force it to stay ONLY in the top row */
.comparison-meta {
  grid-row: 1; 
  background-color: #7cd8d742;
  border-right: 1px solid #eee;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  max-height: 300px;
}
.comparison-meta, .input-stack, .comparison-item img {
  grid-row: 1;
}

.meta-content {
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

.meta-coarse {
  font-weight: bold;
  font-size: 0.85rem;
  line-height: 1.2;
  margin-bottom: 12px;
  text-transform: uppercase;
  color: #333;
  margin: 1em;
}

.meta-precise {
  display: flex;
  flex-direction: column; /* Stacked one above the other */
  gap: 2px;
  font-size: 0.7rem;
  color: #7a7a7a;
  margin: 1em;
}

.meta-precise span {
  white-space: nowrap;
}

/* End SOTA Comparisons */

/* SOTA Comparisons #2 */
/* 1. Define the 7-column grid structure */
.comparison-set.comparison-set-no-meta {
  grid-template-columns: 0.8fr repeat(6, 1fr) !important;
}

/* 2. Map the Input Column to Column 1 */
.comparison-set.comparison-set-no-meta .input-media-item .input-stack,
.comparison-set.comparison-set-no-meta .input-media-item .subtitle {
  grid-column: 1 !important;
}

/* 3. Map the 6 result items to Columns 2 through 7 */
.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(1) img, 
.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(1) .subtitle { grid-column: 1 !important; }

.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(2) img, 
.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(2) .subtitle { grid-column: 2 !important; }

.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(3) img, 
.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(3) .subtitle { grid-column: 3 !important; }

.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(4) img, 
.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(4) .subtitle { grid-column: 4 !important; }

.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(5) img, 
.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(5) .subtitle { grid-column: 5 !important; }

.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(6) img, 
.comparison-set.comparison-set-no-meta .comparison-item:nth-of-type(6) .subtitle { grid-column: 6 !important; }
/* End SOTA Comparisons #2 */

body {
  font-family: 'Noto Sans', sans-serif;
}

/* Hide mobile-only range controls by default; show them only in mobile media queries */
.comparison-range {
  display: none !important;
}


.footer .icon-link {
    font-size: 25px;
    color: #000;
}

.link-block a {
    margin-top: 5px;
    margin-bottom: 5px;
}

.dnerf {
  font-variant: small-caps;
}


.teaser .hero-body {
  padding-top: 0;
  padding-bottom: 3rem;
}

.teaser {
  font-family: 'Google Sans', sans-serif;
}


.publication-title {
}

.publication-banner {
  max-height: parent;

}

.publication-banner video {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  object-fit: fit;
}

.publication-header .hero-body {
}

.publication-title {
    font-family: 'Google Sans', sans-serif;
}

.publication-authors {
    font-family: 'Google Sans', sans-serif;
}

.publication-venue {
    color: #555;
    width: fit-content;
    font-weight: bold;
}

.publication-awards {
    color: #ff3860;
    width: fit-content;
    font-weight: bolder;
}

.publication-authors {
}

.publication-authors a {
   color: #66b7c0; !important;
}

.publication-authors a:hover {
    text-decoration: underline;
}

.author-block {
  display: inline-block;
}

.publication-banner img {
}

.publication-authors {
  /*color: #4286f4;*/
}

.publication-video {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;

    overflow: hidden;
    border-radius: 10px !important;
}

.publication-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.publication-body img {
}

.results-carousel {
  overflow: hidden;
}

.results-carousel .item {
  margin: 5px;
  overflow: hidden;
  border: 1px solid #bbb;
  border-radius: 10px;
  padding: 0;
  font-size: 0;
}

.results-carousel video {
  margin: 0;
}


.interpolation-panel {
  background: #f5f5f5;
  border-radius: 10px;
}

.interpolation-panel .interpolation-image {
  width: 100%;
  border-radius: 5px;
}

.interpolation-video-column {
}

.interpolation-panel .slider {
  margin: 0 !important;
}

.interpolation-panel .slider {
  margin: 0 !important;
}

#interpolation-image-wrapper {
  width: 100%;
}
#interpolation-image-wrapper img {
  border-radius: 5px;
}



/* Detect and adapt to small screens */
@media (max-width: 768px) {
  /* 1. Make the section use the full mobile width */
  .container.is-fluid {
    width: 100% !important;
    padding: 0 5px !important;
  }
  .columns.is-mobile {
    flex-direction: column !important;
    align-items: center !important;
  }

  /* 2. Make the center result images fit the screen width */
  .main-display-column, 
  .main-display img, 
  #result-image, 
  #slider-result-image {
    width: 100% !important;
    max-width: 90vw !important;
    height: auto !important;
  }

  /* 3. Adjust the selection grids for mobile */
  .garment-grid, .person-grid {
    grid-template-columns: repeat(4, 1fr); /* 4 small thumbs per row instead of 2 */
    gap: 10px;
    margin-bottom: 20px;
  }

  .vertical-scroll-box {
    display: flex; /* Change from vertical stack to horizontal for the Resizing Demo */
    flex-direction: row;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
  }

  /* 4. Ensure the slider fits the screen */
  #size-slider {
    width: 80vw !important;
  }

  .size-labels-container {
    width: 80vw !important;
    margin: 0 auto;
  }

  /* 2. Change the 8-column grid to a 2-column mobile grid */
  .comparison-set {
    grid-template-columns: 1fr 1.5fr; /* Sidebar and Inputs side-by-side */
    grid-template-rows: auto auto auto; /* Results will wrap below */
    gap: 15px 10px;
    padding: 10px;
  }

  /* 3. Allow the result images to wrap to the next line */
  .comparison-item {
    display: flex;
    flex-direction: column;
    /* Force result images into a 2-column layout on mobile */
    grid-column: span 1 !important; 
    grid-row: auto !important;
  }

  /* 4. Reset the explicit column mapping so it doesn't break mobile */
  .comparison-meta, .input-media-item, .comparison-item {
    grid-column: auto !important;
    grid-row: auto !important;
  }

  /* Hide "inputs" label */
  .input-media-item .subtitle {
    display: none !important;
  }

  /* 5. Make images smaller so they fit 2-across */
  .comparison-item img {
    max-height: 250px;
    aspect-ratio: 3/4;
  }
  
  /* 6. Fix the 'skinny' issue on mobile by ensuring viewport isn't wider than screen */
  body, html {
    overflow-x: hidden;
    position: relative;
  }
}
/* Extra fixes for small phones to avoid SOTA comparison items collapsing/overlapping */
@media (max-width: 480px) {
  /* Make the comparison track horizontally scrollable like desktop, with a draggable range control */
  .slider-viewport {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .slider-track {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
    align-items: flex-start !important;
    transition: none !important; /* disable transform-based desktop animation on mobile */
  }

  /* Give each comparison-set a large minimum width so its internal grid doesn't collapse */
  .comparison-set {
    flex: 0 0 auto !important;
    min-width: 900px !important;
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: 0.6fr 0.85fr repeat(6, 1fr) !important;
    gap: 5px 5px !important;
    padding: 12px !important;
    align-items: stretch !important;
  }

  /* Ensure images inside each set keep their intended sizes */
  .comparison-item img {
    width: 100% !important;
    height: auto !important;
    max-height: 320px !important;
    object-fit: cover !important;
  }

  /* Keep input stack behaved as grid inside each large comparison-set */
  .input-stack {
    max-height: 320px !important;
    overflow: hidden !important;
  }

  /* Style for the mobile range input */
  .comparison-range {
    width: 90%;
    max-width: 520px;
    margin: 8px auto 0 auto;
    display: block;
  }

  /* Restore the "Inputs" subtitle on very small screens */
  .input-media-item .subtitle {
    display: block !important;
    font-size: 0.75rem !important;
    padding-top: 6px !important;
    text-align: center !important;
    white-space: normal !important;
  }

  /* Hide left/right arrows for SOTA comparisons on very small screens */
  .comparison-slider-wrapper .slider-arrow {
    display: none !important;
  }

}
/* */