/*--------------------------------------------------------------
# Modern theme: dark (default) and light, switched with data-theme
--------------------------------------------------------------*/
:root {
  --bg: #080c12;
  --grid: rgba(56, 214, 240, 0.06);
  --panel: #0e141c;
  --card: #131c27;
  --card-hover: #182534;
  --text: #e6edf5;
  --muted: #a9b8c8;
  --accent: #38d6f0;
  --accent-ink: #04141a;
  --accent-soft: rgba(56, 214, 240, 0.14);
  --grad: linear-gradient(135deg, #38d6f0 0%, #4f8cff 55%, #9b6bff 100%);
  --glow-a: rgba(56, 214, 240, 0.16);
  --glow-b: rgba(155, 107, 255, 0.14);
  --border: rgba(56, 214, 240, 0.22);
  --glass: rgba(8, 12, 18, 0.78);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font-head: "Space Grotesk", "Poppins", sans-serif;
  --font-body: "Inter", "Open Sans", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f5f7;
  --grid: rgba(11, 27, 43, 0.05);
  --panel: #ffffff;
  --card: #f6f8fa;
  --card-hover: #eaf1fa;
  --text: #0b1b2b;
  --muted: #44566a;
  --accent: #0b6bd6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 107, 214, 0.1);
  --grad: linear-gradient(135deg, #0aa6c9 0%, #0b6bd6 55%, #7c4dff 100%);
  --glow-a: rgba(10, 166, 201, 0.14);
  --glow-b: rgba(124, 77, 255, 0.1);
  --border: #d5dbe2;
  --glass: rgba(255, 255, 255, 0.82);
  --shadow: 0 10px 30px rgba(11, 27, 43, 0.12);
  color-scheme: light;
}

/* Blocks that sit on the video stay dark in both themes */
.theme-dark {
  --text: #e6edf5;
  --muted: #a9b8c8;
  --accent: #38d6f0;
  --accent-ink: #04141a;
  --grad: linear-gradient(135deg, #38d6f0 0%, #4f8cff 55%, #9b6bff 100%);
  --border: rgba(56, 214, 240, 0.28);
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 500px at 8% -10%, var(--glow-a), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, var(--glow-b), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
}

body::before { background: transparent; }
body:has(#bgvid)::before { background: rgba(4, 8, 14, 0.68); }

h1, h2, h3, h4, h5, h6 { font-family: var(--font-head); }

a { color: var(--accent); }
a:hover { color: var(--accent); opacity: 0.85; }
hr { border-top-color: var(--border); }

/* Sections: panels */
section > .container {
  background: var(--panel) !important;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
section .container .container {
  background: transparent !important;
  border: 0;
  box-shadow: none;
}
section > .container.hero {
  background: transparent !important;
  border: 0;
  box-shadow: none;
}

.section-title h2 { color: var(--muted); font-family: var(--font-mono); }
.section-title h2::after { background: var(--grad); height: 2px; }
.section-title p {
  font-family: var(--font-head);
  letter-spacing: -0.01em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Cards */
.services .icon-box {
  background: var(--card);
  border-color: var(--border);
  border-width: 1px;
  border-radius: 14px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.services .icon-box h4,
.services .icon-box h4 a { color: var(--text); }
.services .icon-box p { color: var(--muted); }
.services .icon-box:hover {
  background: linear-gradient(var(--card-hover), var(--card-hover)) padding-box, var(--grad) border-box;
  border-color: transparent;
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.services .icon-box:hover h4,
.services .icon-box:hover h4 a { color: var(--accent); }
.services .icon-box:hover p { color: var(--text); }
.icon-box p[style*="color"] { color: var(--muted) !important; }
.icon-box [style*="#007bff"] { color: var(--accent) !important; }

.resume .resume-title,
.research .research-item { color: var(--text); }
.resume .resume-item, .research .research-item { border-left-color: var(--accent); }
.research .research-item h4 { color: var(--accent); }
.research .research-item h5 { background: var(--card); color: var(--text); }
[style*="background: #f9f9f9"] { background: var(--card) !important; border-color: var(--border) !important; }

/* Header: glass bar, pill navigation */
#header.header-top {
  background: var(--glass) !important;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  border-image: var(--grad) 1;
  box-shadow: none;
}
#header h1 a, #header h1 a:hover { color: var(--text) !important; font-family: var(--font-head); }

@media (min-width: 993px) {
  .nav-menu a { color: var(--muted); font-family: var(--font-body); }
  .nav-menu a:hover, .nav-menu li:hover > a { background: var(--accent-soft); color: var(--accent); }
  .nav-menu .active > a, .nav-menu .active a {
    background: var(--grad);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--accent-soft);
  }
}
.mobile-nav-toggle i { color: var(--accent); background: var(--accent-soft); }

/* Theme toggle */
.theme-toggle {
  flex: none;
  width: 44px;
  height: 44px;
  margin-left: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover { background: var(--accent-soft); transform: rotate(18deg); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
@media (max-width: 992px) {
  .theme-toggle { margin-left: auto; margin-right: 52px; width: 40px; height: 40px; }
}

/* Footer icon bar */
.credits {
  background: var(--glass) !important;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  box-shadow: none;
}
.credits a { color: var(--accent) !important; background: transparent !important; transition: transform 0.2s ease, color 0.2s ease; }
.credits a:hover { color: var(--text) !important; padding-left: 15px; padding-right: 15px; transform: translateY(-3px); text-shadow: none; }

/* Home hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  padding: 0 !important;
  margin-top: 30px;
  color: #e6edf5;
}
@media (max-width: 992px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}
.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.hero-eyebrow img { width: 56px; height: 56px; object-fit: contain; border-radius: 50%; background: rgba(255, 255, 255, 0.85); padding: 6px; }
.hero h1 {
  margin: 16px 0 10px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(44px, 6.2vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #ffffff 0%, #9be9f7 45%, #b9a2ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 18px rgba(0, 0, 0, 0.55));
}
.hero h2 { margin: 0 0 18px; font-size: clamp(22px, 2.4vw, 30px); font-weight: 500; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; width: fit-content; }
.hero p { margin: 0 0 24px; max-width: 560px; font-size: 19px; line-height: 1.55; color: #c9d6e2; }
.hero p a { color: #ffffff; font-weight: 600; text-decoration: underline; text-decoration-color: rgba(56, 214, 240, 0.6); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 17px;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.hero-btn:hover { transform: translateY(-2px); opacity: 1; }
.hero-btn.primary { background: var(--grad); color: #ffffff; box-shadow: 0 6px 22px rgba(79, 140, 255, 0.35); }
.hero-btn.primary:hover { color: #ffffff; filter: brightness(1.1); }
.hero-btn.ghost { border: 1px solid transparent; background: linear-gradient(#0a1018, #0a1018) padding-box, var(--grad) border-box; color: #ffffff; }
.hero-btn.ghost:hover { filter: brightness(1.2); color: #ffffff; }

/* News panel */
.home-news {
  border: 1px solid transparent;
  border-radius: 14px;
  background: linear-gradient(rgba(10, 16, 24, 0.82), rgba(10, 16, 24, 0.82)) padding-box, linear-gradient(135deg, rgba(56, 214, 240, 0.6), rgba(155, 107, 255, 0.5)) border-box;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 22px 26px;
  color: #e6edf5;
}
.news-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.news-label .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 10px rgba(79, 140, 255, 0.8); }
.home-news ul { list-style: none; margin: 0; padding: 0; }
.home-news li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 16px;
  line-height: 1.45;
}
.home-news .news-date { padding-top: 2px; font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.06em; color: #8aa0b5; text-transform: uppercase; }
.home-news a { color: #ffffff; text-decoration: underline; text-decoration-color: rgba(56, 214, 240, 0.5); }
@media (max-width: 575px) {
  .home-news li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* Header fit on desktop: use the full width so the toggle never clips */
@media (min-width: 993px) {
  #header .container { max-width: 1400px; padding-left: 32px; padding-right: 32px; }
  .nav-menu a { padding: 9px 15px; }
}
@media (min-width: 993px) and (max-width: 1250px) {
  .nav-menu a { font-size: 17px; padding: 8px 11px; }
}

/* Section sub-heading: allow long text to wrap without overlapping */
.section-title h2 { font-size: 13px; line-height: 1.6; margin-bottom: 26px; }
.section-title p { margin-top: 0; }

/* Mobile header and hero */
@media (max-width: 992px) {
  #header.header-top .container { flex-direction: row; align-items: center; flex-wrap: nowrap; padding-left: 16px; padding-right: 16px; }
  #header.header-top h1 { padding: 0; margin-right: 0; }
  .hero { padding: 0 16px !important; }
}

/* Hero: rotating line and profile links */
.hero-typed { margin: 0 0 14px !important; font-family: var(--font-head); font-size: clamp(20px, 2.2vw, 26px) !important; color: #e6edf5 !important; min-height: 1.5em; }
.typed-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 600; }
.typed-caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 3px; vertical-align: text-bottom; background: var(--accent); animation: caret-blink 1s steps(1) infinite; }
@keyframes caret-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .typed-caret { animation: none; } }
.hero-links { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 26px; }
.hero-links a { color: #c9d6e2; font-size: 16px; font-weight: 500; text-decoration: none; border-bottom: 1px solid rgba(56, 214, 240, 0.35); padding-bottom: 2px; }
.hero-links a:hover { color: #ffffff; border-bottom-color: var(--accent); opacity: 1; }

/* Use the width: wider content panels, and card pages as a grid of horizontal cards */
@media (min-width: 1200px) {
  section > .container:not(.hero) { max-width: 1360px; }
}
#tutorials .row, #learn .row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: 20px;
  margin: 0;
}
#tutorials .row > [class*="col-"], #learn .row > [class*="col-"] {
  width: auto; max-width: none; flex: none; padding: 0; margin: 0 !important;
}
#tutorials .icon-box, #learn .icon-box { margin: 0; padding: 18px; width: 100%; }
#tutorials .icon-box a, #learn .icon-box a {
  display: grid;
  grid-template-columns: minmax(0, 46%) minmax(0, 1fr);
  column-gap: 20px;
  align-items: center;
  text-align: left;
}
#tutorials .icon-box img, #learn .icon-box img {
  grid-row: 1 / span 3; padding-bottom: 0 !important; border-radius: 10px; width: 100%; height: auto;
}
#tutorials .icon-box h4, #learn .icon-box h4 { align-self: end; margin: 0 0 8px; text-align: left; }
#tutorials .icon-box p, #learn .icon-box p { align-self: start; margin: 0 0 6px; text-align: left; }
@media (max-width: 575px) {
  #tutorials .icon-box a, #learn .icon-box a { grid-template-columns: minmax(0, 1fr); }
  #tutorials .icon-box img, #learn .icon-box img { grid-row: auto; margin-bottom: 12px; }
}
/* Rows with one or two cards stretch to fill the panel */
#tutorials .row:has(> :only-child), #learn .row:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
#tutorials .row:has(> :nth-child(2):last-child), #learn .row:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 992px) {
  #tutorials .row:has(> :only-child) .icon-box a, #learn .row:has(> :only-child) .icon-box a { grid-template-columns: minmax(0, 30%) minmax(0, 1fr); }
  #tutorials .row:has(> :only-child) h4, #learn .row:has(> :only-child) h4 { font-size: 26px; }
  #tutorials .row:has(> :only-child) p, #learn .row:has(> :only-child) p { font-size: 17px; }
}
@media (max-width: 767px) {
  #tutorials .row:has(> :nth-child(2):last-child), #learn .row:has(> :nth-child(2):last-child) { grid-template-columns: minmax(0, 1fr); }
}

/* Inner pages: faint aerial-robotics blueprint behind the content (the home page has the video) */
body:not(:has(#bgvid))::before {
  background: var(--accent);
  opacity: 0.24;
  -webkit-mask: url("../img/bg-aerial.svg") center / cover no-repeat;
  mask: url("../img/bg-aerial.svg") center / cover no-repeat;
}
:root[data-theme="light"] body:not(:has(#bgvid))::before { opacity: 0.2; }
section > .container:not(.hero) {
  background: color-mix(in srgb, var(--panel) 60%, transparent) !important;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.resume .resume-item h5 { background: var(--card); color: var(--text); }
