/* ==========================================================================
   Md. Rockibul Islam Khan — portfolio
   ========================================================================== */

:root {
  --bg:            #05070f;
  --bg-alt:        #080b17;
  --surface:       rgba(8, 11, 23, 0.62);
  --surface-hi:    rgba(8, 11, 23, 0.78);
  --line:          rgba(255, 255, 255, 0.09);
  --line-hi:       rgba(56, 232, 225, 0.38);

  --text:          #e8ecf6;
  --text-dim:      #9aa5bd;
  --text-faint:    #6b7794;

  --cyan:          #38e8e1;
  --violet:        #8b7bff;
  --amber:         #ffc46b;

  --grad: linear-gradient(115deg, var(--cyan), var(--violet));

  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body:    'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;

  --wrap: 1160px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;

  --nav-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  max-width: 100%;
  overflow-x: clip;
  position: relative;
}

/* Fixed photo background — content stacks above */
.bg-slideshow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-slideshow__slide {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity var(--bg-crossfade, 1.4s) ease;
}
.bg-slideshow__slide.is-active {
  z-index: 1;
  opacity: 1;
}
.bg-slideshow.is-instant .bg-slideshow__slide {
  transition: none;
}
.bg-slideshow__veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(5, 7, 15, 0.55) 0%, rgba(5, 7, 15, 0.72) 45%, rgba(5, 7, 15, 0.88) 100%),
    radial-gradient(70% 50% at 80% 20%, rgba(139, 123, 255, 0.18), transparent 60%),
    radial-gradient(55% 45% at 10% 80%, rgba(56, 232, 225, 0.12), transparent 65%);
}

/* Keep fixed nav/rail intact — only lift scrolling content above the bg */
main,
.footer {
  position: relative;
  z-index: 1;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); line-height: 1.15; font-weight: 700; }
p { margin: 0; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1em; height: 1em; flex: none; }
.accent {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.25rem;
  box-sizing: border-box;
}

.skip-link {
  position: absolute; left: 50%; top: -60px; transform: translateX(-50%);
  z-index: 200; padding: .6rem 1.1rem; border-radius: 0 0 var(--r-sm) var(--r-sm);
  background: var(--cyan); color: #04121a; font-weight: 600;
  transition: top .2s var(--ease);
}
.skip-link:focus-visible { top: 0; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --------------------------------------------------------- Navigation --- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  width: 100%;
  max-width: 100%;
  height: var(--nav-h);
  box-sizing: border-box;
  transition: background .35s var(--ease), border-color .35s var(--ease), backdrop-filter .35s;
  border-bottom: 1px solid transparent;
}
.nav.is-stuck {
  background: rgba(5, 7, 15, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--line);
}
.nav__inner {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  height: 100%;
  padding-inline: max(1.25rem, env(safe-area-inset-left, 0px))
                  max(1.25rem, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-width: 0;
}
.nav__brand {
  display: flex; align-items: center; gap: .65rem;
  min-width: 0; flex: 1 1 auto;
  font-family: var(--font-display); font-weight: 700;
}
.nav__brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  overflow: hidden; flex: none;
  border: 1px solid var(--line);
  background: rgba(8, 11, 23, 0.55);
}
.nav__brand-mark img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.nav__brand-text {
  font-size: 1.02rem; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: 0 1 auto;
  justify-content: flex-end;
  min-width: 0;
}
.nav__link {
  position: relative;
  padding: .5rem .85rem; border-radius: 999px;
  font-size: .875rem; font-weight: 500; color: var(--text-dim);
  transition: color .25s var(--ease), background .25s var(--ease);
}
.nav__link:hover { color: var(--text); background: var(--surface); }
.nav__link.is-active { color: var(--text); }
.nav__link.is-active::after {
  content: ''; position: absolute; left: 50%; bottom: 2px;
  width: 16px; height: 2px; border-radius: 2px;
  transform: translateX(-50%);
  background: var(--grad);
}

.nav__toggle {
  display: none;
  width: 44px; height: 44px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface);
  padding: 11px 10px;
  flex: none;
  margin-left: auto;
}
.nav__toggle span {
  display: block; height: 2px; border-radius: 2px; background: var(--text);
  transition: transform .3s var(--ease), opacity .2s var(--ease);
}
.nav__toggle span + span { margin-top: 5px; }
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* -------------------------------------------------------- Social rail --- */

