/* ==========================================================================
   The Story — Sachin Mandawi
   Cinematic Scroll Scrubbing & Interactive Portfolio
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --bg-color: #000000;
  --bg-surface: #0a0b0e;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-color: #ff3b6f;
  --accent-secondary: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-gradient: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: var(--font-body);
  background-color: #000000;
  color: var(--text-primary);
  scroll-behavior: auto; /* native natural scroll physics */
  overflow-x: clip;
}

body {
  min-height: 100vh;
  background-color: #000000;
  overflow-x: clip;
  position: relative;
  line-height: 1.6;
}

/* ==========================================================================
   Top Floating Header Bar (Transparent Overlay)
   ========================================================================== */
.story-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 100%);
  border-bottom: none;
  pointer-events: none;
}

.story-header > * {
  pointer-events: auto;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 9999px;
  background: rgba(20, 20, 25, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.25s ease;
}

.btn-back svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.btn-back:hover {
  background: rgba(40, 40, 50, 0.8);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateX(-2px);
}

.btn-back:hover svg {
  transform: translateX(-3px);
}

.story-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(20, 20, 25, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fff, #bbb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
}

.verified-badge svg {
  width: 100%;
  height: 100%;
}

.verified-seal {
  fill: #38bdf8;
}

.verified-check {
  fill: #000;
}

.header-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-fit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: rgba(20, 20, 25, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-fit-toggle svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.btn-fit-toggle:hover {
  background: rgba(40, 40, 50, 0.8);
  border-color: rgba(255, 255, 255, 0.3);
}

.story-progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: rgba(20, 20, 25, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #38bdf8;
}

.progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Top Progress Line */
.top-progress-bar-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 101;
}

.top-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff3b6f, #8b5cf6, #38bdf8);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  transition: width 0.05s linear;
}

/* ==========================================================================
   Scroll Scrubbing Sticky Container (100% Pure Fullscreen)
   ========================================================================== */
.scrub-container {
  position: relative;
  height: 280vh; /* gives ample space for high-precision scrub */
  width: 100%;
  background: #000000;
  margin: 0;
  padding: 0;
}

.scrub-sticky-frame {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  margin: 0;
  padding: 0;
}

/* Video Canvas Box */
.video-canvas-box {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  overflow: hidden;
}

.scrub-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #000000;
  display: block;
}

/* Scroll Hint Cue */
.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 10;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.scroll-mouse-icon {
  width: 22px;
  height: 36px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  position: relative;
  display: flex;
  justify-content: center;
}

.scroll-mouse-wheel {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: #fff;
  margin-top: 6px;
  animation: scrollWheelAnim 1.8s infinite ease-in-out;
}

@keyframes scrollWheelAnim {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(14px); opacity: 0; }
}

.scroll-hint-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   Phase Overlays (Typography Driven by Video)
   ========================================================================== */
.phases-overlay {
  position: absolute;
  bottom: 90px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  padding: 0 20px;
}

.phase-card {
  position: absolute;
  bottom: 0;
  max-width: 580px;
  width: 100%;
  text-align: center;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding: 20px 24px;
  border-radius: 20px;
  background: rgba(14, 16, 21, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.phase-card.phase-active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.phase-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #38bdf8;
  margin-bottom: 6px;
}

.phase-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 6px;
  line-height: 1.2;
}

.phase-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   Story Bio & Developer Details Section (Revealed after scrub)
   ========================================================================== */
.story-bio-section {
  position: relative;
  z-index: 20;
  background: linear-gradient(180deg, rgba(6, 7, 9, 0.95) 0%, var(--bg-surface) 100%);
  padding: 80px 20px 60px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.story-content-wrap {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.bio-card,
.skills-card,
.featured-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 32px 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.bio-card:hover,
.skills-card:hover,
.featured-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
}

.bio-eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-color);
  margin-bottom: 8px;
}

.bio-title,
.skills-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  margin-bottom: 14px;
}

.bio-text {
  font-size: 1rem;
  line-height: 1.7;
  color: #cbd5e1;
}

.bio-text strong {
  color: #fff;
}

/* Skills Grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.skill-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.25s ease;
}

.skill-pill:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateY(-2px);
}

.skill-icon {
  font-size: 1.25rem;
}

.skill-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #f1f5f9;
}

/* Featured Mini Projects */
.project-mini-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.project-mini-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.25s ease;
}

.project-mini-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.project-mini-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.project-mini-info {
  flex: 1;
}

.project-mini-info h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.badge-mini {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-weight: 600;
  text-transform: uppercase;
}

.project-mini-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.project-mini-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.project-mini-link:hover {
  background: #38bdf8;
  color: #000;
}

/* Action Buttons */
.story-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.btn-action-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ff3b6f, #8b5cf6);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 10px 25px rgba(255, 59, 111, 0.25);
  transition: all 0.25s ease;
}

.btn-action-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(255, 59, 111, 0.4);
}

.btn-action-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.25s ease;
}

.btn-action-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.story-footer {
  text-align: center;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 640px) {
  .scrub-container {
    height: 250vh; /* Smooth, natural thumb scroll distance on touchscreens */
  }

  .story-header {
    padding: 0 14px;
    height: 54px;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .btn-back span {
    display: none;
  }

  .btn-back {
    padding: 8px 12px;
  }

  .story-brand {
    padding: 5px 12px;
    gap: 5px;
  }

  .brand-name {
    font-size: 0.94rem;
  }

  .scroll-mouse-icon {
    display: none;
  }

  .scroll-hint {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .scroll-hint-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    padding: 5px 14px;
    background: rgba(18, 20, 26, 0.75);
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .scroll-hint {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .bio-card,
  .skills-card,
  .featured-card {
    padding: 24px 18px;
    border-radius: 20px;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }
}
