/* ============================================================
   Jan Tiedemann — portfolio · vanilla CSS
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', var(--font-sans);
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --container: 1180px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.08), 0 4px 12px -2px rgba(0,0,0,.08);
  --shadow: 0 10px 30px -10px rgba(0,0,0,.30);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.45);

  --ease-out: cubic-bezier(.16,1,.3,1);

  /* Brand gradient */
  --grad-1: #7c5cff;
  --grad-2: #21d4fd;
  --grad-3: #ff7eb3;
}

/* Dark theme (default) */
[data-theme="dark"] {
  --bg:           #07091a;
  --bg-elev:      #0d1130;
  --bg-card:      rgba(20, 24, 56, .55);
  --bg-card-hov:  rgba(28, 33, 76, .75);
  --border:       rgba(255,255,255,.08);
  --border-strong:rgba(255,255,255,.18);
  --text:         #e8ecff;
  --text-muted:   #9aa3c7;
  --text-soft:    #c9d0eb;
  --accent:       #8b7dff;
  --primary:      #7c5cff;
  --primary-hov:  #9a82ff;
  color-scheme: dark;
}

/* Light theme */
[data-theme="light"] {
  --bg:           #f7f8fc;
  --bg-elev:      #ffffff;
  --bg-card:      rgba(255,255,255,.75);
  --bg-card-hov:  rgba(255,255,255,.95);
  --border:       rgba(15,20,55,.08);
  --border-strong:rgba(15,20,55,.18);
  --text:         #0f1437;
  --text-muted:   #58608a;
  --text-soft:    #2d3358;
  --accent:       #5b46ff;
  --primary:      #5b46ff;
  --primary-hov:  #4630e0;
  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .4s var(--ease-out), color .4s var(--ease-out);
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hov); }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
h1,h2,h3,h4 { font-family: var(--font-display); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .5em; }
p { margin: 0 0 1em; color: var(--text-soft); }

.container { width: min(var(--container), calc(100% - 2.5rem)); margin-inline: auto; }

/* ---------- Mesh background ---------- */
.mesh-bg {
  position: fixed; inset: -10%;
  z-index: -1; pointer-events: none;
  overflow: hidden;
  filter: blur(80px) saturate(140%);
  opacity: .65;
}
[data-theme="light"] .mesh-bg { opacity: .35; }
.mesh-blob {
  position: absolute;
  width: 50vmax; height: 50vmax;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: drift 30s ease-in-out infinite alternate;
}
[data-theme="light"] .mesh-blob { mix-blend-mode: multiply; }
.mesh-blob--1 { background: var(--grad-1); top: -10%; left: -10%; }
.mesh-blob--2 { background: var(--grad-2); bottom: -10%; right: -10%; animation-duration: 38s; animation-direction: alternate-reverse; }
.mesh-blob--3 { background: var(--grad-3); top: 40%; left: 40%; animation-duration: 45s; opacity: .7; }
@keyframes drift {
  0%   { transform: translate(0,0)     scale(1); }
  50%  { transform: translate(8vw,4vh) scale(1.15); }
  100% { transform: translate(-6vw,6vh) scale(.95); }
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0;
  z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  width: min(var(--container), calc(100% - 2.5rem));
  margin: 1rem auto;
  padding: .65rem .9rem .65rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow-sm);
  transition: background .3s, box-shadow .3s, transform .3s;
}
.nav.is-scrolled { box-shadow: var(--shadow); }
.nav__brand { display: inline-flex; align-items: center; gap: .65rem; font-weight: 600; color: var(--text); }
.nav__brand-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: .8rem;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
  box-shadow: 0 6px 16px -6px var(--grad-1);
}
.nav__brand-text { letter-spacing: -.01em; }
.nav__links { display: flex; gap: 1.35rem; margin-left: auto; }
.nav__links a {
  font-size: .9rem; color: var(--text-muted); font-weight: 500;
  position: relative; padding: .35rem 0;
}
.nav__links a:hover { color: var(--text); }
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0;
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--grad-1), var(--grad-2));
  transition: right .25s var(--ease-out);
}
.nav__links a:hover::after { right: 0; }
.nav__actions { display: flex; align-items: center; gap: .5rem; }

/* Burger */
.nav__burger { display: none; width: 36px; height: 36px; border-radius: 10px; padding: 8px; flex-direction: column; justify-content: space-between; }
.nav__burger span { display: block; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s, opacity .2s; }
.nav__burger.is-open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav__burger.is-open span:nth-child(2) { opacity: 0; }
.nav__burger.is-open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .9rem;
  line-height: 1;
  border: 1px solid transparent;
  transition: transform .15s var(--ease-out), background .2s, color .2s, border-color .2s, box-shadow .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
  box-shadow: 0 8px 22px -8px var(--grad-1);
}
.btn--primary:hover { color: #fff; box-shadow: 0 12px 28px -8px var(--grad-1); }
.btn--ghost {
  color: var(--text);
  background: var(--bg-card);
  border-color: var(--border-strong);
  backdrop-filter: blur(10px);
}
.btn--ghost:hover { background: var(--bg-card-hov); color: var(--text); }
.btn--lg { padding: .85rem 1.4rem; font-size: 1rem; }
.btn--icon { padding: .55rem; border-radius: 10px; background: var(--bg-card); border-color: var(--border); }
.btn--icon:hover { background: var(--bg-card-hov); }

/* theme icon swap */
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ---------- HERO ---------- */
.hero {
  position: relative;
  padding: 4rem 0 6rem;
}
.hero__inner {
  width: min(var(--container), calc(100% - 2.5rem));
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 4rem;
  align-items: center;
  min-height: calc(100vh - 200px);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .35rem .75rem .35rem .55rem;
  font-size: .8rem; font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(10px);
}
.eyebrow__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,.18);
  animation: pulse 2s infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } }

.hero__title {
  margin: 1.25rem 0;
  font-size: clamp(2.4rem, 5.5vw, 4.4rem);
  font-weight: 700;
}
.grad-text {
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2) 50%, var(--grad-3));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% 200%;
  animation: shift 8s ease-in-out infinite;
}
@keyframes shift { 50% { background-position: 100% 0; } }

.hero__lede { max-width: 540px; font-size: 1.1rem; }
.hero__cta { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1.75rem 0 2.5rem; }

.hero__stats {
  display: flex; gap: 2.5rem;
  list-style: none; padding: 0; margin: 0;
}
.hero__stats li { display: flex; flex-direction: column; gap: .2rem; }
.hero__stats strong {
  font-family: var(--font-display);
  font-size: 2rem; line-height: 1;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero__stats span { font-size: .85rem; color: var(--text-muted); }

/* Orbit visual */
.hero__visual { display: grid; place-items: center; }
.orbit {
  position: relative;
  width: clamp(280px, 32vw, 460px);
  aspect-ratio: 1;
  display: grid; place-items: center;
}
.orbit__core {
  position: relative; z-index: 3;
  width: 38%; aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--bg);
  box-shadow:
    0 0 0 2px rgba(124,92,255,.55),
    0 25px 80px -20px rgba(124,92,255,.55),
    inset 0 0 30px rgba(255,255,255,.1);
}
.orbit__core img { width: 100%; height: 100%; object-fit: cover; }
.orbit__ring {
  position: absolute; inset: 0;
  border: 1px dashed var(--border-strong);
  border-radius: 50%;
  animation: spin 40s linear infinite;
}
.orbit__ring--1 { inset: 12%; animation-duration: 25s; }
.orbit__ring--2 { animation-duration: 50s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.orbit__chip {
  position: absolute;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 500;
  padding: .35rem .65rem;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  color: var(--text);
  animation: spin 40s linear infinite reverse;
  white-space: nowrap;
}
.orbit__ring--1 .orbit__chip:nth-child(1) { top: -4%; left: 50%; transform: translateX(-50%); }
.orbit__ring--1 .orbit__chip:nth-child(2) { bottom: 8%; right: -8%; }
.orbit__ring--1 .orbit__chip:nth-child(3) { bottom: 8%; left: -8%; }
.orbit__ring--1 .orbit__chip { animation-duration: 25s; }
.orbit__ring--2 .orbit__chip:nth-child(1) { top: 5%; right: 0%; }
.orbit__ring--2 .orbit__chip:nth-child(2) { bottom: -2%; left: 50%; transform: translateX(-50%); }
.orbit__ring--2 .orbit__chip:nth-child(3) { top: 50%; left: -6%; transform: translateY(-50%); }
.orbit__ring--2 .orbit__chip:nth-child(4) { top: 50%; right: -6%; transform: translateY(-50%); }
.orbit__ring--2 .orbit__chip { animation-duration: 50s; animation-direction: normal; }

.hero__scroll {
  position: absolute; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  width: 24px; height: 38px;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  display: grid; place-items: start center;
  padding-top: 6px;
}
.hero__scroll span {
  display: block; width: 3px; height: 8px; border-radius: 3px;
  background: var(--accent);
  animation: scrollHint 1.6s ease-in-out infinite;
}
@keyframes scrollHint { 0%,100% { transform: translateY(0); opacity: 1;} 50%{transform: translateY(10px); opacity: 0;} }

/* ---------- Sections ---------- */
.section { padding: 6rem 0; position: relative; }
.section--alt::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--bg-elev);
  opacity: .55;
  z-index: -1;
  border-block: 1px solid var(--border);
}
.section__head { max-width: 720px; margin-bottom: 3rem; }
.section__kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .8rem; font-weight: 500;
  color: var(--accent);
  margin-bottom: .8rem;
  letter-spacing: .05em;
}
.section__title {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700;
}
.section__lede { color: var(--text-muted); font-size: 1.05rem; }

