/* ============================================================
   STYLES.CSS – Filip Dusil Personal Website
   Color scheme: Blue + White/Black with dark mode
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
  /* --- Blue palette --- */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;

  /* --- Brand --- */
  --brand-primary: var(--blue-600);
  --brand-primary-light: var(--blue-400);
  --brand-primary-dark: var(--blue-800);
  --brand-gradient: linear-gradient(135deg, var(--blue-600), var(--blue-400));
  --brand-gradient-strong: linear-gradient(135deg, var(--blue-800), var(--blue-500));

  /* --- Light mode colors (default) --- */
  --color-bg: #ffffff;
  --color-bg-alt: #f8fafc;
  --color-bg-card: #ffffff;
  --color-bg-nav: rgba(255, 255, 255, 0.85);
  --color-text: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --color-shadow: rgba(0, 0, 0, 0.08);
  --color-shadow-strong: rgba(0, 0, 0, 0.15);

  /* --- Section bg for "About me" title --- */
  --section-title-bg-opacity: 0.04;

  /* --- Spacing --- */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* --- Typography --- */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', 'Inter', system-ui, sans-serif;

  /* --- Radius --- */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* --- Transitions --- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 200ms var(--ease-out);
  --transition-base: 350ms var(--ease-out);
  --transition-slow: 600ms var(--ease-out);

  /* --- Z-index scale --- */
  --z-nav: 100;
  --z-modal: 200;
  --z-back-to-top: 50;

  color-scheme: light;
}

/* ============================================================
   1b. DARK MODE
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #000000;
    --color-bg-alt: #0a0a0a;
    --color-bg-card: #111111;
    --color-bg-nav: rgba(0, 0, 0, 0.92);
    --color-text: #f1f5f9;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    --color-border: #1a1a1a;
    --color-border-light: #141414;
    --color-shadow: rgba(0, 0, 0, 0.5);
    --color-shadow-strong: rgba(0, 0, 0, 0.8);
    --section-title-bg-opacity: 0.08;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --color-bg: #000000;
  --color-bg-alt: #0a0a0a;
  --color-bg-card: #111111;
  --color-bg-nav: rgba(0, 0, 0, 0.92);
  --color-text: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  --color-border: #1a1a1a;
  --color-border-light: #141414;
  --color-shadow: rgba(0, 0, 0, 0.5);
  --color-shadow-strong: rgba(0, 0, 0, 0.8);
  --section-title-bg-opacity: 0.08;
  color-scheme: dark;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--transition-base), color var(--transition-base);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--brand-primary-light);
}

ul, ol {
  list-style: none;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ============================================================
   3. NAVIGATION
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  background: var(--color-bg-nav);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--color-border-light);
  transition: background-color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

.nav.scrolled {
  box-shadow: 0 4px 30px var(--color-shadow);
}

.nav__inner {
  max-width: 75rem;
  margin: 0 auto;
  padding: 0 var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  transition: color var(--transition-fast);
}

.nav__logo span {
  color: var(--brand-primary);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav__link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--brand-primary);
  transition: width var(--transition-base);
  border-radius: 1px;
}

.nav__link:hover,
.nav__link.active {
  color: var(--brand-primary);
}

.nav__link:hover::after,
.nav__link.active::after {
  width: 100%;
}

.nav__controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast), color var(--transition-fast);
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
}

.nav__btn:hover {
  background: var(--color-bg-alt);
  color: var(--brand-primary);
}

.nav__btn--active {
  background: var(--brand-primary);
  color: #fff;
}

.nav__btn--active:hover {
  background: var(--brand-primary-dark);
  color: #fff;
}

/* Mobile menu */
.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
}

.nav__hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.nav__hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav__hamburger.open span:nth-child(2) {
  opacity: 0;
}

.nav__hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================================
   4. HERO SECTION
   ============================================================ */
.hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem var(--space-xl) var(--space-3xl);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(37, 99, 235, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(96, 165, 250, 0.06) 0%, transparent 50%);
  animation: heroGlow 15s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes heroGlow {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-3%, 3%) rotate(5deg); }
}

.hero__name {
  font-family: var(--font-display);
  font-size: clamp(3rem, 2rem + 6vw, 7rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
  background: var(--brand-gradient-strong);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-md);
  opacity: 0;
  transform: translateY(30px);
  animation: heroReveal 0.8s var(--ease-out) 0.2s forwards;
}

