/*
  TOKENS
*/
:root {
  --bg: #0b0f14;
  --bg-alt: #10161d;
  --surface: #141b23;
  --surface-hover: #19222c;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e6edf3;
  --text-muted: #8b98a5;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --nav-h: 64px;

  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-body-font-family: var(--font-sans);
  --bs-link-color-rgb: 45, 212, 191;
  --bs-link-hover-color-rgb: 94, 234, 212;
}

/*
  ELEMENT
*/
html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}
body,
body.bg-dark {
  background-color: var(--bg) !important;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-strong);
}
button {
  cursor: pointer;
}
::selection {
  background: var(--accent);
  color: var(--bg);
}

/*
  NAV
*/
#navbar {
  min-height: var(--nav-h);
  background: rgba(11, 15, 20, 0.72);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}
#navbar.scrolled {
  border-bottom-color: var(--border);
}
.brand-mark {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--text);
}
.brand-mark .accent {
  color: var(--accent);
}
#navbar .nav-link {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.85rem;
}
#navbar .nav-link:hover,
#navbar .nav-link:focus-visible {
  color: var(--text);
}
.nav-divider {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  margin: 0 0.5rem;
}
.navbar-toggler:focus {
  box-shadow: none;
}

/*
  BUTTONS
*/
.btn {
  font-weight: 600;
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-lg {
  font-size: 1rem;
  padding: 0.7rem 1.6rem;
}
.btn-accent {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #04201c;
}
.btn-accent:hover,
.btn-accent:focus-visible {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #04201c;
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/*
  HERO
*/
.section-hero {
  position: relative;
  padding: calc(var(--nav-h) + 4.5rem) 0 4.5rem;
  overflow: hidden;
}
.section-hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto auto;
  width: 640px;
  height: 640px;
  background: radial-gradient(closest-side, rgba(45, 212, 191, 0.14), transparent);
  pointer-events: none;
}
.section-hero .container {
  position: relative;
  max-width: 1040px;
}
.hero-inner {
  max-width: 720px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 1.5rem;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.hero-name {
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 0.5rem;
}
.hero-title {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.25rem;
}
.hero-pitch {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 62ch;
  margin-bottom: 2rem;
}
.hero-pitch strong {
  color: var(--text);
  font-weight: 600;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.focus-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 4rem;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.focus {
  padding: 1.4rem 1.5rem;
  background: var(--bg);
  transition: background 0.2s ease;
}
.focus:hover {
  background: var(--surface);
}
.focus-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.focus h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.focus p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/*
  SECTIONS
*/
.section {
  padding: 5.5rem 0;
}
.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.container-narrow {
  max-width: 1040px;
}
.section-head {
  margin-bottom: 2.75rem;
}
.section-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.section-head h2 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin-bottom: 0.4rem;
}
.section-sub {
  color: var(--text-muted);
  margin: 0;
}

/*
  CHIPS
*/
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}
.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

/*
  EXPERIENCE TIMELINE
*/
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline-item {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 2rem;
  padding-bottom: 2.75rem;
  position: relative;
}
.timeline-item:last-child {
  padding-bottom: 0;
}
.timeline-meta {
  display: flex;
  flex-direction: column;
  padding-top: 0.2rem;
}
.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
}
.timeline-place {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.timeline-body {
  position: relative;
  padding-left: 2rem;
  border-left: 1px solid var(--border-strong);
}
.timeline-body::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0.55rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline-body h3 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}
.timeline-body .at {
  color: var(--accent);
  font-weight: 600;
}
.timeline-body ul {
  padding-left: 1.1rem;
  margin: 0;
  color: var(--text-muted);
}
.timeline-body li {
  margin-bottom: 0.35rem;
}
.timeline-body li::marker {
  color: var(--accent);
}

/*
  SKILLS
*/
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem;
}
.skill-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
}
.skill-tile img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

/*
  PROJECTS
*/
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
/* .project-item is a stationary wrapper: it owns the hover + reveal so the
   lifting card never slides out from under the cursor and flickers */
