:root,
html[data-theme="dark"] {
  --bg-start: #060b1a;
  --bg-mid: #0c1632;
  --bg-end: #111f45;
  --grid: rgba(131, 169, 255, 0.08);

  --surface: rgba(14, 24, 50, 0.8);
  --surface-strong: #12224b;
  --surface-card: #152650;

  --text: #e8efff;
  --muted: #a4b6e4;
  --title: #f7faff;

  --accent: #73c5ff;
  --accent-strong: #3eb0ff;
  --accent-warm: #ff9f87;

  --border: rgba(121, 159, 238, 0.36);
  --shadow: 0 18px 40px rgba(2, 8, 24, 0.54);

  --hero-start: #172754;
  --hero-mid: #17466f;
  --hero-end: #30487a;

  --chip-bg: rgba(115, 197, 255, 0.14);
  --meta-bg: rgba(142, 171, 237, 0.16);
  --panel-bg: rgba(20, 34, 66, 0.74);
}

html[data-theme="light"] {
  --bg-start: #eaf1ff;
  --bg-mid: #f7faff;
  --bg-end: #e4edff;
  --grid: rgba(45, 69, 117, 0.08);

  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-card: #ffffff;

  --text: #1c2745;
  --muted: #4b5f8d;
  --title: #0f1b38;

  --accent: #2467f2;
  --accent-strong: #0059d0;
  --accent-warm: #dd5f46;

  --border: rgba(74, 106, 167, 0.24);
  --shadow: 0 14px 30px rgba(56, 83, 126, 0.16);

  --hero-start: #1a3d72;
  --hero-mid: #1870ab;
  --hero-end: #3568a5;

  --chip-bg: rgba(36, 103, 242, 0.1);
  --meta-bg: rgba(44, 90, 173, 0.11);
  --panel-bg: rgba(246, 251, 255, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 88% 14%, rgba(115, 197, 255, 0.2), transparent 30%),
    radial-gradient(circle at 14% 86%, rgba(255, 159, 135, 0.15), transparent 34%),
    linear-gradient(168deg, var(--bg-start), var(--bg-mid) 52%, var(--bg-end));
  background-size: 130% 130%;
  animation: bg-pan 16s ease-in-out infinite alternate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: -2;
}

.ambient-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(6px);
  opacity: 0.35;
}

.orb-a {
  width: 320px;
  height: 320px;
  top: -90px;
  right: -70px;
  background: radial-gradient(circle, rgba(115, 197, 255, 0.5), rgba(115, 197, 255, 0));
  animation: float-a 22s ease-in-out infinite;
}

.orb-b {
  width: 280px;
  height: 280px;
  left: -120px;
  top: 35%;
  background: radial-gradient(circle, rgba(255, 159, 135, 0.44), rgba(255, 159, 135, 0));
  animation: float-b 20s ease-in-out infinite;
}

.orb-c {
  width: 260px;
  height: 260px;
  right: 12%;
  bottom: -130px;
  background: radial-gradient(circle, rgba(124, 155, 255, 0.36), rgba(124, 155, 255, 0));
  animation: float-c 24s ease-in-out infinite;
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--chip-bg);
  font-size: 0.68rem;
  letter-spacing: 0.07em;
}

.page-shell {
  width: min(1180px, 92vw);
  margin: 0 auto;
  padding: 86px 0 70px;
}

.site-main {
  display: grid;
  gap: 30px;
}

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

html.js .section-reveal {
  opacity: 0;
  transform: translateY(24px) scale(0.99);
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.2, 0.8, 0.2, 1);
}

html.js .section-reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  line-height: 1.12;
  color: var(--title);
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  border-radius: 34px;
  padding: clamp(26px, 5vw, 44px);
  color: #ecf4ff;
  background: linear-gradient(132deg, var(--hero-start), var(--hero-mid) 45%, var(--hero-end));
  border: 1px solid rgba(184, 209, 255, 0.32);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after,
.hero::before {
  content: "";
  position: absolute;
  border-radius: 999px;
  z-index: 0;
}

.hero::before {
  width: 320px;
  height: 320px;
  right: -110px;
  top: -140px;
  background: radial-gradient(circle, rgba(255, 159, 135, 0.44), rgba(255, 159, 135, 0));
}

.hero::after {
  width: 260px;
  height: 260px;
  left: -110px;
  bottom: -140px;
  background: radial-gradient(circle, rgba(115, 197, 255, 0.36), rgba(115, 197, 255, 0));
}

.hero-copy-wrap,
.hero-panel {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.19em;
  font-size: 0.74rem;
  color: #cfe6ff;
}

