/*
 * main.css — Saad Ali Portfolio
 * Improved light theme: Instrument Serif · Inter · JetBrains Mono
 */

@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/InstrumentSerif-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/InstrumentSerif-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: block;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: block;
}

/* ═══ UTILITY ═════════════════════════════════════════════ */
/* Replaces onerror inline style — keeps all styles in CSS */
.img-hidden {
  display: none !important;
}
.img-visible {
  display: flex !important;
}

/* Webkit thin scrollbar — covers Chrome, Safari, Edge */
.modal-box::-webkit-scrollbar {
  width: 5px;
}
.modal-box::-webkit-scrollbar-track {
  background: var(--c-bg-alt, #f1f5f9);
}
.modal-box::-webkit-scrollbar-thumb {
  background-color: var(--c-blue, #1e293b);
  border-radius: 99px;
}
.modal-box::-webkit-scrollbar-thumb:hover {
  background-color: var(--c-blue-h, #0f172a);
}

/* ═══ TOKENS ══════════════════════════════════════════════ */
:root {
  --ff-head: "Instrument Serif", Georgia, serif;
  --ff-body: "Inter", system-ui, sans-serif;
  --ff-mono: "JetBrains Mono", monospace;

  --c-bg: #ffffff;
  --c-bg-alt: #f8fafc;
  --c-surface: #ffffff;
  --c-border: #e2e8f0;
  --c-border2: #cbd5e1;

  --c-txt: #1e293b;
  --c-txt-2: #475569;
  --c-txt-3: #94a3b8;
  --c-head: #0f172a;

  /* Slate accent — replaces blue throughout */
  --c-blue: #1e293b; /* slate-800 — primary */
  --c-blue-h: #0f172a; /* slate-900 — hover */
  --c-blue-bg: #f1f5f9; /* slate-100 — light tint */
  --c-blue-br: rgba(30, 41, 59, 0.18); /* slate border */

  --c-teal: #475569;
  --c-teal-bg: #f8fafc;
  --c-teal-br: rgba(71, 85, 105, 0.2);

  --c-violet: #334155;
  --c-violet-bg: #f1f5f9;
  --c-violet-br: rgba(30, 41, 59, 0.15);

  --c-green-bg: #f0fdf4;
  --c-green-br: #bbf7d0;
  --c-green-txt: #166534;
  --c-red-bg: #fef2f2;
  --c-red-br: #fecaca;
  --c-red-txt: #b91c1c;

  --sh-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --sh-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --sh: 0 8px 24px rgba(15, 23, 42, 0.08);
  --sh-lg: 0 20px 60px rgba(15, 23, 42, 0.13);

  --rad-sm: 6px;
  --rad: 10px;
  --rad-lg: 14px;
  --rad-xl: 20px;
  --rad-full: 999px;

  --nav-w: 68px;
  --sp: 48px;
}

/* ═══ RESET ═══════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--c-txt);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
img {
  display: block;
  max-width: 100%;
}
a {
  color: var(--c-blue);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--c-blue-h);
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--ff-head);
  color: var(--c-head);
  line-height: 1.2;
  font-weight: 600;
}

/* ═══ PRELOADER ═══════════════════════════════════════════ */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.6s ease,
    visibility 0.6s ease;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 1;
}

@keyframes pl-fadein {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pl-text-appear {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.preloader-name {
  font-family: var(--ff-head);
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  letter-spacing: 0.5px;
  opacity: 0;
  animation: pl-text-appear 0.4s ease forwards;
  animation-delay: 0.8s;
}

.preloader-role {
  font-family: var(--ff-mono);
  font-size: 0.82rem;
  opacity: 0;
  animation: pl-text-appear 0.4s ease forwards;
  animation-delay: 0.9s;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0 0 14px;
}

.preloader-dots {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.preloader-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1e293b;
  animation: pl-bounce 1.2s ease-in-out infinite;
}
.preloader-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.preloader-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pl-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.3;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ═══ SCROLL TOP ══════════════════════════════════════════ */
.scroll-top {
  position: fixed;
  right: 20px;
  bottom: -20px;
  width: 40px;
  height: 40px;
  background: var(--c-blue);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--sh);
}
.scroll-top:hover {
  background: var(--c-blue-h);
  color: #fff;
  transform: translateY(-3px);
}
.scroll-top.active {
  opacity: 1;
  visibility: visible;
  bottom: 20px;
}

/* ═══ HEADER / NAV ════════════════════════════════════════ */
/* ═══ HEADER / SIDE NAV ═══════════════════════════════════ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--nav-w);
  background: #1e293b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 997;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.25);
}

.header ~ .main {
  margin-left: var(--nav-w);
}

@media (max-width: 1199px) {
  .header {
    width: 240px;
    left: -240px;
    align-items: flex-start;
    padding: 20px 0;
  }
  .header.header-show {
    left: 0;
    box-shadow: 4px 0 32px rgba(15, 23, 42, 0.4);
  }
  .header ~ .main {
    margin-left: 0;
  }
}

/* Nav overlay — dims page content when mobile nav is open */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 996;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
@media (max-width: 1199px) {
  .nav-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: all;
  }
}

/* Mobile toggle */
.header-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  background: #1e293b;
  color: #fff;
  border: none;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  z-index: 9999;
  transition: background 0.2s;
  box-shadow: 0 4px 12px rgba(30, 41, 59, 0.3);
}
.header-toggle:hover {
  background: #0f172a;
}
@media (max-width: 1199px) {
  .header-toggle {
    display: flex;
  }
}

/* Nav list — centred by parent justify-content: center */
.navmenu {
  width: 100%;
}
.navmenu ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
  margin: 0;
  width: 100%;
}

