/* More stylish font for hero greeting */
.hero-greeting-stylish {
  font-family: 'Dancing Script', cursive;
  font-size: 2rem;
  color: var(--text);
  letter-spacing: 0.06em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.18);
  margin-bottom: 0.2em;
  font-weight: 700;
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
  background-clip: initial;
}
/* Make v6.mp4 as big as graphics image in the video card */
.project-video.v6-bigger {
  width: 100%;
  height: auto;
  max-height: 640px;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.22);
  background: #000;
  display: block;
  margin: 0 auto;
  padding: 0;
  transform: scale(1.08);
  transition: transform 0.2s cubic-bezier(.4,1.3,.6,1);
}
/* Play/Pause text button hover effect for videos section matches menu underline */
button.video-text-play,
button.video-text-pause {
  position: relative;
  color: #e11d48;
  background: none;
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  outline: none;
  transition: color 0.18s;
  padding: 0 0.2em;
}
button.video-text-play::after,
button.video-text-pause::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease;
}
button.video-text-play:hover,
button.video-text-pause:hover {
  color: var(--primary);
}
button.video-text-play:hover::after,
button.video-text-pause:hover::after {
  transform: scaleX(1);
}
/* Play/Pause text button hover effect for videos section (text only, no box) */
button.video-text-play:hover,
button.video-text-pause:hover {
  color: #be123c !important;
  background: none !important;
  border-radius: 0;
  transition: color 0.18s;
}
/* Play/Pause text button hover effect for videos section */
.video-text-controls .video-text-play:hover,
.video-text-controls .video-text-pause:hover {
  color: #fff;
  background: #e11d48;
  border-radius: 8px;
  transition: background 0.18s, color 0.18s;
}
/* Video pause label below video */
.video-pause-label {
  text-align: center;
  font-size: 0.92rem;
  color: var(--text);
  margin-top: 0.5rem;
  opacity: 0.85;
  letter-spacing: 0.02em;
}
/* GENERAL */

@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Inter:wght@400;600;700&display=swap");

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

:root {
  --bg: #ffffff;
  --text: #0b0b0b;
  --muted: #6b7280;
  --primary: #e11d48; /* red-600 */
  --primary-600: #be123c; /* red-700 */
  --primary-700: #9f1239; /* red-800 */
  --accent: #ef4444; /* red-500 */
  /* Buttons stay red in light mode */
  --button: #e11d48; /* red-600 */
  --button-700: #be123c; /* red-700 */
  --card: rgba(255, 255, 255, 0.75);
  --card-border: rgba(17, 24, 39, 0.08);
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
  --radius: 16px;
  --radius-lg: 24px;
}

/* THEME TRANSITIONS: make switching between light and dark feel smooth.
  We transition concrete properties (background, color, border-color,
  box-shadow, transform, filter, opacity) on the most commonly changing
  elements so variable swaps animate pleasantly. */
html.theme-transition,
html.theme-transition * {
  /* keep transitions snappy but smooth; some properties (gradients)
    may not animate perfectly across browsers, but this improves
    perceived smoothness for text, cards, borders, and shadows. */
  transition: background 360ms ease, background-color 360ms ease, color 320ms ease,
          border-color 320ms ease, box-shadow 360ms ease, transform 360ms ease,
          filter 320ms ease, opacity 300ms ease;
}

/* Global baseline transitions so theme changes animate even when the
  theme-transition class is not present (covers immediate toggles). */
html, body, .details-container, .color-container, .project-img, .section__pic-container,
.social-btn, .icon-btn, .nav-links a, .subheader, .modal-content, .cert-item, .btn {
  transition: background 360ms ease, background-color 360ms ease, color 320ms ease,
          border-color 320ms ease, box-shadow 360ms ease, transform 360ms ease,
          filter 320ms ease, opacity 300ms ease;
}


[data-theme="dark"] {
  --bg: #10090a; /* deep crimson-tinted black */
  --text: #f5f5f5;
  --muted: #c7c7c7;
  --primary: #ef4444; /* brighter red for dark */
  --primary-600: #dc2626;
  --primary-700: #b91c1c;
  --accent: #f87171;
  /* Buttons red in dark too */
  --button: #ef4444;
  --button-700: #b91c1c;
  --card: rgba(20, 20, 20, 0.6);
  --card-border: rgba(255, 255, 255, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

body {
  font-family: "Inter", "Poppins", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 600px at -10% -20%, rgba(0, 0, 0, 0.08), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(0, 0, 0, 0.06), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(0, 0, 0, 0.04), transparent 65%),
    linear-gradient(180deg, #ededf0 0%, #e3e4e8 100%);
  min-height: 100vh;
}

[data-theme="dark"] body {
  background:
    linear-gradient(0deg, rgba(153, 27, 27, 0.12), rgba(153, 27, 27, 0.12)),
    radial-gradient(1100px 700px at -10% -20%, rgba(127, 29, 29, 0.40), transparent 60%),
    radial-gradient(900px 600px at 120% 10%, rgba(153, 27, 27, 0.34), transparent 62%),
    radial-gradient(700px 500px at 50% 120%, rgba(220, 38, 38, 0.25), transparent 65%),
    radial-gradient(120% 100% at 50% 50%, transparent 60%, rgba(17, 7, 7, 0.45) 100%),
    linear-gradient(180deg, #12090a 0%, #0f0809 100%);
}

html {
  scroll-behavior: smooth;
}

p {
  color: var(--muted);
}

/* TRANSITION */

a,
.btn,
.icon-btn {
  transition: all 300ms ease;
}

/* DESKTOP NAV */

nav,
.nav-links {
  display: flex;
}

nav {
  justify-content: space-around;
  align-items: center;
  height: 17vh;
  /* remove blur to keep header seamless with background */
}

/* Header backgrounds */
#desktop-nav,
#hamburger-nav {
  /* Gradient box matching dark-mode style used in both themes */
  background: linear-gradient(135deg, rgba(239,68,68,0.26) 0%, rgba(185,28,28,0.16) 44%, rgba(0,0,0,0.10) 100%);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  width: min(1100px, 92%);
  margin: 1rem auto;
  padding: 0.6rem 1rem;
  height: auto; /* override fixed header height */
  justify-content: space-between; /* better spacing for logo + menu */
}

/* Position context for centering the desktop theme switch */
#desktop-nav { position: relative; }
#desktop-nav .theme-switch {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
}

/* Light mode: header uses full red gradient and white nav text */
html:not([data-theme="dark"]) #desktop-nav,
html:not([data-theme="dark"]) #hamburger-nav {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 45%, #b91c1c 75%, #dc2626 100%);
  border: 1px solid rgba(255,255,255,0.14);
}
html:not([data-theme="dark"]) #desktop-nav .logo,
html:not([data-theme="dark"]) #hamburger-nav .logo,
html:not([data-theme="dark"]) #desktop-nav .nav-links a,
html:not([data-theme="dark"]) #hamburger-nav .nav-links a {
  color: #ffffff;
}
html:not([data-theme="dark"]) #desktop-nav .nav-links a:hover,
html:not([data-theme="dark"]) #hamburger-nav .nav-links a:hover {
  color: #ffffff;
}
html:not([data-theme="dark"]) #desktop-nav .nav-links a::after,
html:not([data-theme="dark"]) #hamburger-nav .nav-links a::after {
  background: #ffffff;
}

/* Light mode header: icon buttons and hamburger bars appear white */
html:not([data-theme="dark"]) #desktop-nav .icon-btn,
html:not([data-theme="dark"]) #hamburger-nav .icon-btn {
  color: #ffffff;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.28);
}
html:not([data-theme="dark"]) #hamburger-nav .hamburger-icon span {
  background-color: #ffffff;
}

/* Light mode mobile menu links over red header */
html:not([data-theme="dark"]) #hamburger-nav .menu-links a { color: #ffffff; }

/* Header gradient stays identical in light and dark modes */

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-links {
  gap: 0.75rem;
  list-style: none;
  font-size: 1rem; /* smaller menu text */
}

/* Make desktop header menu text a bit smaller without affecting footer/mobile */
#desktop-nav .nav-links { font-size: 0.9rem; }

a {
  color: var(--text);
  text-decoration: none;
  text-decoration-color: white;
}

a:hover {
  color: var(--primary);
  text-decoration: none;
}

/* Header menu hover animation */
.nav-links a {
  position: relative;
  padding: 0.25rem 0;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease;
}

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

.nav-links a:hover { text-decoration: none; }

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* Cursive styling for logo first name */
.logo-cursive {
  font-family: 'Dancing Script', cursive;
  font-weight: 700;
  font-size: 1.6rem;
  display: inline-block;
  vertical-align: middle;
}

.logo:hover {
  cursor: default;
}