.rail {
  position: fixed; left: 1.35rem; bottom: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: .85rem;
  padding-bottom: 1.5rem;
}
.rail::after {
  content: ''; width: 1px; height: 88px;
  background: linear-gradient(to bottom, var(--line), transparent);
}
.rail__link {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
  color: var(--text-faint); font-size: 1rem;
  border: 1px solid transparent;
  transition: transform .3s var(--ease), color .3s var(--ease),
              border-color .3s var(--ease), background .3s var(--ease);
}
.rail__link:hover {
  color: var(--cyan);
  background: var(--surface);
  border-color: var(--line-hi);
  transform: translateY(-4px) rotateX(12deg) rotateY(-12deg) scale(1.06);
}

/* --------------------------------------------------------------- Hero --- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--nav-h) + 3rem) 0 5rem;
  overflow: hidden;
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero.no-webgl .hero__canvas { display: none; }
.hero__veil {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(70% 55% at 78% 28%, rgba(139, 123, 255, .18), transparent 65%),
    radial-gradient(55% 45% at 12% 72%, rgba(56, 232, 225, .12), transparent 70%),
    linear-gradient(to bottom, transparent 40%, rgba(5, 7, 15, 0.55) 100%);
}
.hero.no-webgl .hero__veil {
  background:
    radial-gradient(70% 55% at 78% 28%, rgba(139, 123, 255, .22), transparent 65%),
    radial-gradient(55% 45% at 12% 72%, rgba(56, 232, 225, .16), transparent 70%),
    linear-gradient(to bottom, transparent 30%, rgba(5, 7, 15, 0.5) 100%);
}

.hero__inner {
  position: relative; z-index: 2;
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  padding-inline: 1.25rem;
  box-sizing: border-box;
}

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .35rem .85rem .35rem .6rem; margin-bottom: 1.4rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); backdrop-filter: blur(8px);
  font-size: .78rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-dim);
}
.pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 0 0 rgba(56, 232, 225, .6);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  70%  { box-shadow: 0 0 0 9px rgba(56, 232, 225, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 232, 225, 0); }
}

.hero__name {
  font-size: clamp(2.5rem, 6.2vw, 4.5rem);
  letter-spacing: -.035em;
  margin-bottom: .7rem;
}
.hero__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.05rem, 2.1vw, 1.4rem);
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 1.1rem;
}
.hero__tagline {
  max-width: 46ch; color: var(--text-dim); font-size: 1.02rem;
  margin-bottom: 2rem;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: .85rem; margin-bottom: 2.75rem; }

.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .8rem 1.4rem; border-radius: 999px;
  font-weight: 600; font-size: .92rem; white-space: nowrap;
  border: 1px solid transparent;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease),
              background .25s var(--ease), border-color .25s var(--ease);
}
.btn--lg { padding: .95rem 1.8rem; font-size: 1rem; }
.btn--primary {
  background: var(--grad); color: #04121a;
  box-shadow: 0 10px 30px -12px rgba(56, 232, 225, .65);
}
.btn--primary:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -14px rgba(56, 232, 225, .8); }
.btn--ghost { border-color: var(--line); background: var(--surface); color: var(--text); }
.btn--ghost:hover { border-color: var(--line-hi); background: var(--surface-hi); transform: translateY(-3px); }

.hero__stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem;
  max-width: 560px;
}
.hero__stat-value {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  letter-spacing: -.02em; line-height: 1.1;
}
.hero__stat-label {
  font-size: .74rem; color: var(--text-faint);
  letter-spacing: .04em; line-height: 1.4; margin-top: .2rem;
}

.hero__scroll {
  position: absolute; left: 50%; bottom: 1.6rem; z-index: 3;
  transform: translateX(-50%);
}
.hero__mouse {
  display: block; width: 24px; height: 38px;
  border: 2px solid var(--line); border-radius: 14px;
  position: relative;
}
.hero__mouse::after {
  content: ''; position: absolute; left: 50%; top: 7px;
  width: 3px; height: 7px; border-radius: 2px; background: var(--cyan);
  translate: -50% 0;
  animation: wheel 1.8s ease-in-out infinite;
}
@keyframes wheel {
  0%   { opacity: 0; translate: -50% 0; }
  35%  { opacity: 1; }
  100% { opacity: 0; translate: -50% 13px; }
}

/* ----------------------------------------------------------- Sections --- */

