/* --- Variables --- */
:root {
  --primary: #028392;
  --primary-light: #03a5b8;
  --primary-lightest: #e4f4f6;
  --accent: #BD8C3D;
  --accent-light: #cea665;
  --dark: #1a1918;
  --grey: #4a5568;
  --grey-light: #9c9c9c;
  --grey-lightest: #f0f2f5;
  --white: #ffffff;
}

/* --- Fade-in on load --- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

header h1,
header .authors,
header .smaller,
header .buttons {
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
}

header h1 { animation-delay: 0.1s; }
header .authors { animation-delay: 0.25s; }
header .smaller { animation-delay: 0.35s; }
header .buttons { animation-delay: 0.45s; }

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Open Sans", sans-serif;
  color: var(--dark);
  background: var(--white);
  line-height: 1.7;
  font-size: calc(12px + 0.3vw);
}

a {
  color: var(--primary);
  transition: color 0.3s ease;
}

a:hover {
  color: var(--primary-light);
}

/* --- Progress bar (inverted: gray cover shrinks) --- */
#progressbar-parent {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--grey-lightest);
  z-index: 1000;
}

#progressbar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* --- Layout --- */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 5%;
}

section {
  padding: calc(20px + 1.5vw) 0;
}

#video {
  padding-top: 0.5rem;
}

/* --- Header --- */
header {
  text-align: center;
  padding: calc(30px + 3vw) 0 0;
  position: relative;
  background: linear-gradient(180deg, var(--primary-lightest) 0%, var(--white) 100%);
}

.project-name {
  font-family: "Open Sans", sans-serif;
  font-size: calc(14px + 0.4vw);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

header h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: calc(20px + 1.2vw);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.8rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

header .authors {
  font-size: calc(14px + 0.25vw);
  color: var(--dark);
  margin: 0.3rem 0 0.1rem;
}

header .authors a {
  color: var(--dark);
  text-decoration: none;
  font-weight: 600;
}

header .authors a:hover {
  color: var(--primary);
}

header .smaller {
  font-size: calc(11px + 0.2vw);
  color: var(--grey-light);
  margin: 0.1rem 0;
}

/* --- Color text utilities --- */
.accent {
  color: var(--accent);
}

.primary {
  color: var(--primary);
}

.clr-mutate {
  color: var(--accent);
}

.clr-insert {
  color: #026872;
}

.clr-recompose {
  color: #2c3e7a;
}

.cursive {
  font-family: "Bad Script", cursive;
}

.gray {
  color: var(--grey);
}

/* --- Buttons --- */
.buttons {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.4rem;
  background: transparent;
  color: var(--accent);
  text-decoration: none;
  border-radius: 6px;
  font-size: calc(11px + 0.15vw);
  font-weight: 600;
  font-family: "Open Sans", sans-serif;
  letter-spacing: 0.02em;
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  border: 1.5px solid var(--accent);
}

.button:hover {
  background: var(--accent);
  color: var(--white);
}

.button.chrome-btn {
  background: var(--accent);
  color: var(--white);
}

.button.chrome-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

.button.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.button i {
  font-size: 1em;
}

/* --- Down arrow --- */
.arrow-button {
  display: block;
  text-align: center;
  margin-top: 0;
  font-size: calc(20px + 0.5vw);
  color: var(--grey-light);
  text-decoration: none;
  transition: color 0.3s ease;
}

.arrow-button:hover {
  color: var(--primary);
}

/* --- Section headings --- */
h2 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: calc(18px + 0.5vw);
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--dark);
  padding-bottom: 0.4rem;
  border-bottom: 3px solid var(--primary);
  display: inline-block;
}

/* --- Alternating section backgrounds --- */
section:nth-of-type(even) {
  background: var(--grey-lightest);
}

#design-pipeline {
  background: var(--grey-lightest) !important;
}

#demo-video {
  background: #e8f0ec;
}