/* Circular icon buttons */
.navmenu .nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  font-size: 17px;
  position: relative;
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
}
.navmenu .nav-link span {
  display: none;
}

/* Hover */
.navmenu .nav-link:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  transform: scale(1.1);
}

/* Active */
.navmenu .nav-link.active {
  background: #fff;
  color: #1e293b;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.25);
}

/* Tooltip on hover — desktop only */
@media (min-width: 1200px) {
  .navmenu .nav-link::after {
    content: attr(aria-label);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    background: #1e293b;
    color: #fff;
    font-family: var(--ff-body);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    padding: 5px 11px;
    border-radius: var(--rad-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    opacity: 0;
    pointer-events: none;
    transition:
      opacity 0.15s,
      transform 0.15s;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.3);
  }
  .navmenu .nav-link:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* Mobile: full panel with text */
@media (max-width: 1199px) {
  .navmenu ul {
    align-items: flex-start;
    padding: 0 16px;
    gap: 4px;
  }
  .navmenu .nav-link {
    width: 100%;
    height: auto;
    border-radius: var(--rad);
    justify-content: flex-start;
    gap: 14px;
    padding: 11px 14px;
    background: transparent;
    transform: none;
  }
  .navmenu .nav-link span {
    display: block;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.92rem;
    font-weight: 500;
  }
  .navmenu .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
  }
  .navmenu .nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    box-shadow: none;
  }
  .navmenu .nav-link.active span,
  .navmenu .nav-link:hover span {
    color: #fff;
  }
}

/* ═══ LAYOUT ══════════════════════════════════════════════ */
.section-pad {
  padding: var(--sp) 0;
}
.bg-alt {
  background: var(--c-bg-alt);
}
.section-header {
  margin-bottom: 52px;
}

.eyebrow {
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--c-blue);
  background: var(--c-blue-bg);
  border: 1px solid var(--c-blue-br);
  padding: 4px 13px;
  border-radius: var(--rad-full);
  margin-bottom: 14px;
}

.section-header h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  color: var(--c-head);
}
.section-header p {
  color: var(--c-txt-2);
  font-size: 0.95rem;
  max-width: 520px;
  margin: 14px auto 0;
  line-height: 1.75;
}

@media (max-width: 768px) {
  .section-pad {
    padding: 48px 0;
  }
  [data-aos-delay] {
    transition-delay: 0 !important;
  }
}

/* ═══ HERO ════════════════════════════════════════════════ */
.home-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);
  padding: 56px 0 48px;
}

/* Stronger glows */
.home-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(
      ellipse 60% 55% at 88% 8%,
      rgba(30, 41, 59, 0.2) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 50% 45% at 8% 92%,
      rgba(30, 41, 59, 0.12) 0%,
      transparent 70%
    );
}

/* Animated code-snippet canvas */
#home-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.home-section .container {
  position: relative;
  z-index: 5;
}

.home-eyebrow {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #475569;
  margin-bottom: 16px;
}

.home-name {
  font-family: var(--ff-head);
  font-size: clamp(3rem, 7vw, 5.5rem);
  color: var(--c-head);
  letter-spacing: -2px;
  word-spacing: 0.2em;
  line-height: 1;
  margin-bottom: 20px;
}
.home-name em {
  font-style: italic;
  color: var(--c-blue);
}

.home-typed-wrap {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--c-txt-2);
  margin-bottom: 40px;
}
.home-typed-wrap .typed {
  color: var(--c-txt);
  font-weight: 600;
}
.typed-cursor {
  color: var(--c-blue);
}

.home-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.btn-home-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--c-blue);
  color: #fff;
  padding: 13px 28px;
  border-radius: var(--rad);
  font-weight: 600;
  font-size: 0.95rem;
  transition:
    background 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
}
.btn-home-primary:hover {
  background: var(--c-blue-h);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(30, 41, 59, 0.2);
}

.btn-home-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--c-txt);
  padding: 12px 28px;
  border-radius: var(--rad);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid var(--c-border2);
  transition:
    border-color 0.2s,
    color 0.2s,
    background 0.2s;
}
.btn-home-ghost:hover {
  border-color: var(--c-blue);
  color: var(--c-blue);
  background: var(--c-blue-bg);
}

.home-socials {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.home-socials a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--c-border2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-txt-2);
  font-size: 1rem;
  transition:
    border-color 0.2s,
    color 0.2s,
    background 0.2s,
    transform 0.2s;
}
.home-socials a:hover {
  border-color: var(--c-blue);
  color: var(--c-blue);
  background: var(--c-blue-bg);
  transform: translateY(-2px);
}

.home-scroll-down {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 10;
  line-height: 1;
}

.scroll-chevron {
  display: block;
  font-size: 1rem;
  color: var(--c-blue);
  -webkit-text-stroke: 2px var(--c-blue);
  filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.8));
  opacity: 0.3;
  animation: chevron-wave 1.8s ease-in-out infinite;
}
.scroll-chevron--1 {
  animation-delay: 0s;
}
.scroll-chevron--2 {
  animation-delay: 0.2s;
}
.scroll-chevron--3 {
  animation-delay: 0.4s;
}

@keyframes chevron-wave {
  0% {
    opacity: 0.2;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(3px);
  }
  100% {
    opacity: 0.2;
    transform: translateY(0);
  }
}

/* ═══ ABOUT ═══════════════════════════════════════════════ */

