/* Import Instrument Sans variable font */
@import url("https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wdth,wght@0,75..100,400..700;1,75..100,400..700&display=swap");
/* Import Instrument Serif font */
@import url("https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap");

body {
  background-color: black;
  color: #d6df58;
  font-family: "Instrument Serif", serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

a {
  color: #d6df58;
  text-decoration: none;
  cursor: pointer;
}

/* Loader overlay */
.loader-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

/* Show loader while initializing */
body.is-loading .loader-overlay {
  display: flex;
}

/* Hide instrument UI and canvas while loading */
/* Keep layout space; just hide visuals and interactions */
body.is-loading .instrument-overlay,
body.is-loading canvas {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.loader-bar {
  width: 120px;
  height: 3px;
  background: rgba(214, 223, 88, 0.2);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.loader-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: #d6df58;
  animation: loaderSlide 1s ease-in-out infinite;
}

@keyframes loaderSlide {
  0% {
    left: -40%;
  }
  50% {
    left: 60%;
  }
  100% {
    left: 100%;
  }
}

/* Overlay containers for instrument controls */
.instrument-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto; /* allow interactive children to receive events */
  z-index: 50;
}

.letter-regions {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto; /* make letter hit-areas responsive */
}

.chord-switchers,
.control-buttons {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center; /* Center vertically */
}

.control-buttons-wrapper {
  display: flex;
  gap: 12px;
  pointer-events: auto;
  justify-content: center;
  align-items: center;
  width: auto;
  max-width: 80%;
  position: relative; /* Change to relative positioning */
  margin: 0 auto; /* Center horizontally */
}

.control-button {
  width: 50px;
  height: 50px;
  min-width: 50px;
  font-size: 16px;
  padding: 0;
  position: relative;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #d6df58;
  color: #d6df58;
  border-radius: 999px;
  font-family: "Instrument Serif", serif;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  cursor: pointer;
  pointer-events: auto;
  overflow: hidden;
  white-space: nowrap;
  transition: background-color 0.5s ease, box-shadow 0.5s ease,
    transform 0.5s ease;
}
button.control-button:first-of-type:hover {
  background-color: #d6df58;
  color: black;
  border: 1px solid #d6df58;
}
.letter-region {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  touch-action: none; /* prevent scroll/zoom during touch drag */
  /* Debug styles - uncomment to see regions */
  /* background: rgba(214, 223, 88, 0.1); */
  /* border: 1px solid rgba(214, 223, 88, 0.3); */
}

.chord-switcher,
.control-button {
  pointer-events: auto; /* re-enable on interactive elements */

  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #d6df58;
  color: #d6df58;
  font-family: "Instrument Serif", serif;
  border-radius: 999px;
  line-height: 1;
}

button.chord-switcher {
  width: 24px;
  height: 24px;
  font-size: 10px;
  background: #d6df58;
  color: black;
  font-family: "Instrument Sans", sans-serif;
  font-weight: 600;
  transform-origin: center;
  transform: translate(-50%, -50%) scale(1);
  transition: transform 2s ease-in-out;
  margin-top: 20px;
}
button.chord-switcher:hover {
  background: #d6df58;
  color: black;
  animation: pulse 0.5s;
}
button.chord-switcher:active {
  background: #d6df58;
  color: black !important;
  animation: pulse 0.5s;
}
@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.control-button.expanded,
.control-button[data-type="style"].expanded,
.control-button[data-type="tone"].expanded {
  width: 80px !important;
  padding: 0 15px;
  text-transform: uppercase;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Start audio button specific styles */
.start-audio-text {
  font-family: "Instrument Sans", sans-serif;
  font-size: 16px;
  color: #d6df58;
  text-align: center;
  pointer-events: none;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
  margin: 0 auto;
}

.control-buttons-container {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.control-buttons-wrapper {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.control-buttons-wrapper.show {
  opacity: 1;
}

.start-audio-text {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 1;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.start-audio-text.hide {
  opacity: 0;
  pointer-events: none;
}

/* DOM playhead */
.playhead {
  position: absolute;
  width: 1px;
  height: 24px; /* spans indicator circle */
  background: #d6df58;
  transform: translate(-50%, -50%);
  margin-top: 20px;
  transition: transform 50ms linear;
}

/* When playhead is moving between letters */
.playhead.moving {
  transition: transform 200ms linear;
}

.chord-switcher:hover,
.control-button:hover {
  background: rgba(214, 223, 88, 0.1);
  box-shadow: 0 0 0 2px rgba(214, 223, 88, 0.2) inset;
}

.chord-switcher:active,
.control-button:active {
  transform: scale(0.96);
}

/* Top Headline */
.top-headline {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-family: "Instrument Serif";
  font-size: 28px;
  font-style: normal;
  font-weight: 400;
  line-height: 100%; /* 32px */
  color: #d6df58;
  margin: 0;
  z-index: 10;
  max-width: 90%;
}

/* Bottom Headline */
.bottom-headline {
  position: absolute;
  top: calc(75vh - 80px);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-family: "Instrument Serif", serif;
  font-size: 22px;
  font-weight: 400;
  color: #d6df58;
  margin: 0;
  z-index: 10;
}

/* Dev Controls */
.dev-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.dev-toggle {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.8);
  color: #d6df58;
  border: 1px solid #d6df58;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-family: "Instrument Serif", serif;
  transition: all 0.2s;
}

.dev-toggle:hover {
  background: rgba(214, 223, 88, 0.1);
}

.controls-panel {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #d6df58;
  border-radius: 4px;
  padding: 15px;
  min-width: 200px;
}

.controls-panel.show {
  display: block;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 15px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  font-size: 14px;
  color: #d6df58;
  font-family: "Instrument Serif", serif;
}

button {
  background: rgba(0, 0, 0, 0.8);
  color: #d6df58;
  border: 1px solid #d6df58;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-family: "Instrument Serif", serif;
  transition: all 0.2s;
  text-align: center;
}

button:hover {
  background: rgba(214, 223, 88, 0.1);
}

/* Range inputs */
input[type="range"] {
  width: 100%;
  accent-color: #d6df58;
}

main {
  margin-top: 0;
  position: relative;
  z-index: 1;
}

/* Make sure overlay aligns with the main instrument canvas area (75vh tall) */
body,
html {
  height: 100%;
}

main,
.instrument-overlay {
  top: 0;
  left: 0;
  width: 100%;
  height: 75vh; /* match canvas height */
  margin-bottom: 100px;
}

/* Project Modules */
.project-modules {
  position: relative;
  z-index: 5;
  max-width: 1432px;
  margin: 20px auto 0;
  padding: 0 120px 100px 120px;
}

.project-card {
  display: grid;
  grid-template-columns: 677px 1fr;
  gap: 60px;
  margin-bottom: 120px;
  align-items: start;
}

.project-card:last-child {
  margin-bottom: 0;
}

.project-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.project-header {
  display: flex;
  align-items: top;
  gap: 24px;
  flex-wrap: wrap;
}

.project-number {
  font-family: "Instrument Sans", sans-serif;
  font-size: 20px;
  font-weight: 400;
  color: #d6df58;
  line-height: 1.2;
}

.project-title {
  font-family: "Instrument Sans", sans-serif;
  font-size: 42px;
  font-weight: 400;
  color: #d6df58;
  margin: 0;
  line-height: 1;
  margin-top: -5px;
  font-variation-settings: "wdth" 85, "wght" 30; /* Condensed width */
}

.project-tags {
  display: flex;
  gap: 8px;
}
.project-description {
  font-size: 16px;
}

.tag {
  font-family: "Instrument Sans", sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #000000;
  background: #d6df58;
  border: none;
  border-radius: 53px;
  padding: 8px 12px;
  white-space: nowrap;
  display: flex;
  justify-content: center;
  align-items: center;
  font-variation-settings: "wdth" 100;
  height: 20px;
}

.project-description {
  font-family: "Instrument Sans", sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #d6df58;
  line-height: 1.5;
  margin: 0;
  max-width: 500px;
  /* margin-left: 40px; */
}

.project-image {
  position: relative;
  background: rgba(214, 223, 88, 0.1);
  border: 1px solid rgba(214, 223, 88, 0.3);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
}

.project-image:hover {
  cursor: none;
}

.video-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* Default 16:9 aspect ratio as fallback */
  overflow: hidden;
  background: #000;
}

.video-container[data-aspect-ratio] {
  padding-top: calc(100% / var(--aspect-ratio));
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  position: relative;
  background: rgba(214, 223, 88, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}

.case-study-btn {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  background: rgb(9, 9, 11); /* bg-zinc-950 */
  color: rgb(229, 229, 229); /* text-gray-200 */
  border: none;
  border-radius: 999px;
  padding: 8px 20px; /* px-5 py-2 */
  font-family: "Instrument Sans", sans-serif;
  font-size: 16px; /* text-base */
  font-weight: 400; /* font-normal */
  line-height: normal;
  letter-spacing: -0.02em; /* tracking-tight */
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  white-space: nowrap;
}

.project-image:hover .case-study-btn {
  opacity: 1;
  pointer-events: auto;
}

.case-study-btn:hover {
  background: rgb(24, 24, 27); /* slightly lighter for hover */
}

/* Responsive adjustments */
@media (max-width: 1440px) {
  .project-card {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .project-modules {
    padding: 0 40px;
  }

  .project-card {
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 80px;
  }

  .project-content {
    gap: 20px;
  }

  .project-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .project-number {
    font-size: 18px;
  }

  .project-title {
    font-size: 36px;
    margin-top: 0;
  }

  .project-description {
    font-size: 18px;
    margin-left: 0;
  }
}