.hero__subtitle {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 0.8rem + 1.5vw, 1.6rem);
  font-weight: 400;
  color: var(--color-text-secondary);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: var(--space-3xl);
  opacity: 0;
  transform: translateY(20px);
  animation: heroReveal 0.8s var(--ease-out) 0.5s forwards;
}

@keyframes heroReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Hero stats --- */
.hero__stats {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  gap: var(--space-xl) 0;
  max-width: 56rem;
  opacity: 0;
  transform: translateY(20px);
  animation: heroReveal 0.8s var(--ease-out) 0.8s forwards;
}

.hero-stat {
  flex: 1 1 14rem;
  max-width: 18rem;
  text-align: center;
  padding: 0 var(--space-xl);
  position: relative;
}

/* Vertical divider between stats */
.hero-stat + .hero-stat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 1px;
  background: var(--color-border);
}

.hero-stat__number {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 2rem + 3vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.hero-stat__suffix {
  color: var(--brand-primary);
}

.hero-stat__label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  line-height: 1.5;
  max-width: 14rem;
  margin: 0 auto;
}

/* Scroll indicator */
.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  opacity: 0;
  animation: heroReveal 0.8s var(--ease-out) 1.2s forwards;
}

.hero__scroll-mouse {
  width: 24px;
  height: 38px;
  border: 2px solid var(--color-text-muted);
  border-radius: 12px;
  position: relative;
}

.hero__scroll-mouse::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: var(--brand-primary);
  animation: scrollDot 2s ease-in-out infinite;
}

@keyframes scrollDot {
  0%, 100% { opacity: 1; transform: translateX(-50%) translateY(0); }
  50% { opacity: 0.3; transform: translateX(-50%) translateY(12px); }
}

/* ============================================================
   5. SECTION SHARED STYLES
   ============================================================ */
.section {
  padding: var(--space-4xl) var(--space-xl);
}

.section--alt {
  background: var(--color-bg-alt);
}

.section__container {
  max-width: 75rem;
  margin: 0 auto;
}

/* Section title with background text */
.section-title {
  text-align: center;
  margin-bottom: var(--space-3xl);
  position: relative;
}

.section-title h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  font-weight: 800;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}

.section-title h2 span {
  color: var(--brand-primary);
}

.section-title .title-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: clamp(4rem, 3rem + 5vw, 8rem);
  font-weight: 900;
  color: var(--color-text);
  opacity: var(--section-title-bg-opacity);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* ============================================================
   6. ABOUT SECTION – Pinned scroll-step reveal
   ============================================================ */

/* Outer wrapper creates the scroll height for the pinned effect */
.about-scroll-wrapper {
  position: relative;
  /* Height set dynamically by JS based on number of cards/steps */
}

/* The visible section sticks to the viewport while user scrolls the wrapper */
.about-pinned {
  position: sticky;
  top: 0;
  min-height: 100dvh;
  max-height: 100dvh;
  display: flex;
  align-items: center;
  overflow: hidden;
  /* Tighter than a normal section – everything has to fit one screen */
  padding-top: 5rem;
  padding-bottom: var(--space-xl);
}

.about-pinned .section-title {
  margin-bottom: var(--space-xl);
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
}

.about__image-wrapper {
  border-radius: var(--radius-xl);
  overflow: hidden;
  aspect-ratio: 9 / 16;
  /* Never taller than the space left on screen next to the text column */
  max-height: min(75vh, calc(100dvh - 16rem));
  box-shadow: 0 25px 60px var(--color-shadow-strong);
}

.about__image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about__image-placeholder {
  width: 100%;
  height: 100%;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  color: rgba(255, 255, 255, 0.3);
}

.about__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  /* Column never exceeds the screen, so the cards stay visible */
  max-height: calc(100dvh - 15rem);
  min-height: 0;
}

.about__text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  /* Keeps the blank line before the "PS:" paragraph */
  white-space: pre-line;
  flex-shrink: 0;
}

/* --- Focus area cards (scroll-step driven) --- */

/* Clipping window – the card stack slides inside it so the active
   card is always on screen, no matter how many cards there are */
