/* ==========================================================================
   Abhinav Mehta — Engineering Portfolio
   Vanilla CSS. Dark, compact, understated engineering aesthetic.
   ========================================================================== */

:root {
  --bg: #0b0d0f;
  --bg-alt: #0e1012;
  --card: #16181b;
  --card-hover: #1a1d20;
  --border: #262a2e;
  --border-hover: #3a4045;
  --text: #e9eaea;
  --text-secondary: #9198a1;
  --text-muted: #6b7178;
  --accent: #4fd1c5;
  --accent-dim: #3aa89e;
  --accent-bg: rgba(79, 209, 197, 0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --max-width: 780px;
  --nav-height: 56px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

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

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

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

/* ---------------------------------- Nav ---------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background: rgba(11, 13, 15, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.nav.scrolled {
  border-bottom-color: var(--border);
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-logo {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.nav-logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 13px;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

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

.nav-links a.resume-link {
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.nav-links a.resume-link:hover {
  border-color: var(--accent-dim);
  background: var(--accent-bg);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.nav-toggle svg {
  width: 16px;
  height: 16px;
}

/* -------------------------------- Sections -------------------------------- */

main {
  padding-bottom: 40px;
}

section {
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
}

section:last-of-type {
  border-bottom: none;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 6px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}

.section-intro {
  color: var(--text-secondary);
  font-size: 13.5px;
  max-width: 60ch;
  margin: 8px 0 0;
}

.view-all {
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.15s ease;
}

.view-all:hover {
  gap: 8px;
}

/* ---------------------------------- Intro ---------------------------------- */

.intro {
  padding-top: 40px;
}

.intro-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
}

.intro-text h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--text);
}

.intro-role {
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 16px;
}

.intro-text p {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 52ch;
  margin: 0 0 12px;
}

.intro-text .process-line {
  color: var(--text);
  font-size: 13.5px;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  letter-spacing: -0.01em;
}

.intro-text .process-line b {
  color: var(--accent);
  font-weight: 600;
}

.profile-img-wrap {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
}

.profile-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.intro-secondary {
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 13.5px;
  max-width: 62ch;
}

/* ------------------------------ Project cards ------------------------------ */

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  background: var(--card-hover);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-alt);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.project-card:hover .card-media img {
  transform: scale(1.02);
}

.status-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(11, 13, 15, 0.75);
  border: 1px solid var(--border-hover);
  color: var(--accent);
  backdrop-filter: blur(4px);
}

.card-body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-category {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 10px;
  flex: 1;
}

.card-link {
  font-size: 12.5px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.15s ease;
}

.project-card:hover .card-link {
  gap: 8px;
}

/* --------------------------------- Missing image fallback --------------------------------- */

.img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 80px;
  background: repeating-linear-gradient(
    135deg,
    var(--bg-alt),
    var(--bg-alt) 8px,
    #101315 8px,
    #101315 16px
  );
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  padding: 8px;
  border: 1px dashed var(--border-hover);
}

/* --------------------------------- CAD grid --------------------------------- */

.cad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.cad-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.cad-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.cad-card .card-media {
  aspect-ratio: 4 / 3;
}

.cad-card .card-body {
  padding: 10px 12px 12px;
}

.cad-card .card-title {
  font-size: 13.5px;
  margin-bottom: 2px;
}

.cad-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.cad-card .card-desc {
  font-size: 12px;
  margin-bottom: 0;
}

.cad-subimages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 10px;
}

.cad-subimages .card-media {
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.cad-tag {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-bg);
  border-radius: 4px;
  padding: 2px 6px;
  margin-bottom: 6px;
}

/* --------------------------------- Builds gallery --------------------------------- */

.builds-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.build-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.build-item:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.build-item .card-media {
  aspect-ratio: 1 / 1;
}

.build-item .card-body {
  padding: 8px 10px 10px;
}

.build-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 2px;
}

.build-year {
  font-size: 10.5px;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.build-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin: 0;
}

/* A single, larger feature card used when the Builds gallery has one entry */
.build-feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.build-feature:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.build-feature .card-media {
  aspect-ratio: auto;
  height: 100%;
  min-height: 220px;
  border-bottom: none;
  border-right: 1px solid var(--border);
}

.build-feature .card-body {
  padding: 20px 22px;
  justify-content: center;
}