/* HAMBURGER MENU */

#hamburger-nav {
  display: none;
}

.hamburger-menu {
  position: relative;
  display: inline-block;
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 24px;
  width: 30px;
  cursor: pointer;
}

.hamburger-icon span {
  width: 100%;
  height: 2px;
  background-color: var(--text);
  transition: all 0.3 ease-in-out;
}

.menu-links {
  position: absolute;
  top: 100%;
  right: 0;
  background: linear-gradient(135deg, rgba(239,68,68,0.26) 0%, rgba(185,28,28,0.16) 44%, rgba(0,0,0,0.10) 100%);
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  width: fit-content;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3 ease-in-out;
}

/* Mobile menu uses the same gradient for both themes */

.menu-links a {
  display: block;
  padding: 10px;
  text-align: center;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
  transition: all 0.3 ease-in-out;
}

.menu-links a:hover { background-color: rgba(239, 68, 68, 0.08); color: var(--primary); }

.menu-links li {
  list-style: none;
}

.menu-links.open {
  max-height: 300px;
}

.menu-divider { height: 1px; background: var(--card-border); margin: 4px 10px; }

.hamburger-icon.open span:first-child {
  transform: rotate(45deg) translate(10px, 5px);
}

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

.hamburger-icon.open span:last-child {
  transform: rotate(-45deg) translate(10px, -5px);
}

.hamburger-icon span:first-child {
  transform: none;
}

.hamburger-icon span:first-child {
  opacity: 1;
}

.hamburger-icon span:first-child {
  transform: none;
}

/* SECTIONS */

section {
  padding-top: 6vh;
  height: 96vh;
  margin: 0 10rem;
  box-sizing: border-box;
  min-height: fit-content;
}

.section-container {
  display: flex;
}

/* PROFILE SECTION */

#profile {
  display: flex;
  justify-content: center;
  gap: 5rem;
  height: 80vh;
}

.section__pic-container {
  display: flex;
  height: 400px;
  width: 400px;
  margin: auto 0;
}

.section__text {
  align-self: center;
  text-align: left;
}

.section__text p:not(.hero-bio) {
  font-weight: 600;
}

.section__text__p1 {
  text-align: center;
}

.section__text__p2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

/* Lift subheading a bit more; keep name unchanged */
#profile .section__text__p1 { margin-top: -0.7cm; }
#profile .title { margin-top: 0.2cm; }

.hero-bio {
  color: var(--text);
  font-weight: 400; /* regular weight */
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 68ch;
  margin: 1.4rem auto 1.25rem; /* increased top margin for more space from title */
  opacity: 0.92;
  text-wrap: pretty;
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.hero-bio.lead {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.hero-points {
  list-style: none;
  max-width: 70ch;
  margin: 0.25rem auto 1.25rem;
  padding: 0;
  display: grid;
  gap: 0.5rem 1rem;
}

.hero-points li {
  color: var(--text);
  opacity: 0.9;
  font-size: 0.95rem;
  line-height: 1.65;
  text-align: left;
  position: relative;
  padding-left: 1.25rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.hero-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.18);
}

.title {
  font-size: 3rem;
  text-align: center;
  background: linear-gradient(90deg, var(--text), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Slightly lower the Projects title only */
#projects > h1.title { margin-top: 0.35rem; }

/* Hero title uses same gradient as other titles */

#socials-container {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
  gap: 1rem;
}

/* ICONS */

.icon {
  cursor: pointer;
  height: 2rem;
}

/* Social circular glow buttons */
.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: none;
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease, border-color 200ms ease;
}

.social-btn img {
  height: 22px;
  width: 22px;
  object-fit: contain;
  filter: none;
  transition: filter 200ms ease;
}

.social-btn:hover {
  transform: translateY(-2px);
  background: var(--card);
  border-color: var(--card-border);
  box-shadow: none;
}

.social-btn:hover img { filter: none; }

[data-theme="dark"] .social-btn { background: #ffffff; border-color: var(--card-border); box-shadow: none; }
[data-theme="dark"] .social-btn:hover { border-color: var(--card-border); box-shadow: none; }

.icon-btn {
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  height: 2.25rem;
  min-width: 2.25rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.icon-btn.small { font-size: 0.95rem; height: 2rem; }

.icon-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(0,0,0,0.08); }

/* THEME SWITCH (3D toggle) */
.theme-switch { display: inline-flex; align-items: center; justify-content: center; }
.theme-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; overflow: hidden; }
.theme-switch .switch { position: relative; width: 68px; height: 36px; display: inline-block; cursor: pointer; }
.theme-switch .switch-track {
  position: absolute; inset: 0; border-radius: 999px; border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.75));
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.08),
    inset 0 -2px 6px rgba(0,0,0,0.06),
    0 8px 18px rgba(0,0,0,0.08);
}
html[data-theme="dark"] .theme-switch .switch-track {
  background: linear-gradient(180deg, rgba(35,35,35,0.95), rgba(25,25,25,0.85));
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.45),
    inset 0 -2px 6px rgba(0,0,0,0.55),
    0 10px 22px rgba(0,0,0,0.55);
}
.theme-switch .switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #f3f4f6 45%, #e5e7eb 100%);
  box-shadow:
    0 6px 12px rgba(0,0,0,0.20),
    inset 0 1px 2px rgba(255,255,255,0.9),
    inset 0 -1px 2px rgba(0,0,0,0.08);
  transition: transform 240ms cubic-bezier(.2,.8,.2,1), box-shadow 240ms ease;
}
html[data-theme="dark"] .theme-switch .switch-thumb {
  background: radial-gradient(circle at 35% 30%, #f3f4f6 0%, #e5e7eb 45%, #d1d5db 100%);
}
.theme-switch .switch-icons { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; font-size: 16px; }
.theme-switch .icon-moon { opacity: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2)); }
.theme-switch .icon-sun { opacity: 0.6; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2)); }

/* Checked state → dark */
.theme-switch input:checked + .switch .switch-thumb { transform: translateX(32px); }
.theme-switch input:checked + .switch .icon-moon { opacity: 0.5; }
.theme-switch input:checked + .switch .icon-sun { opacity: 1; }

/* Focus ring */
.theme-switch input:focus-visible + .switch::after {
  content: ""; position: absolute; inset: -4px; border-radius: 999px; box-shadow: 0 0 0 3px rgba(239,68,68,0.35);
}

/* Hover depth */
.theme-switch .switch:hover .switch-thumb { box-shadow: 0 10px 18px rgba(0,0,0,0.24), inset 0 1px 2px rgba(255,255,255,0.9), inset 0 -1px 2px rgba(0,0,0,0.12); }

/* Compact switch in mobile menu */
.theme-switch.mobile .switch { width: 64px; height: 34px; }
.theme-switch.mobile .switch-thumb { width: 28px; height: 28px; top: 3px; left: 3px; }
.theme-switch.mobile .switch-icons { font-size: 15px; padding: 0 9px; }
.theme-switch.mobile input:checked + .switch .switch-thumb { transform: translateX(30px); }

/* BUTTONS */

.btn-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn {
  font-weight: 600;
  transition: all 300ms ease;
  padding: 1rem;
  width: 8rem;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

/* Smaller button in hero only */
#profile .btn {
  width: 5.75rem;
  padding: 0.7rem;
  font-size: 0.9rem;
}

/* Left-align CV button under hero text */
#profile .btn-container {
  justify-content: flex-start;
  max-width: 68ch;
  margin: 0.75rem auto 0;
}

.btn-color-1,
.btn-color-2 { border: var(--card-border) 0.1rem solid; }

.btn-color-1:hover,
.btn-color-2:hover {
  cursor: pointer;
}

.btn-color-1,
.btn-color-2:hover { background: var(--button); color: white; border-color: transparent; }

.btn-color-1:hover { background: var(--button-700); }

.btn-color-2 { background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--button) 12%, transparent)); }

.btn-color-2:hover { border: 0.1rem solid transparent; }

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120px 40px at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.4), transparent 60%);
  transition: opacity 0.2s ease;
  opacity: 0;
}
.btn:hover::after { opacity: 1; }

.btn-container {
  gap: 1rem;
}

