/* HIMBO ENGINE — Typography as muscle performance */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: 'Inter', sans-serif;
  cursor: none;
}

/* Bodoni Moda for the text performance — Inter for UI chrome */

#canvas {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8vw;
}

#text-stage {
  text-align: center;
  line-height: 1.3;
  max-width: 80vw;
  transition: opacity 0.5s ease;
}

#text-stage.stage-fading {
  opacity: 0;
}

/* ========================
   WORD — base state
   Bodoni starts at wght 400; thin is relative here
   ======================== */
.word {
  display: inline-block;
  font-family: 'Bodoni Moda', serif;
  font-optical-sizing: none;
  font-weight: 400;
  font-size: 2.3rem;
  font-variation-settings: 'opsz' 8;
  letter-spacing: 0.02em;
  opacity: 0;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  margin: 0 0.1em;
}

/* ========================
   ENTERING — arrive from below
   ======================== */
.word.entering {
  opacity: 1;
  animation: arrive 0.45s ease-out forwards;
}

/* ========================
   FLEXING — thick/thin contrast kicks in
   ======================== */
.word.flexing {
  opacity: 1;
  font-weight: 700;
  font-size: 2.7rem;
  font-variation-settings: 'opsz' 60;
  letter-spacing: 0.03em;
  animation: swell 1.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ========================
   PUMPED — peak Bodoni: verticals thick, hairlines thin
   ======================== */
.word.pumped {
  opacity: 1;
  font-weight: 900;
  font-size: 2.9rem;
  font-variation-settings: 'opsz' 96;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.1);
  animation: pulse 3s ease-in-out infinite;
}

/* ========================
   RESTING — settled, fashion-editorial weight
   ======================== */
.word.resting {
  opacity: 0.88;
  font-weight: 500;
  font-size: 2.4rem;
  font-variation-settings: 'opsz' 36;
  letter-spacing: 0.025em;
  color: rgba(255, 255, 255, 0.78);
}

/* ========================
   FADING — leaving
   ======================== */
.word.fading {
  opacity: 0;
  font-weight: 400;
  font-size: 2.1rem;
  font-variation-settings: 'opsz' 6;
  letter-spacing: 0em;
  transition: all 0.5s ease-in;
}

/* ========================
   KEYFRAMES
   ======================== */

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.97);
    font-weight: 400;
    font-variation-settings: 'opsz' 6;
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    font-weight: 400;
    font-variation-settings: 'opsz' 8;
  }
}

@keyframes swell {
  0% {
    font-weight: 400;
    font-size: 2.3rem;
    font-variation-settings: 'opsz' 8;
    letter-spacing: 0.02em;
  }
  42% {
    font-weight: 900;
    font-size: 3.2rem;
    font-variation-settings: 'opsz' 96;
    letter-spacing: 0.06em;
  }
  100% {
    font-weight: 700;
    font-size: 2.7rem;
    font-variation-settings: 'opsz' 60;
    letter-spacing: 0.03em;
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.015);
  }
}

/* ========================
   INPUT MODE
   ======================== */
#input-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70vw;
  text-align: center;
}

#input-stage.hidden {
  display: none;
}

#input-field {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: 'Bodoni Moda', serif;
  font-optical-sizing: none;
  font-weight: 400;
  font-variation-settings: 'opsz' 36;
  font-size: 1.8rem;
  letter-spacing: 0.02em;
  width: 100%;
  min-height: 30vh;
  text-align: center;
  resize: none;
  caret-color: #fff;
  line-height: 1.5;
}

#input-field::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

#input-cursor {
  font-size: 2rem;
  font-weight: 200;
  color: rgba(255, 255, 255, 0.6);
}

#input-cursor.blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ========================
   MODE INDICATOR — barely visible
   ======================== */
#mode-indicator {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  font-size: 0.65rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.12);
  transition: opacity 0.5s ease;
  pointer-events: none;
}

/* ========================
   TIMESTAMP OVERLAY
   ======================== */
#timestamp-overlay {
  position: fixed;
  bottom: 4rem;
  left: 1.5rem;
  font-size: 0.7rem;
  font-weight: 200;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0);
  transition: color 0.5s ease;
  pointer-events: none;
  max-width: 300px;
}

#timestamp-overlay.visible {
  color: rgba(255, 255, 255, 0.3);
  animation: timestampSwell 0.4s ease-out;
}

@keyframes timestampSwell {
  0% {
    font-weight: 100;
    letter-spacing: 0.15em;
  }
  50% {
    font-weight: 300;
    letter-spacing: 0.25em;
  }
  100% {
    font-weight: 200;
    letter-spacing: 0.2em;
  }
}

/* ========================
   DATA MODE — workout display
   ======================== */
.workout-date {
  font-weight: 200;
  font-size: 1rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 2rem;
  display: block;
}

.workout-location {
  font-weight: 300;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.2);
  margin-bottom: 3rem;
  display: block;
}

.exercise-name {
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 1.5rem;
  display: block;
}

.exercise-set {
  font-weight: 400;
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.5);
  display: block;
  margin: 0.3rem 0;
}

/* ========================
   PROCESSING INDICATOR
   ======================== */
.processing-indicator {
  display: block;
  font-weight: 200;
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.2);
  margin-top: 2rem;
  animation: pulse 2s ease-in-out infinite;
}

/* ========================
   HELP OVERLAY — bottom-third, centered title card
   ======================== */
#help-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 60px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 100;
}

#help-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.help-content {
  text-align: left;
  max-width: 520px;
  width: 100%;
  margin-bottom: 8vh;
  animation: helpSwell 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes helpSwell {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.help-line {
  display: flex;
  align-items: baseline;
  margin: 0.9rem 0;
  gap: 1.5rem;
}

.help-key {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.9);
  min-width: 110px;
  text-align: right;
  flex-shrink: 0;
}

.help-desc {
  font-weight: 300;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.5);
}

/* ========================
   FIRST-LOAD HINT
   ======================== */
#help-hint {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  font-size: 0.6rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  animation: hintAppear 1.2s ease-out forwards;
  transition: opacity 2.5s ease;
  pointer-events: none;
}

@keyframes hintAppear {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#help-hint.faded {
  opacity: 0;
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 768px) {
  .word {
    font-size: 1.5rem;
  }
  .word.flexing {
    font-size: 1.9rem;
  }
  .word.pumped {
    font-size: 2rem;
  }
  .word.resting {
    font-size: 1.7rem;
  }
  #canvas {
    padding: 5vw;
  }
  #input-field {
    font-size: 1.2rem;
  }
  #help-overlay {
    padding: 30px;
  }
  .help-content {
    margin-bottom: 4vh;
  }
  .help-key {
    min-width: 70px;
    font-size: 0.75rem;
  }
  .help-desc {
    font-size: 0.7rem;
  }
}