/* Outer wrapper — provides space for decorative elements */
.about-photo-wrap {
  position: relative;
  padding: 16px;
  background: linear-gradient(145deg, #e2e8f0 0%, #f1f5f9 55%, #e2e8f0 100%);
  border-radius: var(--rad-xl);
  box-shadow: var(--sh);
}

/* Dot-pattern layer on the background */
.about-photo-bg {
  position: absolute;
  inset: 0;
  border-radius: var(--rad-xl);
  background-image: radial-gradient(
    rgba(30, 41, 59, 0.08) 1.5px,
    transparent 1.5px
  );
  background-size: 18px 18px;
  z-index: 0;
}

/* Hide the frame — not needed with this approach */
.about-photo-frame {
  display: none;
}

/* Photo card itself */
.about-photo {
  position: relative;
  z-index: 2;
  border-radius: var(--rad-lg);
  overflow: hidden;
  aspect-ratio: 4/5;
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  box-shadow: var(--sh-lg);
  padding: 10px 10px 0;
}
.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.4s;
  border-radius: var(--rad-sm) var(--rad-sm) 0 0;
}
.about-photo-wrap:hover .about-photo img {
  transform: scale(1.03);
}
.about-photo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  color: var(--c-border2);
}

.about-title {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  margin-bottom: 12px;
}
.about-lead {
  color: var(--c-txt-2);
  font-size: 0.97rem;
  line-height: 1.8;
  margin-bottom: 24px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
.about-grid-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  border-radius: var(--rad);
  padding: 12px 14px;
}
.about-grid-item i {
  color: var(--c-blue);
  font-size: 15px;
  margin-top: 3px;
  flex-shrink: 0;
}
.about-grid-item div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.about-grid-item strong {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--c-txt-3);
}
.about-grid-item span {
  font-size: 0.87rem;
  color: var(--c-txt);
}
.about-grid-item a {
  color: var(--c-blue);
}

.badge-open {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 2px 8px;
  border-radius: var(--rad-full);
}

.about-body {
  font-size: 0.93rem;
  color: var(--c-txt-2);
  line-height: 1.8;
  margin-bottom: 24px;
}

.about-stats {
  display: flex;
  align-items: center;
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  border-radius: var(--rad-lg);
  overflow: hidden;
}
.stat {
  flex: 1;
  padding: 16px 20px;
  text-align: center;
}
.stat-sep {
  width: 1px;
  height: 48px;
  background: var(--c-border);
  flex-shrink: 0;
}
.stat-n {
  display: block;
  font-family: var(--ff-head);
  font-size: 1.7rem;
  color: var(--c-blue);
  line-height: 1;
  margin-bottom: 3px;
}
.stat-l {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--c-txt-3);
}

@media (max-width: 767px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══ SKILLS ══════════════════════════════════════════════ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 12px;
}
.skill-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--rad);
  padding: 20px 10px 14px;
  text-align: center;
  transition:
    transform 0.22s,
    border-color 0.22s,
    box-shadow 0.22s;
  cursor: default;
}
.skill-card:hover {
  transform: translateY(-5px);
  border-color: var(--c-blue);
  box-shadow: var(--sh);
}
.skill-card img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  margin: 0 auto 10px;
  display: block;
}
.skill-card span {
  display: block;
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--c-txt-3);
  transition: color 0.2s;
}
.skill-card:hover span {
  color: var(--c-blue);
}

@media (max-width: 900px) {
  .skills-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}
@media (max-width: 576px) {
  .skills-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ═══ CV / TIMELINE ═══════════════════════════════════════ */
.cv-heading {
  font-size: 1.1rem;
  color: var(--c-head);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  border-left: 3px solid var(--c-blue);
  margin-bottom: 32px;
}

.timeline {
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--c-border2), var(--c-border));
}

.tl-item {
  position: relative;
  padding: 0 0 28px 28px;
}

.tl-dot {
  position: absolute;
  left: 0;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-blue);
  outline: 3px solid var(--c-blue-bg);
  z-index: 1;
}
.tl-dot--accent {
  background: var(--c-teal);
  outline-color: var(--c-teal-bg);
}

.tl-date {
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--c-blue);
  background: var(--c-blue-bg);
  border: 1px solid var(--c-blue-br);
  padding: 3px 10px;
  border-radius: var(--rad-full);
  margin-bottom: 8px;
}
.tl-date--accent {
  color: var(--c-teal);
  background: var(--c-teal-bg);
  border-color: var(--c-teal-br);
}

.tl-body h4 {
  font-family: var(--ff-body);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-head);
  margin-bottom: 2px;
}
.tl-body h5 {
  font-family: var(--ff-body);
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--c-teal);
  font-style: italic;
  margin-bottom: 8px;
}
.tl-body p {
  font-size: 0.875rem;
  color: var(--c-txt-2);
  line-height: 1.75;
}

.cv-dl-wrap {
  text-align: center;
  margin-top: 52px;
}

.btn-dl {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--c-blue);
  color: #fff;
  padding: 13px 28px;
  border-radius: var(--rad);
  font-weight: 600;
  font-size: 0.92rem;
  border: 2px solid var(--c-blue);
  transition:
    background 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
  cursor: pointer;
}
.btn-dl:hover {
  background: var(--c-blue-h);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(30, 41, 59, 0.25);
}

/* ═══ PORTFOLIO ═══════════════════════════════════════════ */
.pf-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 340px));
  gap: 22px;
  justify-content: center;
}

.pcard {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--rad-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.28s,
    border-color 0.28s;
}
.pcard:hover {
  transform: translateY(-7px);
  box-shadow: var(--sh-lg);
  border-color: var(--c-blue);
}