/* Small Explore More button shown only when Projects filter = web-apps */
.projects-explore-more { display: none; justify-content: center; margin: 0.2rem 0 0; }
.projects-explore-more .btn-explore {
  padding: 0.5rem 0.9rem;
  width: auto;
  font-size: 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--text);
}
.projects-explore-more .btn-explore:hover { background: var(--button); color: #fff; border-color: transparent; }

/* Reveal Explore button when Projects filter is one of these categories */
#projects[data-filter="web-apps"] ~ .projects-explore-more,
#projects[data-filter="web-apps"] .projects-explore-more,
#projects[data-filter="web-apps"] + .projects-explore-more,
#projects[data-filter="python-tools"] ~ .projects-explore-more,
#projects[data-filter="python-tools"] .projects-explore-more,
#projects[data-filter="python-tools"] + .projects-explore-more,
#projects[data-filter="websites"] ~ .projects-explore-more,
#projects[data-filter="websites"] .projects-explore-more,
#projects[data-filter="websites"] + .projects-explore-more,
#projects[data-filter="game"] ~ .projects-explore-more,
#projects[data-filter="game"] .projects-explore-more,
#projects[data-filter="game"] + .projects-explore-more { display: flex; }

/* ABOUT SECTION */

#about {
  position: relative;
}

/* Give a bit more gap between "Get To Know More" and "About Me" */
#about .title { margin-top: 0.5rem; }

.about-containers {
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  margin-top: 0.75rem;
  justify-content: center;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.about-details-container {
  justify-content: center;
  flex-direction: column;
  align-items: center;
}

.about-containers,
.about-details-container {
  display: flex;
}

.about-pic {
  border-radius: 2rem;
  box-shadow: var(--shadow);
}

/* Position About image vertically */
#about .section__pic-container { margin-top: 2.8rem; }
@media screen and (min-width: 1201px) {
  #about .section__pic-container { margin-top: 2.8rem; }
}

/* Ensure About image scales nicely within its container */
#about .section__pic-container img.about-pic {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Centered layout, no right nudge on desktop */
@media screen and (min-width: 1201px) {
  #about .about-containers .details-container { margin-left: 0; }
  /* Keep About image centered on desktop for consistent layout */
  #about .about-pic { transform: none; }
  /* Keep glow centered behind the image */
  #about .section__pic-container::before { transform: translate(-50%, -50%); }
}

.arrow {
  position: absolute;
  right: -5rem;
  bottom: 2.5rem;
}

.details-container {
  padding: 1rem;
  flex: 0 0 260px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  text-align: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  transform: translateY(0);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

/* Red gradient for About cards only (light mode) */
#about .about-containers .details-container {
  background: linear-gradient(135deg, rgba(239,68,68,0.14) 0%, rgba(239,68,68,0.08) 50%, rgba(0,0,0,0.04) 100%);
  padding: 0.5rem 0.85rem; /* slimmer height */
}

/* Left-align the Experience card title inside its gradient box */
#about .about-containers .details-container:first-child {
  text-align: left;
}

/* Left-align the Education card title inside its gradient box */
#about .about-containers .details-container:last-child {
  text-align: left;
}

/* Tighten heading spacing inside About cards to keep them thin */
#about .about-containers .details-container h3 {
  margin: 0.1rem 0;
  line-height: 1.1;
}

[data-theme="dark"] #about .about-containers .details-container {
  background: linear-gradient(135deg, rgba(239,68,68,0.26) 0%, rgba(185,28,28,0.16) 44%, rgba(0,0,0,0.10) 100%);
}

.details-container:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,0.15); }

.section-container {
  gap: 4rem;
  height: 80%;
}

/* Tighten Research section gap to be very close to the divider */
#research .section-container { margin-top: 0.25rem; }

/* Utility class to force the Research section even tighter to the divider */
.research-tight .section-container { margin-top: 0rem; }

/* About card list styles */
.about-list {
  margin: 0.5rem 0 0;
  padding-left: 0;
  list-style: none;
}
.about-list li { text-align: left; }
.about-role { font-weight: 700; color: var(--text); }
.about-company { font-weight: 400; margin-top: 0.15rem; color: var(--text); font-size: 0.9rem; }
.about-meta { font-size: 0.85rem; font-style: italic; color: var(--muted); margin-top: 0.25rem; }
.about-meta.about-meta--small-regular { font-size: 0.8rem; font-style: normal; }

.about-experience-extra,
.about-education-extra {
  max-width: 800px;
  margin: 0.25rem 0 0.75rem;
}

/* About summary paragraph */
.about-summary {
  max-width: 960px;
  margin: 1.25rem auto 0;
  padding: 0 0.25rem;
}
.about-summary p {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.8;
  text-align: justify;
  text-wrap: pretty;
  opacity: 0.95;
}

/* Side-by-side layout for experience and education below cards */
.about-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
  max-width: 960px;
  margin: 0 auto;
}

@media screen and (max-width: 900px) {
  .about-lists { grid-template-columns: 1fr; }
}

/* Add a clear break between multiple experience entries */
.about-list li + li {
  margin-top: 0.75rem;
}

/* .about-education-extra no longer used; entries moved into card */

.section__pic-container {
  height: 400px;
  width: 400px;
  margin: auto 0;
}

/* Make the hero profile picture a bit smaller on desktop */
#profile .section__pic-container {
  width: 300px;
  height: 300px;
}

#profile .section__pic-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Hero glow behind the profile circle */
.section__pic-container { position: relative; z-index: 0; }
.section__pic-container { position: relative; z-index: 0; }
.section__pic-container::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 150%;
  height: 150%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    rgba(239, 68, 68, 0.18) 0%,
    rgba(239, 68, 68, 0.12) 36%,
    rgba(239, 68, 68, 0.06) 58%,
    rgba(239, 68, 68, 0.00) 78%);
  filter: blur(18px);
  z-index: 0;
  pointer-events: none;
}
/* Make the glow behind About image a bit smaller */
#about .section__pic-container::before {
  width: 130%;
  height: 130%;
  filter: blur(20px);
}
.section__pic-container img { position: relative; z-index: 1; }
.section__pic-container::after { content: none; }
.section__pic-container img { position: relative; z-index: 1; }

[data-theme="dark"] .section__pic-container::before {
  background: radial-gradient(circle at 50% 50%,
    rgba(239, 68, 68, 0.28) 0%,
    rgba(185, 28, 28, 0.20) 36%,
    rgba(153, 27, 27, 0.12) 58%,
    rgba(153, 27, 27, 0.00) 80%);
  filter: blur(22px);
}
/* Dark theme: smaller glow for About image */
[data-theme="dark"] #about .section__pic-container::before {
  width: 130%;
  height: 130%;
  filter: blur(18px);
}

/* Disable glow for hero section only */
#profile .section__pic-container::before { content: none; }

@keyframes hero-glow {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.9;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.12);
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .section__pic-container::before { animation: none; }
}

/* EXPERIENCE SECTION */

#experience {
  position: relative;
  /* bring skills & certification closer to the About divider */
  margin-top: calc(0.25rem - 1cm); /* tightened spacing */
}

.experience-sub-title {
  color: var(--muted);
  font-weight: 600;
  font-size: 1.75rem;
  margin-bottom: 2rem;
}

.experience-details-container {
  display: flex;
  justify-content: center;
  flex-direction: column;
  margin-top: 0.25rem; /* reduce gap so skills start nearer the divider */
}

/* Add a bit more gap between "Explore My" and the "Skills" title */
#experience .title { margin-top: 0.6rem; }

/* Add spacing before Certification heading below skills cards */
#experience .certification-title {
  margin-top: 2rem;
}

/* Certifications gallery */
.certifications { margin: 1rem auto 0; max-width: 960px; }

.cert-subheading-logo {
  display: block;
  height: 28px;
  margin: 0.25rem auto 0.75rem;
  object-fit: contain;
  filter: none;
}

.certifications {
  position: relative;
  display: block;
  width: min(960px, calc(100% - 2rem));
  margin: 1rem auto 0; /* tightened to sit closer to the skills content */
  padding-bottom: 0.9rem; /* preserve a little bottom breathing room */
  margin-bottom: 1.2rem; /* ensure smaller space before next section */
}
.cert-row {
  display: flex;
  --gap: 0.75rem;
  gap: var(--gap);
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 0.9rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  scroll-behavior: smooth;
  align-items: center; /* center items vertically */
}
.cert-item { transition: box-shadow 260ms ease; scroll-snap-align: center; overflow: visible; }
.cert-item.is-center { box-shadow: 0 18px 46px rgba(153,27,27,0.26); }
/* All items are clickable */
.cert-item { cursor: pointer; }
.cert-nav {
  background: var(--card);
  border: 1px solid rgba(239,68,68,0.5);
  color: var(--primary);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
  font-size: 20px;
  line-height: 1;
  position: absolute;
  top: calc(50% + 16px); /* nudge arrows lower */
  transform: translateY(-50%);
  z-index: 2;
}
.cert-nav:hover {
  transform: translateY(calc(-50% - 2px));
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}
/* Push arrows further outward so they don't overlap certificates */
.cert-prev { left: -64px; }
.cert-next { right: -64px; }

.cert-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 calc((100% - 2 * var(--gap)) / 3);
  scroll-snap-align: start;
}

