/* ===== Design tokens ===== */
:root {
  --bg: #0f1419;
  --surface: #1a2028;
  --text: #f5f3ee;
  --muted: #888780;
  --accent: #5dcaa5;
  --border: rgba(255, 255, 255, 0.08);

  --max-width: 1100px;
  --section-gap: 120px;

  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px; /* offset for sticky nav */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3 {
  font-weight: 500;
  line-height: 1.15;
}

ul {
  list-style: none;
}

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

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

/* Mono labels — the one place we use uppercase, kept small. */
.mono-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 12px 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

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

.btn-accent:hover {
  background: rgba(93, 202, 165, 0.1);
}

.btn-subtle {
  color: var(--text);
}

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

.btn-lg {
  padding: 16px 32px;
  font-size: 1rem;
}

/* ===== Nav ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: background 0.25s ease, backdrop-filter 0.25s ease,
    border-color 0.25s ease;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: rgba(15, 20, 25, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 500;
}

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

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

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

.nav-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-right: 4px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 110;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.hero-inner {
  max-width: 760px;
}

.hero-title {
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  margin: 16px 0 8px;
}

.hero-tagline {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  color: var(--muted);
  margin-bottom: 24px;
}

.hero-intro {
  max-width: 560px;
  color: var(--muted);
  margin-bottom: 36px;
}

.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ===== Sections ===== */
.section {
  padding: var(--section-gap) 0;
}

.section-heading {
  font-size: clamp(1.6rem, 4vw, 2rem);
  margin-bottom: 48px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
}

/* ===== About ===== */
.about-text {
  max-width: 720px;
}

.about-text p {
  color: var(--muted);
  margin-bottom: 16px;
}

.tech-stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 16px;
  margin-top: 12px;
}

.tech-stack li {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  position: relative;
  padding-left: 18px;
  color: var(--text);
}

.tech-stack li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ===== Experience ===== */
.experience {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
}

.exp-tabs {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
}

.exp-tab {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-align: left;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  margin-left: -1px;
  padding: 12px 18px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.exp-tab:hover {
  color: var(--accent);
  background: rgba(93, 202, 165, 0.05);
}

.exp-tab.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(93, 202, 165, 0.06);
}

.exp-panel {
  animation: fadeIn 0.3s ease;
}

.exp-panel[hidden] {
  display: none;
}

.exp-role {
  font-size: 1.3rem;
}

.exp-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin: 6px 0 20px;
}

.exp-bullets li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 14px;
  color: var(--muted);
}

.exp-bullets li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(93, 202, 165, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(93, 202, 165, 0.1);
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.folder-icon {
  color: var(--accent);
}

.project-link {
  color: var(--muted);
  transition: color 0.15s ease;
}

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

.project-title {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.project-dates {
  color: var(--muted);
  margin-bottom: 14px;
}

.project-desc {
  color: var(--muted);
  font-size: 0.95rem;
  flex-grow: 1;
}

.tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.tag-pills li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--accent);
  background: rgba(93, 202, 165, 0.06);
}

/* Interactive cards open a detail modal. */
.card-media-badge {
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: rgba(93, 202, 165, 0.08);
}

.project-card--interactive {
  cursor: pointer;
}

.project-card--interactive:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.card-cta {
  margin-top: 18px;
  color: var(--accent);
  font-size: 0.78rem;
  transition: transform 0.15s ease;
}

.project-card--interactive:hover .card-cta {
  transform: translateX(4px);
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 10, 13, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: sticky;
  top: 14px;
  float: right;
  margin: 14px 14px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.85);
  color: var(--text);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  z-index: 2;
}

.modal-close:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.modal-content {
  padding: 32px 36px 36px;
}

.modal-title {
  font-size: 1.6rem;
  margin: 8px 0 16px;
}

.modal-desc {
  color: var(--muted);
  margin-bottom: 20px;
}

.modal-media {
  margin-top: 24px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0b0f13;
}

.modal-media:empty {
  display: none;
}

/* Gallery: a stack of figures, each with a caption. */
.modal-media {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-figure {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0b0f13;
}

.modal-figure img,
.modal-figure video {
  display: block;
  width: 100%;
  height: auto;
}

.modal-figure figcaption {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

.modal-media img {
  display: block;
  width: 100%;
  height: auto;
}

/* Inline code popup — always present, collapsible. */
.modal-code:empty {
  display: none;
}

.code-details {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b0f13;
  overflow: hidden;
}

.code-details > summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  padding: 12px 16px;
  user-select: none;
}

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

.code-details > summary::before {
  content: "▸ ";
}

.code-details[open] > summary::before {
  content: "▾ ";
}

.code-details pre {
  margin: 0;
  padding: 16px;
  max-height: 460px;
  overflow: auto;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  color: #d6e7e0;
  tab-size: 4;
}

.modal-media iframe {
  display: block;
  width: 100%;
  height: 70vh;
  border: none;
  background: #fff;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions:empty {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 560px) {
  .modal {
    padding: 0;
  }
  .modal-dialog {
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
  }
  .modal-content {
    padding: 24px 20px 32px;
  }
  .modal-media iframe {
    height: 60vh;
  }
}

/* ===== Contact ===== */
.contact-inner {
  max-width: 600px;
  text-align: center;
}

.contact-heading {
  font-size: clamp(2rem, 6vw, 3rem);
  margin: 12px 0 20px;
}

.contact-text {
  color: var(--muted);
  margin-bottom: 36px;
}

/* ===== Footer ===== */
.footer {
  padding: 40px 0 56px;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.footer-icons {
  display: flex;
  gap: 24px;
}

.footer-icons a {
  color: var(--muted);
  transition: color 0.15s ease, transform 0.15s ease;
}

.footer-icons a:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.footer-text {
  color: var(--muted);
  font-size: 0.75rem;
}

/* ===== Scroll fade-in ===== */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

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

/* ===== Responsive ===== */
@media (max-width: 820px) {
  .experience {
    grid-template-columns: 1fr;
  }

  /* Collapse vertical tabs into stacked cards on mobile. */
  .exp-tabs {
    display: none;
  }

  .exp-panel,
  .exp-panel[hidden] {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
  }

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

@media (max-width: 680px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    inset: 0 0 0 30%;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
    padding: 0 32px;
    background: rgba(15, 20, 25, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-links a {
    font-size: 1.1rem;
  }

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

@media (max-width: 400px) {
  .container {
    padding: 0 18px;
  }
}
