/* ============================================================
   Allan Leone — Portfolio
   Full-screen video + GSAP per-character designer animation
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@800;900&display=swap');

:root {
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --color-white: #ffffff;
  --color-white-92: rgba(255, 255, 255, 0.92);
  --color-white-60: rgba(255, 255, 255, 0.60);
  --color-white-30: rgba(255, 255, 255, 0.30);
  --color-white-15: rgba(255, 255, 255, 0.15);
  --color-white-08: rgba(255, 255, 255, 0.08);
  --color-accent: rgba(100, 149, 255, 0.6);
  --color-accent-dim: rgba(100, 149, 255, 0.15);
  --color-overlay-start: rgba(0, 0, 0, 0.52);
  --color-overlay-end: rgba(0, 0, 0, 0.28);
  --cycle-duration: 10000ms;
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-primary);
  color: var(--color-white);
  background: #000;
  cursor: none;
  /* Hide default for designer tool feel */
}

/* Video */
.video-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.video-bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Overlay */
.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: linear-gradient(135deg, var(--color-overlay-start) 0%, var(--color-overlay-end) 100%);
  pointer-events: none;
}

/* Hero */
.hero {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100dvh;
  text-align: center;
  padding: 2rem;
}

/* SEO-only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Phrase container */
.hero-phrases {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90%;
  max-width: 1200px;
  min-height: 200px;
}

/* Individual phrase — multi-line, centered */
.phrase {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--color-white-92);
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
}

.phrase.active {
  opacity: 1;
  pointer-events: auto;
}

/* Word groups — one word per line */
.phrase .word {
  display: block;
  text-align: center;
}

/* Individual character */
.phrase .char {
  display: inline-block;
  position: relative;
  will-change: transform, opacity;
  transition: color 0.2s ease, -webkit-text-stroke 0.2s ease;
}

/* Outline-only state: transparent fill with white stroke */
.phrase .char.char-outline {
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.4);
}

/* Filled state: solid white, no stroke */
.phrase .char.char-filled {
  color: var(--color-white-92);
  -webkit-text-stroke: 0px transparent;
}

.phrase .char-space {
  width: 0.28em;
}

/* --- Font cycling style classes — each creates a distinct visual feel --- */
.phrase.style-3d {
  text-shadow:
    2px 2px 0 rgba(0, 0, 0, 0.4),
    4px 4px 0 rgba(0, 0, 0, 0.2),
    6px 6px 12px rgba(0, 0, 0, 0.3);
}

.phrase.style-glow {
  text-shadow:
    0 0 10px currentColor,
    0 0 30px currentColor,
    0 0 60px currentColor;
  filter: brightness(1.2);
}

.phrase.style-outline {
  -webkit-text-stroke: 2px currentColor;
  color: transparent !important;
  text-shadow: none;
}

.phrase.style-bold {
  font-weight: 900;
  transform: skewX(-3deg);
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}

.phrase.style-glass {
  opacity: 0.65;
  text-shadow:
    0 0 20px rgba(255, 255, 255, 0.15),
    0 4px 12px rgba(0, 0, 0, 0.4);
  filter: blur(0.3px);
}

.phrase.style-elegant {
  letter-spacing: 0.12em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  font-style: italic;
}

/* --- Per-character selection box (Figma feel) --- */
.phrase .char .char-select {
  position: absolute;
  inset: -3px -2px;
  border: 1px solid var(--color-accent);
  border-radius: 1px;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 6px var(--color-accent-dim);
}

/* Corner handles on char-select */
.phrase .char .char-select::before,
.phrase .char .char-select::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--color-accent);
}

.phrase .char .char-select::before {
  top: -2px;
  left: -2px;
}

.phrase .char .char-select::after {
  bottom: -2px;
  right: -2px;
}

/* --- Alignment guides — very subtle, barely perceptible --- */
.alignment-guide {
  position: absolute;
  background: rgba(255, 80, 180, 0.35);
  opacity: 0;
  pointer-events: none;
  z-index: 15;
}

.alignment-guide.horizontal {
  height: 1px;
  width: 100%;
  left: 0;
  box-shadow: 0 0 6px rgba(255, 80, 180, 0.08);
}

.alignment-guide.vertical {
  width: 1px;
  height: 100%;
  top: 0;
  box-shadow: 0 0 6px rgba(100, 160, 255, 0.08);
  background: rgba(100, 160, 255, 0.35);
}

