:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --border: #232323;
  --border-hover: #3d3d3d;
  --text: #f5f5f5;
  --text-secondary: #a1a1a1;
  --text-muted: #666666;
  --white: #ffffff;
  --radius: 10px;
  --transition: 0.2s ease;
  --font-sans: 'Schibsted Grotesk', system-ui, sans-serif;

  --max-width: 1080px;
  --nav-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) var(--bg);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--white);
  color: var(--bg);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 4px; }

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--white);
  color: var(--bg);
  padding: 8px 16px;
  border-radius: var(--radius);
  z-index: 1000;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}
.nav-link:hover,
.nav-link:focus-visible,
.nav-link.active {
  color: var(--text);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle-bar {
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: transform var(--transition), opacity var(--transition);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Sections ---------- */
.section {
  padding: 96px 0;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.section.in-view { opacity: 1; transform: none; }

.section-title {
  font-family: var(--font-sans);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.section-number {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--nav-height);
}

.hero-name {
  font-family: var(--font-sans);
  font-size: clamp(2.75rem, 7vw, 4.75rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.hero-tagline {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(1.35rem, 3.5vw, 2.1rem);
  color: var(--text-muted);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 26px;
}

.hero-description {
  font-size: 1.02rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 26px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--white);
  color: var(--bg);
  border-color: var(--white);
}
.btn-primary:hover {
  background: transparent;
  color: var(--white);
  border-color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-hover);
}
.btn-outline:hover {
  border-color: var(--white);
}

.btn-large {
  padding: 15px 34px;
  font-size: 0.95rem;
}

.hero-socials {
  display: flex;
  gap: 20px;
}

.social-link {
  color: var(--text-muted);
  transition: color var(--transition), transform var(--transition);
  display: flex;
}
.social-link:hover {
  color: var(--text);
  transform: translateY(-2px);
}

/* ---------- About ---------- */
.about-content {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 56px;
  align-items: start;
}

.about-text p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 0.98rem;
}
.about-text strong {
  color: var(--text);
  font-weight: 600;
}

.about-facts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fact {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color var(--transition);
}
.fact:hover { border-color: var(--border-hover); }

.fact-value {
  font-family: var(--font-sans);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.fact-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color var(--transition);
}
.skill-card:hover { border-color: var(--border-hover); }

.skill-card-title {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
  font-weight: 500;
}

.skill-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.skill-tags li {
  font-size: 0.78rem;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 11px;
  border-radius: 20px;
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: border-color var(--transition), transform var(--transition);
}
.project-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
}

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

.project-title {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.project-card:hover .project-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.project-link-badge {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--bg);
  background: var(--white);
  padding: 3px 9px;
  border-radius: 4px;
  white-space: nowrap;
}
.project-link-repo {
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-hover);
}