.section {
  padding: clamp(4.5rem, 9vw, 7.5rem) 0;
  position: relative;
  overflow-x: clip;
  max-width: 100%;
}
.section--alt {
  background: rgba(8, 11, 23, 0.42);
  backdrop-filter: blur(2px);
}
.section--alt::before, .section--alt::after {
  content: ''; position: absolute; left: 0; right: 0; height: 1px;
  background: linear-gradient(to right, transparent, var(--line), transparent);
}
.section--alt::before { top: 0; }
.section--alt::after { bottom: 0; }

.section__head { max-width: 640px; margin-bottom: 3rem; }
.section__head--center { margin-inline: auto; text-align: center; }
.section__kicker {
  font-family: var(--font-display); font-size: .8rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--cyan);
  margin-bottom: .8rem;
}
.section__title { font-size: clamp(1.85rem, 4.2vw, 2.9rem); letter-spacing: -.03em; }
.section__note { margin-top: 1rem; color: var(--text-dim); font-size: .95rem; }

/* Reveal on scroll */
.reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* -------------------------------------------------------------- About --- */

.about { max-width: 68ch; }
.about__lead { font-size: 1.05rem; color: var(--text-dim); }
.about__facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.5rem 2rem; margin-top: 2.5rem;
  padding-top: 2.5rem; border-top: 1px solid var(--line);
}
.about__facts dt {
  font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .3rem;
}
.about__facts dd { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }

/* ------------------------------------------------------------- Skills --- */

.grid { display: grid; gap: 1.25rem; }

.card {
  position: relative;
  padding: 1.6rem;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform-style: preserve-3d;
  transition: transform .3s var(--ease), border-color .3s var(--ease), background .3s var(--ease);
}
.card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), rgba(56,232,225,.1), transparent 62%);
  opacity: 0; transition: opacity .3s var(--ease); pointer-events: none;
}
.card:hover { border-color: var(--line-hi); background: var(--surface-hi); }
.card:hover::before { opacity: 1; }

.card__icon {
  display: grid; place-items: center;
  width: 42px; height: 42px; margin-bottom: 1rem;
  border-radius: 12px; font-size: 1.25rem;
  background: linear-gradient(140deg, rgba(56,232,225,.16), rgba(139,123,255,.16));
  border: 1px solid var(--line);
  color: var(--cyan);
  transform: translateZ(28px);
}
.card__title {
  font-size: 1.05rem; margin-bottom: .9rem; letter-spacing: -.01em;
  transform: translateZ(18px);
}
.chips {
  display: flex; flex-wrap: wrap; gap: .4rem;
  align-items: flex-start; align-content: flex-start;
  transform: translateZ(10px);
}
.chip {
  padding: .3rem .7rem; border-radius: 999px;
  background: rgba(255,255,255,.045); border: 1px solid var(--line);
  font-size: .78rem; color: var(--text-dim); white-space: nowrap;
}

/* Compact skill cards — content is short, so keep the frame tight. */
.card--skill {
  padding: 1.25rem 1.3rem;
  justify-content: flex-start;
  gap: 0;
}
.card--skill .card__icon {
  width: 36px; height: 36px; margin-bottom: .75rem; font-size: 1.05rem;
}
.card--skill .card__title {
  font-size: 1rem; margin-bottom: .75rem;
}
.card--skill .chips { gap: .35rem; }
.card--skill .chip { padding: .25rem .6rem; font-size: .74rem; }

/* ------------------------------------------------- 3D card deck (all) --- */
/* Card size and geometry come from deckSettings in js/data.js. */

.section--deck .section__head { margin-bottom: 2.25rem; }

.deck {
  --card-w: 420px;
  --card-h: 460px;
  position: relative;
  touch-action: pan-y;
  outline: none;
  margin-bottom: 1.5rem;
  overflow: hidden;
  max-width: 100%;
}
.deck:focus-visible { outline: none; }
.deck:focus-visible .deck__stage {
  box-shadow: inset 0 0 0 1px var(--line-hi);
  border-radius: var(--r-md);
}

.deck__stage {
  position: relative;
  height: calc(var(--card-h) + 4rem);
  perspective: none;
  cursor: grab;
  display: grid;
  place-items: center;
  overflow: hidden;
  max-width: 100%;
}
.deck__stage::after {
  content: '';
  position: absolute; left: 50%; bottom: 0.6rem;
  width: min(70%, 380px); height: 24px;
  translate: -50% 0;
  background: radial-gradient(ellipse at center, rgba(56, 232, 225, 0.12), transparent 72%);
  pointer-events: none; z-index: 0;
}
.deck.is-dragging .deck__stage { cursor: grabbing; }

