/* ============================================================
   Mustafo Sobirjonov — Portfolio
   Mobile-first · CSS custom properties · Fluid typography
   ============================================================ */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  /* Colors */
  --clr-bg:           #0a0a0a;
  --clr-bg-raised:    #111111;
  --clr-bg-card:      #141416;
  --clr-text-1:       #fafafa;
  --clr-text-2:       #e4e4e7;
  --clr-text-3:       #8a8a93;
  --clr-text-4:       #3f3f46;
  --clr-border:       rgba(255, 255, 255, 0.08);
  --clr-border-md:    rgba(255, 255, 255, 0.12);
  --clr-border-lg:    rgba(255, 255, 255, 0.18);
  --clr-glass:        rgba(16, 16, 18, 0.65);
  --clr-accent:       #ededed;
  --clr-green:        #4ade80;

  /* Fluid type scale */
  --fs-2xs:    clamp(0.65rem,  1.5vw,  0.72rem);
  --fs-xs:     clamp(0.72rem,  1.8vw,  0.8rem);
  --fs-sm:     clamp(0.8rem,   2vw,    0.9rem);
  --fs-base:   clamp(0.95rem,  2.2vw,  1.05rem);
  --fs-md:     clamp(1.05rem,  2.5vw,  1.2rem);
  --fs-lg:     clamp(1.2rem,   3vw,    1.5rem);
  --fs-xl:     clamp(1.5rem,   4vw,    2.25rem);
  --fs-2xl:    clamp(1.8rem,   5vw,    3rem);
  --fs-hero:   clamp(2.75rem,  11vw,   6.5rem);
  --fs-journey:clamp(1.55rem,  4.5vw,  3.4rem);

  /* Fluid spacing */
  --sp-1:   0.25rem;
  --sp-2:   0.5rem;
  --sp-3:   0.75rem;
  --sp-4:   1rem;
  --sp-5:   1.25rem;
  --sp-6:   1.5rem;
  --sp-8:   2rem;
  --sp-10:  2.5rem;
  --sp-12:  3rem;
  --sp-section: clamp(4.5rem, 12vh, 8rem);

  /* Layout */
  --max-w:    1200px;
  --gutter:   clamp(1.25rem, 5vw, 3rem);

  /* Radii */
  --r-sm:   8px;
  --r-md:   clamp(12px, 2vw, 18px);
  --r-lg:   clamp(16px, 3vw, 24px);
  --r-pill: 999px;

  /* Fonts */
  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;

  /* Motion */
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:   cubic-bezier(0.55, 0, 1, 0.45);
  --dur-fast:  0.18s;
  --dur-base:  0.28s;
  --dur-slow:  0.45s;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* `clip` prevents horizontal overflow without creating a new scroll container.
     Unlike `hidden`, it keeps window as the scroller so window.scrollY and
     GSAP's ScrollToPlugin work correctly. */
  overflow-x: clip;

  /* Hide scrollbar — all browsers */
  scrollbar-width: none;
  -ms-overflow-style: none;

  /* Disable elastic/bounce scroll at page boundaries */
  overscroll-behavior: none;
}

html::-webkit-scrollbar { display: none; }

body {
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport on iOS */
  background: var(--clr-bg);
  color: var(--clr-text-2);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.65;

  /* iOS safe area (notch / home bar) */
  padding-bottom: env(safe-area-inset-bottom);

  /* Reinforce no bounce on body as well */
  overscroll-behavior: none;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

img { display: block; max-width: 100%; }
ul  { list-style: none; }

button {
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── Custom cursor ───────────────────────────────────────────── */
.cursor {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  html.has-custom-cursor,
  html.has-custom-cursor * {
    cursor: none !important;
  }

  html.has-custom-cursor .cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
    display: block;
    width: 18px;
    height: 18px;
    border: 1px solid #fff;
    border-radius: var(--r-pill);
    pointer-events: none;
    opacity: 0;
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
    will-change: transform, width, height, border-radius, opacity;
  }

  html.has-custom-cursor .cursor.is-visible {
    opacity: 1;
  }
}

/* ── Utilities ───────────────────────────────────────────────── */
.section-inner {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section-header {
  margin-bottom: clamp(2.5rem, 7vh, 4.5rem);
}

.section-label {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--clr-text-3);
  margin-bottom: var(--sp-4);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-2xl);
  color: var(--clr-text-1);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-8);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  touch-action: manipulation;
  transition:
    background-color var(--dur-base) var(--ease),
    border-color     var(--dur-base) var(--ease),
    color            var(--dur-base) var(--ease),
    transform        var(--dur-base) var(--ease);
  /* iOS min tap target */
  min-height: 44px;
}

