/* ==========================================================================
   Ahmed Nasr — Portfolio
   Design system: warm paper / ink editorial theme
   Typography: Fraunces (display) + Inter (body)
   ========================================================================== */

:root {
  /* Color — warm neutrals */
  --paper: #f7f6f2;
  --paper-deep: #efede5;
  --surface: #ffffff;
  --ink: #211e1a;
  --ink-soft: #49453d;
  --muted: #7e786c;
  --faint: #a8a196;

  /* Lines */
  --line: #e6e2d8;
  --line-strong: #d4cfc2;

  /* Accent — restrained pine green */
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-tint: #e8f1ed;
  --accent-glow: rgba(15, 118, 110, 0.16);

  /* Status */
  --success: #22a56b;

  /* Type */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Shape */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 24px;

  /* Depth — natural layered shadows */
  --shadow-sm: 0 1px 2px rgba(33, 30, 26, 0.05), 0 1px 6px rgba(33, 30, 26, 0.045);
  --shadow-md: 0 2px 4px rgba(33, 30, 26, 0.04), 0 12px 28px -14px rgba(33, 30, 26, 0.16);
  --shadow-lg: 0 4px 8px rgba(33, 30, 26, 0.05), 0 22px 44px -18px rgba(33, 30, 26, 0.2);

  /* Theme-dependent surfaces (redefined in [data-theme="dark"]) */
  color-scheme: light;
  --header-bg: rgba(247, 246, 242, 0.85);
  --mmenu-bg: rgba(247, 246, 242, 0.97);
  --tool-bg: rgba(255, 255, 255, 0.7);
  --media-bg: #edeae2;
  --media-bar-bg: #faf9f5;
  --caption-bg: rgba(255, 255, 255, 0.88);
  --field-bg: #faf9f5;
  --footer-bg: #211e1a;
  --wash-a: rgba(15, 118, 110, 0.06);
  --wash-b: rgba(190, 158, 90, 0.05);
  --photo-shadow: 0 2px 6px rgba(33, 30, 26, 0.1), 0 14px 30px -10px rgba(33, 30, 26, 0.28);
  --photo-shadow-hover: 0 3px 8px rgba(33, 30, 26, 0.12), 0 18px 36px -12px rgba(33, 30, 26, 0.32);

  --speed: 0.22s;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Dark theme ---------- */

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #131312;
  --paper-deep: #0e0e0d;
  --surface: #1c1b19;
  --ink: #f1ede4;
  --ink-soft: #cec8ba;
  --muted: #9d968a;
  --faint: #6d675c;

  --line: #292722;
  --line-strong: #3a372f;

  --accent: #2ec4ae;
  --accent-strong: #5bd8c6;
  --accent-tint: rgba(46, 196, 174, 0.13);
  --accent-glow: rgba(46, 196, 174, 0.22);

  --success: #3dd68c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.32), 0 14px 30px -14px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.35), 0 24px 48px -18px rgba(0, 0, 0, 0.6);

  --header-bg: rgba(19, 19, 18, 0.82);
  --mmenu-bg: rgba(19, 19, 18, 0.97);
  --tool-bg: rgba(255, 255, 255, 0.05);
  --media-bg: #151412;
  --media-bar-bg: #191816;
  --caption-bg: rgba(28, 27, 25, 0.88);
  --field-bg: #141312;
  --footer-bg: #0b0b0a;
  --wash-a: rgba(46, 196, 174, 0.09);
  --wash-b: rgba(190, 158, 90, 0.05);
  --photo-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), 0 14px 30px -10px rgba(0, 0, 0, 0.6);
  --photo-shadow-hover: 0 3px 8px rgba(0, 0, 0, 0.5), 0 18px 36px -12px rgba(0, 0, 0, 0.65);
}

/* ---------- Reset & base ---------- */

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.btn,
.slider-btn,
.theme-toggle,
.nav-toggle,
.lightbox-close,
.lightbox-btn,
.chip {
  touch-action: manipulation;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E"),
    radial-gradient(64rem 64rem at 112% -8%, var(--wash-a), transparent 62%),
    radial-gradient(52rem 52rem at -8% 108%, var(--wash-b), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.35s ease, color 0.35s ease;
}

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

ul {
  list-style: none;
}

a {
  color: inherit;
}

::selection {
  background: var(--accent);
  color: var(--surface);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ---------- Layout ---------- */

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2rem);
}

.section {
  padding: clamp(5rem, 10vw, 8.5rem) 0;
  scroll-margin-top: 84px;
}

