/* ─────────────────────────────────────────────────────────────────────────────
   main.css — inverso.bio
   Single-page scroll-driven portfolio
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --purple-smoke:    #5E4B56;
  --charcoal:        #2A2629;
  --dusty-mauve:     #7D6B75;
  --onyx:            #35313A;
  --ink-black:       #1A1718;

  --bg:              #F2F0EE;
  --bg-white:        #FFFFFF;
  --text-primary:    #1A1718;
  --text-secondary:  #5E4B56;
  --text-muted:      #7D6B75;

  --accent:          var(--purple-smoke);
  --accent-dim:      rgba(94, 75, 86, 0.12);

  --font-body:       'Space Grotesk', sans-serif;
  --font-display:    'Syne', sans-serif;

  --grain-opacity:   0.032;
  --section-pad:     clamp(5rem, 10vw, 9rem);

  --ease-out:        cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Grain texture overlay ─────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px;
}

/* ── Background canvas ─────────────────────────────────────────────────────── */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Main content ──────────────────────────────────────────────────────────── */
main {
  position: relative;
  z-index: 1;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

/* ── WIP Badge ─────────────────────────────────────────────────────────────── */
#wip-badge {
  position: fixed;
  top: 1.5rem;
  right: 1.75rem;
  z-index: 1000;
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--text-muted);
  border: 1px solid var(--dusty-mauve);
  padding: 0.3rem 0.65rem;
  border-radius: 2px;
  background: rgba(242, 240, 238, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}

/* ── Audio controls ────────────────────────────────────────────────────────── */
#audio-widget {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

#audio-mute-btn {
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  color: var(--text-muted);
  border: 1px solid var(--dusty-mauve);
  background: rgba(242, 240, 238, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0.3rem 0.75rem;
  border-radius: 2px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

#audio-mute-btn.active,
#audio-mute-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Waveform bars */
#audio-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 16px;
  opacity: 0.4;
  transition: opacity 0.3s;
}

#audio-waveform.playing {
  opacity: 1;
}

.wave-bar {
  width: 2px;
  border-radius: 1px;
  background: var(--accent);
  height: 4px;
  transform-origin: center;
  transition: transform 0.1s;
}

#audio-waveform.playing .wave-bar {
  animation: wave-pulse 0.8s ease-in-out infinite alternate;
}

#audio-waveform.playing .wave-bar:nth-child(1) { animation-delay: 0.0s; }
#audio-waveform.playing .wave-bar:nth-child(2) { animation-delay: 0.1s; }
#audio-waveform.playing .wave-bar:nth-child(3) { animation-delay: 0.2s; }
#audio-waveform.playing .wave-bar:nth-child(4) { animation-delay: 0.15s; }
#audio-waveform.playing .wave-bar:nth-child(5) { animation-delay: 0.05s; }

@keyframes wave-pulse {
  from { transform: scaleY(1); }
  to   { transform: scaleY(5); }
}

#audio-waveform.rewinding {
  animation: rewind-flash 0.5s ease;
}

@keyframes rewind-flash {
  0%   { filter: none; opacity: 1; }
  25%  { filter: hue-rotate(60deg) brightness(1.5); opacity: 0.6; }
  60%  { filter: hue-rotate(0deg); opacity: 0.3; }
  100% { filter: none; opacity: 1; }
}

/* ── More button + drawer ──────────────────────────────────────────────────── */
#more-btn {
  position: fixed;
  bottom: 1.75rem;
  left: 1.75rem;
  z-index: 1000;
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  font-variant: small-caps;
  color: var(--text-muted);
  border: 1px solid var(--dusty-mauve);
  background: rgba(242, 240, 238, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0.3rem 0.75rem;
  border-radius: 2px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

#more-btn:hover,
#more-btn[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

#more-drawer {
  position: fixed;
  bottom: 4rem;
  left: 1.75rem;
  z-index: 999;
  background: var(--bg-white);
  border: 1px solid rgba(94, 75, 86, 0.2);
  border-radius: 3px;
  padding: 1rem 1.25rem;
  min-width: 140px;
  box-shadow: 4px 4px 0 var(--ink-black);
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}