.btn:active { transform: scale(0.97); }

@media (hover: hover) {
  .btn:hover { transform: translateY(-2px); }
  .btn:active { transform: translateY(0) scale(0.98); }
}

.btn--primary {
  background: var(--clr-accent);
  color: var(--clr-bg);
}
.btn--primary:hover { background: #fff; }

.btn--ghost {
  color: var(--clr-text-1);
  border-color: var(--clr-border-lg);
}
.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--clr-text-3);
}

.btn--lg {
  padding: var(--sp-5) var(--sp-10);
  font-size: var(--fs-base);
}

/* ── Ambient glow ────────────────────────────────────────────── */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 78% 18%, rgba(120, 120, 140, 0.09), transparent 70%),
    radial-gradient(45% 40% at 12% 90%, rgba(90, 90, 120, 0.07), transparent 70%);
}

/* ── Navigation ──────────────────────────────────────────────── */
.nav-wrap {
  position: sticky;
  top: clamp(0.6rem, 2vw, 1.1rem);
  z-index: 200;
  padding: 0 var(--gutter);
  max-width: calc(var(--max-w) + 2 * var(--gutter));
  margin: 0 auto;
  width: 100%;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-pill);
  background: var(--clr-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 12px 40px -12px rgba(0,0,0,0.85);
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  min-height: 44px;
  min-width: 44px;
}

.nav__brand img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease);
}
.nav__brand:hover img { transform: scale(1.07) rotate(-5deg); }

/* Desktop links (hidden on mobile, shown via media query) */
.nav__links {
  display: none;
  align-items: center;
  gap: var(--sp-1);
}

.nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--clr-text-3);
  transition: color var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}
.nav__link:hover {
  color: var(--clr-text-1);
  background: rgba(255,255,255,0.06);
}

/* Hamburger toggle (visible on mobile) */
.nav__toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 12px;
  border-radius: var(--r-pill);
  transition: background var(--dur-base) var(--ease);
}
.nav__toggle:hover  { background: rgba(255,255,255,0.06); }

.nav__toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--clr-text-1);
  border-radius: 2px;
  transition: transform var(--dur-base) var(--ease), opacity var(--dur-fast) var(--ease);
  transform-origin: center;
}

/* X state when open */
.nav__toggle[aria-expanded="true"] span:first-child {
  transform: translateY(3.25px) rotate(45deg);
}
.nav__toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

/* ── Mobile nav overlay ──────────────────────────────────────── */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 190;
  background: rgba(10, 10, 10, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-10);
  padding: var(--sp-12) var(--gutter);

  opacity: 0;
  visibility: hidden;
  transition:
    opacity  var(--dur-slow) var(--ease),
    visibility 0s var(--dur-slow);
}

.nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition:
    opacity var(--dur-slow) var(--ease),
    visibility 0s 0s;
}

.nav-overlay__list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  text-align: center;
}

.nav-overlay__list a {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--clr-text-1);
  letter-spacing: -0.02em;
  padding: var(--sp-3) var(--sp-8);
  min-height: 64px;
  transition: color var(--dur-base) var(--ease);
}
.nav-overlay__list a:hover { color: var(--clr-text-3); }

.nav-overlay__resume {
  margin-top: var(--sp-4);
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  padding: clamp(2rem, 8vh, 5rem) var(--gutter) clamp(3rem, 8vh, 5rem);
  max-width: var(--max-w);
  margin: 0 auto;
}

.hero__inner {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 4vw, 3rem);
}

.hero__portrait {
  display: flex;
  justify-content: center;
}

.portrait {
  width: clamp(140px, 45vw, 240px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,0.5));
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clr-text-3);
  margin-bottom: var(--sp-6);
}

.hero__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--clr-green);
  flex-shrink: 0;
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(74,222,128,0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0   rgba(74,222,128,0); }
}

