/* =========================================================
   Portfolio — Pape Birame Thiombane — Terminal Theme
   ========================================================= */

:root,
[data-theme="dark"] {
  --bg: #000640;
  --bg-alt: #00042c;
  --surface: #030a52;
  --surface-2: #06105e;
  --border: #1c2a78;
  --border-soft: #131f5e;
  --nav-bg: rgba(0, 6, 64, 0.78);
  --nav-bg-mobile: rgba(0, 6, 64, 0.98);

  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.6);
  --accent-glow: rgba(255, 255, 255, 0.35);
  --accent-contrast: #04072a;

  --bg-glow-1: rgba(255, 255, 255, 0.05);
  --bg-glow-2: rgba(86, 224, 224, 0.05);

  --green: #39ff88;
  --green-dim: #1f8f4f;
  --yellow: #ffd23f;
  --red: #ff5555;
  --cyan: #56e0e0;
  --amber: #ffb454;

  --text: #f2f4ff;
  --text-dim: #aab2e0;
  --text-faint: #6b74a8;

  --font-mono: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;

  --radius: 10px;
  --nav-h: 68px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="light"] {
  --bg: #f5f6fb;
  --bg-alt: #eceef8;
  --surface: #ffffff;
  --surface-2: #eef0fa;
  --border: #d7dbef;
  --border-soft: #e3e6f5;
  --nav-bg: rgba(245, 246, 251, 0.82);
  --nav-bg-mobile: rgba(245, 246, 251, 0.98);

  --accent: #000640;
  --accent-dim: rgba(0, 6, 64, 0.65);
  --accent-glow: rgba(0, 6, 64, 0.16);
  --accent-contrast: #ffffff;

  --bg-glow-1: rgba(0, 6, 64, 0.05);
  --bg-glow-2: rgba(15, 122, 144, 0.04);

  /* darker/more saturated so progress semantics stay legible on a light surface */
  --green: #0ea355;
  --green-dim: #0b7d42;
  --yellow: #b8860b;
  --red: #d92d2d;
  --cyan: #0f7a90;
  --amber: #b5590a;

  --text: #0b1030;
  --text-dim: #454b74;
  --text-faint: #767ca8;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
  background-image:
    radial-gradient(circle at 15% 10%, var(--bg-glow-1), transparent 40%),
    radial-gradient(circle at 85% 30%, var(--bg-glow-2), transparent 40%);
}

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

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }

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

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

/* subtle scanline overlay for terminal feel — softened in light mode */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  opacity: 0.5;
  transition: opacity 0.35s var(--ease);
}
[data-theme="light"] .crt-overlay { opacity: 0.08; mix-blend-mode: multiply; }

/* =========================== Layout helpers =========================== */
.section { padding: 120px 0; position: relative; }
.section__inner { width: min(1140px, 92vw); margin: 0 auto; }

.section__title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 8px;
}
.section__index { color: var(--accent); margin-right: 6px; }

.section__subtitle {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 48px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

/* =========================== Reveal on scroll =========================== */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================== Buttons =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.btn .icon { width: 16px; height: 16px; }

.btn--primary {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px -6px var(--accent-glow);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn--sm { padding: 9px 16px; font-size: 0.78rem; }

/* =========================== Navbar =========================== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 500;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.navbar__inner {
  width: min(1200px, 94vw);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.navbar__brand {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}
.prompt { color: var(--accent); }
.brand-at { color: var(--text-faint); }
.brand-host { color: var(--cyan); }
.prompt-colon { color: var(--text-faint); }
.prompt-path { color: var(--text-dim); }

.cursor-blink {
  display: inline-block;
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.navbar__links {
  display: flex;
  gap: 28px;
  flex: 1;
  justify-content: center;
}
.nav-link {
  color: var(--text-dim);
  font-size: 0.86rem;
  font-weight: 500;
  position: relative;
  transition: color 0.2s;
}
.nav-index { color: var(--accent-dim); margin-right: 4px; }
.nav-link:hover { color: var(--accent); }
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -6px;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.nav-link:hover::after { width: 100%; }

.navbar__actions { display: flex; align-items: center; gap: 14px; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px) rotate(8deg); }
.theme-toggle .icon { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: inline; }

.navbar__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px; height: 34px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.navbar__toggle span {
  width: 16px; height: 2px;
  background: var(--accent);
  margin: 0 auto;
  transition: transform 0.25s, opacity 0.25s;
}
.navbar__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.navbar__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================== Terminal window =========================== */
.terminal-window {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px -30px rgba(0, 0, 0, 0.6);
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.terminal-window__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot--red { background: var(--red); }
.dot--yellow { background: var(--yellow); }
.dot--green { background: var(--green); }
.terminal-window__title {
  margin-left: 8px;
  color: var(--text-faint);
  font-size: 0.78rem;
}
.terminal-window__body {
  padding: 20px 22px;
  font-size: 0.9rem;
}
.term-line { color: var(--text); margin-bottom: 8px; }
.term-line--muted { margin-top: 14px; }
.term-prompt { color: var(--accent); margin-right: 6px; }

.about__paragraph {
  color: var(--text-dim);
  margin: 6px 0 4px 20px;
  line-height: 1.85;
  font-size: 0.95rem;
}

.about__formation { margin-top: 24px; }

.timeline {
  list-style: none;
  margin: 10px 0 4px 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.timeline__item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}
.timeline__date {
  font-size: 0.74rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.timeline__title {
  color: var(--text);
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.timeline__tag {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 20px;
}
.timeline__sub { color: var(--text-dim); font-size: 0.85rem; }

/* =========================== Hero =========================== */
.hero {
  padding-top: calc(var(--nav-h) + 70px);
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
}
.hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  width: 100%;
  align-items: center;
  padding: 0 clamp(16px, 4vw, 48px);
}

.hero__title {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 30px;
}
.hero__hello {
  font-size: 1rem;
  color: var(--text-dim);
  font-weight: 500;
}

.hero__name-wrap { display: block; min-height: 1.25em; }
.hero__name {
  font-size: clamp(1.9rem, 4.2vw, 3.1rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  text-shadow: 0 0 22px var(--accent-glow);
}

.hero__terminal { max-width: 520px; margin-bottom: 34px; }
.hero__cta { display: flex; gap: 16px; flex-wrap: wrap; }

.hero__text {
  position: relative;
  z-index: 2;
  padding: 0 20px;
  order: 2;
}

.hero__scene {
  position: relative;
  height: 360px;
  width: 100%;
  z-index: 1;
  order: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.scene-canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.scene-canvas.is-dragging { cursor: grabbing; }

/* Desktop: laptop and name sit side by side on the same vertical center —
   the transparent canvas means there's no visible seam even where it bleeds
   past its column into the text's side. */
@media (min-width: 901px) {
  .hero__grid {
    grid-template-columns: 0.95fr 1.2fr;
    gap: 20px;
  }
  .hero__text { order: 1; padding: 0; }
  .hero__scene {
    order: 2;
    height: 480px;
  }
}

.scroll-indicator {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 38px;
  border: 2px solid var(--border);
  border-radius: 14px;
}
.scroll-indicator span {
  display: block;
  width: 4px; height: 8px;
  margin: 6px auto 0;
  background: var(--accent);
  border-radius: 3px;
  animation: scroll-dot 1.8s infinite;
}
@keyframes scroll-dot {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { opacity: 0; }
}

/* =========================== Skills =========================== */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 20px 26px;
  text-align: center;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease), background-color 0.35s var(--ease);
}
.skill-card:hover {
  transform: translateY(-8px);
  border-color: var(--border-soft);
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.5);
}

.skill-card__ring {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 18px;
}
.ring-svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}
.ring-progress {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 377;
  stroke-dashoffset: 377;
  transition: stroke-dashoffset 1.4s var(--ease), stroke 0.4s;
}
.ring-progress.level-green { stroke: var(--green); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--green) 45%, transparent)); }
.ring-progress.level-yellow { stroke: var(--yellow); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--yellow) 45%, transparent)); }
.ring-progress.level-red { stroke: var(--red); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--red) 45%, transparent)); }