.cert-item img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  border-radius: 10px; /* gentle rounded corners */
  background: var(--card);
  display: block; /* avoid inline baseline gaps */
}
/* Larger center image without zooming/cropping; responsive cap */
.cert-item.is-center img { max-height: 400px; }

/* Center-scaling behavior */
.cert-item { transition: box-shadow 260ms ease; transform: none; scroll-snap-align: center; }
.cert-item.is-center { box-shadow: 0 18px 46px rgba(153,27,27,0.26); }

@media screen and (max-width: 900px) {
  .cert-item img { max-height: 220px; }
}

/* Optional subtle scrollbar styling */
.cert-row::-webkit-scrollbar {
  height: 8px;
}
.cert-row::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.06);
  border-radius: 999px;
}
.cert-row::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.28);
  border-radius: 999px;
}
[data-theme="dark"] .cert-row::-webkit-scrollbar-track { background: rgba(255,255,255,0.10); }
[data-theme="dark"] .cert-row::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.35); }

/* Left-align content inside Experience cards */
#experience .details-container {
  text-align: left;
}

/* Distinct accents for Computing and Marketing cards */
#experience .details-container h2.experience-sub-title {
  position: relative;
  padding-bottom: 0.4rem;
}

#experience .computing-card {
  border-top: 3px solid var(--primary);
}
#experience .computing-card h2.experience-sub-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), transparent);
  transform-origin: left;
  transform: scaleX(0.7);
  transition: transform 220ms ease;
}

#experience .marketing-card {
  border-top: 3px solid var(--accent);
}
#experience .marketing-card h2.experience-sub-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  transform-origin: left;
  transform: scaleX(0.7);
  transition: transform 220ms ease;
}

/* Hover interactions */
#experience .details-container:hover { transform: translateY(-6px); box-shadow: 0 16px 44px rgba(153,27,27,0.18); }
#experience .computing-card:hover h2.experience-sub-title::after,
#experience .marketing-card:hover h2.experience-sub-title::after {
  transform: scaleX(1);
}

/* Subtle list item hover glow */
#experience .skills-list li { transition: color 160ms ease, text-shadow 160ms ease; }
#experience .skills-list li:hover {
  color: var(--text);
  text-shadow: 0 0 10px rgba(239,68,68,0.2);
}

.article-container {
  display: flex;
  text-align: initial;
  flex-wrap: wrap;
  flex-direction: row;
  gap: 2.5rem;
  justify-content: space-around;
}

/* Skills chips */
.skills-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.6rem;
}
.skill-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.06);
  color: var(--text);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}
[data-theme="dark"] .skill-chip {
  background: rgba(239,68,68,0.18);
}

/* Skills list bullets */
.skills-list {
  margin: 0.25rem 0 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}
.skills-list li {
  position: relative;
  padding-left: 1.25rem;
  line-height: 1.65;
}
.skills-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary, #ef4444);
  box-shadow:
    0 0 0 3px rgba(239,68,68,0.14),
    0 0 10px rgba(239,68,68,0.55),
    0 0 22px rgba(239,68,68,0.35);
  animation: bullet-pulse 2.4s ease-in-out infinite;
}

[data-theme="dark"] .skills-list li::before {
  box-shadow:
    0 0 0 3px rgba(239,68,68,0.22),
    0 0 12px rgba(239,68,68,0.75),
    0 0 28px rgba(239,68,68,0.55);
}

@keyframes bullet-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 0 3px rgba(239,68,68,0.14),
      0 0 10px rgba(239,68,68,0.55),
      0 0 22px rgba(239,68,68,0.35);
  }
  50% {
    transform: scale(1.06);
    box-shadow:
      0 0 0 3px rgba(239,68,68,0.18),
      0 0 16px rgba(239,68,68,0.75),
      0 0 32px rgba(239,68,68,0.48);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skills-list li::before { animation: none; }
}

article {
  display: flex;
  width: 10rem;
  justify-content: space-around;
  gap: 0.5rem;
}

article .icon {
  cursor: default;
}

/* Reveal animations */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 700ms ease, transform 700ms ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

.fade-in-up { opacity: 0; transform: translateY(16px); }
.fade-in-up.visible { opacity: 1; transform: translateY(0); }

/* PROJECTS SECTION */

#projects {
  position: relative;
  /* moved closer to Certification divider - subtract 1.2cm for a slight nudge down */
  margin-top: calc(5rem - 1.2cm); /* extra space below Certification */
}

/* Nudge the 'Browse My Recent' text a bit higher */
#projects .section__text__p1 { margin-top: -2.2rem; }

/* Section divider */
.section-divider {
  border: none;
  height: 1px;
  margin: 1rem auto 1.5rem;
  max-width: 960px;
  background: linear-gradient(90deg, transparent, var(--card-border), transparent);
}

/* Divider between Projects and Research: moved down a bit to increase vertical separation */
#projects-research-divider {
  /* bump down approximately 1cm (1cm ≈ 37.8px). Using 1rem/1.6rem depends on root font-size; we'll use calc to add 1cm for clarity */
  margin-top: calc(1rem + 1cm);
  transition: margin-top 240ms ease;
}
/* keep shift-down for backward compatibility */
#projects-research-divider.shift-down {
  margin-top: calc(1rem + 1cm);
}

/* When specific project categories are active, pull the Research heading and block 1cm up
   only for: python-tools, websites, game, web-apps. Graphics and videos remain unchanged. */
#projects[data-filter="python-tools"] + #research,
#projects[data-filter="websites"] + #research,
#projects[data-filter="game"] + #research,
#projects[data-filter="web-apps"] + #research,
#projects[data-filter="python-tools"] ~ #research,
#projects[data-filter="websites"] ~ #research,
#projects[data-filter="game"] ~ #research,
#projects[data-filter="web-apps"] ~ #research {
  /* move the whole research section 1cm upwards relative to its normal position */
  transform: translateY(-1cm);
  /* make sure the layout transition is smooth */
  transition: transform 220ms ease;
}

/* For Graphics and Videos filters, nudge the Research section slightly down by 0.5cm */
#projects[data-filter="graphics"] + #research,
#projects[data-filter="videos"] + #research,
#projects[data-filter="graphics"] ~ #research,
#projects[data-filter="videos"] ~ #research {
  transform: translateY(0.5cm);
  transition: transform 220ms ease;
}

/* PROJECTS SUBHEADER (gradient box under Projects title) */
.subheader.subheader-projects {
  background: linear-gradient(135deg, rgba(239,68,68,0.26) 0%, rgba(185,28,28,0.16) 44%, rgba(0,0,0,0.10) 100%);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  width: min(960px, 92%);
  margin: 1.6rem auto 1.25rem; /* pushed the subheader down further */
  padding: 0.4rem 0.6rem;
}
html:not([data-theme="dark"]) .subheader.subheader-projects {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 45%, #b91c1c 75%, #dc2626 100%);
  border: 1px solid rgba(255,255,255,0.14);
}
.subheader-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem 1.4rem; /* more horizontal spacing */
  padding: 0.45rem 0.6rem; /* extra breathing room */
}
.subheader-links a {
  position: relative;
  display: inline-block;
  padding: 0.35rem 0.7rem; /* pill-like padding */
  font-size: 0.98rem;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 999px; /* pill */
  box-shadow: none;
  transition: color 180ms ease, background-color 180ms ease, transform 120ms ease;
}
/* Underline hover like header menu */
.subheader-links a::after {
  content: "";
  position: absolute;
  left: 12px; /* inset from pill edge */
  right: 12px;
  bottom: 6px;
  height: 2px;
  background: var(--primary);
  opacity: 0.0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease, opacity 180ms ease;
}
.subheader-links a:hover::after,
.subheader-links a.active::after { transform: scaleX(1); opacity: 1; }
.subheader-links a:hover { color: var(--primary); background-color: rgba(0,0,0,0.04); transform: translateY(-1px); }
/* Light mode inside red gradient box: keep links white */
html:not([data-theme="dark"]) .subheader-links a { color: #ffffff; }
html:not([data-theme="dark"]) .subheader-links a:hover { color: #ffffff; }
html:not([data-theme="dark"]) .subheader-links a::after { background: #ffffff; }
@media screen and (max-width: 800px) {
  .subheader-links { gap: 0.6rem 1rem; padding: 0.35rem 0.5rem; }
  .subheader-links a { font-size: 0.92rem; padding: 0.28rem 0.6rem; }
}

@media screen and (max-width: 420px) {
  .subheader-links { gap: 0.45rem 0.6rem; padding: 0.25rem; }
  .subheader-links a { font-size: 0.88rem; padding: 0.2rem 0.45rem; }
}

.color-container {
  border-color: var(--card-border);
  background: var(--card);
}

.project-img {
  border-radius: 1rem;
  width: 100%;
  height: auto;
  box-shadow: var(--shadow);
}

.project-title {
  margin: 1rem;
  color: var(--text);
}

.project-btn {
  color: var(--text);
  border-color: var(--card-border);
}

.color-container { transition: transform 220ms ease, box-shadow 220ms ease; }
.color-container:hover { transform: translateY(-6px) scale(1.01); box-shadow: 0 20px 50px rgba(153, 27, 27, 0.18); }

.project-img { transition: transform 300ms ease; }
.color-container:hover .project-img { transform: scale(1.03); }

/* Simple project (no box) */
/* Uniform project cards */
#projects .about-containers { align-items: stretch; }
#projects .project-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 300px;
  min-height: 360px;
}
#projects .details-container { flex: 0 0 300px; }
#projects .project-card .article-container {
  width: 100%;
  gap: 0;
}
#projects .project-card .project-preview {
  width: 100%;
}
#projects .project-card .project-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
}