.build-feature .card-title {
  font-size: 17px;
}

.build-feature .card-desc {
  font-size: 13px;
}

@media (max-width: 640px) {
  .build-feature {
    grid-template-columns: 1fr;
  }
  .build-feature .card-media {
    aspect-ratio: 16 / 10;
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: 0;
  }
}

/* --------------------------------- Research --------------------------------- */

.research-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.research-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.research-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 16px;
}

.research-block {
  margin-bottom: 16px;
}

.research-block h4 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 6px;
}

.research-block p,
.research-block li {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.research-block ul {
  margin: 0;
  padding-left: 18px;
}

.research-geometries {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.geometry-thumb {
  aspect-ratio: 1 / 1;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
}

.geometry-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
  list-style: none;
  padding: 0;
}

.geometry-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.geometry-num {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.research-quote {
  border-left: 2px solid var(--accent-dim);
  padding-left: 14px;
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
}

.team-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.research-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.btn {
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hover);
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

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

.btn.btn-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #06110f;
}

/* --------------------------------- Experience --------------------------------- */

.experience-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.experience-card .exp-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.exp-org {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 2px;
}

.exp-role {
  font-size: 12.5px;
  color: var(--accent);
  margin: 0 0 10px;
}

.exp-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 12px;
}

.exp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.exp-link {
  font-size: 12.5px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* --------------------------------- Certification --------------------------------- */

.cert-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.cert-badge {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.cert-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cert-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 2px;
}

.cert-issuer {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0 0 6px;
}

.cert-link {
  font-size: 12px;
  color: var(--accent);
}

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

.tag {
  display: inline-block;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.about-text p {
  font-size: 13.5px;
  color: var(--text-secondary);
  max-width: 64ch;
  margin: 0 0 14px;
}

/* --------------------------------- Connect --------------------------------- */

.connect-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.connect-links a {
  font-size: 13px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.connect-links a:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

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

footer {
  padding: 24px 0 40px;
}

footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 12px;
}

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

.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ============================= Project detail pages ============================= */

.breadcrumb {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--accent);
}

.project-hero {
  padding: 32px 0 0;
}

.project-hero .card-category {
  margin-bottom: 8px;
}

.project-hero h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.project-meta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 12.5px;
  margin-bottom: 20px;
}

.hero-media {
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  margin-bottom: 8px;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-section {
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
}

.detail-section:last-of-type {
  border-bottom: none;
}

.detail-section h2 {
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 0 0 12px;
}

.detail-section p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0 0 12px;
  max-width: 68ch;
}

.detail-section ul {
  margin: 0 0 12px;
  padding-left: 18px;
}

.detail-section li {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.placeholder-note {
  color: var(--text-muted);
  font-style: italic;
}

.detail-media {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  aspect-ratio: 16 / 10;
  margin: 12px 0;
}

.detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.gallery-grid .detail-media {
  margin: 0;
  aspect-ratio: 4 / 3;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.related-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.related-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.related-card .card-media {
  aspect-ratio: 16 / 10;
}

.related-card .card-body {
  padding: 10px 12px;
}

.related-card .card-title {
  font-size: 13px;
  margin: 0;
}

/* ============================= CAD archive page ============================= */

.cad-page-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.cad-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.cad-filter {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.cad-filter:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.cad-filter.active {
  background: var(--accent-bg);
  border-color: var(--accent-dim);
  color: var(--accent);
}

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

@media (max-width: 720px) {
  .cad-page-grid,
  .cad-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .research-geometries {
    grid-template-columns: repeat(4, 1fr);
  }

  .gallery-grid,
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .geometry-list {
    grid-template-columns: 1fr;
  }

  .cad-subimages {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    gap: 14px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-toggle {
    display: flex;
  }

  .intro-row {
    flex-direction: column-reverse;
    gap: 16px;
  }

  .profile-img-wrap {
    width: 64px;
    height: 64px;
  }

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

  .cad-grid,
  .cad-page-grid {
    grid-template-columns: 1fr;
  }

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

  .research-geometries {
    grid-template-columns: repeat(4, 1fr);
  }

  .experience-card {
    flex-direction: column;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .gallery-grid,
  .related-grid {
    grid-template-columns: 1fr;
  }

  footer .container {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}