#more-drawer.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.more-drawer-title {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.more-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.more-drawer-links a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: color 0.15s;
}

.more-drawer-links a:hover {
  color: var(--accent);
}

#more-close {
  display: block;
  margin-top: 0.85rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
}

#more-close:hover {
  color: var(--accent);
}

/* ── Language selector ─────────────────────────────────────────────────────── */
#lang-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.lang-btn {
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid transparent;
  background: none;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.15s, border-color 0.15s;
}

.lang-btn:hover {
  color: var(--text-primary);
  border-color: var(--dusty-mauve);
}

.lang-btn.active {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Toast ─────────────────────────────────────────────────────────────────── */
#lang-toast {
  position: fixed;
  bottom: 5.5rem;
  right: 1.75rem;
  z-index: 2000;
  font-size: 0.7rem;
  font-family: var(--font-body);
  color: var(--text-muted);
  background: rgba(242, 240, 238, 0.95);
  border: 1px solid var(--dusty-mauve);
  padding: 0.5rem 0.9rem;
  border-radius: 2px;
  max-width: 280px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

#lang-toast.show {
  opacity: 1;
  transform: translateY(0);
}

#lang-toast.hide {
  opacity: 0;
  transform: translateY(6px);
}

/* ── Character reveal animation ────────────────────────────────────────────── */
.char {
  display: inline;
  opacity: 0;
  transform: translateY(var(--char-offset, 6px));
  transition:
    opacity 0.25s var(--ease-out),
    transform 0.25s var(--ease-out);
  transition-delay: calc(var(--char-index, 0) * 0ms);
}

.char.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─────────────────────────────────────────────────────────────────────────────
   SECTIONS
   ───────────────────────────────────────────────────────────────────────────── */

/* ── HERO ──────────────────────────────────────────────────────────────────── */
#hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(3rem, 8vw, 7rem) clamp(2rem, 8vw, 8rem);
}

.hero-name {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 10vw, 8rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ink-black);
  margin-bottom: 1.2rem;
}

.hero-name em {
  font-style: normal;
  color: var(--accent);
}

.hero-tagline {
  font-size: clamp(1rem, 2vw, 1.35rem);
  color: var(--text-muted);
  font-weight: 400;
  max-width: 480px;
  margin-bottom: 3rem;
}

.scroll-prompt {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  animation: prompt-pulse 2.4s ease-in-out infinite;
}

.scroll-prompt::before {
  content: '';
  display: block;
  width: 1px;
  height: 28px;
  background: var(--dusty-mauve);
  animation: line-drop 2.4s ease-in-out infinite;
}

@keyframes prompt-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.9; }
}

@keyframes line-drop {
  0%, 100% { transform: scaleY(0.4); transform-origin: top; }
  50%       { transform: scaleY(1);   transform-origin: top; }
}

/* ── INTRODUCTION ──────────────────────────────────────────────────────────── */
#intro {
  padding: var(--section-pad) clamp(2rem, 8vw, 8rem);
  max-width: 780px;
}

.section-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.section-heading {
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--ink-black);
  margin-bottom: 2rem;
}

.section-body {
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  color: var(--text-primary);
  line-height: 1.85;
  max-width: 640px;
}

.section-body p + p {
  margin-top: 1.2em;
}

/* ── GOAL 1 ────────────────────────────────────────────────────────────────── */
#goal1 {
  padding: var(--section-pad) clamp(2rem, 8vw, 8rem);
}

.goal-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
  max-width: 1100px;
}

.goal-text {
  max-width: 540px;
}