/* Slight nudge for project blocks under the subheader */
#projects .experience-details-container { margin-top: 1.0rem; }

/* Make graphics card image larger with rounded corners */
/* Graphics presentation: no background card, just the image */
#projects .project-card.graphics-card {
  max-width: 960px;
  background: transparent;
  border: none;
  box-shadow: none;
  min-height: auto;
  position: relative;
}
#projects .project-card.graphics-card .project-preview {
  padding: 0;
}
#projects .project-card.graphics-card .project-img {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}

#projects .project-card.videos-card {
  max-width: 960px;
  background: transparent;
  border: none;
  box-shadow: none;
  min-height: auto;
  position: relative;
}

/* P2P specific styling: dock the video to the left, rounded corners, and hide anything behind */
.p2p-video-wrapper {
  position: relative;
  width: 100%;
  max-width: 1200px; /* keeps the original max constraint */
  min-width: 0; /* allow it to shrink on narrow viewports */
  display: flex;
  justify-content: flex-start; /* keep video to the left so text can sit on the right */
  align-items: flex-start;
  overflow: visible;
  background: none;
  box-shadow: none;
}

#p2p-video {
  width: min(90vw, 1200px);
  height: auto;
  max-height: 80vh;
  min-width: 360px; /* safe minimum for very small screens */
  object-fit: cover; /* cover so there are no background gaps */
  border-radius: 24px; /* rounded corner */
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
  background: #000; /* avoid showing elements behind when aspect differs */
  z-index: 100; /* ensure it sits above other content */
  display: block;
}

/* New inner container that holds the video and its centered play button */
.p2p-video-inner {
  position: relative; /* context for centering the absolute play button */
  display: inline-block;
  width: auto;
}

/* Two-column layout for the P2P card: video left, info right */
.p2p-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  justify-content: flex-start; /* video side stays left */
  width: 100%;
}

.p2p-video-wrapper { flex: 0 0 auto; }
.p2p-info {
  flex: 1 1 320px; /* text column grows and wraps as needed */
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.p2p-desc { color: var(--muted); line-height: 1.6; }
.p2p-actions { display: flex; gap: 0.6rem; margin-top: 0.6rem; }

@media screen and (max-width: 900px) {
  /* stack vertically on small screens */
  .p2p-layout { flex-direction: column; align-items: center; }
  .p2p-info { max-width: 92vw; text-align: center; }
  .p2p-video-wrapper { justify-content: center; }
}

/* Make sure the play button sits above the video and is well positioned */
  #p2p-play-btn {
  position: absolute;
  top: 50%;
  left: 50%; /* center horizontally over the inner video container */
  transform: translate(-50%, -50%); /* center both axes */
  background: rgba(255,255,255,0.92);
  border: none;
  border-radius: 50%;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  cursor: pointer;
  transition: background 0.2s, transform 0.12s;
  z-index: 200; /* above the video */
}

#p2p-play-btn:hover { transform: translate(-50%, -50%) scale(1.03); }

@media screen and (max-width: 760px) {
  .p2p-video-wrapper { justify-content: center; }
  #p2p-video { width: 92vw; min-width: 280px; border-radius: 18px; }
  /* center the play button on narrow screens */
  #p2p-play-btn { left: 50%; transform: translate(-50%, -50%); width: 88px; height: 88px; }
}

/* On narrow screens reduce sizes to avoid overflow */
@media screen and (max-width: 760px) {
  .p2p-video-wrapper { justify-content: center; }
  #p2p-video { width: 92vw; min-width: 280px; border-radius: 18px; }
  /* center the play button on narrow screens */
  #p2p-play-btn { left: 50%; transform: translate(-50%, -50%); width: 88px; height: 88px; }
}

/* Replace inline SVG triangle color by using CSS filter on it, fallback kept */
#p2p-play-btn svg { filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4)); }
/* play logo opacity increased so the triangle is more visible */
#p2p-play-btn svg { opacity: 0.85; transition: opacity 180ms ease, transform 160ms ease; }
/* hide the white circle and keep the triangle visible */
#p2p-play-btn svg circle { display: none; }
#p2p-play-btn svg polygon { fill: #fff !important; transform-origin: 50% 50%; width: 100%; height: 100%; }

#p2p-play-btn:hover { transform: translate(-50%, -50%) scale(1.06); background: rgba(0,0,0,0.64); box-shadow: 0 14px 44px rgba(0,0,0,0.38); }
#p2p-play-btn:focus { outline: none; box-shadow: 0 0 0 4px rgba(17,24,39,0.12); }
#p2p-play-btn:hover svg,
#p2p-play-btn:focus svg { opacity: 0.9; transform: scale(1.02); }

/* Make the play button keyboard accessible and visible when focused */
#p2p-play-btn:focus { outline: none; box-shadow: 0 0 0 6px rgba(255,255,255,0.06); }

@media screen and (max-width: 900px) {
  .details-container[data-category="p2p"] .p2p-video-wrapper { height: auto; padding: 2vh 0; }
  #p2p-video { width: 92vw; aspect-ratio: 16 / 9; height: auto; border-radius: 12px; }
  /* keep the play button centered over the video on small screens */
  #p2p-play-btn { width: 64px; height: 64px; left: 50%; transform: translate(-50%, -50%); }
}

/* Tablet: hide the hamburger-menu three-line icon (but keep mobile and desktop behavior) */
@media screen and (min-width: 600px) and (max-width: 1024px) {
  #hamburger-nav .hamburger-icon span {
    display: none !important;
  }
  /* also ensure the hamburger icon itself doesn't capture space visually */
  #hamburger-nav .hamburger-icon { width: 0; height: 0; }
}

/* Remove any container chrome for the P2P project card so only the video shows */
.details-container[data-category="p2p"],
.details-container[data-category="p2p"] .project-preview,
.details-container[data-category="p2p"] .article-container,
.details-container[data-category="p2p"] .p2p-video-wrapper {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  /* Also make sure pseudo-elements can't show a background */
  .details-container[data-category="p2p"]::before,
  .details-container[data-category="p2p"]::after {
    content: none !important;
  }

  /* Make the P2P card full-bleed and the video very large, docked to the viewport left */
  /* This uses viewport units and absolute positioning to make the video appear at the left edge */
  .details-container[data-category="p2p"] {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 calc(-50vw + 50%) !important; /* full-bleed centered to viewport edges */
    padding: 0 !important;
    position: relative;
    left: 0 !important;
    right: auto !important;
    box-sizing: border-box;
  }

  .details-container[data-category="p2p"] .p2p-video-wrapper {
    position: relative;
    width: 100vw;
    height: 80vh; /* wrapper visible area */
    max-height: 80vh;
    display: flex;
    align-items: center;
  justify-content: flex-start; /* keep the video flush-left inside the full-bleed area */
    overflow: hidden; /* will crop overflowing video content */
    padding-left: 0;
    border-radius: 18px; /* rounded visible area */
    box-shadow: 0 20px 60px rgba(0,0,0,0.28);
    /* subtle inner dark vignette to mask edges */
    background: linear-gradient(180deg, rgba(0,0,0,0.06), rgba(0,0,0,0.02));
  }

  /* Render the visible video area at a strict 16:9 aspect ratio and scale responsively */
  #p2p-video {
    width: clamp(640px, 60vw, 1100px);
    aspect-ratio: 16 / 9; /* enforces 16:9 */
    height: auto; /* height derived from width and aspect-ratio */
    object-fit: cover; /* cover ensures the frame fills the area */
    border-radius: 0; /* wrapper provides the rounded mask */
    margin-left: 0; /* flush to left inside wrapper */
    transform: none; /* remove cropping translate */
    max-height: 80vh; /* cap height to viewport space */
    position: relative;
    left: 0; /* ensure the video itself is not offset */
  }

  /* If you want the video to be flush to viewport left (no gutter), use this */
  .details-container[data-category="p2p"] .p2p-video-wrapper {
    padding-left: 0;
  }

  /* Play button: dark translucent circular button with white triangle */
  #p2p-play-btn {
    /* center the button over the video */
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 96px;
    height: 96px;
    background: rgba(0,0,0,0.44);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.06);
    transition: transform 180ms ease, background 160ms ease, box-shadow 160ms ease, opacity 180ms ease;
    box-shadow: 0 8px 30px rgba(0,0,0,0.32);
    z-index: 600; /* ensure it's above the video and other controls */
  }

  /* Replace inline SVG triangle color by using CSS filter on it, fallback kept */
  #p2p-play-btn svg { filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4)); }
  /* play logo opacity increased so the triangle is more visible */
  #p2p-play-btn svg { opacity: 0.85; transition: opacity 180ms ease, transform 160ms ease; }
  /* hide the white circle and keep the triangle visible */
  #p2p-play-btn svg circle { display: none; }
  #p2p-play-btn svg polygon { fill: #fff !important; transform-origin: 50% 50%; width: 100%; height: 100%; }

  #p2p-play-btn:hover { transform: translate(-50%, -50%) scale(1.06); background: rgba(0,0,0,0.64); box-shadow: 0 14px 44px rgba(0,0,0,0.38); }
  #p2p-play-btn:focus { outline: none; box-shadow: 0 0 0 4px rgba(17,24,39,0.12); }
  #p2p-play-btn:hover svg,
  #p2p-play-btn:focus svg { opacity: 0.9; transform: scale(1.02); }

  /* Make the play button keyboard accessible and visible when focused */
  #p2p-play-btn:focus { outline: none; box-shadow: 0 0 0 6px rgba(255,255,255,0.06); }

  @media screen and (max-width: 900px) {
    .details-container[data-category="p2p"] .p2p-video-wrapper { height: auto; padding: 2vh 0; }
    #p2p-video { width: 92vw; aspect-ratio: 16 / 9; height: auto; border-radius: 12px; }
    /* keep the play button centered over the video on small screens */
    #p2p-play-btn { width: 64px; height: 64px; left: 50%; transform: translate(-50%, -50%); }
  }



