@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
@font-face {
  font-family: "Charter";
  font-style: normal;
  font-weight: normal;
  src: url("../assets/fonts/Charter/charter_regular.woff2") format("woff2");
}
@font-face {
  font-family: "Charter";
  font-style: italic;
  font-weight: normal;
  src: url("../assets/fonts/Charter/charter_italic.woff2") format("woff2");
}
@font-face {
  font-family: "Charter";
  font-style: normal;
  font-weight: bold;
  src: url("../assets/fonts/Charter/charter_bold.woff2") format("woff2");
}
@font-face {
  font-family: "Charter";
  font-style: italic;
  font-weight: bold;
  src: url("../assets/fonts/Charter/charter_bold_italic.woff2") format("woff2");
}

/* ======================== Grid System ===================== */
.columns-12 { display: grid; column-gap: 2vw; grid-template-columns: repeat(12, 1fr); }
.columns-10 { display: grid; column-gap: 2vw; grid-template-columns: repeat(10, 1fr); }
.columns-8 { display: grid; column-gap: 2vw; grid-template-columns: repeat(8, 1fr); }
.columns-6 { display: grid; column-gap: 2vw; grid-template-columns: repeat(6, 1fr); }
.columns-5 { display: grid; column-gap: 2vw; grid-template-columns: repeat(5, 1fr); }
.columns-4 { display: grid; column-gap: 2vw; grid-template-columns: repeat(4, 1fr); }
.columns-3 { display: grid; column-gap: 2vw; grid-template-columns: repeat(3, 1fr); }
.columns-2 { display: grid; column-gap: 2vw; grid-template-columns: repeat(2, 1fr); }

@media screen and (max-width: 992px) {
  .columns-12 { grid-template-columns: repeat(6, 1fr); }
  .columns-10 { grid-template-columns: repeat(5, 1fr); }
  .columns-8 { grid-template-columns: repeat(4, 1fr); }
  .columns-6 { grid-template-columns: repeat(3, 1fr); }
  .columns-5 { grid-template-columns: repeat(3, 1fr); }
}
@media screen and (max-width: 769px) {
  .columns-12 { grid-template-columns: repeat(3, 1fr); }
  .columns-2 { grid-template-columns: repeat(1, 1fr); }
}

/* ======================== Author Links ===================== */
.author-link {
  color: #2a7ab8;
  text-decoration: underline;
  text-decoration-color: rgba(42, 122, 184, 0.4);
  text-underline-offset: 3px;
  transition: all 0.2s ease;
}
.author-link:hover {
  color: #1d5a8a;
  text-decoration-color: rgba(42, 122, 184, 0.8);
}

.author-affiliation {
  font-size: 0.92em;
  color: #555;
  margin-top: 4px;
}
.author-affiliation sup {
  color: #2a7ab8;
  font-weight: 600;
}

/* ======================== Title ===================== */
.kiwi-title {
  margin: 30px 0;
  text-align: center;
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 4.8vw, 3.4rem);
  line-height: 1.22;
}

.kiwi-title-inline {
  display: inline;
}

.kiwi-title-head {
  white-space: nowrap;
}

.kiwi-title-logo {
  height: 0.75em;
  width: auto;
  margin-right: 0.15em;
  vertical-align: -0.12em;
  display: inline-block;
}

/* ======================== Feature Cards ===================== */
.feature-cards {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin: 30px 0 10px 0;
}

.feature-card {
  flex: 1 1 0;
  min-width: 180px;
  max-width: 280px;
  border-radius: 14px;
  box-shadow: 0px 4px 16px 0px rgba(28, 33, 46, 0.09);
  padding: 28px 22px;
  background: #fff;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0px 6px 24px 0px rgba(28, 33, 46, 0.14);
}

.feature-card .card-icon {
  font-size: 2.2em;
  margin-bottom: 12px;
  display: block;
}

.feature-card h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 0.95em;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #1c212e;
}

.feature-card p {
  font-family: 'Charter', serif;
  font-size: 0.82em;
  color: #555;
  line-height: 1.5;
  margin: 0;
}