.section-alt {
  background: var(--paper-deep);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.overline {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.overline-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0;
}

/* ---------- Accessibility ---------- */

.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 3000;
  padding: 0.7rem 1.1rem;
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.25s var(--ease), background-color 0.3s ease, color 0.3s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  background: transparent;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  font-style: italic;
  transition: transform 0.25s var(--ease), background-color 0.3s ease, color 0.3s ease;
}

.brand:hover .brand-mark {
  transform: rotate(-8deg) scale(1.06);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 1.9rem;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 0.4rem 0;
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--speed) ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease);
}

.nav-link:hover {
  color: var(--ink);
}

.nav-link.active {
  color: var(--ink);
  font-weight: 600;
}

.nav-link.active::after,
.nav-link:hover::after {
  transform: scaleX(1);
}

/* Mobile toggle */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: border-color var(--speed) ease, background var(--speed) ease;
}

.nav-toggle:hover {
  border-color: var(--muted);
}

/* Nav actions — theme toggle + hamburger */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.28s ease, background-color 0.3s ease,
    border-color 0.3s ease, color 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--muted);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.theme-toggle:active {
  transform: scale(0.94);
}

.theme-icon {
  position: absolute;
  width: 18px;
  height: 18px;
  transition: opacity 0.3s ease, transform 0.45s var(--ease);
}

.theme-icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.theme-icon-sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

html[data-theme="dark"] .theme-icon-moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

html[data-theme="dark"] .theme-icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.nav-toggle-line {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.28s var(--ease), opacity 0.2s ease;
}

.nav-toggle.open .nav-toggle-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle.open .nav-toggle-line:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open .nav-toggle-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.82rem 1.45rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.28s ease, background-color 0.22s ease,
    border-color 0.22s ease, color 0.22s ease;
}

.btn-primary {
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  transform: translateY(-2px);
  border-color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.btn-ghost:active {
  transform: translateY(0) scale(0.97);
}

.btn-small {
  padding: 0.52rem 0.95rem;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
  padding: 0.98rem;
}

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

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: clamp(8.5rem, 14vh, 11rem) 0 clamp(4.5rem, 8vh, 6rem);
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(2.5rem, 6vw, 4.5rem);
}

.hero-title {
  margin-top: 1.1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.75rem, 2rem + 4.6vw, 4.9rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.hero-title em,
.section-title em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}

.typing-tinted {
  font-style: italic;
  color: var(--accent);
}

.hero-role {
  margin-top: 1.4rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 1rem + 0.9vw, 1.45rem);
  color: var(--ink-soft);
  min-height: 2.2em;
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 0.25rem;
  background: var(--accent);
  vertical-align: -0.12em;
  animation: caret-blink 0.95s steps(1) infinite;
}

@keyframes caret-blink {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

.hero-lead {
  margin-top: 1.15rem;
  max-width: 34rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2.1rem;
}

.hero-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2.4rem;
}

.hero-tools li {
  padding: 0.34rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--tool-bg);
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--muted);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Profile card */
.profile-card {
  position: relative;
  padding: 1.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
}

.profile-card::before {
  content: "";
  position: absolute;
  inset: -14px -14px auto auto;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--accent-tint);
  z-index: -1;
}

.profile-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.2rem;
}

.profile-photo-wrap {
  position: relative;
  flex-shrink: 0;
  width: clamp(110px, 13vw, 170px);
  height: clamp(110px, 13vw, 170px);
}

.photo-halo {
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  background: var(--accent-tint);
  transform: translate(14px, 15px);
}

.profile-photo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 4px solid var(--surface);
  box-shadow: var(--photo-shadow), 0 0 0 1px var(--line-strong);
  transition: transform 0.35s var(--ease), box-shadow 0.35s ease, border-color 0.3s ease;
}

.profile-card:hover .profile-photo {
  transform: scale(1.03) rotate(-1deg);
  box-shadow: var(--photo-shadow-hover), 0 0 0 1px var(--line-strong);
}

.profile-id h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.profile-id p {
  margin-top: 0.2rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.app-status {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  animation: status-pulse 2.4s ease-out infinite;
}

@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 165, 107, 0.35); }
  60% { box-shadow: 0 0 0 7px rgba(34, 165, 107, 0); }
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  text-align: center;
}

.profile-stat {
  padding: 0 0.55rem;
}

.profile-stat + .profile-stat {
  border-left: 1px solid var(--line);
}

.profile-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

.profile-stat span {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- Section heads ---------- */

.section-head {
  max-width: 47rem;
  margin: 0 auto clamp(2.5rem, 5vw, 3.5rem);
  text-align: center;
}

.section-head .overline {
  justify-content: center;
}

.section-title {
  margin-top: 1.05rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.95rem, 1.3rem + 2.5vw, 3rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.3s ease, border-color 0.25s ease,
    background-color 0.3s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

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

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
}

.about-prose p {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--ink-soft);
}

