/* ============================================================
   Ekam Mann — Portfolio
   Design system: dark, bold, engineering-credible. Near-black
   ground, engineering blue accent, mono for specs/metrics/tools,
   hairline rules instead of shadows.
   ============================================================ */

:root {
  --bg: #0a0a0a;
  --surface: #131517;
  --surface-raised: #17191c;
  --text: #f5f6f7;
  --text-secondary: #b7bcc0;
  --text-tertiary: #83898e;
  --border: #262a2d;
  --border-strong: #3a3f43;
  --accent: #6ea1f2;
  --accent-strong: #a5c4f7;
  --accent-on: #0a0a0a;
  --accent-tint: #16233a;
  --focus-ring: #6ea1f2;
  --code-bg: #1a1d20;
  --shadow: none;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  --container-w: 1120px;
  --radius: 3px;
  --nav-h: 64px;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

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

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  font-weight: 700;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 1em;
  color: var(--text);
}

ul,
ol {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

li {
  margin-bottom: 0.4em;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-on);
  padding: 0.75em 1.25em;
  z-index: 200;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (max-width: 640px) {
  .container {
    padding: 0 1.25rem;
  }
}

main {
  display: block;
}

/* ---------- Nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  min-height: var(--nav-h);
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-h);
}

.nav-brand {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

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

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.1rem;
  border-bottom: 2px solid transparent;
}

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

.nav-links a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

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

@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
  }
  .site-nav .container {
    flex-wrap: wrap;
  }
  /* In-flow collapsible panel (not fixed) so opening the menu pushes
     the page down instead of floating over the hero content below it. */
  .nav-links {
    order: 3;
    flex-basis: 100%;
    flex-direction: column;
    gap: 0;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 220ms ease;
  }
  .nav-links.is-open {
    max-height: 320px;
    border-top: 1px solid var(--border);
  }
  .nav-links li {
    width: 100%;
  }
  .nav-links a {
    display: block;
    padding: 0.85rem 0.1rem;
    border-bottom: 1px solid var(--border);
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.7em 1.4em;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 44px;
  transition: background-color 150ms ease, border-color 150ms ease,
    color 150ms ease;
}

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

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

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

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

.btn-row {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

/* ---------- Hero / About ---------- */
/* --hero-bg-image is unset until a photo is supplied; the scrim
   layer alone gives an intentional dark vignette as a placeholder.
   To drop in a photo later, set on .hero:
     style="--hero-bg-image: url('/assets/img/hero-bg.jpg');" */
.hero {
  position: relative;
  overflow: hidden;
  min-height: calc(100svh - var(--nav-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem 0 4rem;
  border-bottom: 1px solid var(--border);
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--hero-bg-image, none),
    radial-gradient(ellipse 90% 60% at 50% 0%, #182335 0%, transparent 60%),
    linear-gradient(180deg, rgba(10, 10, 10, 0.35) 0%, rgba(10, 10, 10, 0.92) 75%, var(--bg) 100%);
  background-size: cover, cover, 100% 100%;
  background-position: center, center, center;
  background-color: var(--bg);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(to right, var(--border) 1px, transparent 1px);
  background-size: 48px 100%;
  opacity: 0.5;
}

@media (max-width: 640px) {
  .hero {
    padding: 4rem 0 2.5rem;
  }
  .hero::after {
    display: none;
  }
  /* The desktop hero photo is cropped wide (roughly 2.6:1) for a wide,
     short banner. On mobile the hero is narrow and tall, so
     background-size: cover on that crop would zoom in so far only a
     sliver of the image is visible. Use a separate, portrait-friendlier
     crop instead of fighting one image across two very different
     container shapes. */
  .hero::before {
    background-image: url("/assets/img/hero-aeroshell-mobile.jpg"),
      radial-gradient(
        ellipse 90% 60% at 50% 0%,
        #182335 0%,
        transparent 60%
      ),
      linear-gradient(
        180deg,
        rgba(10, 10, 10, 0.35) 0%,
        rgba(10, 10, 10, 0.92) 75%,
        var(--bg) 100%
      );
    background-size: cover, cover, 100% 100%;
    background-position: center 25%, center, center;
  }
}

.hero h1 {
  font-size: clamp(2.5rem, 8vw, 5.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 16ch;
}

.hero .lede {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 62ch;
  margin-bottom: 1.75rem;
}

/* Entrance animation: hero content fades/slides in on load, staggered.
   Reduced-motion users get this instantly via the global override above. */
.hero h1,
.hero .lede,
.hero .btn-row {
  animation: hero-fade-up 0.7s ease both;
}

.hero .lede {
  animation-delay: 0.12s;
}

.hero .btn-row {
  animation-delay: 0.24s;
}

@keyframes hero-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 3.75rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-mono);
  font-size: 1.03rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-decoration: none;
  animation: hero-fade-up 0.7s ease 0.4s both,
    scroll-cue-bounce 2.2s ease-in-out 1.1s infinite;
}

.scroll-cue svg {
  width: 22px;
  height: 22px;
}

.scroll-cue:hover {
  color: var(--accent);
}

@keyframes scroll-cue-bounce {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(6px);
  }
}

@media (max-width: 640px) {
  .scroll-cue {
    bottom: 1.5rem;
  }
}

/* Reveal-on-scroll: applied via JS (main.js) only when IntersectionObserver
   and motion are available, so content stays visible without JS. */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ---------- Threads ---------- */
.threads {
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--border);
}

.threads-intro {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 68ch;
  margin-bottom: 2.25rem;
}

.threads h2,
.section-heading {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 1.75rem;
}

.thread-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

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

.thread {
  border-top: 2px solid var(--accent);
  padding-top: 1rem;
}

.thread .thread-index {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-tertiary);
  display: block;
  margin-bottom: 0.5rem;
}