.about__cards-viewport {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  /* Fade cards out as they slide up out of view */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.5rem);
  mask-image: linear-gradient(to bottom, transparent 0, #000 1.5rem);
}

.about__cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: transform 0.45s var(--ease-out);
  will-change: transform;
}

.focus-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: opacity 0.45s var(--ease-out),
              transform 0.45s var(--ease-out),
              border-color 0.3s var(--ease-out),
              box-shadow 0.3s var(--ease-out);

  /* Default: hidden */
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
}

/* Step 1: card title visible (collapsed) */
.focus-card.fc--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Step 2: card expanded (title + description) */
.focus-card.fc--expanded {
  border-color: var(--brand-primary-light);
  box-shadow: 0 12px 30px var(--color-shadow);
}

/* Card header (icon + title) – always visible once fc--visible */
.focus-card__header {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
  padding: var(--space-lg) var(--space-xl);
}

.focus-card__icon {
  font-size: 2rem;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-50);
  border-radius: var(--radius-md);
}

:root[data-theme="dark"] .focus-card__icon,
:root:not([data-theme="light"]) .focus-card__icon {
  background: rgba(59, 130, 246, 0.1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .focus-card__icon {
    background: var(--blue-50);
  }
}

.focus-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
}

/* Card body (description) – collapsed by default */
.focus-card__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease-out);
}

.focus-card.fc--expanded .focus-card__body {
  grid-template-rows: 1fr;
}

.focus-card__body-inner {
  overflow: hidden;
}

.focus-card__desc {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  padding: 0 var(--space-xl) var(--space-lg);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.35s var(--ease-out) 0.1s, transform 0.35s var(--ease-out) 0.1s;
}

.focus-card.fc--expanded .focus-card__desc {
  opacity: 1;
  transform: translateY(0);
}

/* Short laptop screens – tighten everything so a whole expanded card fits */
@media (min-width: 48.0625rem) and (max-height: 52rem) {
  .about-pinned {
    padding-top: 4.5rem;
    padding-bottom: var(--space-md);
  }

  .about-pinned .section-title {
    margin-bottom: var(--space-md);
  }

  .about-pinned .section-title h2 {
    font-size: 1.75rem;
  }

  .about__content {
    max-height: calc(100dvh - 11rem);
    gap: var(--space-md);
  }

  .about__text {
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .focus-card__header {
    padding: var(--space-md) var(--space-lg);
  }

  .focus-card__icon {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
  }

  .focus-card__desc {
    font-size: 0.85rem;
    padding: 0 var(--space-lg) var(--space-md);
  }
}

/* --- Scroll progress indicator (right edge) --- */
.about__progress {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 120px;
  background: var(--color-border);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  z-index: 10;
}

.about__progress.visible {
  opacity: 1;
}

.about__progress-bar {
  width: 100%;
  height: 0%;
  background: var(--brand-primary);
  border-radius: 2px;
  transition: height 0.15s linear;
}

/* ============================================================
   7. EXPERIENCE / TWO-COLUMN TIMELINE
   ============================================================ */
.timeline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--space-3xl);
  position: relative;
  max-width: 60rem;
  margin: 0 auto;
}

/* Center vertical line (static track) */
.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
  transform: translateX(-50%);
}

/* Progressive line – grows as the user scrolls through the timeline */
.timeline__line {
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 0%;
  background: linear-gradient(to bottom, var(--blue-400), var(--brand-primary));
  transform: translateX(-50%);
  transition: height 0.2s linear;
  z-index: 0;
  pointer-events: none;
}

/* Column headers */
.timeline__col {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.timeline__col-header {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  text-align: center;
  width: fit-content;
}

.timeline__col--education .timeline__col-header {
  background: rgba(96, 165, 250, 0.1);
  color: var(--blue-400);
}

.timeline__col--work .timeline__col-header {
  background: rgba(37, 99, 235, 0.1);
  color: var(--brand-primary);
}

/* Education column: align items to the right edge */
.timeline__col--education {
  align-items: flex-end;
  text-align: right;
}

/* Work column: align items to the left edge */
.timeline__col--work {
  align-items: flex-start;
  text-align: left;
}

/* Individual timeline items */
.timeline__item {
  position: relative;
  padding-bottom: var(--space-md);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  max-width: 100%;
}

.timeline__item.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Timeline dot – sits on the center line */
.timeline__dot {
  position: absolute;
  top: 0.35rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--color-bg);
  z-index: 1;
}