.pcard-thumb {
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  border-bottom: 1px solid var(--c-border);
  transition: font-size 0.25s;
  overflow: hidden;
  background: var(--c-bg-alt);
  position: relative;
  padding: 12px 12px 0;
}
.pcard-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform 0.4s ease;
  border-radius: var(--rad-sm) var(--rad-sm) 0 0;
  box-shadow: var(--sh-sm);
}
.pcard:hover .pcard-thumb img {
  transform: scale(1.04);
}
/* Fallback icon — hidden unless image fails */
.pcard-thumb .img-fallback {
  display: none;
  color: var(--c-txt-3);
}
.pcard-thumb .img-fallback.img-visible {
  display: block;
}
.pcard:hover .pcard-thumb {
  font-size: 3.4rem;
}

.pcard-body {
  padding: 20px 22px;
  flex: 1;
}
.pcard-num {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--c-txt-3);
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.pcard-body h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-head);
  margin-bottom: 8px;
}
.pcard-body p {
  font-size: 0.85rem;
  color: var(--c-txt-2);
  line-height: 1.7;
  margin-bottom: 14px;
}

.pcard-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pcard-tags span {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--c-blue);
  background: var(--c-blue-bg);
  border: 1px solid var(--c-blue-br);
  padding: 3px 8px;
  border-radius: var(--rad-full);
}

.pcard-foot {
  padding: 12px 22px 16px;
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.pcard-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-blue);
  background: transparent;
  border: 1.5px solid var(--c-blue);
  padding: 6px 14px;
  border-radius: var(--rad-sm);
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}
.pcard-btn:hover {
  background: var(--c-blue);
  color: #fff;
}

.pcard-gh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--c-border2);
  border-radius: var(--rad-sm);
  color: var(--c-txt-2);
  font-size: 0.82rem;
  transition:
    border-color 0.2s,
    color 0.2s,
    background 0.2s;
}
.pcard-gh:hover {
  border-color: var(--c-head);
  color: var(--c-head);
  background: var(--c-bg-alt);
}

@media (max-width: 900px) {
  .pf-grid {
    grid-template-columns: repeat(2, minmax(0, 340px));
  }
}
@media (max-width: 640px) {
  .pf-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin: 0 auto;
  }
}
@media (max-width: 576px) {
  .pf-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
}

/* ═══ MODALS ══════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(15, 23, 42, 0.65);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--rad-xl);
  max-width: 680px;
  width: 100%;
  max-height: 92vh;
  overflow: hidden;
  box-shadow: var(--sh-lg);
  animation: modal-pop 0.28s cubic-bezier(0.2, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
@keyframes modal-pop {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Gradient band at top of each modal — plain hex, no color-mix */
/* Modal screenshot image header */
.modal-img {
  position: relative;
  width: 100%;
  aspect-ratio: 16/7;
  border-radius: var(--rad-xl) var(--rad-xl) 0 0;
  overflow: hidden;
  background: var(--c-bg-alt);
  padding: 14px 14px 0;
  flex-shrink: 0;
}
.modal-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  border-radius: var(--rad) var(--rad) 0 0;
  box-shadow: var(--sh);
}
.modal-img-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  border-radius: var(--rad-xl) var(--rad-xl) 0 0;
}
.modal-img-fallback.img-visible {
  display: flex;
}
/* Close button floats top-right over the image */
.modal-img .modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--c-blue);
  border: none;
  border-radius: var(--rad-sm);
  padding: 6px 10px;
  font-size: 0.9rem;
  color: #fff;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.15s;
  z-index: 2;
}
.modal-img .modal-close-btn:hover {
  background: var(--c-blue-h);
  color: #fff;
  transform: scale(1.08);
}

.modal-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-radius: var(--rad-xl) var(--rad-xl) 0 0;
  font-size: 2.5rem;
}
.modal-band--blue {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  color: var(--c-blue);
}
.modal-band--teal {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  color: var(--c-teal);
}
.modal-band--violet {
  background: linear-gradient(135deg, #d1d5db, #e5e7eb);
  color: var(--c-violet);
}

.modal-close-btn {
  background: var(--c-blue);
  border: none;
  border-radius: var(--rad-sm);
  padding: 6px 10px;
  font-size: 0.9rem;
  color: #fff;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.15s;
  line-height: 1;
}
.modal-close-btn:hover {
  background: var(--c-blue-h);
  color: #fff;
  transform: scale(1.08);
}

.modal-inner {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-cat {
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: 0.67rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--c-blue);
  background: var(--c-blue-bg);
  border: 1px solid var(--c-blue-br);
  padding: 3px 10px;
  border-radius: var(--rad-full);
  margin-bottom: 10px;
}

.modal-inner h3 {
  font-size: 1.5rem;
  color: var(--c-head);
  margin-bottom: 3px;
}
.modal-sub {
  display: block;
  font-size: 0.82rem;
  color: var(--c-txt-3);
  margin-bottom: 18px;
}

.modal-inner h6 {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--c-blue);
  margin: 18px 0 8px;
}
.modal-inner p {
  font-size: 0.9rem;
  color: var(--c-txt-2);
  line-height: 1.8;
}
.modal-inner ul {
  padding-left: 18px;
}
.modal-inner ul li {
  font-size: 0.88rem;
  color: var(--c-txt-2);
  line-height: 1.7;
  margin-bottom: 4px;
}
.modal-inner ul li::marker {
  color: var(--c-blue);
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.modal-tags span {
  font-family: var(--ff-mono);
  font-size: 0.63rem;
  font-weight: 500;
  color: var(--c-blue);
  background: var(--c-blue-bg);
  border: 1px solid var(--c-blue-br);
  padding: 3px 9px;
  border-radius: var(--rad-full);
}

.modal-foot {
  padding: 16px 28px 24px;
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.btn-modal-gh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--c-head);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--rad-sm);
  font-weight: 600;
  font-size: 0.85rem;
  transition:
    opacity 0.2s,
    transform 0.15s;
  text-decoration: none;
}
.btn-modal-gh:hover {
  opacity: 0.88;
  color: #fff;
  transform: translateY(-1px);
}
.btn-modal-cl {
  background: transparent;
  color: var(--c-txt-2);
  padding: 10px 20px;
  border-radius: var(--rad-sm);
  font-weight: 500;
  font-size: 0.85rem;
  border: 1.5px solid var(--c-border);
  transition:
    border-color 0.2s,
    color 0.2s,
    background 0.2s,
    transform 0.15s;
  cursor: pointer;
}
.btn-modal-cl:hover {
  border-color: var(--c-blue);
  color: var(--c-blue);
  background: var(--c-blue-bg);
  transform: translateY(-2px);
}

