:root {
  --bg: #ffffff;
  --bg-alt: #f4f4f2;
  --panel: #ffffff;
  --border: #1c1c1c;
  --border-soft: #d9d9d5;
  --accent: #d43f27;
  --accent-2: #647588;
  --accent-warm: #d43f27;
  --text: #111111;
  --text-dim: #5c5c58;
  --header-height: 64px;
  --font-display: 'Roboto', sans-serif;
  --font-title: 'Archivo', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #101010;
  --bg-alt: #181818;
  --panel: #101010;
  --border: #f2f2f0;
  --border-soft: #333331;
  --accent: #ff5a3c;
  --accent-2: #9aa7b4;
  --accent-warm: #ff5a3c;
  --text: #f2f2f0;
  --text-dim: #9c9c96;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body { transition: background 0.2s, color 0.2s; }

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--text);
  color: var(--bg);
  padding: 0.7rem 1.2rem;
  z-index: 1000;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  line-height: 1.6;
  overflow-x: hidden;
}

/* LAYOUT */
.main {
  max-width: 1240px;
  margin: 0 auto;
  padding-top: var(--header-height, 64px);
}

/* HEADER / NAVBAR */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.nav {
  max-width: 1240px;
  margin: 0 auto;
  height: 64px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 0.9rem;
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: background 0.15s, color 0.15s;
}
.nav-logo:hover { background: var(--accent); color: var(--bg); }

.nav-menu { display: flex; align-items: center; }
.nav-list {
  display: flex;
  list-style: none;
  gap: 2rem;
}
.nav-link {
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: color 0.15s;
  position: relative;
  padding-bottom: 2px;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--accent); }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }

.nav-close { display: none; }

.nav-actions { display: flex; align-items: center; gap: 1.2rem; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--text);
  transition: border-color 0.15s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: inline; }

.lang-toggle {
  background: none;
  border: 1px solid var(--border);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  width: fit-content;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: border-color 0.15s;
}
.lang-toggle:hover { border-color: var(--accent); }
.lang-option { transition: color 0.15s; }
.lang-option.active { color: var(--accent); font-weight: 700; }
.lang-sep { opacity: 0.4; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--text);
}

.btn {
  padding: 0.8rem 1.6rem;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
  display: inline-block;
  border: 1px solid var(--text);
  cursor: pointer;
}
.btn-primary {
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-outline {
  background: none;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--text); background: var(--bg-alt); }

/* HOME / HERO — Swiss centered layout */
.home {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.home-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 4rem 2rem;
  text-align: center;
}
.home-avatar {
  width: 144px;
  height: 144px;
  margin: 0 auto 2rem;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--text);
}
.home-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  display: block;
}
.home-eyebrow {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 2px;
  margin-bottom: 1.2rem;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.home-role {
  display: block;
  font-family: var(--font-title);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 0.9rem;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.reveal-line {
  display: block;
  overflow: hidden;
}
.reveal-line span {
  display: inline-block;
  transform: translateY(110%);
}
.home-title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  letter-spacing: 0.5px;
  margin-bottom: 1.4rem;
}
.home-desc {
  color: var(--text-dim);
  font-size: 1rem;
  max-width: 460px;
  margin: 0 auto 2.2rem;
}
.home-buttons {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 2.2rem;
}
.home-socials {
  display: flex;
  gap: 1.4rem;
  justify-content: center;
}
.home-socials a {
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}
.home-socials a:hover { color: var(--text); border-color: var(--text); }

/* SECTIONS */
.section {
  padding: 4rem 2rem;
  border-bottom: 1px solid var(--border);
}
.section:last-of-type { border-bottom: none; }
.home.section { padding: 0; }
.section-head { margin-bottom: 2.5rem; }
.section-tag {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.section-head h2 {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
  margin: 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}
.section-head-plain h2 { margin-top: 0; }
.section-sub { color: var(--text-dim); max-width: 640px; }

.about-text { color: var(--text-dim); margin-bottom: 1.2rem; font-size: 1rem; max-width: 680px; }
.about-text strong { color: var(--text); }

/* GITHUB ACTIVITY */
.github-activity {
  margin-top: 2.4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}
.github-activity-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  text-decoration: none;
  margin-bottom: 1.2rem;
}
.github-activity-label {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: -0.01em;
}
.github-activity-cta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}
.github-activity-link:hover .github-activity-cta { text-decoration: underline; }
.github-activity-graph {
  width: 100%;
  max-width: 720px;
  height: auto;
  display: block;
  border: 1px solid var(--border-soft);
  background: var(--panel);
}