.about-prose p + p {
  margin-top: 1.15rem;
}

.stats-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.stat {
  padding: 1.45rem 1.7rem;
}

.stat + .stat {
  border-top: 1px solid var(--line);
}

.stat dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat dd {
  margin-top: 0.4rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 2.4vw, 2.5rem);
  line-height: 1;
  color: var(--ink);
}

/* ---------- Education ---------- */

.edu-card {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(1.7rem, 3.5vw, 2.3rem);
  transition: transform 0.25s var(--ease), box-shadow 0.3s ease, border-color 0.25s ease,
    background-color 0.3s ease;
}

.edu-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: clamp(1.4rem, 3vw, 2rem);
}

.edu-icon {
  width: 4rem;
  height: 4rem;
  font-size: 1.5rem;
  margin-bottom: 0;
}

.edu-info h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.25rem, 1rem + 1.2vw, 1.5rem);
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 0.45rem;
}

.edu-institution {
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--muted);
}

.edu-caption {
  font-size: 0.82rem;
  color: var(--faint);
}

.edu-duration {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.4rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
}

.edu-duration i {
  font-size: 0.82rem;
  color: var(--accent);
}

.edu-chips {
  margin-top: 1.25rem;
}

.gpa-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 1.15rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--accent-tint);
  transition: transform 0.25s var(--ease), border-color 0.25s ease, box-shadow 0.3s ease,
    background-color 0.3s ease;
}

.gpa-readout {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
}

.gpa-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--accent);
}

.gpa-max {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.gpa-label {
  margin-top: 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.edu-card:hover {
  border-color: var(--line-strong);
}

.edu-card:hover .gpa-badge {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

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

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
  gap: 1.5rem;
}

.skill-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 2rem;
}

.icon-tile {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 14px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  transition: transform 0.3s var(--ease), background 0.3s ease;
}

.card:hover .icon-tile {
  transform: rotate(-6deg) scale(1.05);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.28rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.card p {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--muted);
}

.skill-card p {
  margin: 0.55rem 0 1.4rem;
}

/* Chips */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.3rem 0.78rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.77rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink-soft);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease);
}

.chip:hover {
  background: var(--surface);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

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

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 2rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.project-media {
  display: flex;
  flex-direction: column;
  aspect-ratio: 16 / 10;
  background: var(--media-bg);
  transition: background-color 0.3s ease;
}

.project-slider {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.slides,
.slide {
  width: 100%;
  height: 100%;
}

.slide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.slide.active {
  opacity: 1;
}

.slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
}

.slide-caption {
  position: absolute;
  left: 0.85rem;
  bottom: 0.85rem;
  max-width: calc(100% - 8.2rem);
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--caption-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 0.7rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.media-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.95rem;
  background: var(--media-bar-bg);
  border-top: 1px solid var(--line);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.slide-count {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.media-buttons {
  display: flex;
  gap: 0.5rem;
}

.slider-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.78rem;
  cursor: pointer;
  transition: transform 0.18s var(--ease), color 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease;
}

.slider-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.slider-btn:active {
  transform: scale(0.92);
}

.project-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  padding: 1.5rem 1.65rem 1.75rem;
}

.project-body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.55rem;
}

.project-body p {
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 1.3rem;
}

.project-body .chip-list {
  margin-bottom: 1.5rem;
}

.project-body .btn {
  margin-top: auto;
}

.project-card:has(:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: start;
  gap: 2rem;
}

.contact-info {
  display: grid;
  gap: 0.9rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  padding: 1.15rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: transform 0.22s var(--ease), border-color 0.22s ease, box-shadow 0.3s ease,
    background-color 0.3s ease;
}

.contact-item:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.contact-item .icon-tile {
  width: 2.9rem;
  height: 2.9rem;
  font-size: 1.05rem;
  margin-bottom: 0;
  flex-shrink: 0;
}