/* ═══ CONTACT ═════════════════════════════════════════════ */
.cinfo {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cinfo-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--rad);
  padding: 16px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.cinfo-row:hover {
  border-color: var(--c-blue);
  box-shadow: var(--sh-sm);
}

.cinfo-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: var(--c-blue-bg);
  color: var(--c-blue);
  border: 1px solid var(--c-blue-br);
  border-radius: var(--rad-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition:
    background 0.2s,
    color 0.2s;
}
.cinfo-row:hover .cinfo-icon {
  background: var(--c-blue);
  color: #fff;
}

.cinfo-row div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cinfo-row strong {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--c-txt-3);
}
.cinfo-row span {
  font-size: 0.9rem;
  color: var(--c-txt);
}
.cinfo-row a {
  color: var(--c-blue);
}

/* Form */
.cform label {
  display: block;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--c-txt-2);
  margin-bottom: 7px;
}
.cform input,
.cform textarea {
  width: 100%;
  display: block;
  font-family: var(--ff-body);
  font-size: 0.92rem;
  color: var(--c-txt);
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--rad-sm);
  padding: 11px 14px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.cform input::placeholder,
.cform textarea::placeholder {
  color: var(--c-txt-3);
}
.cform input:focus,
.cform textarea:focus {
  outline: none;
  border-color: var(--c-blue);
  box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.08);
}
.cform textarea {
  resize: vertical;
  min-height: 130px;
}

.cform button[type="submit"] {
  width: 100%;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--c-blue);
  color: #fff;
  border: none;
  border-radius: var(--rad-sm);
  padding: 13px 28px;
  font-family: var(--ff-body);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
}
.cform button[type="submit"]:hover {
  background: var(--c-blue-h);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(30, 41, 59, 0.25);
}
.cform button[type="submit"]:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.loading {
  display: none;
  text-align: center;
  padding: 10px;
  font-size: 0.88rem;
  color: var(--c-txt-2);
  margin-bottom: 10px;
}
.loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-blue);
  margin-right: 8px;
  vertical-align: middle;
  animation: spin 0.75s linear infinite;
}
.error-message {
  display: none;
  padding: 11px 14px;
  margin-bottom: 12px;
  background: var(--c-red-bg);
  border: 1px solid var(--c-red-br);
  color: var(--c-red-txt);
  border-radius: var(--rad-sm);
  font-size: 0.88rem;
}
.sent-message {
  display: none;
  padding: 11px 14px;
  margin-bottom: 12px;
  background: var(--c-green-bg);
  border: 1px solid var(--c-green-br);
  color: var(--c-green-txt);
  border-radius: var(--rad-sm);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

/* ═══ FOOTER ══════════════════════════════════════════════ */
.site-footer {
  background: #334155;
  color: rgba(255, 255, 255, 0.6);
  padding: 40px 0 28px;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 20px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.footer-name {
  font-family: var(--ff-head);
  font-size: 1.3rem;
  color: #fff;
  letter-spacing: 1px;
}
.footer-tag {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
}

.footer-links {
  display: flex;
  gap: 10px;
}
.footer-links a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s,
    transform 0.2s;
}
.footer-links a:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  transform: translateY(-2px);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.4);
}
.footer-bottom a {
  color: rgba(255, 255, 255, 0.6);
}
.footer-bottom a:hover {
  color: #fff;
}

/* ═══ MOBILE RESPONSIVE — all breakpoints ════════════════════════════════ */