#projects .project-card.videos-card .project-preview { padding: 0; }
#projects .project-card.videos-card .project-preview {
  border-radius: 18px;
  overflow: hidden; /* ensure video corners clip */
}
#projects .project-card.videos-card .project-video {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  display: block;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  background: #000; /* black letterboxing around video if aspect differs */
}

/* Video controls styled like graphics arrows */

/* Videos section: position prev/next arrows vertically centered over the video, like graphics */
.video-controls {
  position: relative;
  width: 100%;
  height: 0;
  margin-top: 0;
}
.video-controls .video-prev,
.video-controls .video-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(239,68,68,0.5);
  background: var(--card);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow), 0 0 14px rgba(239,68,68,0.45);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
  z-index: 2;
  font-size: 20px;
}
.video-controls .video-prev:hover,
.video-controls .video-next:hover {
  transform: translateY(calc(-50% - 2px));
  box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 0 22px rgba(239,68,68,0.6);
}
.video-controls .video-prev { left: -56px; }
.video-controls .video-next { right: -56px; }
.video-controls .video-play,
.video-controls .video-pause {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background 180ms, color 180ms, box-shadow 180ms;
  z-index: 2;
  opacity: 0.85;
}
.video-controls .video-play:hover,
.video-controls .video-pause:hover {
  background: var(--primary);
  color: #fff;
  opacity: 1;
}

/* Graphics arrows */
.graphics-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(239,68,68,0.5);
  background: var(--card);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow), 0 0 14px rgba(239,68,68,0.45);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
  z-index: 2;
}
.graphics-nav:hover { transform: translateY(calc(-50% - 2px)); box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 0 22px rgba(239,68,68,0.6); }
.graphics-prev { left: -56px; }
.graphics-next { right: -56px; }
#projects .project-card .project-title { margin: 0.9rem 0 0.75rem; }
#projects .project-card .btn-container { margin-top: auto; justify-content: center; }

/* Project preview hover crossfade for Project One (match Project Two sizing) */
.project-preview { position: relative; display: flex; align-items: center; justify-content: center; }
.project-preview .project-img.base { position: relative; z-index: 1; object-fit: cover; /* uses global .project-img width/height */ }
.project-preview .project-img.hover {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  opacity: 0;
  z-index: 2;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.color-container:hover .project-preview .project-img.hover { opacity: 1; }
/* Also trigger image swap when hovering the simplified card or the image wrapper itself */
.details-container.simple:hover .project-preview .project-img.hover,
.project-preview:hover .project-img.hover { opacity: 0; }

/* Image + inline video wrapper for project thumbnails */
.img-video-wrap { position: relative; display: inline-block; width: 100%; }
.img-video-wrap .p2p-thumb { display: block; width: 100%; height: auto; }
.img-video-wrap .project-video { width: 100%; height: auto; display: block; }
.img-video-wrap .play-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: none;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
}
.img-video-wrap .play-overlay svg { filter: drop-shadow(0 6px 18px rgba(0,0,0,0.45)); }
.img-video-wrap .p2p-inline-video { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; z-index: 30; }
.img-video-wrap .p2p-inline-video.hidden { display: none; }
/* When hiding the thumbnail, keep its layout space so absolutely-positioned
   inline videos can render into the same area. Use visibility+opacity so the
   wrapper keeps its height instead of collapsing. */
.img-video-wrap .p2p-thumb.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Filter animation for project cards */
#projects .project-card { transition: opacity 200ms ease, transform 200ms ease; }
#projects .project-card[style*="display: none"] { opacity: 0; transform: scale(0.98); }


/* CONTACT */

/* Make Contact section compact and remove large vertical spacing */
#contact {
  display: flex;
  justify-content: center;
  flex-direction: column;
  height: auto; /* allow content to size naturally */
  padding-bottom: 0.6rem;
  /* add extra vertical breathing room above contact content */
  padding-top: 2cm;
}

/* Divider between Research and Contact */
#contact {
  border-top: 1px solid rgba(17,24,39,0.08); /* matches --card-border used by .section-divider */
  padding-top: 0.6rem; /* reduced space so contact content sits closer to divider */
  margin-top: 0.2rem; /* pull the whole section slightly upward */
  position: relative; /* positioning context for the pseudo-element */
}

/* Lower the contact section 0.5cm from the divider by reducing upward shift */
#contact {
  transform: translateY(-0.2cm);
  transition: transform 220ms ease;
}

/* More robust divider using a pseudo-element so it can't be collapsed by layout rules */
#contact::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0.45rem; /* sit slightly below the top edge to create a gap */
  height: 1px;
  width: min(960px, 92%);
  background: linear-gradient(90deg, transparent, rgba(17,24,39,0.08), transparent);
  pointer-events: none;
  z-index: 30; /* ensure it's above most content */
}

/* Light-mode fix: avoid duplicate divider lines between Research and Contact.
   Hide the explicit <hr> immediately after #research and remove the border-top
   on #contact in light theme; keep the pseudo-element as the single divider.
   Dark mode remains unchanged. */
html:not([data-theme="dark"]) #research + .section-divider { display: none; }
html:not([data-theme="dark"]) #contact { border-top: none; }

/* Light-mode only: remove red-tinted glow effects on hover while keeping
   neutral shadows. Dark mode will keep the red accents. */
