/* ================================================
   IHY v2 — style.css
   The Decode Experience.
   Two pages: hint (scolding) + home (decode).
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300;1,400&family=Inter:wght@300;400;500&family=JetBrains+Mono:wght@300;400&display=swap');

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

/* ─── Tokens ─────────────────────────────────── */
:root {
  --bg:             #0b0b0b;
  --surface:        #111111;
  --surface-2:      #161616;
  --text-primary:   #e8e4de;
  --text-secondary: #6b6560;
  --text-dim:       #35322f;
  --accent:         #c9a96e;
  --accent-soft:    rgba(201, 169, 110, 0.1);
  --accent-glow:    rgba(201, 169, 110, 0.04);
  --border:         rgba(201, 169, 110, 0.18);
  --border-dim:     rgba(255, 255, 255, 0.05);
  --error:          rgba(180, 90, 80, 0.85);
}

/* ─── Base ───────────────────────────────────── */
html { font-size: 16px; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  transition: opacity 0.6s ease;
}

body.visible { opacity: 1; }

/* ─── Ambient glow ───────────────────────────── */
.bg-glow {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 55% 45% at 50% 50%,
    rgba(201, 169, 110, 0.04) 0%, transparent 70%);
  animation: breathe 10s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes breathe {
  0%,  100% { transform: scale(1);    opacity: 0.5; }
  50%        { transform: scale(1.12); opacity: 1;   }
}

/* ─── Page container ─────────────────────────── */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 6vw, 5rem);
  position: relative;
  overflow: hidden;
}

/* ─── Eyebrow ─────────────────────────────────── */
.eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ─── Shared animations ──────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0);    }
}

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

.anim-up   { opacity: 0; animation: fadeInUp 0.9s cubic-bezier(0.22,1,0.36,1) forwards; }
.anim-fade { opacity: 0; animation: fadeIn   0.9s ease forwards; }

.d1 { animation-delay: 0.15s; }
.d2 { animation-delay: 0.4s;  }
.d3 { animation-delay: 0.7s;  }
.d4 { animation-delay: 1.0s;  }
.d5 { animation-delay: 1.3s;  }
.d6 { animation-delay: 1.6s;  }

/* ─── Shared button ──────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.85rem 2.6rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease, letter-spacing 0.3s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--accent-soft);
  letter-spacing: 0.25em;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ════════════════════════════════════════════════
   HINT PAGE — soft scolding
   ════════════════════════════════════════════════ */

.hint-page {
  text-align: center;
}

.hint-content {
  max-width: 520px;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* The "you clicked" top line */
.hint-hook {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 2.5rem;
}

/* The soft scolding paragraph */
.hint-body {
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.85;
  margin-bottom: 2.5rem;
}

.hint-body em {
  font-style: italic;
  color: var(--text-primary);
  font-weight: 400;
}

/* The URL visual strip */
.url-strip {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.65rem, 1.8vw, 0.8rem);
  font-weight: 300;
  background: var(--surface);
  border: 1px solid var(--border-dim);
  padding: 0.9rem 1.4rem;
  margin-bottom: 2.5rem;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.url-keep {
  color: var(--accent);
}

.url-slash {
  color: var(--text-dim);
}

/* The encoded path - gets struck through with animation */
.url-code {
  color: var(--text-dim);
  position: relative;
  transition: opacity 0.4s ease;
}

.url-code.struck::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: var(--error);
  animation: strikeThrough 0.5s ease forwards;
  transform-origin: left;
}

@keyframes strikeThrough {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Hint direction */
.hint-direction {
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.hint-direction strong {
  color: var(--accent);
  font-weight: 400;
}

/* Small arrow CTA link */
.hint-cta {
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.3s ease;
}

.hint-cta:hover {
  color: var(--accent);
}

/* ════════════════════════════════════════════════
   HOME PAGE — decode
   ════════════════════════════════════════════════ */

.home-page {
  text-align: center;
}

/* ─── Form section ───────────────────────────── */
.form-section {
  max-width: 480px;
  width: 100%;
  position: relative;
  z-index: 1;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.form-section.hidden {
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
  position: absolute;
}

/* "50% there" heading */
.home-heading {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 0.6rem;
}

.home-heading .accent {
  color: var(--accent);
}

.home-subtext {
  font-size: 0.88rem;
  font-weight: 300;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  line-height: 1.7;
}

/* Input wrapper */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.input-label {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: left;
}

.code-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-dim);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 300;
  padding: 1rem 1.2rem;
  outline: none;
  transition: border-color 0.3s ease;
  /* No border-radius — sharp edges feel intentional here */
}

.code-input::placeholder {
  color: var(--text-dim);
  font-style: italic;
}

.code-input:focus {
  border-color: var(--border);
}

.code-input.error {
  border-color: rgba(180, 90, 80, 0.5);
}

/* Error text */
.error-text {
  font-size: 0.72rem;
  color: var(--error);
  text-align: left;
  height: 1rem;
  transition: opacity 0.3s ease;
}

.error-text.hidden {
  opacity: 0;
}

/* Reveal button */
#reveal-btn {
  width: 100%;
  padding: 1rem;
}

/* ─── Message section ────────────────────────── */
/* Hidden until successful decode */
#message-section {
  max-width: 480px;
  width: 100%;
  position: relative;
  z-index: 1;
  display: none;
  text-align: center;
  opacity: 0;
  transition: opacity 0.8s ease;
}

#message-section.visible {
  display: block;
}

#message-section.faded-in {
  opacity: 1;
}

.message-eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 3rem;
  animation: fadeIn 0.8s ease 0.2s both;
}

/* Decoded lines container */
#decoded-lines {
  margin-bottom: 3rem;
  min-height: 8rem;
}

.decoded-line {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.1rem, 3vw, 1.7rem);
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.65;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.decoded-line.dim {
  color: var(--text-secondary);
  font-style: italic;
}

/* The actual "Happy Birthday" line — bigger */
.decoded-line.wish {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 400;
  color: var(--text-primary);
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.decoded-line.sign {
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.decoded-line.break {
  height: 1.5rem;
  opacity: 1;
  transform: none;
}

.decoded-line.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Confetti canvas (birthday page) */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ─── Audio Toggle ───────────────────────────── */
#audio-toggle {
  position: fixed;
  bottom: 1.8rem;
  right: 1.8rem;
  z-index: 100;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--border-dim);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s ease, color 0.3s ease;
  outline: none;
}

#audio-toggle:hover {
  border-color: var(--border);
  color: var(--text-secondary);
}

#audio-toggle.playing {
  color: var(--accent);
  border-color: var(--border);
}

#audio-toggle.playing #audio-icon {
  display: inline-block;
  animation: musicPulse 2s ease-in-out infinite;
}

@keyframes musicPulse {
  0%, 100% { opacity: 0.6; transform: scale(1);    }
  50%       { opacity: 1;   transform: scale(1.15); }
}

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 480px) {
  .url-strip {
    font-size: 0.58rem;
    padding: 0.75rem 1rem;
  }
}