.project-item {
  display: flex;
}
.project-card {
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  /* driven by JS on mousemove (tilt + spotlight position) */
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  --lift: 0px;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift));
  transform-style: preserve-3d;
  transition:
    transform 0.45s var(--ease-out),
    box-shadow 0.45s var(--ease-out),
    border-color 0.3s ease,
    background-color 0.3s ease;
}
/* cursor-following spotlight */
.project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(360px circle at var(--mx) var(--my), rgba(45, 212, 191, 0.16), transparent 45%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 2;
}
.project-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.project-thumb {
  aspect-ratio: 16 / 10;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.001);
  filter: brightness(0.82) saturate(0.85);
  backface-visibility: hidden;
  transition: transform 0.7s var(--ease-out), filter 0.45s ease;
}
.project-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem 1.25rem;
}
.project-body h3 {
  font-size: 1.05rem;
  margin: 0;
  transition: color 0.3s ease;
}
.project-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}
.project-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
  transition:
    color 0.3s ease,
    background-color 0.3s ease,
    border-color 0.3s ease,
    transform 0.45s var(--ease-out);
}

/* hover / keyboard-focus state */
.project-card:focus-visible {
  --lift: -10px;
}
.project-card:focus-visible::after {
  opacity: 1;
}
.project-card:focus-visible .project-thumb img {
  transform: scale(1.08);
  filter: none;
}
.project-card:focus-visible h3 {
  color: var(--accent);
}
.project-card:focus-visible .project-link {
  color: #04201c;
  background-color: var(--accent);
  border-color: var(--accent);
  transform: rotate(45deg);
}
/* mouse/trackpad only, so touch devices don't get a "stuck" hover state */
@media (hover: hover) and (pointer: fine) {
  .project-item:hover .project-card {
    --lift: -10px;
    border-color: rgba(45, 212, 191, 0.5);
    background-color: var(--surface-hover);
    box-shadow:
      0 28px 50px -24px rgba(0, 0, 0, 0.9),
      0 0 0 1px rgba(45, 212, 191, 0.2),
      0 18px 44px -18px rgba(45, 212, 191, 0.35);
    /* faster response while tracking the cursor */
    transition:
      transform 0.2s var(--ease-out),
      box-shadow 0.45s var(--ease-out),
      border-color 0.3s ease,
      background-color 0.3s ease;
  }
  .project-item:hover .project-card::after {
    opacity: 1;
  }
  .project-item:hover .project-thumb img {
    transform: scale(1.08);
    filter: none;
  }
  .project-item:hover h3 {
    color: var(--accent);
  }
  .project-item:hover .project-link {
    color: #04201c;
    background-color: var(--accent);
    border-color: var(--accent);
    transform: rotate(45deg);
  }
}

/*
  CONTACT
*/
.contact-container {
  max-width: 720px;
}
#contact-form .form-control {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}
#contact-form .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#contact-form .form-control[readonly] {
  cursor: not-allowed;
  opacity: 0.6;
}
#contact-form .form-floating > label {
  color: var(--text-muted);
}
#contact-form .form-floating > .form-control:focus ~ label::after,
#contact-form .form-floating > .form-control:not(:placeholder-shown) ~ label::after {
  background: transparent;
}
#contact-message {
  height: 160px;
}
.char-limit {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/*
  MODAL
*/
#okModal .modal-content {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
#okModal .modal-body {
  color: var(--text-muted);
}

/*
  FOOTER
*/
.site-footer {
  padding: 1.75rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.footer-links {
  display: flex;
  gap: 1.25rem;
}
.footer-links a {
  color: var(--text-muted);
}
.footer-links a:hover {
  color: var(--text);
}

/*
  REVEAL ON SCROLL (only hides content once JS has confirmed it can reveal it)
*/
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .btn, .project-card, .project-thumb img, .project-link {
    transition: none;
  }
  .project-card,
  .project-item:hover .project-card,
  .project-item:hover .project-thumb img,
  .project-item:hover .project-link {
    transform: none;
  }
}

/*
  ERROR PAGE (error.php)
*/
.banner-cust {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
#error h3 {
  min-width: 214px;
  color: inherit;
}

/*
  MEDIA
*/
@media (max-width: 767.98px) {
  #navbar .navbar-collapse {
    padding: 0.5rem 0 1rem;
  }
  .focus-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .timeline-meta {
    flex-direction: row;
    gap: 0.75rem;
    padding-left: 2rem;
  }
  .section {
    padding: 4rem 0;
  }
  .section-hero {
    padding: calc(var(--nav-h) + 2.5rem) 0 3.5rem;
  }
}
@media (max-width: 420px) {
  .focus-grid {
    grid-template-columns: 1fr;
  }
  .skill-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