html:not([data-theme="dark"]) {
  /* General hover shadows: prefer neutral shadow defined by --shadow */
  .paper-hover:hover,
  .color-container:hover,
  .details-container:hover,
  .research-nav:hover,
  .graphics-nav:hover,
  .cert-nav:hover,
  .video-controls .video-prev:hover,
  .video-controls .video-next:hover {
    box-shadow: var(--shadow) !important;
    /* preserve slight lift but remove red glow */
    transform: translateY(-4px) !important;
  }

  /* Also neutralize the default (non-hover) colored glows on navigation
     buttons and the centered certificate item so no red "background glow"
     appears in light mode. */
  .research-nav,
  .graphics-nav,
  .cert-nav,
  .video-controls .video-prev,
  .video-controls .video-next,
  .cert-item.is-center {
    box-shadow: var(--shadow) !important;
    border-color: rgba(0,0,0,0.06) !important;
  }

  /* Replace red-tinted focused/focus-ring on the theme switch with neutral ring */
  .theme-switch input:focus-visible + .switch::after {
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
  }

  /* Skills list hover: remove red text-shadow */
  #experience .skills-list li:hover {
    text-shadow: none !important;
    color: var(--text) !important;
  }

  /* Remove red glow on small decorative bullets (keep subtle neutral outline) */
  .hero-points li::before,
  .skills-list li::before {
    box-shadow: 0 0 0 3px rgba(0,0,0,0.04) !important;
  }

  /* Light-mode only: move Contact section down and increase vertical spacing */
  #contact {
    /* Increase vertical breathing room in light mode while keeping dark mode unchanged */
    padding-top: 2.2cm !important; /* reduced by another 0.5cm as requested */
    padding-bottom: 1.2rem !important; /* slightly more bottom padding */
    margin-top: 0.8rem !important;
    transform: translateY(0) !important; /* reset the upward nudge so it sits lower */
  }

  /* Consolidated light-mode hero text styles: high contrast, no heavy
     text-shadows, and consistent bullet styling. Dark mode remains
     untouched. */
  .hero-greeting-stylish {
    color: var(--muted) !important;
    text-shadow: none !important;
  }

  .title {
    /* keep the text-gradient title but ensure strong dark start for
       legibility on light backgrounds */
    background: linear-gradient(90deg, var(--text), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
  }

  .hero-bio {
    color: var(--text) !important;
    text-shadow: none !important;
    opacity: 1 !important;
  }

  .hero-points li {
    color: var(--text) !important;
    text-shadow: none !important;
  }

  .hero-points li::before {
    background: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.04) !important;
  }

  .btn.btn-color-1 {
    background: var(--button) !important;
    color: #fff !important;
    border-color: transparent !important;
  }

  .section__text__p1,
  .section__text__p2 {
    color: var(--text) !important;
  }

  /* Make all buttons solid red in light mode and disable hover transforms/shadows */
  .btn,
  .btn-color-1,
  .btn-color-2,
  .icon-btn,
  .social-btn,
  .simple-btn,
  .generate-btn,
  .video-text-play,
  .video-text-pause,
  .option-btn,
  .download-btn {
    background: var(--button) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: none !important;
    transform: none !important;
  }

  /* Light-mode: make Experience and Education cards more prominently red to match design.
     Targets the two details-container cards inside #about so other .details-container
     usages remain unaffected. */
  #about .about-containers .details-container {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 45%, #b91c1c 75%);
    border: 1px solid rgba(255,255,255,0.14) !important;
    color: #fff;
    box-shadow: 0 14px 38px rgba(0,0,0,0.12) !important;
  }

  /* Ensure headings inside those cards remain readable */
  #about .about-containers .details-container h3 {
    color: #fff !important;
  }

  /* Remove hover effects for these buttons in light mode */
  .btn:hover,
  .icon-btn:hover,
  .social-btn:hover,
  .simple-btn:hover,
  .generate-btn:hover,
  .video-text-play:hover,
  .video-text-pause:hover,
  .option-btn:hover,
  .download-btn:hover {
    background: var(--button) !important;
    color: #fff !important;
    box-shadow: none !important;
    transform: none !important;
  }

  /* Fix: keep prev/next arrow hover nudge vertically centered like dark mode.
     The global light-mode rule earlier forced transform:none for many buttons;
     arrows need the translateY(calc(-50% - 2px)) on hover to remain centered.
     Apply this only in light mode so dark mode remains unchanged. */
  .video-controls .video-prev:hover,
  .video-controls .video-next:hover,
  .graphics-nav:hover,
  .cert-nav:hover {
    /* use same hover transform as defined for dark mode arrows */
    transform: translateY(calc(-50% - 2px)) !important;
    /* keep neutralized shadow from earlier light-mode overrides */
    box-shadow: 0 12px 32px rgba(0,0,0,0.12) !important;
  }

  /* Research arrows: restore dark-mode like vertical nudge in light mode */
  .research-nav:hover {
    transform: translateY(calc(-50% - 2px)) !important;
    box-shadow: 0 12px 32px rgba(0,0,0,0.12) !important;
  }

  /* Make GitHub and LinkedIn icons in the hero white in light mode only.
     We target the social images inside the hero's `#socials-container` so
     other social icons elsewhere are unaffected. */
  #socials-container .social-btn img {
    filter: brightness(0) invert(1) !important;
  }
}

@media screen and (max-width: 600px) {
  /* mobile: slightly less padding but also lower the section a bit */
  #contact { padding-top: 1.8cm; margin-top: 0.6rem; transform: translateY(0.2cm); }
  #contact::before { top: 0.6rem; }

  /* light-mode mobile override */
  /* match dark-mode mobile spacing so light and dark are consistent */
  html:not([data-theme="dark"]) #contact {
    padding-top: 1.4cm;
    margin-top: 0.9rem;
    transform: translateY(0.2cm);
  }
}

.contact-info-upper-container {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: calc(var(--radius-lg) - 6px);
  border: 1px solid var(--card-border);
  background: var(--card);
  box-shadow: var(--shadow);
  margin: 1rem auto; /* reduce vertical margin */
  padding: 0.3rem 0.6rem; /* tighter padding */
  gap: 0.4rem;
  max-width: 720px;
}

.contact-info-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.6rem; /* slightly reduced spacing between items */
}

.contact-info-container p {
  font-size: 0.98rem;
  margin: 0;
}

/* Contact icons/links: use theme-aware colors. Icons are inverted only in dark theme. */
#contact .contact-info-container img.contact-icon {
  filter: none;
  opacity: 0.95;
  mix-blend-mode: normal;
}

#contact .contact-info-container a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  text-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

#contact .contact-info-container a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Invert contact icons for dark theme so they appear white */
[data-theme="dark"] #contact .contact-info-container img.contact-icon {
  filter: brightness(0) invert(1);
}

.contact-icon {
  cursor: default;
}

.email-icon {
  height: 2.5rem;
}

/* Copyright line styled small and centered under the contact block */
.site-copyright {
  text-align: center;
  margin: 0.25rem auto 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@media screen and (max-width: 600px) {
  .site-copyright { margin-bottom: 0.8rem; font-size: 0.88rem; }
}

/* Mobile: make contact icons uniform size and aligned left margin */
@media screen and (max-width: 480px) {
  /* give the contact block a consistent left padding so icons align */
  #contact .contact-info-upper-container {
    padding-left: 14px;
    padding-right: 14px;
  }

  /* force icons to the same size */
  #contact .contact-info-container img.contact-icon,
  #contact .contact-info-container img.email-icon {
    height: 40px; /* uniform size */
    width: 40px;
    object-fit: contain;
    margin-left: 4px; /* small left offset to match design */
  }

  /* ensure the text aligns consistently next to the icons */
  #contact .contact-info-container p {
    margin-left: 8px;
  }
}

/* FOOTER SECTION */

footer {
  height: 26vh;
  margin: 0 1rem;
  background: transparent;
  border-top: none;
  box-shadow: none;
  backdrop-filter: none;
}

footer p {
  text-align: center;
}

[data-theme="dark"] footer {
  background: transparent;
  border-top: none;
  box-shadow: none;
  backdrop-filter: none;
}

/* Active nav link */
.nav-links a.active { color: var(--primary); text-decoration-color: var(--primary); }

/* PDF Preview Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 2rem;
}
.modal-overlay.open { display: flex; }
.modal-content {
  width: min(1100px, 96%);
  height: min(80vh, 900px);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 2rem;
  padding: 0.6rem 0.9rem;
  align-self: flex-end;
  cursor: pointer;
}
#pdf-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--card);
}
.modal-actions {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 1210;
}
.modal-actions .btn { padding: 0.5rem 0.9rem; }

@media (max-width: 700px) {
  .modal-content { height: 86vh; }
  .modal-close { font-size: 1.6rem; }
}


/* Research paper item thumbnail and simple buttons */
.paper-item { display: flex; gap: 1rem; align-items: center; }
.paper-thumb { width: 84px; height: 112px; object-fit: cover; border-radius: 6px; box-shadow: 0 8px 30px rgba(0,0,0,0.12); border: 1px solid var(--card-border); }
.paper-actions { display:flex; gap:0.5rem; margin-top:0.4rem; }
.simple-btn { padding: 0.45rem 0.7rem; width: auto; border-radius: 8px; background: transparent; border: 1px solid var(--card-border); color: var(--text); font-weight:600; }
.simple-btn:hover { background: var(--button); color: #fff; border-color: transparent; }

/* glow effect on hover for the research block */
.paper-hover { transition: box-shadow 220ms ease, transform 220ms ease; }
.paper-hover:hover { box-shadow: 0 18px 60px rgba(225,29,72,0.16); transform: translateY(-4px); }

/* landscape variant */
.landscape-paper { display:flex; flex-direction:row; gap:1rem; align-items:center; justify-content:flex-start; }
.paper-thumb-land { width: 420px; height: 260px; object-fit: cover; border-radius: 10px; box-shadow: 0 18px 60px rgba(0,0,0,0.16); border: 1px solid var(--card-border); }
.landscape-actions { display:flex; flex-direction:column; gap:0.6rem; margin-left: 0.2rem; }

@media (max-width: 820px) {
  .paper-thumb-land { width: 100%; height: auto; max-height: 240px; }
  .landscape-paper { flex-direction: column; align-items:flex-start; }
  .landscape-actions { flex-direction:row; }
}

/* Positioning: bring research block up and center it */
#research {
  padding-top: 0.8vh; /* move the research block higher on the page */
  height: auto; /* allow content to size normally */
  margin: 0 auto 1.6rem; /* center horizontally with a bit less bottom spacing */
}
#research .section-container {
  display: flex;
  justify-content: center; /* center inner container horizontally */
  align-items: center; /* center vertically within the section container */
  gap: 1.25rem;
}
#research .details-container {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 0.45rem;
  margin-top: 0rem; /* sit directly under the divider */
  box-sizing: border-box;
}
#research .landscape-paper {
  justify-content: center; /* center the image + actions */
  margin: 0 auto;
}