/* ── 480px and below (small phones) ─────────────────────────────────────── */
@media (max-width: 480px) {
  /* Hero */
  .home-section {
    padding: 80px 0 60px;
  }
  .home-eyebrow {
    font-size: 0.65rem;
    letter-spacing: 1.5px;
  }
  .home-name {
    font-size: clamp(2.2rem, 10vw, 3rem);
    letter-spacing: -1px;
  }
  .home-typed-wrap {
    font-size: 0.95rem;
    margin-bottom: 28px;
  }
  .btn-home-primary,
  .btn-home-ghost {
    width: auto;
    justify-content: center;
    padding: 11px 20px;
  }
  .home-cta {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }
  .home-scroll-down {
    font-size: 1rem;
  }

  /* About */
  .about-photo-wrap {
    margin: 0 8px;
  }
  .about-title {
    font-size: 1.1rem;
  }
  .about-lead {
    font-size: 0.88rem;
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
  .about-stats {
    flex-direction: column;
  }
  .stat-sep {
    width: 80%;
    height: 1px;
  }
  .stat {
    padding: 12px 16px;
  }

  /* Skills */
  .skills-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .skill-card {
    padding: 14px 6px 10px;
  }
  .skill-card img {
    width: 28px;
    height: 28px;
  }
  .skill-card span {
    font-size: 0.55rem;
  }

  /* CV */
  .cv-heading {
    font-size: 1rem;
  }
  .tl-body h4 {
    font-size: 0.9rem;
  }
  .tl-body h5 {
    font-size: 0.78rem;
  }
  .tl-body p {
    font-size: 0.82rem;
  }
  .tl-date {
    font-size: 0.62rem;
  }
  .btn-dl {
    width: 100%;
    justify-content: center;
  }

  /* Portfolio */
  .pf-grid {
    grid-template-columns: 1fr;
  }
  .pcard-body h3 {
    font-size: 0.95rem;
  }
  .pcard-body p {
    font-size: 0.8rem;
  }

  /* Modals */
  .modal-overlay {
    padding: 8px;
  }
  .modal-box {
    border-radius: var(--rad-lg);
    max-height: 95vh;
  }
  .modal-img {
    aspect-ratio: 16/8;
    padding: 8px 8px 0;
  }
  .modal-inner {
    padding: 16px 16px;
  }
  .modal-inner h3 {
    font-size: 1.1rem;
  }
  .modal-foot {
    padding: 12px 16px 16px;
  }
  .btn-modal-gh,
  .btn-modal-cl {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Contact */
  .cinfo-row {
    padding: 12px;
    gap: 10px;
  }
  .cform input,
  .cform textarea {
    font-size: 0.88rem;
    padding: 10px 12px;
  }
  .cform button[type="submit"] {
    font-size: 0.88rem;
    padding: 12px 20px;
  }

  /* Footer */
  .footer-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 4px;
  }
  .footer-name {
    font-size: 1.1rem;
  }
}

/* ── 576px and below ─────────────────────────────────────────────────────── */
@media (max-width: 576px) {
  /* Hero — ensure canvas/background is visible */
  .home-name {
    font-size: clamp(2.4rem, 9vw, 3.5rem);
  }

  /* About photo centred */
  .about-photo-wrap {
    max-width: 280px;
  }

  /* Skills */
  .skills-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Portfolio */
  .pf-grid {
    grid-template-columns: 1fr;
  }
  .pcard-tags {
    gap: 4px;
  }
  .pcard-tags span {
    font-size: 0.6rem;
    padding: 2px 7px;
  }

  /* CV two columns collapse */
  .cv-dl-wrap {
    margin-top: 36px;
  }

  /* Contact */
  .cinfo {
    gap: 10px;
  }
}

/* ── 768px and below ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Main content needs no left margin on mobile */
  .header ~ .main {
    margin-left: 0;
  }

  /* Hero canvas snippet font */
  .home-section {
    padding: 90px 16px 70px;
  }

  /* About photo */
  .about-photo-wrap {
    max-width: 300px;
    margin: 0 auto 32px;
  }
  .about-stats {
    flex-wrap: wrap;
  }

  /* Section headers */
  .section-header {
    margin-bottom: 36px;
  }
  .section-header h2 {
    font-size: 1.7rem;
  }

  /* CV side by side → stacked already handled by Bootstrap col-lg-6 */
  .cv-heading {
    margin-bottom: 20px;
  }

  /* Portfolio cards */
  .pf-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Modals */
  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }
  .modal-box {
    border-radius: var(--rad-lg) var(--rad-lg) 0 0;
    max-height: 88vh;
  }
  .modal-inner {
    padding: 18px 20px;
  }
  .modal-foot {
    flex-direction: row;
    flex-wrap: nowrap;
    padding: 8px 14px;
    gap: 8px;
  }

  /* Contact layout */
  .cinfo-row strong {
    font-size: 0.68rem;
  }
  .cinfo-row span {
    font-size: 0.85rem;
  }

  /* Footer */
  .footer-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 4px;
  }
}

/* ── 900px and below ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .pf-grid {
    grid-template-columns: 1fr;
  }
  .skills-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ── Landscape phones ────────────────────────────────────────────────────── */
@media (max-width: 768px) and (orientation: landscape) {
  .home-section {
    min-height: auto;
    padding: 60px 16px 50px;
  }
  .home-name {
    font-size: clamp(2rem, 6vw, 2.8rem);
  }
  .modal-overlay {
    align-items: center;
  }
  .modal-box {
    max-height: 90vh;
    border-radius: var(--rad-lg);
  }
}

/* ═══ MOBILE CRITICAL FIXES ══════════════════════════════ */

/* Header toggle must always be above everything */
.header-toggle {
  z-index: 99998 !important;
}

/* 3. Hero — reduce canvas opacity on small screens so text is readable */
@media (max-width: 768px) {
  .home-section {
    padding: 90px 16px 70px;
    overflow: hidden;
  }
  .home-section .container {
    padding: 0 8px;
  }
  .home-eyebrow {
    font-size: 0.67rem;
  }
  .home-name {
    font-size: clamp(2rem, 9vw, 3rem);
    letter-spacing: -1px;
  }
  .home-typed-wrap {
    font-size: 0.9rem;
  }
  .btn-home-primary,
  .btn-home-ghost {
    width: auto;
    justify-content: center;
    padding: 11px 20px;
  }
  .home-cta {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin: 0 0 32px;
  }
}