.task-text {
  font-size: calc(13px + 0.2vw);
  color: var(--dark);
  margin-bottom: 0.8rem;
  font-style: italic;
}

.task-label {
  font-weight: 700;
  font-style: normal;
  color: var(--primary);
}

.task-text-sm {
  font-size: calc(11px + 0.15vw);
  color: var(--dark);
  font-style: italic;
  margin-top: 0.2rem;
}

/* --- Horizontal carousel --- */
#use-cases-highlight .container {
  max-width: 100%;
  padding: 0;
}

#use-cases-highlight h2 {
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 5%;
}

.carousel-track {
  display: flex;
  gap: 1.2rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 0.5rem 5%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.interface-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  min-width: 320px;
  max-width: 380px;
  flex-shrink: 0;
}

.interface-vid {
  width: 100%;
  display: block;
}

.interface-info {
  padding: 0.8rem 1rem 1rem;
}

.interface-title {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: calc(12px + 0.15vw);
  font-weight: 700;
  font-style: italic;
  margin-bottom: 0.3rem;
  color: var(--dark);
}

.interface-desc {
  font-size: calc(11px + 0.12vw);
  line-height: 1.5;
  color: var(--grey);
}

/* --- Gallery --- */
.gallery {
  position: relative;
  margin: 1rem auto 0.5rem;
  max-width: 85%;
}

.gallery-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.gallery-media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.95) translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}

.gallery-media.active {
  opacity: 1;
  transform: scale(1) translateX(0);
  pointer-events: auto;
}

.gallery-media.exit-left {
  opacity: 0;
  transform: scale(0.95) translateX(-30px);
}

.gallery-controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.gallery-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e5ea;
  color: var(--grey-light);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

.gallery-dot:hover {
  background: #d0d4da;
  color: var(--grey);
}

.gallery-dot.active {
  background: var(--primary);
  color: var(--white);
}

/* --- Figure caption --- */
.figure-caption {
  font-size: calc(12px + 0.2vw);
  color: var(--grey-light);
  text-align: left;
  margin-top: 0.3rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
  font-style: italic;
}

/* --- Video styling --- */
video {
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

video::cue {
  font-size: 0.8em;
  background: rgba(0, 0, 0, 0.6);
}

/* --- Full-width images / GIFs --- */
.full-width {
  width: 100%;
  border-radius: 8px;
  display: block;
  margin: 1rem 0;
}

.smaller-img {
  max-width: 70%;
  margin-left: auto;
  margin-right: auto;
}

.smaller-img-sm {
  max-width: 55%;
  margin-left: auto;
  margin-right: auto;
}

/* --- Two-column side by side --- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}

.two-col-item {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.two-col-item h2 {
  font-size: calc(15px + 0.3vw);
}

.two-col-item img {
  max-width: 100%;
  align-self: center;
}

.two-col-item p {
  font-size: calc(12px + 0.2vw);
  line-height: 1.6;
  color: var(--grey);
  margin-top: 0.5rem;
  align-self: end;
}

@media (max-width: 700px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* --- Spacing utilities --- */
.spacing-above {
  margin-top: 1.5rem;
}

.less-spacing {
  margin: 0.3rem 0;
}

.no-spacing {
  margin: 0;
}

/* --- Operation groups (demo section) --- */
.operation-group {
  margin-bottom: 2rem;
}

.operation-label {
  font-family: "Open Sans", sans-serif;
  font-size: calc(14px + 0.2vw);
  font-weight: 700;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.label-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  border-radius: 5px;
  color: var(--white);
  font-size: 0.85em;
  font-weight: 700;
}

.accent-bg {
  background: var(--accent);
}

.primary-bg {
  background: var(--primary);
}

/* --- Motifs (story-docs style cards) --- */
.motif {
  display: flex;
  flex-direction: column;
}

.motif-gif {
  width: 100%;
  border-radius: 8px;
  display: block;
  box-shadow: none;
}

.motif-box {
  background: transparent;
  border-radius: 0;
  padding: 0.4rem 0;
  margin-top: 0;
}

.motif-box b {
  display: block;
  font-size: calc(12px + 0.15vw);
  margin-bottom: 0.3rem;
  text-align: center;
}

.motif-box p {
  font-size: calc(10px + 0.15vw);
  color: var(--grey);
  line-height: 1.5;
}

/* --- Tabs --- */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--grey-lightest);
  margin-bottom: 1rem;
}