.paper-caption {
  text-align: center;
  margin-top: 0.4rem; /* reduce gap between image and caption */
  color: var(--text);
  font-size: 1rem;
}

.paper-caption strong { font-weight: 700; font-size: 1.02rem; }

/* Previous / Next nav for research carousel (positioned outside like graphics arrows) */
.research-nav {
  background: var(--card);
  border: 1px solid rgba(239,68,68,0.5);
  color: var(--primary);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow), 0 0 14px rgba(239,68,68,0.45);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}
.research-prev { left: -56px; }
.research-next { right: -56px; }
.research-nav:hover { transform: translateY(calc(-50% - 2px)); box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 0 22px rgba(239,68,68,0.6); }

/* Ensure nav and content align nicely */
.landscape-paper { align-items: center; }
/* make the details container a positioning context for the absolute arrows */
#research .details-container { position: relative; display:flex; align-items:center; justify-content:center; gap:1rem; }

/* vertical figure wrapper so caption stays under the image */
.research-figure { display:flex; flex-direction:column; align-items:center; gap:0.6rem; }
.research-figure .landscape-actions { order: 2; }
.research-figure .paper-caption { order: 3; }

@media (max-width: 900px) {
  #research { padding-top: 1.2vh; }
  #research .details-container { padding: 0.4rem; }
  #research .landscape-paper { gap: 0.75rem; }
}

/* -----------------------------
   Light-mode enhanced scroll animations
   ----------------------------- */
html:not([data-theme="dark"]) .reveal {
  /* start slightly more elevated and rotated for a lively feel */
  opacity: 0;
  transform: translateY(28px) rotateX(6deg) scale(0.995);
  transform-origin: 50% 60%;
  transition: opacity 700ms cubic-bezier(.2,.9,.25,1), transform 780ms cubic-bezier(.2,.9,.25,1), filter 480ms ease;
  will-change: transform, opacity, filter;
}

html:not([data-theme="dark"]) .reveal.visible {
  opacity: 1;
  transform: translateY(0) rotateX(0) scale(1);
  filter: drop-shadow(0 18px 40px rgba(0,0,0,0.06));
}

/* Stagger helper using CSS variable --reveal-delay (set by JS) */
html:not([data-theme="dark"]) .reveal {
  transition-delay: var(--reveal-delay, 0ms);
}

/* Parallax effect for images and picture containers (light mode) */
html:not([data-theme="dark"]) .parallax {
  transform: translateZ(0);
  transition: transform 860ms cubic-bezier(.2,.9,.25,1);
  will-change: transform;
}

/* A subtle scale and lift when a parallax item becomes visible */
html:not([data-theme="dark"]) .parallax.visible {
  transform: translateY(0) translateZ(0) scale(1.006);
}

/* Reduce motion fallback */
@media (prefers-reduced-motion: reduce) {
  html:not([data-theme="dark"]) .reveal,
  html:not([data-theme="dark"]) .parallax { transition: none !important; transform: none !important; }
}

/* Mobile-only: place prev/next inside the video frame and increase tap targets */
@media screen and (max-width: 480px) {
  .video-controls {
    position: relative;
    margin-top: 0.4rem;
    height: auto;
  }
  .video-controls .video-prev,
  .video-controls .video-next {
    left: 12px !important;
    right: 12px !important;
    width: 52px;
    height: 52px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.14);
    background: rgba(255,255,255,0.95);
    color: var(--primary);
    font-size: 22px;
    z-index: 3;
  }
  .video-controls .video-prev { left: 12px; }
  .video-controls .video-next { right: 12px; }
  /* ensure centered play/pause remains above arrows */
  .video-controls .video-play, .video-controls .video-pause { z-index: 4; width: 56px; height: 56px; }
}

/* Mobile-only: hide Research 'Preview' button and disable the PDF preview modal so
   only the Download link remains on small screens. Desktop/tablet are unchanged. */
@media screen and (max-width: 480px) {
  /* hide the 'Preview' button in the research card */
  #research .landscape-actions #research-preview {
    display: none !important;
  }

  /* keep the download link visible and tappable */
  #research .landscape-actions #research-download {
    display: inline-block !important;
  }

  /* prevent the modal preview from appearing on mobile */
  #pdf-preview-modal {
    display: none !important;
    pointer-events: none !important;
  }
}

/* Mobile: let the videos card size itself to the video's intrinsic size (shrink-wrap)
   but cap it to the viewport so it never overflows. Desktop remains unchanged. */
@media screen and (max-width: 480px) {
  /* Make the videos card use inline-block so it can shrink-wrap */
  #projects .project-card.videos-card {
    display: inline-block;
    width: auto;
    max-width: 100%;
    margin: 0.6rem auto;
    background: transparent;
    box-shadow: none;
    border: none;
  }

  /* Project preview container should not force the video to stretch */
  #projects .project-card.videos-card .project-preview {
    display: inline-block;
    width: auto;
    height: auto;
    padding: 0;
    border-radius: 12px;
    overflow: visible;
  }

  /* Let the video show at its intrinsic resolution but cap to viewport dimensions */
  #projects .project-card.videos-card .project-video {
    width: auto;
    height: auto;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
    object-fit: contain;
    display: block;
  }

  /* Keep controls positioned relative to the preview area */
  .video-controls { position: relative; }
}

/* Light-mode on small screens: ensure the hero profile picture sits in the same
   position as dark mode (match #profile .section__pic-container sizing/position).
   Keeps web/desktop unchanged. */
@media screen and (max-width: 480px) {
  html:not([data-theme="dark"]) #profile .section__pic-container {
    /* match the dark-mode profile sizing and layout */
    /* Use the same responsive vw-based sizing as dark mode mobile to
       ensure both themes show the same circular image size on phones. */
    width: 46vw !important;
    height: 46vw !important;
    margin: 0.5rem auto !important;
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    transform: translateY(-6vw) !important; /* keep the mobile upward nudge */
    z-index: 0 !important;
  }
  html:not([data-theme="dark"]) #profile .section__pic-container img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }
}

/* Mobile-only: center the videos and give them a subtle rounded corner */
@media screen and (max-width: 480px) {
  /* center the preview container */
  #projects .project-card.videos-card {
    text-align: center;
  }

  /* center the project-preview and ensure video is centered */
  #projects .project-card.videos-card .project-preview {
    margin-left: auto;
    margin-right: auto;
    display: block;
  }

  /* rounded corners on the video itself */
  #projects .project-card.videos-card .project-video {
    border-radius: 14px;
    overflow: hidden;
  }
}

/* Mobile: improve layout for the research summary paragraph */
@media screen and (max-width: 480px) {
  .about-summary {
    display: flex;
    justify-content: center;
    padding: 0 12px 0 12px;
  }
  .about-summary p {
    max-width: 92vw;
    font-size: 0.99rem; /* slightly larger for readability on phones */
    line-height: 1.55;
    color: var(--muted);
    text-align: center;
    margin: 0 auto;
    padding: 10px 8px;
    background: transparent;
    border-radius: 10px;
  }
}

/* Light-mode on small screens: make About Experience/Education text white
   while keeping desktop/web appearance unchanged. Targets headings and
   list item text inside #about on phones. */
@media screen and (max-width: 480px) {
  html:not([data-theme="dark"]) #about .about-containers .details-container h3,
  html:not([data-theme="dark"]) #about .about-details-container .about-role,
  html:not([data-theme="dark"]) #about .about-details-container .about-company,
  html:not([data-theme="dark"]) #about .about-details-container .about-meta {
    color: #ffffff !important;
  }

  /* Ensure the list text inside the experience/education blocks is clearly white */
  html:not([data-theme="dark"]) #about .about-details-container .about-list li {
    color: #ffffff !important;
  }
}