@media (max-width: 480px) {
  .home-cta {
    width: 100%;
  }
}

/* 4. Skills grid — prevent overflow on all mobile sizes */
@media (max-width: 767px) {
  .skills-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    overflow: hidden;
  }
}
@media (max-width: 480px) {
  .skills-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .skill-card {
    padding: 12px 6px 8px;
  }
  .skill-card img {
    width: 26px;
    height: 26px;
  }
  .skill-card span {
    font-size: 0.52rem;
  }
}

/* 5. Section padding so content doesn't start under the toggle button */
@media (max-width: 1199px) {
  .home-section {
    padding-top: 80px;
  }
  section,
  .section {
    scroll-margin-top: 0;
  }
}

/* 6. Prevent any section from overlapping the next */
@media (max-width: 768px) {
  .main {
    overflow-x: hidden;
  }
  .about,
  .skills,
  .cv,
  .portfolio,
  .contact {
    position: relative;
    z-index: 1;
  }
}

/* 7. Fix preloader dots not bleeding into page */
#preloader {
  isolation: isolate;
}

/* Download CV button — smaller on mobile */
@media (max-width: 768px) {
  .btn-dl {
    padding: 10px 22px;
    font-size: 0.82rem;
    width: auto;
  }
  .cv-dl-wrap {
    margin-top: 32px;
  }
}

/* Mobile padding — breathing room on left/right edges */
@media (max-width: 768px) {
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }
}
@media (max-width: 480px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Modals — 90% width on mobile */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal-box {
    width: 90%;
    margin: 0 auto 0;
    border-radius: var(--rad-lg) var(--rad-lg) 0 0;
    max-height: 88vh;
  }
}
@media (max-width: 480px) {
  .modal-box {
    width: 94%;
  }
}

/* ═══ MODAL MOBILE — 90vw × 90vh, centred, scrollable ══════ */
@media (max-width: 1199px) {
  .modal-overlay {
    padding: 0;
    align-items: center;
    justify-content: center;
  }
  .modal-box {
    width: 90vw !important;
    max-width: 90vw !important;
    height: 90vh !important;
    max-height: 90vh !important;
    border-radius: var(--rad-lg) !important;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  .modal-inner {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
  }
  .modal-img {
    flex-shrink: 0;
  }
  .modal-foot {
    flex-shrink: 0;
  }
}

/* Modal footer — compact on mobile to maximise content area */
@media (max-width: 1199px) {
  .modal-foot {
    padding: 8px 14px !important;
    gap: 8px !important;
    flex-wrap: nowrap;
  }
  .btn-modal-gh,
  .btn-modal-cl {
    padding: 7px 14px !important;
    font-size: 0.78rem !important;
    flex: 1;
    justify-content: center;
    text-align: center;
  }
}

/* Remove large gaps between sections on mobile */
@media (max-width: 768px) {
  .home-section {
    min-height: auto;
    padding: 70px 16px 50px;
  }
  .section-pad {
    padding: 40px 0;
  }
}
@media (max-width: 480px) {
  .home-section {
    padding: 60px 16px 40px;
  }
  .section-pad {
    padding: 32px 0;
  }
}

/* Canvas — keep subtle on mobile so it never overpowers text */
@media (max-width: 768px) {
  #home-canvas {
    opacity: 0.45;
  }
}
@media (max-width: 480px) {
  #home-canvas {
    opacity: 0.3;
  }
}

/* Revert home section height on mobile + minimal canvas opacity */
@media (max-width: 768px) {
  .home-section {
    min-height: 100vh !important;
    padding: 100px 16px 80px !important;
  }
  #home-canvas {
    opacity: 0.85;
  }
}

/* Ensure all 3 chevrons are visible on mobile */
@media (max-width: 768px) {
  .home-scroll-down {
    bottom: 16px;
    gap: 0px;
  }
  .scroll-chevron {
    font-size: 0.85rem;
  }
}

/* Fix: ensure all 3 chevrons fit within viewport on mobile */
@media (max-width: 768px) {
  .home-section {
    padding-bottom: 80px !important;
  }
  .home-scroll-down {
    bottom: 20px;
    gap: 1px;
  }
  .scroll-chevron {
    font-size: 0.8rem;
    line-height: 1.1;
  }
}