.deck__track {
  position: absolute; inset: 0;
  z-index: 1;
}

.deck__card {
  position: absolute; left: 50%; top: 50%;
  width: var(--card-w); height: var(--card-h);
  will-change: transform, opacity;
  filter: drop-shadow(0 24px 36px rgba(0, 0, 0, 0.5));
  transition: none;
}
.deck__card > * {
  display: flex; flex-direction: column;
  width: 100%; height: 100%;
  margin: 0;
}
.deck__card.is-front > * {
  border-color: var(--line-hi);
  box-shadow: 0 0 0 1px rgba(56, 232, 225, 0.12);
}
.deck__card > *:hover { transform: none; }

.deck__scroll {
  flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding-right: .5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line-hi) transparent;
}
.deck__scroll::-webkit-scrollbar { width: 6px; }
.deck__scroll::-webkit-scrollbar-thumb {
  background: var(--line-hi); border-radius: 999px;
}
.deck__scroll::-webkit-scrollbar-track { background: transparent; }
.deck__card.is-front .deck__scroll { cursor: auto; }

/* --------------------------------------------------------- Experience --- */

.job { display: flex; flex-direction: column; }
.job--current { border-color: rgba(56,232,225,.24); }
.job__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem 1rem; margin-bottom: .35rem; }
.job__role { font-size: 1.25rem; letter-spacing: -.02em; }
.job__period {
  padding: .22rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: .75rem; color: var(--text-dim); white-space: nowrap;
}
.job--current .job__period { border-color: var(--line-hi); color: var(--cyan); }
.job__company { color: var(--text-dim); font-size: .95rem; margin-bottom: 1.2rem; }
.job__company strong { color: var(--text); font-weight: 600; }
.job__bullets { display: grid; gap: .7rem; }
.job__bullets li {
  position: relative; padding-left: 1.5rem;
  color: var(--text-dim); font-size: .94rem;
}
.job__bullets li::before {
  content: ''; position: absolute; left: 0; top: .62em;
  width: 7px; height: 7px; border-radius: 2px;
  background: var(--grad); rotate: 45deg;
}

/* ----------------------------------------------------------- Projects --- */

.project { display: flex; flex-direction: column; gap: .9rem; }
.project--featured {
  background: linear-gradient(140deg, rgba(56,232,225,.07), rgba(139,123,255,.07));
  border-color: rgba(56,232,225,.22);
}
.project__top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; transform: translateZ(20px); }
.project__badge {
  padding: .28rem .7rem; border-radius: 999px;
  background: rgba(56,232,225,.12); border: 1px solid rgba(56,232,225,.3);
  font-family: var(--font-display); font-size: .7rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--cyan);
  white-space: nowrap;
}
.project--featured .project__badge {
  background: rgba(255,196,107,.12); border-color: rgba(255,196,107,.32); color: var(--amber);
}
.project__num {
  font-family: var(--font-display); font-size: .8rem; color: var(--text-faint);
}
.project__title { font-size: 1.15rem; letter-spacing: -.02em; transform: translateZ(16px); }
.project__summary { color: var(--text-dim); font-size: .92rem; flex: 1; }

/* -------------------------------------------------------- Credentials --- */