/* TIMELINE (EXPERIENCE) */
.timeline {
  display: flex;
  flex-direction: column;
}
.timeline-item {
  border-top: 1px solid var(--border-soft);
  padding: 1.8rem 0;
}
.timeline-item:first-child { border-top: none; padding-top: 0; }
.timeline-period {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.76rem;
  letter-spacing: 1px;
  margin-bottom: 0.4rem;
}
.timeline-item h3 {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.02rem;
  margin-bottom: 0.6rem;
}
.timeline-org {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.88rem;
}
.education-line {
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* PROJECT GRID */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.4rem;
}
.project-card {
  background: var(--panel);
  border: 1px solid var(--text);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: background 0.15s;
}
.project-card:hover { background: var(--bg-alt); }
.project-card-media { aspect-ratio: 16/10; overflow: hidden; border-bottom: 1px solid var(--text); }
.project-card-media img { width: 100%; height: 100%; object-fit: cover; }
.project-card-body { padding: 1.4rem; }
.project-card-body h3 { font-family: var(--font-title); font-weight: 700; font-size: 1.1rem; margin-bottom: 0.5rem; }
.project-card-body p { color: var(--text-dim); font-size: 0.86rem; margin-bottom: 1rem; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.22rem 0.55rem;
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  text-transform: uppercase;
}

.project-card-placeholder {
  border-style: dashed;
  border-color: var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.project-card-placeholder .project-card-body { text-align: center; }
.project-card-placeholder h3 { color: var(--text-dim); }
.project-card-placeholder p { font-size: 0.82rem; }

/* CASE STUDY */
.case-study { padding-top: 2rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.2rem;
  margin-bottom: 4rem;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--text);
  padding: 1.5rem;
  text-align: center;
}
.stat-number {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-label { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.5rem; }

.showcase-block {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 2.5rem;
  align-items: center;
  margin-bottom: 3.5rem;
  padding-bottom: 3.5rem;
  border-bottom: 1px solid var(--border-soft);
}
.showcase-block:last-of-type { border-bottom: none; }
.showcase-block.reverse { grid-template-columns: 1.3fr 1fr; }
.showcase-block.reverse .showcase-text { order: 2; }
.showcase-block.reverse .showcase-media { order: 1; }
.showcase-text h3 { font-family: var(--font-title); font-weight: 700; font-size: 1.3rem; margin-bottom: 1rem; color: var(--text); }
.showcase-text p { color: var(--text-dim); margin-bottom: 1rem; font-size: 0.94rem; }
.mini-table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 8px; margin-bottom: 1rem; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; min-width: 420px; }
.mini-table th, .mini-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border-soft); }
.mini-table th { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); background: var(--bg-alt); }
.mini-table td { color: var(--text); font-family: var(--font-mono); }
.mini-table td:first-child { font-family: var(--font-display); color: var(--text); }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table-caption { color: var(--text-dim); font-size: 0.78rem; margin: -0.6rem 0 1rem; }
.feature-list { list-style: none; }
.feature-list li {
  color: var(--text-dim);
  font-size: 0.86rem;
  padding-left: 1.2rem;
  position: relative;
  margin-bottom: 0.5rem;
}
.feature-list li::before {
  content: "-";
  color: var(--accent);
  position: absolute;
  left: 0;
}
.showcase-media {
  overflow: hidden;
  border: 1px solid var(--text);
}
.showcase-media img { width: 100%; display: block; }

.dnbr-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: var(--text);
  border: 1px solid var(--text);
  margin-bottom: 2rem;
}
.dnbr-gallery img {
  width: 100%;
  display: block;
  background: var(--panel);
}

.disclaimer {
  font-size: 0.78rem;
  color: var(--text-dim);
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
  margin-bottom: 2rem;
}

.back-to-projects {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  border-bottom: 1px solid var(--text);
}
.back-to-projects:hover { color: var(--accent); border-color: var(--accent); }

