:root {
  --font-serif: "Times New Roman", Times, Georgia, serif;

  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-subtle: #efeff4;
  --header-bg: rgba(255, 255, 255, 0.88);
  --text-primary: #1d1d1f;
  --text-secondary: #515154;
  --text-muted: #6e6e73;
  --border: #d2d2d7;
  --border-subtle: #e5e5ea;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --pill-bg: #eef6ff;
  --pill-border: #bfdbfe;
  --pill-fg: #0066cc;
  --btn-dark-bg: #1d1d1f;
  --btn-dark-fg: #ffffff;
  --footer-bg: #1d1d1f;
  --footer-fg: #a1a1a6;
  --shadow-card: 0 6px 20px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.09);
}

[data-theme="dark"] {
  --bg: #0a0a0c;
  --surface: #141418;
  --surface-subtle: #1d1d24;
  --header-bg: rgba(16, 16, 20, 0.88);
  --text-primary: #f5f5f7;
  --text-secondary: #b4b4bc;
  --text-muted: #86868b;
  --border: #2c2c35;
  --border-subtle: #23232b;
  --accent: #4da3ff;
  --accent-hover: #6eb5ff;
  --pill-bg: rgba(0, 113, 227, 0.16);
  --pill-border: rgba(77, 163, 255, 0.34);
  --pill-fg: #7cc0ff;
  --btn-dark-bg: #f5f5f7;
  --btn-dark-fg: #111114;
  --footer-bg: #070709;
  --footer-fg: #8e8e93;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 14px 32px rgba(0, 0, 0, 0.55);
}

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

/* Global Times New Roman across 100% of letters */
html,
body,
button,
input,
select,
textarea,
code,
pre,
kbd,
samp,
nav,
a,
span,
p,
h1,
h2,
h3,
h4,
h5,
h6,
li,
small,
strong,
em {
  font-family: var(--font-serif) !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}

main {
  flex: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
video:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  z-index: 100;
  left: 16px;
  top: -120px;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.skip-link:focus {
  top: 12px;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: 28px;
}

/* Preview constraint when user manually forces Mobile View on a wide screen */
html[data-device="mobile"][data-override="mobile"] body {
  max-width: 430px;
  margin-inline: auto;
  border-inline: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
}

/* =========================================================================
   Sticky Header — Desktop & Phone Adaptive
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--btn-dark-bg);
  color: var(--btn-dark-fg);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 17px;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-links a[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 700;
}

.nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle,
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-width: 44px;
  padding-inline: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover,
.menu-toggle:hover {
  background: var(--surface-subtle);
}

.menu-toggle {
  display: none;
  background: var(--btn-dark-bg);
  color: var(--btn-dark-fg);
  border-color: var(--btn-dark-bg);
  font-size: 18px;
  font-weight: 700;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding-inline: 16px;
  border-radius: 8px;
  background: var(--btn-dark-bg);
  color: var(--btn-dark-fg);
  border: 1px solid var(--btn-dark-bg);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.nav-cta:hover {
  opacity: 0.9;
}

/* Mobile Slide-Down Sheet */
.mobile-drawer {
  display: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 20px 20px;
  box-shadow: var(--shadow-card);
}

.mobile-drawer.is-open {
  display: block;
}

.mobile-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
}

.mobile-drawer-links a,
.mobile-drawer-links button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding-inline: 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.mobile-drawer-links a[aria-current="page"] {
  background: var(--pill-bg);
  border-color: var(--pill-border);
  color: var(--pill-fg);
}

.mobile-drawer-links .drawer-cta {
  margin-top: 6px;
  justify-content: center;
  background: var(--btn-dark-bg);
  color: var(--btn-dark-fg);
  border-color: var(--btn-dark-bg);
}

/* =========================================================================
   Hero Card & Page Headers
   ========================================================================= */
.hero-wrap {
  padding-top: 36px;
  padding-bottom: 20px;
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 48px 52px;
  box-shadow: var(--shadow-card);
}

.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  color: var(--pill-fg);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 18px;
}

.eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.hero-title {
  font-size: clamp(38px, 4.6vw, 56px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 20px;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 66ch;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-subtle);
}

.hero-stack-note {
  margin-left: 8px;
  font-size: 15px;
  font-style: italic;
  color: var(--text-muted);
}

/* =========================================================================
   Sections & Asymmetric Bento Video Showcase
   ========================================================================= */