/* Gradient card backgrounds */
.feature-card.gradient-blue {
  background: linear-gradient(135deg, #e8f4fd 0%, #f0f7ff 100%);
  border: 1px solid rgba(42, 122, 184, 0.1);
}
.feature-card.gradient-green {
  background: linear-gradient(135deg, #e8fdf0 0%, #f0fff5 100%);
  border: 1px solid rgba(34, 160, 83, 0.1);
}
.feature-card.gradient-purple {
  background: linear-gradient(135deg, #f0e8fd 0%, #f5f0ff 100%);
  border: 1px solid rgba(120, 66, 184, 0.1);
}
.feature-card.gradient-orange {
  background: linear-gradient(135deg, #fdf2e8 0%, #fff8f0 100%);
  border: 1px solid rgba(200, 120, 40, 0.1);
}

@media screen and (max-width: 900px) {
  .feature-cards { gap: 16px; }
  .feature-card { min-width: 140px; padding: 20px 16px; }
  .feature-card h3 { font-size: 0.88em; }
}
@media screen and (max-width: 600px) {
  .feature-cards { flex-direction: column; align-items: center; }
  .feature-card { max-width: 100%; width: 100%; }
}

/* ======================== Gallery Tabs ===================== */
.gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.gallery-tab {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 20px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.82em;
  font-weight: 500;
  color: #555;
  background: #f0f1f3;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.gallery-tab:hover {
  background: #e4e6ea;
  color: #333;
}
.gallery-tab.active {
  background: #2a7ab8;
  color: #fff;
  border-color: #2a7ab8;
}

.gallery-content {
  display: none;
}
.gallery-content.active {
  display: block;
}

/* ======================== Video Grid ===================== */
.video-grid {
  --carousel-card-width: min(94%, 1300px);
  display: flex;
  gap: 20px;
  margin: 0 0 16px 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.video-grid::-webkit-scrollbar {
  display: none;
}

.video-edge-spacer {
  flex: 0 0 0;
  pointer-events: none;
}

.video-row {
  position: relative;
  width: 100%;
  margin: 0 auto;
}

.video-nav {
  position: absolute;
  top: calc(50% - 20px);
  z-index: 5;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.video-nav.prev {
  left: -14px;
}

.video-nav.next {
  right: -14px;
}

.video-item {
  flex: 0 0 auto;
  width: var(--carousel-card-width);
  scroll-snap-align: center;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0px 2px 12px 0px rgba(28, 33, 46, 0.07);
  transition: box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.video-item:hover {
  box-shadow: 0px 4px 20px 0px rgba(28, 33, 46, 0.12);
}

.video-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.video-pair video,
.video-pair img {
  width: 100%;
  display: block;
  vertical-align: top;
}

.video-pair .pair-label {
  font-family: 'Poppins', sans-serif;
  font-size: 0.7em;
  font-weight: 500;
  text-align: center;
  padding: 4px 0;
  color: #888;
  background: rgba(0,0,0,0.03);
}

.slider-container.video-comparison {
  display: inline-block;
  box-shadow: none;
  outline: none;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(62vh, 520px);
  --divider-width: 1px;
  --divider-color: #ffffff;
  --default-handle-width: clamp(16px, 5vw, 36px);
  --default-handle-color: #ffffff;
}

.slider-container.video-comparison .before,
.slider-container.video-comparison .after {
  margin: 0;
  position: relative;
}

.slider-container.video-comparison video,
.slider-container.video-comparison img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(62vh, 520px);
  object-fit: contain;
  display: block;
  margin: 0 auto;
  vertical-align: top;
}

.video-comparison-wrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
}

.video-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.65);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 6;
}

.video-comparison-wrap.is-loading .video-loading-overlay {
  opacity: 1;
  visibility: visible;
}

.video-loading-spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid rgba(42, 122, 184, 0.2);
  border-top-color: #2a7ab8;
  animation: kiwi-spin 0.9s linear infinite;
}

.video-loading-text {
  font-family: 'Poppins', sans-serif;
  font-size: 0.74em;
  color: #2a7ab8;
  font-weight: 500;
}

@keyframes kiwi-spin {
  to {
    transform: rotate(360deg);
  }
}

.comparison-legend {
  position: absolute;
  top: 10px;
  padding: 4px 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.72em;
  font-weight: 500;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  pointer-events: none;
  z-index: 4;
  max-width: calc(50% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comparison-legend.left {
  left: 10px;
}

.comparison-legend.right {
  right: 10px;
}

.video-item .edit-caption {
  padding: 10px 14px;
  font-family: 'Charter', serif;
  font-size: 0.82em;
  color: #444;
  line-height: 1.45;
  text-align: center;
  border-top: 1px solid #f0f0f0;
}

/* ======================== Triple/Quad Grid for Ref+Instruction tasks ===================== */
.video-triple {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
}
.video-triple video,
.video-triple img {
  width: 100%;
  display: block;
  vertical-align: top;
}

.reference-compare {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(0, 1.8fr);
  gap: 0;
  align-items: center;
}

.reference-compare-ref {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reference-media-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reference-media-wrap img,
.reference-media-wrap video {
  width: 80%;
  max-width: 80%;
  height: min(62vh, 520px);
  max-height: min(62vh, 520px);
  object-fit: contain;
  display: block;
}

.reference-compare-slider {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reference-compare-slider .video-comparison-wrap {
  width: 100%;
}

.reference-compare-slider .slider-container.video-comparison {
  width: 100%;
}

.video-quad {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0;
}
.video-quad video,
.video-quad img {
  width: 100%;
  display: block;
  vertical-align: top;
}

/* ======================== Comparison Section ===================== */
.comparison-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  align-items: start;
}

.comparison-row.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.comparison-cell {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0px 2px 10px 0px rgba(28, 33, 46, 0.06);
}

.comparison-cell video,
.comparison-cell img {
  width: 100%;
  display: block;
}

.comparison-cell .method-label {
  font-family: 'Poppins', sans-serif;
  font-size: 0.75em;
  font-weight: 600;
  text-align: center;
  padding: 6px 0;
  color: #666;
  background: #f8f9fa;
}

.comparison-cell .method-label.ours {
  color: #2a7ab8;
  background: #e8f4fd;
}

.comparison-caption {
  font-family: 'Charter', serif;
  font-size: 0.82em;
  color: #666;
  text-align: center;
  padding: 8px 0 0 0;
  margin-bottom: 24px;
}

@media screen and (max-width: 900px) {
  .comparison-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .comparison-row.three-col { grid-template-columns: repeat(2, 1fr); }
  .video-grid { --carousel-card-width: min(92%, 980px); }
  .video-grid { gap: 18px; }
  .reference-compare {
    grid-template-columns: minmax(200px, 1.1fr) minmax(0, 1.9fr);
  }
  .video-nav.prev { left: -8px; }
  .video-nav.next { right: -8px; }
}
@media screen and (max-width: 600px) {
  .comparison-row { grid-template-columns: 1fr; }
  .comparison-row.three-col { grid-template-columns: 1fr; }
  .video-grid { --carousel-card-width: 92%; }
  .video-grid { gap: 14px; }
  .video-nav {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }
  .video-nav.prev { left: -4px; }
  .video-nav.next { right: -4px; }
  .reference-compare {
    grid-template-columns: 1fr;
  }
  .reference-media-wrap img,
  .reference-media-wrap video {
    height: auto;
    max-height: 40vh;
    object-fit: contain;
  }
  .slider-container.video-comparison,
  .slider-container.video-comparison video,
  .slider-container.video-comparison img {
    max-height: 52vh;
  }
  .video-pair { grid-template-columns: 1fr 1fr; }
  .gallery-tab { padding: 6px 12px; font-size: 0.75em; }
}

/* ======================== Rounded Shadow Video ===================== */
.rounded-shadow-video {
  border-radius: 12px;
  box-shadow: 0px 4px 20px 0px rgba(28, 33, 46, 0.09);
  overflow: hidden;
  vertical-align: top;
}

.rounded-shadow-video video,
.rounded-shadow-video img {
  width: 100%;
  display: block;
}

/* ======================== Results Table ===================== */
.results-table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
}

.results-table-wrapper.wide {
  width: 60vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin: 16px 0;
}

.results-table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

.results-table-wrapper th {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.82em;
  padding: 10px 12px;
  background: #f0f1f3;
  text-align: center;
  border-bottom: 2px solid #ddd;
}

.results-table-wrapper td {
  font-family: 'Charter', serif;
  font-size: 0.85em;
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

.results-table-wrapper tr:nth-child(odd) td {
  background: #fafbfc;
}

.results-table-wrapper tr[style*="background-color:#E6F2FF"] td,
.results-table-wrapper tr[style*="background-color: #E6F2FF"] td {
  background-color: #E6F2FF !important;
  border-bottom-color: #d7e7f8;
}

.results-table-wrapper .best {
  font-weight: bold;
  color: #2a7ab8;
}

.results-table-wrapper .second-best {
  text-decoration: underline;
  text-decoration-color: rgba(42, 122, 184, 0.4);
  text-underline-offset: 2px;
}

/* ======================== Section Divider ===================== */
.section-divider {
  width: 60px;
  height: 3px;
  background: #2a7ab8;
  border-radius: 2px;
  margin: 0 auto 24px auto;
}

/* ======================== Pipeline/Method Figure ===================== */
.method-figure {
  margin: 20px 0;
  text-align: center;
}
.method-figure img {
  max-width: 100%;
  border-radius: 8px;
}

/* ======================== Reference Image + Instruction Editing Task ===================== */
.ref-instruction-item {
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0px 2px 12px 0px rgba(28, 33, 46, 0.07);
  transition: box-shadow 0.2s ease;
}
.ref-instruction-item:hover {
  box-shadow: 0px 4px 20px 0px rgba(28, 33, 46, 0.12);
}

.ref-instruction-visuals {
  display: grid;
  grid-template-columns: 1fr 2fr 2fr;
  gap: 0;
}
.ref-instruction-visuals video,
.ref-instruction-visuals img {
  width: 100%;
  display: block;
  vertical-align: top;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.ref-instruction-visuals .ref-label-row {
  display: grid;
  grid-template-columns: 1fr 2fr 2fr;
}

.ref-label-row .pair-label {
  font-family: 'Poppins', sans-serif;
  font-size: 0.7em;
  font-weight: 500;
  text-align: center;
  padding: 4px 0;
  color: #888;
  background: rgba(0,0,0,0.03);
}

.ref-instruction-item .edit-caption {
  padding: 10px 14px;
  font-family: 'Charter', serif;
  font-size: 0.82em;
  color: #444;
  line-height: 1.45;
  border-top: 1px solid #f0f0f0;
}

/* ======================== Contribution List ===================== */
.contribution-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.contribution-list li {
  position: relative;
  padding: 6px 0 6px 24px;
  font-family: 'Charter', serif;
  font-size: 0.95em;
  line-height: 1.6;
  color: #333;
}

.contribution-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2a7ab8;
}

/* ======================== Full Content Width ===================== */
.container {
  width: min(60vw, 1500px);
  margin-left: auto;
  margin-right: auto;
  padding-left: 0;
  padding-right: 0;
}

div.container.blog#first-content {
  position: relative;
  z-index: 0;
}

div.container.blog#first-content::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: inherit;
  z-index: -1;
  pointer-events: none;
}

div.container.blog.main,
div.container.blog.large,
div.container.blog.extra-large,
div.container.blog.extra-extra-large {
  padding-left: 0;
  padding-right: 0;
}

@media screen and (max-width: 900px) {
  .container {
    width: 92vw;
  }
}

@media screen and (max-width: 600px) {
  .container {
    width: 94vw;
  }
}