.hero__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-hero);
  color: var(--clr-text-1);
  line-height: 0.93;
  letter-spacing: -0.035em;
  margin-bottom: var(--sp-6);
}

.hero__subtitle {
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--clr-text-2);
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-5);
}

.hero__lede {
  font-size: var(--fs-base);
  color: var(--clr-text-3);
  line-height: 1.7;
  max-width: 34rem;
  margin-bottom: var(--sp-10);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
}

/* ── Journey ─────────────────────────────────────────────────── */
.journey {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--clr-bg);
}

.journey__stage {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 0 var(--gutter);
}

.journey__logos {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.journey__logo {
  --logo-glow: rgba(255, 255, 255, 0.2);
  position: absolute;
  top: 100%;
  left: 50%;
  width: min(105vw, 1350px);
  max-width: none;
  max-height: none;
  object-fit: contain;
  opacity: 0;
  filter:
    blur(4px)
    drop-shadow(0 0 30px var(--logo-glow))
    drop-shadow(0 0 68px var(--logo-glow));
  will-change: transform, opacity, filter;
  backface-visibility: hidden;
}

.journey__logo--doit {
  --logo-glow: rgba(55, 180, 105, 0.34);
  width: min(105vw, 1350px);
}

.journey__logo--csu {
  --logo-glow: rgba(200, 168, 92, 0.28);
  width: min(158vw, 2020px);
}

.journey__logo--artel {
  --logo-glow: rgba(238, 36, 52, 0.32);
  width: min(124vw, 1590px);
}

.journey__label {
  position: absolute;
  top: clamp(5rem, 10vh, 7.5rem);
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--clr-text-3);
  white-space: nowrap;
}

.journey__steps {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 860px;
  display: grid;
  place-items: center;
}

.journey__step {
  grid-area: 1 / 1;
  text-align: center;
  visibility: hidden;
  will-change: transform, opacity;
  padding: 0 var(--sp-4);
}

.journey__kicker {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clr-text-3);
  margin-bottom: var(--sp-6);
}

.journey__line {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--clr-text-1);
  font-size: var(--fs-journey);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.journey__line em {
  font-style: normal;
  background: linear-gradient(180deg, #ffffff, #c0c0ca);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.journey__hint {
  position: absolute;
  z-index: 3;
  bottom: clamp(1.75rem, 5vh, 3rem);
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--clr-text-3);
  opacity: 0.65;
  white-space: nowrap;
}

.journey__hint::after {
  content: "";
  display: block;
  width: 1px;
  height: 24px;
  margin: var(--sp-3) auto 0;
  background: linear-gradient(to bottom, var(--clr-text-3), transparent);
  animation: scrollHint 2s var(--ease) infinite;
  transform-origin: top;
}

@keyframes scrollHint {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

@media (max-width: 639px) {
  .journey__logo {
    top: 50%;
    max-height: none;
    filter:
      blur(3px)
      drop-shadow(0 0 22px var(--logo-glow))
      drop-shadow(0 0 46px var(--logo-glow));
  }

  .journey__logo--doit {
    width: min(96vw, 385px);
  }

  .journey__logo--csu {
    width: min(144vw, 560px);
  }

  .journey__logo--artel {
    width: min(114vw, 445px);
  }
}

/* ── About ───────────────────────────────────────────────────── */
.about {
  padding: var(--sp-section) 0;
  border-top: 1px solid var(--clr-border);
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 8vw, 5rem);
}

.about__bio p {
  color: var(--clr-text-3);
  font-size: var(--fs-md);
  line-height: 1.75;
  margin-bottom: var(--sp-5);
}

.about__resume-btn { margin-top: var(--sp-6); }

.about__sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
}

.about__detail-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--clr-text-3);
  margin-bottom: var(--sp-4);
}

.about__detail-value {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--clr-text-1);
  margin-bottom: var(--sp-2);
}

.about__detail-sub {
  font-size: var(--fs-sm);
  color: var(--clr-text-3);
  line-height: 1.6;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.skill-tag {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 var(--sp-4);
  background: var(--clr-bg-card);
  border: 1px solid var(--clr-border-md);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--clr-text-2);
}

/* ── Projects ────────────────────────────────────────────────── */
.projects {
  padding: var(--sp-section) 0;
  border-top: 1px solid var(--clr-border);
}