.cred {
  padding: 1.75rem; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.cred:hover { border-color: var(--line-hi); }
.deck__card > .cred:hover { transform: none; }
.cred__icon {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 11px; margin-bottom: 1.1rem; font-size: 1.2rem;
  background: linear-gradient(140deg, rgba(56,232,225,.16), rgba(139,123,255,.16));
  border: 1px solid var(--line); color: var(--cyan);
}
.cred__label {
  font-size: .74rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: .75rem;
}
.cred__title { font-size: 1.05rem; margin-bottom: .3rem; letter-spacing: -.01em; }
.cred__sub { color: var(--text-dim); font-size: .9rem; }
.cred__period { color: var(--cyan); font-size: .82rem; font-family: var(--font-display); margin-top: .5rem; }
.cred__list { display: grid; gap: .85rem; }
.cred__list li { display: flex; align-items: flex-start; gap: .65rem; font-size: .9rem; color: var(--text-dim); }
.cred__dot { width: 7px; height: 7px; margin-top: .55em; border-radius: 50%; background: var(--violet); flex: none; }
.cred__code { color: var(--text-faint); font-size: .8rem; }

/* ------------------------------------------------------------ Contact --- */

.section--contact { padding-bottom: clamp(4rem, 8vw, 6rem); }
.contact { display: grid; justify-items: center; gap: 2rem; }
.contact__resume {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .85rem;
}
.contact__list {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem;
}
.contact__item {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .75rem 1.25rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: .92rem; color: var(--text-dim);
  transition: transform .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
a.contact__item:hover { color: var(--text); border-color: var(--line-hi); transform: translateY(-3px); }
.contact__item .icon { font-size: 1.05rem; color: var(--cyan); }

.contact__socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; perspective: 700px; }
.social-card {
  display: grid; place-items: center; gap: .55rem;
  width: 138px; padding: 1.15rem .6rem;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); text-align: center;
  transform-style: preserve-3d;
  transition: transform .35s var(--ease), border-color .35s var(--ease), background .35s var(--ease);
}
.social-card .icon { font-size: 1.5rem; color: var(--text-dim); transition: color .3s var(--ease); }
.social-card__label { font-family: var(--font-display); font-size: .82rem; font-weight: 600; }
.social-card__handle { font-size: .68rem; color: var(--text-faint); overflow-wrap: anywhere; }
.social-card:hover {
  transform: translateY(-8px) rotateX(14deg) rotateY(-14deg);
  border-color: var(--line-hi); background: var(--surface-hi);
}
.social-card:hover .icon { color: var(--cyan); }

/* ------------------------------------------------------------- Footer --- */

.footer { padding: 2.5rem 0 3rem; border-top: 1px solid var(--line); background: rgba(8, 11, 23, 0.55); }
.footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem; }
.footer__name { font-family: var(--font-display); font-weight: 600; font-size: .92rem; }
.footer__meta { font-size: .82rem; color: var(--text-faint); }
.footer__socials { display: flex; gap: .5rem; }
.footer__socials a {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 10px; color: var(--text-faint);
  border: 1px solid transparent;
  transition: color .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease);
}
.footer__socials a:hover { color: var(--cyan); border-color: var(--line-hi); transform: translateY(-3px); }

/* -------------------------------------------------------- Breakpoints --- */

@media (max-width: 1080px) {
  .rail { display: none; }
}

@media (max-width: 900px) {
  .hero__inner { max-width: none; padding-inline: 1rem; }
  .hero__stats { grid-template-columns: repeat(2, 1fr); max-width: 420px; }

  .nav__inner {
    max-width: none;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    column-gap: .75rem;
    padding-inline: max(1rem, env(safe-area-inset-left, 0px))
                    max(1rem, env(safe-area-inset-right, 0px));
  }
  .nav__brand {
    grid-column: 1;
    grid-row: 1;
    max-width: 100%;
  }
  .nav__toggle {
    display: block;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    margin: 0;
  }
  /* Keep closed menu out of the grid so it cannot shove the toggle */
  .nav__links {
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    z-index: 99;
    display: none !important;
    flex-direction: column; align-items: stretch; gap: .25rem;
    width: 100%;
    max-width: 100%;
    max-height: calc(100svh - var(--nav-h) - env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    padding: 1rem max(1rem, env(safe-area-inset-right, 0px)) 1.5rem
             max(1rem, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
    background: rgba(5, 7, 15, .96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
  }
  .nav__links.is-open { display: flex !important; }
  .nav__link { padding: .8rem 1rem; border-radius: var(--r-sm); font-size: .95rem; }
  .nav__link.is-active::after { display: none; }
  .nav__link.is-active { background: var(--surface); color: var(--cyan); }
}

@media (max-width: 640px) {
  .wrap { padding-inline: 1rem; }
  .hero__inner { padding-inline: 1rem; }
  .hero__stats { gap: 1rem; }
  .hero__name { font-size: clamp(2rem, 9vw, 2.75rem); }
  .deck__card > * { padding: 1.25rem; }
  .contact__resume { width: 100%; }
  .contact__resume .btn { flex: 1 1 auto; justify-content: center; }
  .footer__inner { flex-direction: column; text-align: center; }
}

/* ---------------------------------------------------- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  /* Keep slideshow class swaps visible; crossfade already disabled in JS. */
  .bg-slideshow__slide { transition: none !important; }
}