/* --- Baseline / grid rulers --- */
.ruler-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
}

.ruler-overlay .grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.04);
}

.ruler-overlay .grid-line.h {
  height: 1px;
  width: 100%;
}

.ruler-overlay .grid-line.v {
  width: 1px;
  height: 100%;
}

/* --- Kerning indicator (spacing arrows) --- */
.kerning-indicator {
  position: absolute;
  height: 1px;
  background: var(--color-accent);
  opacity: 0;
  pointer-events: none;
  z-index: 14;
  top: 50%;
}

.kerning-indicator::before,
.kerning-indicator::after {
  content: '';
  position: absolute;
  top: -3px;
  width: 1px;
  height: 7px;
  background: var(--color-accent);
}

.kerning-indicator::before {
  left: 0;
}

.kerning-indicator::after {
  right: 0;
}

/* --- Layer label (briefly appears) --- */
.layer-label {
  position: absolute;
  top: -32px;
  left: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--color-accent);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 16;
}

/* --- Designer cursor — big, prominent, with Figma-style name tag --- */
.designer-cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 20;
  width: 32px;
  height: 32px;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

#user-cursor {
  position: fixed;
  /* Match screen coordinates exactly */
  z-index: 10000;
  transition: opacity 0.2s ease;
}

.designer-cursor.user-cursor {
  z-index: 10000;
}

.designer-cursor svg {
  width: 100%;
  height: 100%;
}

/* Figma-style name bubble */
.cursor-label {
  position: absolute;
  top: 24px;
  left: 16px;
  background: #5b5fc7;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* --- Click ripple — bigger, brighter flash on cursor click --- */
.click-ripple {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.7);
  pointer-events: none;
  z-index: 19;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  box-shadow: 0 0 12px rgba(91, 95, 199, 0.5);
}

/* --- Final selection box (whole phrase, subtle) --- */
.selection-box {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  z-index: 10;
}

.selection-box .handle-tr,
.selection-box .handle-bl {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--color-white-60);
}

.selection-box::before,
.selection-box::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--color-white-60);
}

.selection-box::before {
  top: -3px;
  left: -3px;
}

.selection-box::after {
  bottom: -3px;
  right: -3px;
}

.selection-box .handle-tr {
  top: -3px;
  right: -3px;
}

.selection-box .handle-bl {
  bottom: -3px;
  left: -3px;
}

/* --- Progress Bar (~50px total) --- */
.progress-bar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-bar .segment {
  width: 8px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-white-08);
  overflow: hidden;
  position: relative;
}

.progress-bar .segment .fill {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: var(--color-white-60);
  transform: scaleX(0);
  transform-origin: left;
  will-change: transform;
}

.progress-bar .segment.past .fill {
  transform: scaleX(1);
  transition: none;
}

.progress-bar .segment.active .fill {
  animation: progress-fill var(--cycle-duration) linear forwards;
}

.progress-bar .segment.future .fill {
  transform: scaleX(0);
  transition: none;
}

@keyframes progress-fill {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .phrase .char {
    transform: none !important;
    opacity: 1 !important;
  }

  .char-select,
  .alignment-guide,
  .kerning-indicator,
  .designer-cursor,
  .ruler-overlay,
  .layer-label {
    display: none !important;
  }

  .progress-bar .segment.active .fill {
    animation: none;
    transform: scaleX(1);
  }
}

/* Mobile */
@media (max-width: 640px) {
  .hero-phrases {
    width: 94%;
  }

  .progress-bar {
    bottom: 2rem;
  }

  .progress-bar .segment {
    width: 24px;
  }
}

/* --- Start Button & Transitions --- */
.top-actions {
  position: fixed;
  top: 2rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 99;
  pointer-events: none;
}

.action-btn {
  pointer-events: auto;
  padding: 0.5rem 1rem;
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-white-92);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  cursor: none;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--color-white);
  transform: translateY(-2px);
}

.start-btn {
  position: absolute;
  bottom: 13%;
  /* Positioned below the text animation */
  left: 50%;
  transform: translateX(-50%);
  z-index: 99;
  padding: 1.2rem 3.5rem;
  font-family: var(--font-primary);
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 100px;
  cursor: none;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.start-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.start-btn:active {
  transform: translateX(-50%) translateY(0);
}

/* Fade Overlay for final transition */
#fade-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s ease;
}

#fade-overlay.active {
  opacity: 1;
  pointer-events: auto;
}