/* Education dots on the right edge → center line */
.timeline__col--education .timeline__dot {
  right: calc(-1 * var(--space-3xl) / 2 - 7px);
  background: var(--blue-400);
  box-shadow: 0 0 0 3px var(--blue-400);
}

/* Work dots on the left edge → center line */
.timeline__col--work .timeline__dot {
  left: calc(-1 * var(--space-3xl) / 2 - 7px);
  background: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary);
}

.timeline__period {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand-primary);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-xs);
}

.timeline__col--education .timeline__period {
  color: var(--blue-400);
}

.timeline__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 2px;
}

.timeline__company {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

/* Company name linking to the company website */
.timeline__company-link {
  color: var(--brand-primary);
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.timeline__company-link:hover,
.timeline__company-link:focus-visible {
  color: var(--brand-primary-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.timeline__company-ext {
  font-size: 0.85em;
  margin-left: 0.2em;
  opacity: 0.7;
}

.timeline__meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.timeline__desc {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.timeline__desc.timeline__desc--expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.timeline__toggle {
  display: inline-block;
  margin-top: var(--space-xs);
  padding: 0;
  border: none;
  background: none;
  color: var(--brand-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.timeline__toggle:hover {
  color: var(--brand-primary-dark);
}

.timeline__badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  vertical-align: middle;
  margin-left: var(--space-sm);
}

.timeline__badge--current {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

/* ============================================================
   8. PORTFOLIO
   ============================================================ */
.portfolio__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
}

.project-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out),
              box-shadow var(--transition-base), border-color var(--transition-base);
}

.project-card.revealed {
  opacity: 1;
  transform: translateY(0);
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 50px var(--color-shadow-strong);
  border-color: var(--brand-primary-light);
}

.project-card__preview {
  aspect-ratio: 16 / 9;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Sits on top of the initials placeholder – if the file is missing,
   the image element removes itself and the initials stay visible */
.project-card__preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card__preview-placeholder {
  font-size: 2.5rem;
  color: rgba(255, 255, 255, 0.25);
  font-weight: 800;
  font-family: var(--font-display);
}

.project-card__status {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  backdrop-filter: blur(10px);
}

.project-card__status--active {
  background: rgba(34, 197, 94, 0.85);
  color: #fff;
}

.project-card__status--inactive {
  background: rgba(100, 116, 139, 0.85);
  color: #fff;
}

.project-card__body {
  padding: var(--space-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.project-card__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-text);
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.project-card__tag {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-primary);
}

.project-card__actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: auto;
  padding-top: var(--space-md);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn--primary {
  background: var(--brand-primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--brand-primary-dark);
  color: #fff;
  transform: translateY(-1px);
}

.btn--outline {
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.btn--outline:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.btn--link {
  color: var(--brand-primary);
  padding: 0.6rem 0;
}

.btn--link:hover {
  color: var(--brand-primary-dark);
}

/* ============================================================
   9. MODAL (Project Detail)
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
  padding: var(--space-xl);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  max-width: 40rem;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: var(--space-2xl);
  position: relative;
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-base);
  border: 1px solid var(--color-border);
}

.modal-backdrop.open .modal {
  transform: scale(1) translateY(0);
}

.modal__close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
  color: var(--color-text-secondary);
  font-size: 1.2rem;
  transition: all var(--transition-fast);
}

.modal__close:hover {
  background: var(--brand-primary);
  color: #fff;
}

.modal__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: var(--space-md);
  padding-right: 3rem;
}

.modal__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.modal__meta-item {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.modal__meta-item strong {
  color: var(--color-text);
}

.modal__detail {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}

/* --- Structured case study blocks --- */
.modal__section + .modal__section {
  margin-top: var(--space-lg);
}

.modal__section-title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand-primary);
  margin-bottom: var(--space-xs);
}

.modal__list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.modal__list li {
  position: relative;
  padding-left: var(--space-md);
}

.modal__list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand-primary);
  opacity: 0.6;
}

.modal__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* ============================================================
   10. CONTACT SECTION
   ============================================================ */
.contact__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: start;
}

.contact__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.contact__heading {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.3;
  color: var(--color-text);
}

.contact__cta {
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.contact__details {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.contact__item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.contact__icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  background: rgba(37, 99, 235, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.contact__item-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.contact__item-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.contact__item-value a {
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.contact__item-value a:hover {
  color: var(--brand-primary);
}

/* Calendly wrapper */
.contact__calendly {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 500px;
}

.contact__calendly iframe {
  width: 100%;
  height: 500px;
  border: none;
}

/* --- Social links --- */
.social-links {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-md);
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.social-link:hover {
  background: var(--brand-primary);
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

.social-link svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

/* ============================================================
   11. FOOTER
   ============================================================ */
.footer {
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.footer__socials {
  display: flex;
  gap: var(--space-md);
}

.footer__copy {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ============================================================
   12. BACK TO TOP BUTTON
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: var(--z-back-to-top);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity var(--transition-fast), visibility var(--transition-fast), transform var(--transition-fast), background-color var(--transition-fast);
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--brand-primary-dark);
  transform: translateY(-3px);
}

/* ============================================================
   13. RESPONSIVE
   ============================================================ */
@media (max-width: 64rem) {
  .portfolio__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 48rem) {
  .section {
    padding: var(--space-2xl) var(--space-md);
  }

  .nav__links {
    position: fixed;
    top: 4rem;
    left: 0;
    right: 0;
    background: var(--color-bg);
    flex-direction: column;
    padding: var(--space-xl);
    gap: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--transition-base), opacity var(--transition-base), visibility var(--transition-base);
  }

  .nav__links.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav__hamburger {
    display: flex;
  }

  .hero {
    padding: 5rem var(--space-md) var(--space-2xl);
    min-height: 100dvh;
  }

  .hero__stats {
    flex-direction: column;
    align-items: center;
    gap: var(--space-xl);
  }

  .hero-stat {
    flex: 0 0 auto;
    max-width: 100%;
  }

  /* On mobile the divider becomes horizontal above each stat */
  .hero-stat + .hero-stat::before {
    left: 25%;
    top: calc(-1 * var(--space-xl) / 2);
    width: 50%;
    height: 1px;
  }

  /* Mobile: no pinning, everything flows normally */
  .about-pinned {
    max-height: none;
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }

  .about__content {
    max-height: none;
  }

  .about__cards-viewport {
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }

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

  .about__image-wrapper {
    max-height: 50vh;
    aspect-ratio: 3 / 4;
  }

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

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

  .contact__calendly {
    min-height: 400px;
  }

  .contact__calendly iframe {
    height: 400px;
  }

  .timeline {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .timeline::before {
    left: 1rem;
    transform: none;
  }

  .timeline__line {
    left: 1rem;
    transform: none;
  }

  .timeline__col--education,
  .timeline__col--work {
    align-items: flex-start;
    text-align: left;
    padding-left: 3rem;
  }

  .timeline__col--education .timeline__dot,
  .timeline__col--work .timeline__dot {
    left: calc(-3rem + 1rem - 7px);
    right: auto;
  }

  .section-title .title-bg {
    font-size: clamp(2.5rem, 2rem + 3vw, 5rem);
  }

  .modal {
    padding: var(--space-lg);
    margin: var(--space-md);
    max-height: 85vh;
  }

  .social-links {
    justify-content: center;
  }

  .project-card__actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

/* Extra small phones */
@media (max-width: 24rem) {
  .hero__name {
    font-size: clamp(2.2rem, 1.5rem + 5vw, 3.5rem);
  }

  .nav__inner {
    padding: 0 var(--space-md);
  }
}

/* ============================================================
   14. SCROLL ANIMATIONS (CSS-only reveal via IntersectionObserver)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.reveal-stagger.revealed > *:nth-child(1) { transition-delay: 0.1s; }
.reveal-stagger.revealed > *:nth-child(2) { transition-delay: 0.2s; }
.reveal-stagger.revealed > *:nth-child(3) { transition-delay: 0.3s; }
.reveal-stagger.revealed > *:nth-child(4) { transition-delay: 0.4s; }
.reveal-stagger.revealed > *:nth-child(5) { transition-delay: 0.5s; }
.reveal-stagger.revealed > *:nth-child(6) { transition-delay: 0.6s; }

.reveal-stagger.revealed > * {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   15. UTILITIES
   ============================================================ */
.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;
}