.goal-image-slot {
  aspect-ratio: 4/5;
  background: var(--accent-dim);
  border: 1px dashed var(--dusty-mauve);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.goal-image-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  display: none; /* shown when src is real */
}

.goal-image-slot svg {
  opacity: 0.3;
}

/* ── GOAL 2 (blurred) ──────────────────────────────────────────────────────── */
#goal2-wrapper {
  position: relative;
  padding: var(--section-pad) clamp(2rem, 8vw, 8rem);
}

#goal2 {
  max-width: 640px;
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
  transition: filter 0.8s ease;
}

#goal2.unlocked {
  filter: none;
  pointer-events: auto;
  user-select: auto;
}

.goal2-overlay {
  position: absolute;
  top: 50%;
  left: clamp(2rem, 8vw, 8rem);
  transform: translateY(-50%);
  max-width: 540px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
}

.goal2-lock {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.goal2-lock svg {
  opacity: 0.5;
  flex-shrink: 0;
}

/* ── Newsletter ────────────────────────────────────────────────────────────── */
#newsletter-section {
  padding: var(--section-pad) clamp(2rem, 8vw, 8rem);
  max-width: 640px;
}

#newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
  margin-top: 1.5rem;
  transition: opacity 0.3s;
}

#newsletter-email {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--dusty-mauve);
  border-radius: 2px;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

#newsletter-email:focus {
  border-color: var(--accent);
}

#newsletter-submit {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.7rem 1.5rem;
  background: var(--ink-black);
  color: #fff;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  align-self: flex-start;
}

#newsletter-submit:hover {
  background: var(--accent);
}

#newsletter-submit:active {
  transform: translateY(1px);
}

#newsletter-confirm {
  display: none;
  opacity: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 1rem;
  transition: opacity 0.4s;
}

/* ── CONTACT ───────────────────────────────────────────────────────────────── */
#contact {
  background: var(--ink-black);
  color: #fff;
  min-height: 80svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--section-pad) clamp(2rem, 8vw, 8rem);
  position: relative;
  z-index: 1;
}

#contact .section-label {
  color: rgba(255,255,255,0.35);
}

#contact .section-heading {
  color: #fff;
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  margin-bottom: 2.5rem;
}

.contact-email-link {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 0.1em;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: 3rem;
}

.contact-email-link:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.7);
}

.contact-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.contact-social-link {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.4);
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  padding-bottom: 2px;
}

.contact-social-link:hover {
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.4);
}

/* ── FOOTER ────────────────────────────────────────────────────────────────── */
footer {
  background: var(--ink-black);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 2rem clamp(2rem, 8vw, 8rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  position: relative;
  z-index: 1;
}

.footer-wip {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.25);
}

.footer-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.footer-updated,
.footer-copyright {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.04em;
}

/* ── Section divider image slot ────────────────────────────────────────────── */
.section-divider-img {
  width: 100%;
  height: clamp(200px, 30vw, 420px);
  overflow: hidden;
  position: relative;
}

.section-divider-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.35) brightness(0.92);
  transform: scale(1.04);
  transition: transform 0.6s var(--ease-out), filter 0.6s ease;
}

.section-divider-img:hover img {
  filter: saturate(0.6) brightness(1);
  transform: scale(1);
}

.section-divider-img.placeholder-img {
  background: var(--accent-dim);
  border: 1px dashed var(--dusty-mauve);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .goal-content {
    grid-template-columns: 1fr;
  }

  .goal-image-slot {
    aspect-ratio: 16/9;
    max-height: 260px;
  }
}

@media (max-width: 640px) {
  #wip-badge {
    top: 1rem;
    right: 1rem;
  }

  #audio-widget {
    bottom: 1rem;
    right: 1rem;
  }

  #more-btn {
    bottom: 1rem;
    left: 1rem;
  }

  #more-drawer {
    bottom: 3.5rem;
    left: 1rem;
  }

  footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-meta {
    align-items: flex-start;
  }
}