.tab {
  padding: 0.4rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: "Open Sans", sans-serif;
  font-size: calc(11px + 0.15vw);
  font-weight: 700;
  color: var(--grey-light);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab:hover {
  color: var(--dark);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panels {
  position: relative;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.tab-panel p {
  margin-top: 0.5rem;
  color: var(--grey);
  font-size: calc(11px + 0.15vw);
}

/* --- Column grids --- */
.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 0.8rem;
}

.four-col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 0.8rem;
}

.card {
  text-align: center;
  min-width: 0;
  overflow: hidden;
}

.card img {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  display: block;
}

.card-img-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--grey-lightest);
  border-radius: 8px;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-img-placeholder i {
  font-size: 2rem;
  color: var(--grey-light);
}

.card-img-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.exp-box {
  text-align: left;
}

.exp-box b {
  display: block;
  margin-bottom: 0.3rem;
  font-size: calc(12px + 0.2vw);
}

.exp-box p {
  font-size: calc(11px + 0.15vw);
  color: var(--grey);
  line-height: 1.6;
}

/* --- GIF items (flex, no overflow) --- */
.gif-item {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  overflow: hidden;
}

.gif-item:nth-child(even) {
  flex-direction: row-reverse;
}

.gif-item img {
  width: 55%;
  min-width: 0;
  border-radius: 8px;
  flex-shrink: 0;
}

.gif-item .gif-text {
  flex: 1;
  min-width: 0;
}

.gif-item .gif-text h3 {
  font-size: calc(13px + 0.15vw);
  margin-bottom: 0.3rem;
  color: var(--dark);
}

.gif-item .gif-text p {
  color: var(--grey);
  font-size: calc(11px + 0.15vw);
  line-height: 1.5;
}

/* --- Citation / BibTeX --- */
#bibtex {
  background: linear-gradient(180deg, var(--grey-lightest) 0%, #e8e6df 100%) !important;
  padding: calc(30px + 2vw) 0;
}

.citation-label {
  font-size: calc(11px + 0.1vw);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

.citation-heading {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: calc(18px + 0.5vw);
  font-weight: 700;
  color: var(--dark);
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 1rem;
  display: block;
}

.citation-card {
  position: relative;
  background: var(--white);
  border: none;
  border-radius: 14px;
  padding: 2rem 2.2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.citation-copy {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  background: #f3f1ec;
  color: var(--dark);
  border: 1px solid #ddd9d0;
  border-radius: 8px;
  font-family: "Open Sans", sans-serif;
  font-size: calc(10px + 0.12vw);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.citation-copy:hover {
  background: #e8e5de;
}

#bibtex-text {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  padding-right: 5rem;
  margin: 0;
  font-family: "Courier New", Courier, monospace;
  font-size: calc(11px + 0.18vw);
  line-height: 1.8;
  overflow-x: auto;
  color: #2c2c2c;
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: calc(20px + 1vw) 0;
  color: var(--grey-light);
  font-size: calc(10px + 0.15vw);
}

footer .buttons {
  margin-top: 0.8rem;
}

/* --- Responsive --- */
@media (max-width: 1000px) {
  .three-col {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 600px) {
  .three-col,
  .four-col {
    grid-template-columns: 1fr;
  }

  .buttons {
    flex-direction: column;
    align-items: center;
  }

  header {
    padding: calc(30px + 2vw) 0 calc(15px + 1vw);
  }

  .gif-item,
  .gif-item:nth-child(even) {
    flex-direction: column;
  }

  .gif-item img {
    width: 100%;
  }

  .bibtex-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}
