/* Base */
* {
  box-sizing: border-box;
}
html {
  background-color: #0a0a0a;
  color: #ffffff;
}

/* ─── THEME COLOUR TOKENS ─────────────────────────────── */
:root {
  --scramble-gradient-start: #34d399;
  --scramble-gradient-end:   #ffffff;
}
html.light {
  --scramble-gradient-start: #059669;
  --scramble-gradient-end:   #111827;
}
body {
  font-family: "Inter", sans-serif;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* ─── THEME TOGGLE BUTTON ─────────────────────────────── */
.theme-toggle {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.2s,
    border-color 0.2s,
    background 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
}

/* ─── LIGHT MODE OVERRIDES ────────────────────────────── */

/* Base */
html.light,
html.light body {
  background-color: #f9fafb !important;
  color: #111827;
}

/* Tailwind hardcoded dark backgrounds — attribute selector avoids the
   CSS tokeniser treating # inside .class as an ID selector */
html.light [class*="bg-[#0a0a0a]"] {
  background-color: #f9fafb !important;
}
html.light [class*="bg-[#111"] {
  background-color: #ffffff !important;
}

/* ── Nav ── */
html.light nav {
  background: rgba(249, 250, 251, 0.92) !important;
  border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}
html.light .nav-link { color: #6b7280; }
html.light .nav-link:hover,
html.light .nav-link.active { color: #111827; }

html.light .theme-toggle {
  border-color: rgba(0, 0, 0, 0.12);
  color: #6b7280;
}
html.light .theme-toggle:hover {
  color: #111827;
  border-color: rgba(0, 0, 0, 0.25);
  background: rgba(0, 0, 0, 0.05);
}

/* Mobile menu button */
html.light #menuBtn { color: #6b7280 !important; }
html.light #menuBtn:hover { color: #111827 !important; }

/* Mobile menu panel */
html.light #mobileMenu {
  background: #f9fafb !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

/* ── Borders ── */
html.light .border-white\/5,
html.light .border-white\/6 {
  border-color: rgba(0, 0, 0, 0.07) !important;
}
html.light .border-t {
  border-top-color: rgba(0, 0, 0, 0.08) !important;
}

/* ── Text colours ── */
/* all .text-white → dark */
html.light .text-white { color: #111827 !important; }
/* all hover:text-white → dark hover */
html.light .hover\:text-white:hover { color: #111827 !important; }

html.light .text-gray-300 { color: #374151 !important; }
html.light .text-gray-400 { color: #4b5563 !important; }
html.light .text-gray-500 { color: #6b7280 !important; }
html.light .text-gray-600 { color: #9ca3af !important; }

/* Emerald stays emerald (slightly darker for contrast on white) */
html.light .text-emerald-400 { color: #059669 !important; }
html.light .text-emerald-300 { color: #047857 !important; }

/* ── Headings & semantic text ── */
html.light h1,
html.light h2,
html.light h3 { color: #111827 !important; }

html.light .section-title,
html.light .project-name,
html.light .cred-number { color: #111827 !important; }

/* Body paragraphs — medium grey for hierarchy; NOT !important so inline
   text-gray-400/text-gray-500 classes can still override per-element */
html.light p { color: #4b5563; }

html.light .project-desc,
html.light .timeline-body,
html.light .timeline-sub { color: #6b7280 !important; }

html.light .section-label { color: #059669 !important; }
html.light .timeline-year { color: #059669 !important; }
html.light .tag { color: #4b5563 !important; }
html.light .cred-text { color: #6b7280 !important; }

/* ── Cards ── */
html.light .project-card,
html.light .skill-block,
html.light .contact-card,
html.light .social-card {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

/* skill-block text (was #d1d5db — invisible on white) */
html.light .skill-block { color: #374151 !important; }

html.light .project-card.featured {
  background: linear-gradient(135deg, #fff 0%, #ecfdf5 100%) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
}
html.light .project-card--blue {
  background: linear-gradient(135deg, #fff 0%, #eff6ff 100%) !important;
  border-color: rgba(59, 130, 246, 0.2) !important;
}
html.light .project-card--blue:hover {
  border-color: rgba(59, 130, 246, 0.4) !important;
}
html.light .project-badge--blue {
  color: #2563eb !important;
  background: rgba(59, 130, 246, 0.08) !important;
  border-color: rgba(59, 130, 246, 0.2) !important;
}

html.light .project-card:hover,
html.light .skill-block:hover,
html.light .contact-card:hover,
html.light .social-card:hover {
  border-color: rgba(0, 0, 0, 0.18) !important;
}

html.light .social-card { color: #6b7280 !important; }
html.light .social-card:hover { color: #111827 !important; }

/* ── Project tags & tech pills ── */
html.light .project-tags span {
  color: #6b7280 !important;
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html.light .tech-pill {
  color: #6b7280 !important;
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html.light .tech-pill:hover {
  color: #111827 !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
}
html.light .tech-pill.accent {
  color: #059669 !important;
  background: rgba(16, 185, 129, 0.07) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
}

/* ── Buttons ── */
html.light .btn-primary { background: #111827; color: #ffffff; }
html.light .btn-primary:hover { background: #374151; }

html.light .btn-secondary { color: #374151; border-color: rgba(0, 0, 0, 0.18); }
html.light .btn-secondary:hover {
  border-color: rgba(0, 0, 0, 0.4);
  background: rgba(0, 0, 0, 0.04);
}

html.light .btn-ghost { color: #6b7280; }
html.light .btn-ghost:hover { color: #111827 !important; }

/* ── Icons ── */
html.light .social-icon { color: #9ca3af; }
html.light .social-icon:hover { color: #111827 !important; }

html.light .project-link-icon { color: #9ca3af; }
html.light .project-link-icon:hover,
html.light .project-card:hover .project-link-icon { color: #111827 !important; }

/* ── Icon boxes (quick-facts, community cards) ── */
html.light [class*="bg-emerald-500\/10"] {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
}
html.light [class*="bg-red-500\/10"] {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.2) !important;
}
html.light [class*="bg-pink-500\/10"] {
  background: rgba(236, 72, 153, 0.08) !important;
  border-color: rgba(236, 72, 153, 0.2) !important;
}
html.light [class*="bg-blue-500\/10"] {
  background: rgba(59, 130, 246, 0.08) !important;
  border-color: rgba(59, 130, 246, 0.2) !important;
}

/* ── Contact ── */
html.light .contact-icon {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
}

/* ── Footer ── */
html.light footer {
  border-top-color: rgba(0, 0, 0, 0.08) !important;
}
html.light footer p { color: #9ca3af !important; }

/* ── Timeline ── */
html.light .timeline-item { border-left-color: rgba(0, 0, 0, 0.1); }
html.light .timeline-dot { border-color: #f9fafb; }

/* ── Profile image ring ── */
html.light .border-emerald-500\/30 {
  border-color: rgba(16, 185, 129, 0.3) !important;
  background-color: #f9fafb !important;
}

/* ── Gradient headings ── */
html.light .bg-gradient-to-r.from-white.to-gray-500 {
  background-image: linear-gradient(to right, #111827, #6b7280) !important;
}
/* "Achiever." — from-emerald-400 to-white goes invisible on white bg */
html.light .bg-gradient-to-r.from-emerald-400.to-white {
  background-image: linear-gradient(to right, #059669, #374151) !important;
}

/* ── Shimmer text ── */
html.light .shimmer-text {
  background: linear-gradient(
    90deg,
    #111827 0%,
    #111827 30%,
    #059669 50%,
    #111827 70%,
    #6b7280 100%
  );
  background-size: 250% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: shimmerSweep 3s linear 1.2s 1 both;
}

/* NAV */
.nav-link {
  font-size: 0.875rem;
  color: #6b7280;
  transition: color 0.2s;
  text-decoration: none;
}
.nav-link:hover,
.nav-link.active {
  color: #ffffff;
}

/* BUTTONS */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #ffffff;
  color: #000000;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  text-decoration: none;
  transition:
    background 0.2s,
    transform 0.15s;
}
.btn-primary:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-decoration: none;
  transition:
    border-color 0.2s,
    background 0.2s,
    transform 0.15s;
}
.btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: #9ca3af;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: color 0.2s;
}
.btn-ghost:hover {
  color: #ffffff;
}

/* TAGS */
.tag {
  font-size: 0.8rem;
  color: #9ca3af;
  font-family: "JetBrains Mono", monospace;
}

/* CREDIBILITY */
.cred-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.cred-number {
  font-size: 2rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
}
.cred-text {
  font-size: 0.8rem;
  color: #6b7280;
}

/* SECTION LABELS */
.section-label {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #10b981;
  margin-bottom: 0.5rem;
}
.section-title {
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

/* PROJECT CARDS */
.project-card {
  background: #111111;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition:
    border-color 0.2s,
    transform 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
}
.project-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}
.project-card.featured {
  border-color: rgba(16, 185, 129, 0.2);
  background: linear-gradient(135deg, #111 0%, #0d1f18 100%);
}
.project-card.featured:hover {
  border-color: rgba(16, 185, 129, 0.4);
}
.project-card--blue {
  border-color: rgba(59, 130, 246, 0.2);
  background: linear-gradient(135deg, #111 0%, #0d1525 100%);
}
.project-card--blue:hover {
  border-color: rgba(59, 130, 246, 0.4);
}
.project-badge--blue {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.project-badge {
  font-size: 0.7rem;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.project-link-icon {
  color: #4b5563;
  transition: color 0.2s;
}
.project-link-icon:hover,
.project-card:hover .project-link-icon {
  color: #ffffff;
}
/* Stretched invisible overlay anchored to the card — makes the entire card clickable.
   project-link-icon must stay position:static so ::after is contained by project-card. */
.project-link-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
/* Secondary links (e.g. "View on GitHub") sit above the stretched layer */
.project-card a:not(.project-link-icon) {
  position: relative;
  z-index: 2;
}

.project-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}
.project-desc {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.6;
  flex: 1;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.project-tags span {
  font-size: 0.7rem;
  font-family: "JetBrains Mono", monospace;
  color: #4b5563;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
}

/* SKILL BLOCKS */
.skill-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: #111111;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #d1d5db;
  font-weight: 500;
}
.skill-icon {
  font-size: 1.2rem;
}

/* TECH PILLS */
.tech-pill {
  font-size: 0.8rem;
  font-family: "JetBrains Mono", monospace;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.3rem 0.75rem;
  border-radius: 0.375rem;
  transition:
    color 0.2s,
    border-color 0.2s;
}
.tech-pill:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}
.tech-pill.accent {
  color: #10b981;
  background: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.2);
}

/* SOCIAL ICONS */
.social-icon {
  color: #4b5563;
  transition: color 0.2s;
}
.social-icon:hover {
  color: #ffffff;
}

/* ANIMATIONS */
.fade-in {
  animation: fadeInUp 0.7s ease forwards;
}
.fade-in-delay {
  animation: fadeInUp 0.7s ease 0.3s both;
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── TITLE ANIMATION SYSTEM ──────────────────────────── */

/* 1. CURTAIN REVEAL — index hero (word-by-word slide up) */
.title-curtain {
  overflow: hidden;
  display: inline-block;
  vertical-align: bottom;
  line-height: inherit;
}
.title-curtain-inner {
  display: inline-block;
  transform: translateY(115%);
  opacity: 0;
}
.title-curtain-inner.revealed {
  animation: curtainUp 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes curtainUp {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Gradient shimmer sweep on "Hossain" */
@keyframes shimmerSweep {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 100% center;
  }
}
.shimmer-text {
  background: linear-gradient(
    90deg,
    #ffffff 0%,
    #ffffff 30%,
    #10b981 50%,
    #ffffff 70%,
    #6b7280 100%
  );
  background-size: 250% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
html.light .shimmer-text {
  background: linear-gradient(
    90deg,
    #111827 0%,
    #111827 30%,
    #059669 50%,
    #111827 70%,
    #6b7280 100%
  );
  background-size: 250% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* 2. SCRAMBLE — about page ("Builder. Creator. zZOK.") */
.title-scramble {
  opacity: 0;
}
.title-scramble.scrambling {
  opacity: 1;
}
.scramble-gradient {
  display: inline-block;
  background: linear-gradient(to right, var(--scramble-gradient-start), var(--scramble-gradient-end));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* 3. BLUR-SCALE per letter — projects page */
.title-letters .tl {
  display: inline-block;
  opacity: 0;
  filter: blur(8px);
  transform: scale(0.85) translateY(12px);
}
.title-letters .tl.in {
  animation: letterIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.title-letters .tl.space {
  display: inline-block;
  width: 0.35em;
}
@keyframes letterIn {
  to {
    opacity: 1;
    filter: blur(0px);
    transform: scale(1) translateY(0);
  }
}

/* 4. SKEW SLICE — education page */
.title-slice-line {
  display: block;
  overflow: hidden;
}
.title-slice-inner {
  display: inline-block;
  transform: translateX(-48px) skewX(-8deg);
  opacity: 0;
}
.title-slice-inner.sliced {
  animation: sliceIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes sliceIn {
  to {
    transform: translateX(0) skewX(0deg);
    opacity: 1;
  }
}

/* 5. TYPEWRITER — contact page */
.title-typewriter {
  display: inline;
}
.title-typewriter-word {
  display: inline;
  opacity: 0;
}
.title-typewriter-word.typed {
  animation: wordFadeIn 0.2s ease forwards;
}
@keyframes wordFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.typewriter-caret {
  display: inline-block;
  width: 3px;
  height: 0.85em;
  background: #10b981;
  margin-left: 3px;
  vertical-align: middle;
  border-radius: 1px;
  animation: caretBlink 0.8s step-end infinite;
}
.typewriter-caret.done {
  animation: caretFade 0.5s ease 1s forwards;
}
@keyframes caretBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}
@keyframes caretFade {
  to {
    opacity: 0;
    width: 0;
    margin: 0;
  }
}

/* PAGE HERO (inner pages) */
.page-hero {
  padding-top: 7rem;
  padding-bottom: 4rem;
}

/* TIMELINE */
.timeline-item {
  position: relative;
  padding-left: 2rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 2.5rem;
}
.timeline-item:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}
.timeline-dot {
  position: absolute;
  left: -5px;
  top: 0.35rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #0a0a0a;
}
.timeline-year {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: #10b981;
  margin-bottom: 0.35rem;
}
.timeline-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
}
.timeline-sub {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.25rem;
}
.timeline-body {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.7;
}

/* CONTACT */
.contact-card {
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  transition:
    border-color 0.2s,
    transform 0.2s;
  color: inherit;
}
.contact-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}
.contact-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #10b981;
  flex-shrink: 0;
}

.social-card {
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: #9ca3af;
  font-size: 0.875rem;
  font-weight: 500;
  transition:
    border-color 0.2s,
    color 0.2s,
    transform 0.2s;
}
.social-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  transform: translateY(-1px);
}

/* ─── REDUCED MOTION ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  /* Kill all animations and transitions globally */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* Snap fade-in elements to visible immediately */
  .fade-in,
  .fade-in-delay {
    animation: none;
    opacity: 1;
    transform: none;
  }

  /* Snap scroll-reveal elements to visible */
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* Curtain title — show words immediately */
  .title-curtain-inner {
    transform: none;
    opacity: 1;
    animation: none;
  }

  /* Shimmer text — freeze on static gradient, no sweep */
  .shimmer-text {
    animation: none;
    background-position: 0% center;
  }

  /* Letter-blur title — show letters immediately */
  .title-letters .tl {
    opacity: 1;
    filter: none;
    transform: none;
    animation: none;
  }

  /* Skew-slice title — show lines immediately */
  .title-slice-inner {
    transform: none;
    opacity: 1;
    animation: none;
  }

  /* Typewriter words — show all immediately */
  .title-typewriter-word {
    opacity: 1;
    animation: none;
  }

  /* Typewriter caret — hide it entirely */
  .typewriter-caret {
    display: none;
  }

  /* Suppress hover transforms on cards and buttons */
  .project-card:hover,
  .skill-block:hover,
  .contact-card:hover,
  .social-card:hover,
  .btn-primary:hover,
  .btn-secondary:hover {
    transform: none;
  }
}