.skill-canvas {
  position: absolute;
  inset: 20px;
  width: calc(100% - 40px);
  height: calc(100% - 40px);
  border-radius: 50%;
}

.skill-card__percent {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

.skill-card__name {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.skill-card__badge {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 20px;
}

.legend {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 44px;
  flex-wrap: wrap;
}
.legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.legend__dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend__dot--green { background: var(--green); }
.legend__dot--yellow { background: var(--yellow); }
.legend__dot--red { background: var(--red); }

/* =========================== Projects (JSON cards) =========================== */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 26px;
}

.json-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease), background-color 0.35s var(--ease);
}
.json-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent-dim);
  box-shadow: 0 24px 50px -26px var(--accent-glow);
}
.json-card__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.json-card__title { margin-left: 8px; color: var(--text-faint); font-size: 0.76rem; }

.json-card__body {
  margin: 0;
  padding: 18px 20px 22px;
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}
.json-key { color: var(--cyan); }
.json-str { color: var(--amber); }
.json-bool { color: var(--accent); }

.contact__json { font-size: 0.85rem; line-height: 1.9; }

/* =========================== Contact =========================== */
.contact__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: start;
}
.contact__cta { margin-top: 30px; }

/* =========================== Footer =========================== */
.footer {
  border-top: 1px solid var(--border-soft);
  background: var(--bg-alt);
  padding: 56px 0 0;
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.footer__inner {
  width: min(1140px, 92vw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
}
.footer__tagline { margin-top: 10px; color: var(--text-dim); font-size: 0.82rem; }
.footer__col h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 16px;
}
.footer__link {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-dim);
  font-size: 0.86rem;
  padding: 6px 0;
  transition: color 0.2s, transform 0.2s;
  width: fit-content;
}
.footer__link .icon { width: 16px; height: 16px; }
.footer__link:hover { color: var(--accent); transform: translateX(3px); }
.footer__link--static:hover { color: var(--text-dim); transform: none; cursor: default; }

.footer__bottom {
  border-top: 1px solid var(--border-soft);
  padding: 20px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.78rem;
}

/* =========================== Responsive =========================== */
@media (max-width: 900px) {
  .contact__grid { grid-template-columns: 1fr; }
  .footer__inner { grid-template-columns: 1fr; gap: 30px; }
}

@media (max-width: 760px) {
  .navbar__links {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--nav-bg-mobile);
    backdrop-filter: blur(12px);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 10px 6vw 20px;
    border-bottom: 1px solid var(--border-soft);
    transform: translateY(-130%);
    opacity: 0;
    transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
  }
  .navbar__links.is-open { transform: translateY(0); opacity: 1; }
  .nav-link { padding: 12px 0; width: 100%; border-bottom: 1px solid var(--border-soft); }
  .navbar__toggle { display: flex; }
  .navbar__actions .btn--sm span { display: none; }
  .section { padding: 90px 0; }
}

@media (max-width: 480px) {
  .navbar__actions .btn--primary { padding: 9px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { transition: none; opacity: 1; transform: none; }
  .scroll-indicator span, .cursor-blink { animation: none; }
}