.hero h1 {
  color: #ffffff;
  font-size: clamp(2.2rem, 5.6vw, 4.05rem);
  margin-bottom: 14px;
}

.hero-location {
  margin: -4px 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cfe6ff;
  font-size: 0.92rem;
  font-weight: 600;
}

.hero-location svg {
  width: 14px;
  height: 14px;
  fill: var(--accent-warm);
}

.hero-copy {
  margin: 0;
  max-width: 58ch;
  color: #dbe7ff;
  font-size: 1.04rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform 0.17s ease, box-shadow 0.17s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(8, 15, 30, 0.26);
}

.btn-primary {
  background: #ffbfad;
  color: #2e1b12;
}

.btn-secondary {
  background: #ffbfad;
  color: #2e1b12;
  border-color: transparent;
}

.btn-ghost {
  border-color: rgba(255, 214, 194, 0.78);
  color: #ffe7dc;
}

.hero-panel {
  background: var(--panel-bg);
  border: 1px solid rgba(224, 238, 255, 0.36);
  border-radius: 22px;
  padding: 20px 20px 16px;
  backdrop-filter: blur(7px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.hero-panel h2 {
  color: #ffffff;
  font-size: 1.42rem;
  margin-bottom: 2px;
}

.hero-panel ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: #e5f2ff;
}

.hero-panel p {
  margin: 2px 0 0;
  color: #cfe1ff;
  font-size: 0.95rem;
}

.projects,
.research,
.site-footer {
  border-radius: 26px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 30px);
}

.section-heading h2 {
  font-size: clamp(1.6rem, 2.5vw, 2.3rem);
}

.section-heading p {
  margin: 8px 0 0;
  color: var(--muted);
}

.project-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.project-card {
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0px;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  background: var(--surface-card);
  position: relative;
  overflow: hidden;
  transform: perspective(980px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift));
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.project-card::before {
  content: "";
  position: absolute;
  left: -70px;
  top: -56px;
  width: 210px;
  height: 120px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(115, 197, 255, 0.24), rgba(115, 197, 255, 0));
}

.project-card:nth-child(2)::before {
  background: radial-gradient(circle, rgba(255, 159, 135, 0.26), rgba(255, 159, 135, 0));
}

.project-card:nth-child(3)::before {
  background: radial-gradient(circle, rgba(126, 183, 255, 0.2), rgba(126, 183, 255, 0));
}

.project-card:hover {
  --lift: -4px;
  box-shadow: 0 12px 24px rgba(8, 14, 28, 0.22);
}

.project-tag,
.project-card h3,
.project-description,
.project-meta,
.project-links {
  position: relative;
  z-index: 1;
}

.project-tag {
  display: inline-flex;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-card h3 {
  margin-top: 10px;
  font-size: 1.45rem;
}

.project-description {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.56;
  min-height: 112px;
}

.project-meta {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 8px;
}

.project-meta li {
  border-radius: 10px;
  background: var(--meta-bg);
  padding: 7px 10px;
  font-size: 0.86rem;
  color: var(--text);
}

.project-links {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.project-links a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.project-links a:hover {
  text-decoration: underline;
}

.project-note {
  font-size: 0.9rem;
  color: var(--muted);
}

.project-card.is-loaded {
  border-color: rgba(115, 197, 255, 0.6);
}

.projects-status {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.research-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface-card);
}

.panel h3 {
  font-size: 1.35rem;
}

.panel ul {
  margin: 12px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.panel a {
  color: var(--accent-strong);
  text-decoration: none;
}

.panel a:hover {
  text-decoration: underline;
}

.site-footer {
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
}

.footer-links {
  margin: 0;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 700;
}

.footer-links a:hover {
  text-decoration: underline;
}

@keyframes bg-pan {
  from {
    background-position: 0% 0%;
  }

  to {
    background-position: 100% 100%;
  }
}

@keyframes float-a {
  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(-22px, 18px);
  }
}

@keyframes float-b {
  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(16px, -14px);
  }
}

@keyframes float-c {
  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(-20px, -20px);
  }
}

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

  .hero-panel {
    max-width: 640px;
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .project-description {
    min-height: 0;
  }
}

@media (max-width: 720px) {
  .theme-toggle {
    top: 12px;
    right: 12px;
    padding: 7px 10px;
  }

  .theme-toggle-label {
    display: none;
  }

  .page-shell {
    width: min(1180px, 94vw);
    padding-top: 70px;
  }

  .hero {
    border-radius: 24px;
    padding: 24px;
  }

  .projects,
  .research,
  .site-footer {
    border-radius: 20px;
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .orb,
  .section-reveal,
  .project-card,
  .theme-toggle {
    animation: none;
    transition: none;
  }
}