.thread h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.thread p {
  color: var(--text-secondary);
  font-size: 0.97rem;
  margin: 0;
}

/* ---------- Tools (marquee) ---------- */
.tools-section {
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--border);
}

.tool-group {
  margin-bottom: 2rem;
}

.tool-group:last-child {
  margin-bottom: 0;
}

.tool-group-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
}

/* Default/fallback state (no JS, or motion reduced): a plain wrapped
   row of pills, no animation. JS measures each track and only adds
   .is-marquee-ready once it has padded the content wide enough to
   loop with no visible gap, whatever the item count. */
.tool-marquee {
  overflow: hidden;
}

.tool-marquee.is-marquee-ready {
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    black 6%,
    black 94%,
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    black 6%,
    black 94%,
    transparent
  );
}

.tool-marquee-track {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.tool-marquee.is-marquee-ready .tool-marquee-track {
  flex-wrap: nowrap;
  width: max-content;
  animation: tool-marquee 26s linear infinite;
}

.tool-marquee.is-marquee-ready:hover .tool-marquee-track {
  animation-play-state: paused;
}

.tool-marquee[data-dir="reverse"] .tool-marquee-track {
  animation-direction: reverse;
}

@keyframes tool-marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.tool-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4em 0.9em;
  white-space: nowrap;
}

.tool-pill-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 3px;
  background: #ffffff;
  padding: 2px;
  flex: none;
}

.tool-pill svg.tool-pill-icon {
  fill: currentColor;
  background: none;
  padding: 0;
  width: 16px;
  height: 16px;
}

/* ---------- Experience ---------- */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.experience-item {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.experience-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-bottom: 0.6rem;
}

.experience-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.experience-logo {
  height: 40px;
  width: auto;
  max-width: 96px;
  object-fit: contain;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 4px 6px;
  flex: none;
}