.projects__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}

.project-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--clr-bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-lg);
  transition:
    border-color var(--dur-base) var(--ease),
    background   var(--dur-base) var(--ease),
    transform    var(--dur-base) var(--ease);
}

@media (hover: hover) {
  .project-card:hover {
    border-color: var(--clr-border-lg);
    background: #1a1a1d;
    transform: translateY(-3px);
  }
}

.project-card:active {
  transform: scale(0.99);
}

.project-card__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.project-card__year {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--clr-text-3);
}

.project-card__type {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--clr-text-3);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-pill);
  padding: 2px var(--sp-3);
}

.project-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-xl);
  color: var(--clr-text-1);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: var(--sp-4);
}

.project-card__desc {
  font-size: var(--fs-sm);
  color: var(--clr-text-3);
  line-height: 1.7;
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--clr-border);
}

.project-card__tags span {
  font-size: var(--fs-2xs);
  font-weight: 500;
  color: var(--clr-text-3);
  letter-spacing: 0.04em;
}

/* ── Experience ──────────────────────────────────────────────── */
.experience {
  padding: var(--sp-section) 0;
  border-top: 1px solid var(--clr-border);
}

.exp-list {
  display: flex;
  flex-direction: column;
  list-style: none;
}

.exp-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  padding: clamp(1.5rem, 4vw, 2.25rem) 0;
  border-bottom: 1px solid var(--clr-border);
}

.exp-item__period {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--clr-text-3);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.exp-item__role {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--clr-text-1);
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-2);
}

.exp-item__org {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--clr-text-3);
  margin-bottom: var(--sp-4);
}

.exp-item__desc {
  font-size: var(--fs-sm);
  color: var(--clr-text-3);
  line-height: 1.7;
}

/* ── Contact ─────────────────────────────────────────────────── */
.contact {
  padding: var(--sp-section) 0 calc(var(--sp-section) * 1.2);
  border-top: 1px solid var(--clr-border);
}

.contact__inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-6);
}

.contact__title {
  font-size: var(--fs-2xl);
}

.contact__sub {
  font-size: var(--fs-base);
  color: var(--clr-text-3);
  max-width: 28rem;
}

.contact__links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--clr-text-3);
}

.contact__links a {
  transition: color var(--dur-base) var(--ease);
}
.contact__links a:hover { color: var(--clr-text-1); }

.contact__socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-5);
  margin-top: var(--sp-2);
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-pill);
  border: 1px solid var(--clr-border-md);
  color: var(--clr-text-3);
  transition: color var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease),
              background var(--dur-base) var(--ease);
}

.social-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

@media (hover: hover) {
  .social-icon:hover {
    color: var(--clr-text-1);
    border-color: var(--clr-border-lg);
    background: var(--clr-bg-raised);
  }
}

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  padding: var(--sp-8) 0 calc(var(--sp-8) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--clr-border);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--clr-text-4);
}

/* ── Tablet+ layout upgrades ─────────────────────────────────── */
@media (min-width: 640px) {
  /* Nav: show links, hide hamburger */
  .nav__links  { display: flex; }
  .nav__toggle { display: none; }

  /* Pinned sections: fill the viewport and vertically center their content
     so GSAP's pin locks onto a full-screen, centered stage (like Journey) —
     no awkward top-aligned block with empty space below. */
  .about,
  .projects,
  .experience,
  .contact {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    align-content: center;
    overflow: hidden;
  }
  /* Experience entries are stacked into one cell by JS so they cross-fade one
     at a time; without JS they stay in normal flow and all remain readable. */

  /* Hero: full-viewport stage so its pin locks onto a centered screen, like
     the other sections. overflow:hidden cleanly clips the scroll-exit. */
  .hero {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    padding-top: clamp(1.5rem, 4vh, 3rem);
    padding-bottom: clamp(1.5rem, 4vh, 3rem);
  }

  /* Hero: side-by-side */
  .hero__inner {
    flex-direction: row;
    align-items: center;
  }

  .hero__content { flex: 1 1 0; }

  .hero__portrait {
    flex: 0 0 auto;
    justify-content: flex-end;
  }

  /* Size the tall cut-out by height (not width) so the whole hero fits the
     viewport on any screen — keeps the figure prominent without overflowing. */
  .portrait {
    width: auto;
    height: clamp(340px, 62vh, 460px);
    max-width: 42vw;
  }

  /* Projects: 2-col */
  .projects__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Experience: date on left */
  .exp-item {
    grid-template-columns: 10rem 1fr;
    gap: var(--sp-8);
    align-items: start;
  }
}