/* Home section — fit all content + chevrons within viewport on mobile */
@media (max-width: 768px) {
  .home-section {
    padding-top: 70px !important;
    padding-bottom: 70px !important;
  }
  .home-eyebrow {
    margin-bottom: 8px;
  }
  .home-name {
    font-size: clamp(2rem, 8vw, 2.8rem);
    margin-bottom: 12px;
  }
  .home-typed-wrap {
    font-size: 0.88rem;
    margin-bottom: 20px;
  }
  .home-cta {
    margin-bottom: 20px;
    gap: 8px;
  }
  .btn-home-primary,
  .btn-home-ghost {
    padding: 10px 18px;
    font-size: 0.88rem;
  }
  .home-socials {
    margin-top: 16px;
  }
  .home-socials a {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .home-section {
    padding-top: 60px !important;
    padding-bottom: 60px !important;
  }
  .home-name {
    font-size: clamp(1.8rem, 7vw, 2.4rem);
    margin-bottom: 8px;
  }
  .home-typed-wrap {
    margin-bottom: 16px;
  }
  .home-cta {
    margin-bottom: 16px;
  }
}

/* Use dvh on mobile for true viewport height excluding browser chrome */
@media (max-width: 1199px) {
  .home-section {
    min-height: 100dvh !important;
  }
}

/* Reduce gap between photo and text in about section on mobile */
@media (max-width: 991px) {
  .about .row {
    --bs-gutter-y: 1.5rem;
  }
  .about-photo-wrap {
    margin-bottom: 0;
  }
}

/* Increase hero text sizes on mobile */
@media (max-width: 768px) {
  .home-eyebrow {
    font-size: 0.78rem;
    letter-spacing: 2px;
  }
  .home-name {
    font-size: clamp(2.6rem, 10vw, 3.4rem);
  }
  .home-typed-wrap {
    font-size: 1.05rem;
  }
}
@media (max-width: 480px) {
  .home-name {
    font-size: clamp(2.2rem, 9vw, 3rem);
  }
  .home-typed-wrap {
    font-size: 0.95rem;
  }
}

/* Add spacing between hero text lines on mobile */
@media (max-width: 768px) {
  .home-eyebrow {
    margin-bottom: 12px;
  }
  .home-name {
    margin-bottom: 16px;
  }
  .home-typed-wrap {
    margin-bottom: 24px;
  }
}

/* Slightly larger hero fonts on mobile */
@media (max-width: 768px) {
  .home-eyebrow {
    font-size: 0.85rem;
  }
  .home-name {
    font-size: clamp(2.8rem, 11vw, 3.6rem);
  }
  .home-typed-wrap {
    font-size: 1.15rem;
  }
}

/* Eyebrow — tighter letter spacing and reduced opacity on mobile */
@media (max-width: 768px) {
  .home-eyebrow {
    letter-spacing: 1px;
    opacity: 0.8;
  }
}

/* CV section headings — larger on mobile only */
@media (max-width: 991px) {
  .cv-heading {
    font-size: 1.3rem;
  }
}

/* Modal footer — all buttons equal card-style in one row on mobile */
@media (max-width: 768px) {
  .modal-foot {
    flex-wrap: nowrap !important;
    gap: 6px !important;
    padding: 8px 12px !important;
  }
  .modal-foot .btn-modal-gh,
  .modal-foot .btn-modal-cl {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    padding: 8px 4px !important;
    font-size: 0.65rem !important;
    border-radius: var(--rad-sm) !important;
    text-align: center !important;
    line-height: 1.2 !important;
  }
  .modal-foot .btn-modal-gh i,
  .modal-foot .btn-modal-cl i {
    font-size: 1rem !important;
    display: block !important;
  }
}

/* Modal footer — icon-only compact buttons */
.modal-foot .btn-modal-gh,
.modal-foot .btn-modal-cl {
  width: 42px;
  height: 42px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex: none;
  border-radius: var(--rad-sm);
}
.modal-foot {
  gap: 8px;
  flex-wrap: nowrap;
}

/* Screen reader only — visually hidden but accessible */
.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;
}

/* Modal footer icon buttons — reduced padding */
.modal-foot .btn-modal-gh {
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  font-size: 1rem;
}
.modal-foot .btn-modal-cl {
  width: auto !important;
  height: 36px !important;
  padding: 0 12px !important;
  font-size: 0.82rem !important;
  flex: none !important;
  flex-direction: row !important;
}

/* Modal footer — no padding on icon buttons, floated left */
.modal-foot {
  justify-content: flex-start !important;
}
.modal-foot .btn-modal-gh {
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  font-size: 0.95rem;
}
.modal-foot .btn-modal-cl {
  margin-left: auto !important;
  height: 32px !important;
  padding: 0 10px !important;
}

/* Modal footer icon buttons — match card icon button size */
.modal-foot .btn-modal-gh {
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  font-size: 0.82rem !important;
  flex: none !important;
  flex-direction: row !important;
}

/* Modal footer — icon + small text label */
.modal-foot .btn-modal-gh {
  width: auto !important;
  padding: 0 8px 0 6px !important;
  gap: 5px !important;
  font-size: 0.82rem !important;
}
.btn-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Modal footer — more breathing room */
.modal-foot {
  padding: 12px 16px !important;
  gap: 10px !important;
}

/* Modal footer — equal width on Live and GitHub buttons */
.modal-foot .btn-modal-gh {
  min-width: 80px !important;
  justify-content: center !important;
}

/* Modal footer — more padding on desktop */
@media (min-width: 769px) {
  .modal-foot {
    padding: 16px 28px !important;
    gap: 12px !important;
  }
  .modal-foot .btn-modal-gh {
    min-width: 100px !important;
    height: 36px !important;
    padding: 0 14px !important;
    font-size: 0.85rem !important;
  }
  .modal-foot .btn-modal-cl {
    height: 36px !important;
    padding: 0 16px !important;
    font-size: 0.85rem !important;
  }
}

/* Modal scrollbar — theme colour */
.modal-box::-webkit-scrollbar {
  width: 5px;
}
.modal-box::-webkit-scrollbar-track {
  background: var(--c-bg-alt);
}
.modal-box::-webkit-scrollbar-thumb {
  background: var(--c-blue);
  border-radius: 99px;
}
.modal-box::-webkit-scrollbar-thumb:hover {
  background: var(--c-blue-h);
}

/* Modal inner — themed scrollbar */
.modal-inner::-webkit-scrollbar {
  width: 5px;
}
.modal-inner::-webkit-scrollbar-track {
  background: var(--c-bg-alt);
}
.modal-inner::-webkit-scrollbar-thumb {
  background: var(--c-blue);
  border-radius: 99px;
}
.modal-inner::-webkit-scrollbar-thumb:hover {
  background: var(--c-blue-h);
}