.experience-role {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.experience-role span {
  color: var(--text-secondary);
  font-weight: 500;
}

.experience-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.experience-desc {
  color: var(--text-secondary);
  max-width: 68ch;
  margin-bottom: 0.9rem;
}

.experience-links {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.experience-links a {
  font-weight: 600;
  text-decoration: none;
}

/* ---------- CTA band ---------- */
.cta-band {
  padding: 3rem 0;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-top: 3rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

.footer-contact {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-contact a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-contact a:hover {
  color: var(--accent);
}

.footer-note {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  max-width: 32ch;
}

/* ---------- Page header (non-home pages) ---------- */
.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.4rem);
}

.page-header .lede {
  color: var(--text-secondary);
  max-width: 65ch;
  font-size: 1.05rem;
  margin-bottom: 0;
}

/* ---------- Project cards ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 2.75rem 0 4rem;
}

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

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

.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: border-color 150ms ease, transform 150ms ease;
}

.project-card:hover {
  border-color: var(--accent);
}

.project-card:hover .card-title {
  color: var(--accent);
}

.card-media {
  aspect-ratio: 4 / 3;
  background: var(--code-bg);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

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

.card-media.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  text-align: center;
}

.card-media.is-placeholder .placeholder-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.card-body {
  padding: 1.25rem 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.card-hook {
  color: var(--text-secondary);
  font-size: 0.93rem;
  margin: 0;
  flex: 1;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.25em 0.55em;
}

/* ---------- Project detail ---------- */
.project-detail {
  padding: 3rem 0 4.5rem;
}

.scope-line {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-secondary);
  background: var(--accent-tint);
  border-left: 3px solid var(--accent);
  padding: 0.9rem 1.1rem;
  margin: 0 0 2.25rem;
  line-height: 1.6;
}

.scope-line strong {
  color: var(--text);
}

.project-body {
  max-width: 72ch;
}

.project-body h2 {
  font-size: 1.35rem;
  margin-top: 2.25rem;
}

.project-body h3 {
  font-size: 1.1rem;
  margin-top: 1.75rem;
}

.project-body p,
.project-body li {
  color: var(--text-secondary);
  font-size: 1rem;
}

.caveat {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--text-tertiary);
  background: var(--code-bg);
  padding: 1rem 1.2rem;
  margin: 1.75rem 0;
  border-radius: var(--radius);
}

.caveat p {
  margin: 0;
  font-size: 0.93rem;
}

.caveat p + p {
  margin-top: 0.6rem;
}

.image-block {
  margin: 2rem 0;
}

.image-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2rem 0;
}

@media (max-width: 640px) {
  .image-pair {
    grid-template-columns: 1fr;
  }
}

.image-block img,
.image-pair img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
}

figure {
  margin: 0;
}

figcaption {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 0.5rem;
  font-family: var(--font-mono);
}

.metric {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}

.no-image-note {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1.75rem;
  text-align: center;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin: 2rem 0;
  background: var(--code-bg);
}

.video-block {
  margin: 2rem 0;
  max-width: 420px;
}

.video-block video {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  height: auto;
  display: block;
  background: var(--code-bg);
}

/* ---------- Code block ---------- */
.code-details {
  margin: 1.75rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
}

.code-summary {
  cursor: pointer;
  list-style: none;
  padding: 0.9rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.code-summary::-webkit-details-marker {
  display: none;
}

.code-summary::after {
  content: "Show code";
  font-weight: 500;
  color: var(--accent);
  font-size: 0.8rem;
}

.code-details[open] .code-summary::after {
  content: "Hide code";
}

.code-details pre {
  margin: 0;
  padding: 1.1rem;
  border-top: 1px solid var(--border);
  overflow-x: auto;
}

.code-details code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre;
}

.project-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.project-nav a {
  text-decoration: none;
  font-weight: 600;
}

/* ---------- Resume page ---------- */
.resume-embed-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
  margin: 2rem 0;
}

.resume-embed-wrap embed,
.resume-embed-wrap iframe {
  width: 100%;
  height: 78vh;
  min-height: 480px;
  border: none;
  display: block;
}

.resume-fallback {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}

/* ---------- 404 ---------- */
.error-page {
  padding: 6rem 0;
  text-align: center;
}

.error-page .code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}

/* ---------- Utility ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