/* ── Desktop layout upgrades ─────────────────────────────────── */
@media (min-width: 1024px) {
  /* Hero: bigger portrait (still height-driven so the hero fits the viewport) */
  .portrait {
    width: auto;
    height: clamp(480px, 82vh, 700px);
    max-width: 48vw;
    filter: drop-shadow(0 40px 70px rgba(0,0,0,0.6));
  }

  /* About: 2-col */
  .about__grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  /* Projects: 3-col */
  .projects__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Experience: wider date column */
  .exp-item {
    grid-template-columns: 12rem 1fr;
  }
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__dot,
  .journey__hint::after { animation: none; }
  .btn,
  .project-card { transition: none; }

  /* Journey: unpin, show all steps as a list */
  .journey {
    height: auto;
    padding: clamp(4rem, 10vh, 7rem) 0;
  }
  .journey__stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(3rem, 8vh, 5rem);
    padding: 0 var(--gutter);
  }
  .journey__label { position: static; transform: none; }
  .journey__steps { gap: clamp(3rem, 8vh, 5rem); }
  .journey__step  { grid-area: auto; visibility: visible; opacity: 1; }
  .journey__logos,
  .journey__hint  { display: none; }
}


/* ═══════════════════════════════════════════════════════════════
   Terminal Easter Egg
   ═══════════════════════════════════════════════════════════════ */

.terminal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 10, 0.97);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  transform: translateY(-100%);
  will-change: transform, opacity;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, 'Cascadia Mono', 'Courier New', monospace;
}

/* ── Chrome bar ── */
.terminal__chrome {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.terminal__dots {
  display: flex;
  gap: 6px;
}
.terminal__dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.terminal__dots span:nth-child(2) { background: #ffbd2e; }
.terminal__dots span:nth-child(3) { background: #28c840; }

/* Red dot is the close button */
.terminal__dot-close {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f57;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter 0.15s;
}
.terminal__dot-close:hover { filter: brightness(0.65); }

.terminal__title {
  flex: 1;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.25);
}

/* ── Scrollable body ── */
.terminal__body {
  flex: 1;
  overflow-y: auto;
  padding: 2.2rem clamp(1.5rem, 5vw, 4rem) 4rem;
  scrollbar-width: none;
}
.terminal__body::-webkit-scrollbar { display: none; }

/* ── Output lines ── */
.terminal__output {
  max-width: 840px;
  font-size: clamp(0.72rem, 1.3vw, 0.84rem);
  line-height: 1.9;
  color: #c8d3f5;
}

.t-line {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Tag labels ── */
.t-tag {
  font-weight: 700;
  letter-spacing: 0.03em;
}
.t-prompt   { color: #89ddff; }
.t-sys      { color: #89ddff; }
.t-data     { color: #c3e88d; }
.t-academic { color: #c3e88d; }
.t-athletic { color: #ffcb6b; }
.t-projects { color: #c792ea; }
.t-critical { color: #ff5370; }

/* ── Inline accents ── */
.t-ok     { color: #c3e88d; }
.t-hi     { color: #ffcb6b; }
.t-bar    { color: #c792ea; letter-spacing: -1px; }
.t-status { color: #c3e88d; font-weight: 600; }

/* ── JSON syntax ── */
.t-key   { color: #89ddff; }
.t-str   { color: #c3e88d; }
.t-brace { color: rgba(255, 255, 255, 0.45); }

/* ── Blinking block cursor ── */
.t-cursor {
  display: inline-block;
  color: #89ddff;
  animation: t-blink 1.1s step-end infinite;
}
@keyframes t-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Footer mobile trigger ── */
.terminal__trigger {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 0.28rem 0.65rem;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.18);
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  border-radius: 4px;
  transition: color 0.2s, border-color 0.2s;
}
.terminal__trigger:hover {
  color: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.18);
}