/* ---------- About ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 3rem;
  align-items: start;
}
.about__text p { font-size: 1.05rem; }
.about__card {
  padding: 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-sm);
}
.about__card h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-mono); font-weight: 500; }
.about__card dl { display: grid; grid-template-columns: max-content 1fr; gap: .65rem 1.25rem; margin: 0; }
.about__card dt { font-weight: 600; color: var(--text); }
.about__card dd { margin: 0; color: var(--text-muted); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 12px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--grad-1), var(--grad-2), transparent);
  border-radius: 2px;
  opacity: .5;
}
.timeline__item { position: relative; padding-left: 50px; padding-bottom: 2rem; }
.timeline__dot {
  position: absolute; left: 6px; top: 24px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(124,92,255,.15);
}
.timeline__card {
  padding: 1.75rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  transition: transform .3s var(--ease-out), border-color .3s, box-shadow .3s;
}
.timeline__card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.timeline__meta {
  display: flex; flex-wrap: wrap; gap: .35rem 1rem;
  font-family: var(--font-mono); font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .35rem;
}
.timeline__date { color: var(--accent); font-weight: 500; }
.timeline__card h3 { font-size: 1.3rem; margin: .25rem 0 .75rem; }

/* ---------- Chips ---------- */
.chips { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li {
  font-family: var(--font-mono); font-size: .72rem;
  padding: .25rem .6rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
}

/* ---------- Skills ---------- */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.skill-card {
  position: relative;
  padding: 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  transition: transform .35s var(--ease-out), border-color .3s, box-shadow .3s;
  overflow: hidden;
}
.skill-card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(600px circle at var(--mx,50%) var(--my,0%), rgba(124,92,255,.13), transparent 40%);
  opacity: 0; transition: opacity .3s;
  pointer-events: none;
}
.skill-card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.skill-card:hover::before { opacity: 1; }
.skill-card__icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(124,92,255,.18), rgba(33,212,253,.12));
  margin-bottom: 1rem;
}
.skill-card h3 { font-size: 1.2rem; margin-bottom: .5rem; }
.skill-card p { font-size: .95rem; }

/* ---------- Projects ---------- */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.project-card {
  display: flex; flex-direction: column;
  padding: 1.5rem 1.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  text-decoration: none;
  color: inherit;
  transition: transform .3s var(--ease-out), border-color .3s, box-shadow .3s;
  min-height: 200px;
}
.project-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.project-card__head { display: flex; align-items: center; gap: .65rem; margin-bottom: .65rem; }
.project-card__title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--text); margin: 0; }
.project-card__desc { font-size: .92rem; color: var(--text-muted); margin: 0; flex: 1; }
.project-card__foot {
  display: flex; align-items: center; gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .8rem; color: var(--text-muted);
}
.project-card__lang { display: inline-flex; align-items: center; gap: .35rem; }
.project-card__lang::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--lang-color, var(--accent)); }
.project-card__stat { display: inline-flex; align-items: center; gap: .25rem; }
.project-card__link {
  margin-left: auto;
  font-weight: 600;
  color: var(--accent);
  font-size: .8rem;
}

/* Skeleton */
.skeleton {
  background: linear-gradient(110deg, var(--bg-card) 30%, var(--bg-card-hov) 50%, var(--bg-card) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  border-color: transparent;
  pointer-events: none;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.projects__more { text-align: center; margin-top: 2.25rem; }

/* ---------- Contact ---------- */
.contact {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 3rem;
  padding: 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  align-items: start;
}
.contact__copy p { color: var(--text-muted); font-size: 1.05rem; }
.contact__actions { display: grid; gap: .8rem; }
.contact__btn {
  display: flex; align-items: center; gap: .9rem;
  padding: 1rem 1.25rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: transform .2s, border-color .2s, background .2s;
}
.contact__btn:hover { transform: translateY(-2px); border-color: var(--border-strong); color: var(--text); background: var(--bg-card-hov); }
.contact__btn span { display: flex; flex-direction: column; }
.contact__btn small { color: var(--text-muted); font-size: .82rem; }
.contact__btn svg { flex-shrink: 0; color: var(--accent); }
.contact__btn--primary {
  background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
  color: #fff;
  border-color: transparent;
}
.contact__btn--primary:hover { color: #fff; }
.contact__btn--primary small { color: rgba(255,255,255,.85); }
.contact__btn--primary svg { color: #fff; }

/* ---------- Footer ---------- */
.footer { padding: 2.5rem 0; border-top: 1px solid var(--border); margin-top: 4rem; }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--text-muted); }
.footer__tag { font-family: var(--font-mono); }

/* ---------- Reveal on scroll ---------- */
[data-reveal] {
  opacity: 0; transform: translateY(24px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
}
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero__inner { grid-template-columns: 1fr; gap: 3rem; min-height: auto; padding-top: 2rem; }
  .hero__visual { order: -1; max-width: 360px; margin: 0 auto; }
  .about__grid { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; padding: 2rem; }
}

@media (max-width: 720px) {
  .nav__links { display: none; }
  .nav__links.is-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: calc(100% + .5rem);
    left: 0; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
  }
  .nav__burger { display: flex; }
  .nav__brand-text { display: none; }
  .nav .btn span { display: none; }
  .nav .btn--primary { padding: .55rem; }
  .hero { padding: 2rem 0 4rem; }
  .hero__stats { gap: 1.5rem; flex-wrap: wrap; }
  .hero__stats strong { font-size: 1.6rem; }
  .section { padding: 4rem 0; }
  .timeline__card { padding: 1.25rem 1.4rem; }
  .timeline__item { padding-left: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}