/* STACK GRID */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
}
.stack-card {
  background: var(--panel);
  padding: 1.5rem;
}
.stack-icon { font-size: 1.6rem; }
.stack-card h4 { font-family: var(--font-title); font-weight: 700; margin: 0.6rem 0 0.4rem; }
.stack-card p { color: var(--text-dim); font-size: 0.86rem; }

/* TABS (Qualification / Skills) */
.tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  margin-bottom: 2.2rem;
  border: 1px solid var(--text);
  width: fit-content;
}
.tab-btn {
  background: none;
  border: none;
  border-right: 1px solid var(--text);
  padding: 0.6rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab-btn:last-child { border-right: none; }
.tab-btn:hover { background: var(--bg-alt); }
.tab-btn.active {
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* SKILLS — plain list, one per line */
.skill-cloud {
  list-style: none;
  display: flex;
  flex-direction: column;
  max-width: 560px;
}
.skill-pill {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  background: none;
}
.skill-cloud li:first-child { border-top: 1px solid var(--border-soft); }

/* PROJECT SWIPER */
.project-swiper { padding-bottom: 2.8rem; }
.project-swiper .swiper-slide { height: auto; }
.swiper-pagination-bullet {
  background: var(--border-soft);
  border-radius: 0;
  opacity: 1;
}
.swiper-pagination-bullet-active {
  background: var(--accent);
}

/* CONTACT — simple links, no form */
.contact-section { padding-top: 4rem; padding-bottom: 4rem; }
.contact-simple { text-align: center; max-width: 560px; margin: 0 auto; }
.contact-simple h2 {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
}
.contact-simple .section-sub { margin: 0 auto 2.2rem; }
.contact-links {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}
.contact-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1rem 0.2rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: color 0.15s;
}
.contact-link:hover { color: var(--accent); }
.contact-link-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.contact-link-value {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
}

.footer {
  text-align: center;
  padding: 2.5rem 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

/* SCROLL REVEAL */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-stagger.in-view > * {
  opacity: 1;
  transform: translateY(0);
}
.reveal-stagger.in-view > *:nth-child(1) { transition-delay: 0.02s; }
.reveal-stagger.in-view > *:nth-child(2) { transition-delay: 0.1s; }
.reveal-stagger.in-view > *:nth-child(3) { transition-delay: 0.18s; }
.reveal-stagger.in-view > *:nth-child(4) { transition-delay: 0.26s; }
.reveal-stagger.in-view > *:nth-child(5) { transition-delay: 0.34s; }
.reveal-stagger.in-view > *:nth-child(6) { transition-delay: 0.42s; }

/* MAGNETIC BUTTON HOVER */
.btn-magnetic { transition: transform 0.2s ease-out; }

/* SCROLL UP */
.scroll-up {
  position: fixed;
  right: 1.6rem;
  bottom: 1.6rem;
  width: 40px; height: 40px;
  background: var(--text);
  color: var(--bg);
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  z-index: 90;
}
.scroll-up:hover { background: var(--accent); }
.scroll-up.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* RESPONSIVE */
@media (max-width: 960px) {
  .nav { padding: 0 1.5rem; }
  .nav-menu {
    position: fixed;
    top: 0; right: -100%;
    width: min(320px, 85%);
    height: 100vh;
    background: var(--bg);
    border-left: 1px solid var(--border);
    padding: 5rem 2rem 2rem;
    transition: right 0.3s;
    z-index: 110;
  }
  .nav-menu.show { right: 0; }
  .nav-list { flex-direction: column; gap: 1.6rem; }
  .nav-close {
    display: block;
    position: absolute;
    top: 1.2rem; right: 1.2rem;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.8rem;
    cursor: pointer;
  }
  .nav-toggle { display: flex; }

  .section { padding: 3rem 1.5rem; }

  .home-inner { padding: 3rem 1.5rem; }
  .home-role { font-size: clamp(2.1rem, 9vw, 3rem); }

  .showcase-block, .showcase-block.reverse {
    grid-template-columns: 1fr;
  }
  .showcase-block.reverse .showcase-text,
  .showcase-block.reverse .showcase-media { order: initial; }
}

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
  }
}