.contact-label {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-value {
  font-size: 0.97rem;
  font-weight: 500;
  color: var(--ink);
  word-break: break-word;
}

.contact-card {
  padding: clamp(1.7rem, 3.5vw, 2.3rem);
}

.contact-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.contact-card > p {
  font-size: 0.93rem;
  color: var(--muted);
  margin-bottom: 1.6rem;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.82rem 1rem;
  background: var(--field-bg);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.3s ease, color 0.3s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--faint);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.site-footer {
  background: var(--footer-bg);
  color: #b3ada0;
  transition: background-color 0.3s ease;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 2.4rem;
  padding-bottom: 2.4rem;
}

.site-footer p {
  font-size: 0.88rem;
}

.to-top {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #cfc9bd;
  text-decoration: none;
  transition: color 0.2s ease;
}

.to-top:hover {
  color: var(--surface);
}

/* ---------- Lightbox ---------- */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  place-items: center;
  background: rgba(29, 26, 22, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.lightbox.active {
  display: grid;
}

.lightbox-content {
  max-width: min(92vw, 1020px);
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 80px -24px rgba(0, 0, 0, 0.75);
}

.lightbox-caption {
  margin-top: 1.1rem;
  font-size: 0.95rem;
  color: #d8d2c6;
}

.lightbox-count {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #938c7e;
}

.lightbox-close,
.lightbox-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.18s var(--ease);
}

.lightbox-close:hover,
.lightbox-btn:hover {
  background: var(--surface);
  color: var(--ink);
  transform: scale(1.05);
}

.lightbox-close:active,
.lightbox-btn:active {
  transform: scale(0.95);
}

.lightbox-close {
  top: 1.4rem;
  right: 1.5rem;
}

.lightbox-prev {
  left: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev:hover,
.lightbox-next:hover {
  transform: translateY(-50%) scale(1.05);
}

.lightbox :focus-visible {
  outline-color: #5eead4;
}

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 920px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .nav-list {
    gap: 1.4rem;
  }

  .hero-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero-lead {
    max-width: 30rem;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-tools {
    justify-content: center;
  }

  .profile-card {
    max-width: 440px;
    width: 100%;
    margin: 0 auto;
  }

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

  .stats-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .stat + .stat {
    border-top: none;
    border-left: 1px solid var(--line);
  }

  .edu-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .edu-meta {
    justify-self: start;
  }

  .gpa-badge {
    flex-direction: row;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.85rem 1.25rem;
  }

  .gpa-label {
    margin-top: 0;
  }

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

@media (max-width: 768px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-list {
    position: fixed;
    inset: 76px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 1.1rem 1.25rem 1.5rem;
    background: var(--mmenu-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.3s var(--ease);
  }

  .nav-list.open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .nav-link {
    display: block;
    padding: 0.75rem 0.9rem;
    border-radius: var(--r-sm);
    font-size: 0.98rem;
  }

  .nav-link::after {
    display: none;
  }

  .nav-link:hover,
  .nav-link.active {
    background: var(--surface);
    border: 1px solid var(--line);
  }

  .projects-grid {
    gap: 1.5rem;
  }

  .stats-panel {
    grid-template-columns: 1fr;
  }

  .stat + .stat {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .form-group input,
  .form-group textarea {
    font-size: 1rem;
  }

  /* Education card — mobile breathing room */
  .edu-card {
    padding: 1.5rem;
    margin: 0 1rem;
  }

  .edu-icon {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.35rem;
  }

  .edu-info h3 {
    font-size: 1.15rem;
    line-height: 1.35;
    margin-bottom: 0.55rem;
  }

  .edu-institution {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .edu-duration {
    margin-top: 0.45rem;
    font-size: 0.84rem;
  }

  .edu-caption {
    font-size: 0.78rem;
  }

  .edu-chips {
    gap: 0.45rem;
  }

  .edu-chips .chip {
    font-size: 0.73rem;
    padding: 0.28rem 0.7rem;
  }

  .gpa-badge {
    padding: 0.7rem 1.1rem;
  }

  .gpa-value {
    font-size: 1.9rem;
  }

  .slide-caption {
    display: none;
  }
}

@media (max-width: 560px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 22rem;
  }

  .hero-title {
    font-size: clamp(2.4rem, 12vw, 3.1rem);
  }

  .hero-role {
    font-size: 1.05rem;
  }

  .hero-lead {
    font-size: 0.98rem;
  }

  .gpa-value {
    font-size: 1.8rem;
  }

  .profile-stats {
    gap: 0.2rem;
  }

  .profile-stat strong {
    font-size: 1.25rem;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 400px) {
  .overline {
    letter-spacing: 0.11em;
  }

  .hero-title {
    font-size: 2.35rem;
    letter-spacing: -0.02em;
  }

  .section-title {
    font-size: 1.72rem;
  }

  .profile-stats {
    gap: 0;
  }

  .profile-stat strong {
    font-size: 1.15rem;
  }

  .lightbox-close {
    top: 0.9rem;
    right: 0.9rem;
    width: 40px;
    height: 40px;
  }

  .lightbox-prev {
    left: 0.9rem;
    width: 40px;
    height: 40px;
  }

  .lightbox-next {
    right: 0.9rem;
    width: 40px;
    height: 40px;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}