.section {
  padding-block: 32px;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.section-heading {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.section-index {
  color: var(--text-muted);
  font-weight: 400;
  margin-right: 6px;
}

.section-link {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
}

.section-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Spotlight Full-Width Split Card (Desktop 2-col -> Mobile 1-col) */
.spotlight-card {
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.video-pair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

html[data-device="desktop"] .spotlight-card:hover,
html[data-device="desktop"] .project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.video-box {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: 12px;
  overflow: hidden;
}

.project-card .video-box {
  border-radius: 0;
}

.video-box video,
.video-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000000;
}

.project-card .video-box img {
  object-fit: cover;
}

.spotlight-copy,
.card-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.card-copy {
  flex: 1;
  justify-content: flex-start;
  padding: 24px;
}

.kicker {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.spotlight-copy h3,
.card-copy h3,
.card-copy h2 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 10px;
}

.spotlight-copy p,
.card-copy p {
  font-size: 17px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin-bottom: 18px;
}

.tag-row li,
.project-meta-tag {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 14px;
}

.card-cta {
  margin-top: auto;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
}

.card-cta:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* =========================================================================
   02 / 4-Pillar Engineering Capabilities Strip
   ========================================================================= */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.pillar-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.pillar-card h3 {
  font-size: 20px;
  font-weight: 700;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.pillar-card p {
  font-size: 16px;
  color: var(--text-secondary);
}

/* =========================================================================
   03 & 04 / Education + Lab Split Band
   ========================================================================= */
.split-band {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 24px;
}

.info-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.info-card h2 {
  font-size: 22px;
  font-weight: 700;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.info-card p {
  font-size: 17px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.edu-list,
.lab-mini-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 16px;
}

.lab-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.lab-pill-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  font-size: 15px;
  font-weight: 700;
  transition: border-color 0.15s ease;
}

.lab-pill-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* =========================================================================
   Contact CTA Banner & Footer
   ========================================================================= */
.contact-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.contact-banner h2 {
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 700;
  margin-bottom: 18px;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.site-footer {
  margin-top: 40px;
  padding: 32px 24px;
  background: var(--footer-bg);
  color: var(--footer-fg);
  text-align: center;
  font-size: 15px;
}

.site-footer strong {
  color: #ffffff;
}

.footer-view-switch {
  margin-top: 8px;
  font-size: 14px;
}

.view-switch-btn {
  background: none;
  border: none;
  color: #7cc0ff;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 14px;
  cursor: pointer;
  margin-left: 6px;
}

/* =========================================================================
   Inner Pages: Projects Grid, Project Case Study, About, and Lab
   ========================================================================= */
.projects-three-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.lab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.tool-card {
  padding: 26px;
}

.tool-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.tool-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--pill-bg);
  color: var(--pill-fg);
}

.tool-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lock-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 13px;
}

/* Project Detail & About Markdown */
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 44px;
  box-shadow: var(--shadow-card);
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 20px;
}

.specs-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px;
  margin-block: 20px 26px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  font-size: 16px;
}

.markdown-body {
  font-size: 19px;
  line-height: 1.7;
  color: var(--text-primary);
}

.markdown-body h1 {
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.18;
  margin-bottom: 18px;
}

.markdown-body h2 {
  font-size: 26px;
  margin-top: 32px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.markdown-body h3 {
  font-size: 21px;
  margin-top: 24px;
  margin-bottom: 8px;
}

.markdown-body p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 18px 24px;
  color: var(--text-secondary);
}

.markdown-body li {
  margin-bottom: 8px;
}

.markdown-body strong {
  color: var(--text-primary);
}

.markdown-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin-block: 16px;
}

.prev-next-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle);
  font-size: 17px;
  font-weight: 700;
}

.prev-next-nav a {
  color: var(--accent);
}

/* Toast */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--btn-dark-bg);
  color: var(--btn-dark-fg);
  font-size: 16px;
  font-weight: 700;
  box-shadow: var(--shadow-hover);
}

/* =========================================================================
   PHONE VERSION RULES
   Triggered either by Auto-Detect (html[data-device="mobile"]) OR narrow viewport
   (unless user explicitly forced Desktop override)
   ========================================================================= */
html[data-device="mobile"] .container {
  padding-inline: 16px;
}

html[data-device="mobile"] .nav-links,
html[data-device="mobile"] .nav-cta {
  display: none;
}

html[data-device="mobile"] .menu-toggle {
  display: inline-flex;
}

html[data-device="mobile"] .hero-wrap {
  padding-top: 18px;
  padding-bottom: 12px;
}

html[data-device="mobile"] .hero-card {
  padding: 26px 20px;
  border-radius: 16px;
}

html[data-device="mobile"] .hero-title {
  font-size: 34px;
}

html[data-device="mobile"] .hero-subtitle {
  font-size: 17px;
  margin-bottom: 20px;
}

html[data-device="mobile"] .hero-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

html[data-device="mobile"] .hero-stack-note {
  grid-column: 1 / -1;
  margin-left: 0;
  text-align: center;
  font-size: 14px;
}

html[data-device="mobile"] .spotlight-card {
  grid-template-columns: 1fr;
  padding: 16px;
  gap: 16px;
}

html[data-device="mobile"] .video-pair-grid,
html[data-device="mobile"] .projects-three-grid,
html[data-device="mobile"] .split-band,
html[data-device="mobile"] .lab-grid {
  grid-template-columns: 1fr;
  gap: 16px;
}

html[data-device="mobile"] .pillars-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

html[data-device="mobile"] .pillar-card {
  padding: 16px;
}

html[data-device="mobile"] .pillar-card h3 {
  font-size: 17px;
}

html[data-device="mobile"] .pillar-card p {
  font-size: 14px;
}

html[data-device="mobile"] .lab-mini-grid {
  grid-template-columns: 1fr;
}

html[data-device="mobile"] .contact-actions .btn {
  width: 100%;
  min-height: 48px;
}

html[data-device="mobile"] .detail-card {
  padding: 22px 18px;
}

@media (max-width: 960px) {
  html:not([data-override="desktop"]) .projects-three-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  html:not([data-override="desktop"]) .pillars-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  html:not([data-override="desktop"]) .container {
    padding-inline: 16px;
  }
  html:not([data-override="desktop"]) .nav-links,
  html:not([data-override="desktop"]) .nav-cta {
    display: none;
  }
  html:not([data-override="desktop"]) .menu-toggle {
    display: inline-flex;
  }
  html:not([data-override="desktop"]) .spotlight-card,
  html:not([data-override="desktop"]) .video-pair-grid,
  html:not([data-override="desktop"]) .projects-three-grid,
  html:not([data-override="desktop"]) .split-band,
  html:not([data-override="desktop"]) .lab-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