.project-sub {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.project-description {
  font-size: 0.87rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 18px;
  flex: 1;
}

.project-tech {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.project-tech li {
  font-size: 0.7rem;
  font-family: var(--font-sans);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 4px;
}

/* ---------- Education ---------- */
.timeline {
  list-style: none;
  max-width: 780px;
}

.timeline-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:first-child { border-top: 1px solid var(--border); }

.timeline-title {
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.timeline-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timeline-date {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  padding-top: 3px;
}

.education-note {
  margin-top: 26px;
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 620px;
}

/* ---------- Contact ---------- */
.contact { text-align: center; }

.contact-intro {
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 32px;
  font-size: 0.98rem;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 32px;
}

.contact-link {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color var(--transition);
}
.contact-link:hover { color: var(--text); }

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

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

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

.footer-top {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}
.footer-top:hover { color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .section { padding: 72px 0; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: #0f0f0f;
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    gap: 14px;
  }
  .nav-links.nav-open { display: flex; }
  .nav-toggle { display: flex; }

  .about-content { grid-template-columns: 1fr; gap: 36px; }
  .about-facts { flex-direction: row; flex-wrap: wrap; }
  .fact { flex: 1; min-width: 130px; }

  .projects-grid { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1; }

  .timeline-item { flex-direction: column; gap: 4px; }
}

@media (max-width: 480px) {
  .container { padding: 0 18px; }
  .section-title::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .section { opacity: 1; transform: none; transition: none; }
  .hero-name, .hero-tagline,
  .hero-description, .hero-actions, .hero-socials {
    opacity: 1; animation: none;
  }
}

/* ==================================================
   Creative touches (pure monochrome)
   ================================================== */

/* --- Scroll progress bar --- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--white);
  z-index: 200;
  pointer-events: none;
}

/* --- Animated nav underline --- */
.hero {
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.08) 1px, transparent 1.5px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 40%, black, transparent 78%);
  mask-image: radial-gradient(ellipse 85% 75% at 50% 40%, black, transparent 78%);
  pointer-events: none;
}
.hero .container {
  position: relative;
  z-index: 1;
}

/* --- Staggered hero entrance --- */
.hero-name, .hero-tagline,
.hero-description, .hero-actions, .hero-socials {
  opacity: 0;
  animation: hero-in 0.7s cubic-bezier(0.2, 0.6, 0.2, 1) forwards;
}
.hero-name        { animation-delay: 0.20s; }
.hero-tagline     { animation-delay: 0.32s; }
.hero-description { animation-delay: 0.44s; }
.hero-actions     { animation-delay: 0.56s; }
.hero-socials     { animation-delay: 0.68s; }
@keyframes hero-in {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Scramble caret after name while decoding --- */
.hero-name .scramble-char {
  color: var(--text-muted);
  font-weight: 700;
}

/* --- Animated nav underline --- */
.nav-link {
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

/* --- Card spotlight (mouse-tracked white glow) --- */
.project-card {
  position: relative;
  overflow: hidden;
}
.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(480px circle at var(--mx, 50%) var(--my, 50%),
              rgba(255, 255, 255, 0.07), transparent 45%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.project-card:hover::before {
  opacity: 1;
}
.project-card > * {
  position: relative;
  z-index: 1;
}

/* --- Section title hover: number flashes white --- */
.section-title:hover .section-number {
  color: var(--text);
  transition: color 0.3s ease;
}

/* --- Fact cards: value counts hover lift --- */
.fact-value {
  transition: transform 0.25s ease;
}
.fact:hover .fact-value {
  transform: translateX(4px);
}

/* --- Skill tag hover pop --- */
.skill-tags li {
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.skill-tags li:hover {
  color: var(--text);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

/* --- Timeline row hover --- */
.timeline-item {
  transition: padding-left 0.25s ease, background 0.25s ease;
}
.timeline-item:hover {
  padding-left: 10px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03), transparent);
}

/* --- Magnetic buttons get will-change --- */
.btn {
  will-change: transform;
}

/* ================================================== Crosshair overlay */
#crosshair { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10000; }
#crosshair-svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
#crosshair-line-h, #crosshair-line-v { position: absolute; top: 0; left: 0; background: #ffffff; opacity: 0; will-change: transform, opacity; }
#crosshair-line-h { width: 100%; height: 1px; }
#crosshair-line-v { height: 100%; width: 1px; }
@media (pointer: coarse), (prefers-reduced-motion: reduce) { #crosshair { display: none !important; } }

/* Spider canvas background */
#spider-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* Cursor effect toggle */
.cursor-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  z-index: 50;
  font-family: var(--font-sans, sans-serif);
}
.cursor-toggle-btn {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-sans, sans-serif);
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  color: var(--text-muted);
  transition: all 0.2s ease;
  line-height: 1;
}
.cursor-toggle-btn.active {
  background: var(--text);
  color: var(--bg);
}
.cursor-toggle-sep {
  color: var(--border);
  font-size: 12px;
  user-select: none;
}
.cursor-toggle-btn:hover:not(.active) {
  color: var(--text);
}
@media (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor-toggle { display: none !important; }
}
