:root {
  /* Ljust tema – svalare, krispigt och dämpat (nordisk/apple-slate) */
  --bg: #f5f6f8;
  --bg-alt: #eceef1;
  --surface: #ffffff;
  --text: #1a1e24;
  --muted: #5e6673;
  --faint: #858f9e;
  --line: rgba(22, 30, 42, 0.08);
  --line-subtle: rgba(22, 30, 42, 0.05);
  --link: #2d6cdf;
  --btn-bg: rgba(22, 30, 42, 0.05);
  --btn-bg-hover: rgba(22, 30, 42, 0.09);
  --btn-primary-bg: #1a1e24;
  --btn-primary-text: #f5f6f8;
  --nav-bg: rgba(245, 246, 248, 0.78);
  --hero-glow-1: rgba(94, 129, 172, 0.12);
  --hero-glow-2: rgba(143, 161, 189, 0.14);
  --hero-glow-3: rgba(129, 161, 193, 0.12);
  --art-bg: rgba(255, 255, 255, 0.75);
  --art-border: rgba(255, 255, 255, 0.9);
  --scroll-border: rgba(22, 30, 42, 0.18);
  --scroll-pill: rgba(22, 30, 42, 0.35);

  --r-xl: 36px;
  --r-lg: 28px;
  --r-md: 18px;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --shadow: 0 2px 8px rgba(18, 25, 38, 0.03), 0 16px 44px rgba(18, 25, 38, 0.05);
  --shadow-hover: 0 4px 14px rgba(18, 25, 38, 0.05), 0 24px 64px rgba(18, 25, 38, 0.08);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, "Segoe UI",
    Roboto, sans-serif;
}

/* Mörkt tema – svalt, luftigt skiffer/grafit med mjuk kontrast */
[data-theme="dark"] {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --surface: #171d26;
  --text: #e6edf3;
  --muted: #8b949e;
  --faint: #6e7681;
  --line: rgba(240, 246, 252, 0.1);
  --line-subtle: rgba(240, 246, 252, 0.06);
  --link: #58a6ff;
  --btn-bg: rgba(240, 246, 252, 0.08);
  --btn-bg-hover: rgba(240, 246, 252, 0.14);
  --btn-primary-bg: #e6edf3;
  --btn-primary-text: #0d1117;
  --nav-bg: rgba(13, 17, 23, 0.82);
  --hero-glow-1: rgba(56, 139, 253, 0.16);
  --hero-glow-2: rgba(110, 118, 129, 0.14);
  --hero-glow-3: rgba(63, 185, 80, 0.12);
  --art-bg: rgba(23, 29, 38, 0.75);
  --art-border: rgba(240, 246, 252, 0.15);
  --scroll-border: rgba(240, 246, 252, 0.25);
  --scroll-pill: rgba(240, 246, 252, 0.45);

  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 20px 50px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 6px 24px rgba(0, 0, 0, 0.45), 0 30px 70px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Skip Link för tangentbordsnavigering och skärmläsare */
.skip-link {
  position: absolute;
  top: -100px;
  left: 20px;
  z-index: 9999;
  padding: 10px 18px;
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 16px;
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* Tydlig fokusram för alla interaktiva element */
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: 52px;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease), background 0.4s var(--ease);
}

.nav.is-scrolled {
  border-bottom-color: var(--line);
}

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

.nav__logo {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.nav__logo span {
  color: var(--faint);
  font-weight: 500;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 13px;
  color: var(--muted);
}

.nav__links a {
  transition: color 0.2s;
}

.nav__links a:hover {
  color: var(--text);
}

/* Theme Toggle Button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--btn-bg-hover);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

/* Ikonväxling baserad på data-theme */
[data-theme="dark"] .theme-icon-sun {
  display: block;
}
[data-theme="dark"] .theme-icon-moon {
  display: none;
}
[data-theme="light"] .theme-icon-sun,
:root:not([data-theme="dark"]) .theme-icon-sun {
  display: none;
}
[data-theme="light"] .theme-icon-moon,
:root:not([data-theme="dark"]) .theme-icon-moon {
  display: block;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 92vh;
  min-height: 92svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 120px 24px 80px;
  overflow: hidden;
  perspective: 1200px;
}

/* Subtilt arkitektoniskt punkt-grid i bakgrunden */
.hero__grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--faint) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.16;
  mask-image: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.9) 10%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.9) 10%, transparent 75%);
  pointer-events: none;
}

[data-theme="dark"] .hero__grid {
  opacity: 0.14;
}

.hero__glow {
  position: absolute;
  inset: -20% -10% auto;
  height: 120%;
  background: radial-gradient(40% 40% at 30% 35%, var(--hero-glow-1), transparent 70%),
    radial-gradient(35% 40% at 70% 30%, var(--hero-glow-2), transparent 70%),
    radial-gradient(40% 45% at 50% 70%, var(--hero-glow-3), transparent 70%);
  filter: blur(50px);
  animation: drift 18s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes drift {
  to {
    transform: translate3d(0, -4%, 0) scale(1.08) rotate(4deg);
  }
}

/* Premium Glassmorphic Code Nodes & Constellation */
.hero__ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
  z-index: 0;
}

.hero__constellation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--muted);
  opacity: 0.35;
}

.glass-node {
  position: absolute;
  top: 0;
  left: 0;
  text-align: left;
  padding: 12px 16px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 58%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid var(--line);
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.05), inset 0 1px 0 var(--art-border);
  opacity: 0.48;
  will-change: transform;
  transition: opacity 0.3s, border-color 0.3s;
}

.glass-node.is-fleeing {
  border-color: color-mix(in srgb, var(--link) 45%, var(--line));
  opacity: 0.76;
}

[data-theme="dark"] .glass-node {
  background: color-mix(in srgb, var(--surface) 48%, transparent);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  opacity: 0.44;
}

[data-theme="dark"] .glass-node.is-fleeing {
  opacity: 0.72;
}

.glass-node__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-subtle);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.glass-node__head .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.glass-node__head .file {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color: var(--text);
  opacity: 0.85;
}

.glass-node__head .badge {
  margin-left: auto;
  font-size: 9.5px;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--btn-bg);
  color: var(--faint);
}

.glass-node__head .badge--live {
  color: #bc8cff;
  background: rgba(188, 140, 255, 0.12);
}

.glass-node pre {
  margin: 0;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* Diskret syntax highlighting i dämpade kalla toner */
.glass-node .kw { color: var(--link); font-weight: 500; }
.glass-node .fn { color: var(--text); opacity: 0.9; }
.glass-node .num { color: #d29922; }
.glass-node .str { color: #39c5cf; }

/* Subtila micro-pills längre bak i djupet */
.micro-pill {
  position: absolute;
  top: 0;
  left: 0;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--faint);
  padding: 4px 11px;
  border-radius: 99px;
  border: 1px dashed var(--line);
  background: color-mix(in srgb, var(--bg) 50%, transparent);
  opacity: 0.42;
  will-change: transform;
  white-space: nowrap;
  transition: opacity 0.3s, border-color 0.3s;
}

.micro-pill.is-fleeing {
  color: var(--text);
  border-color: var(--muted);
  opacity: 0.65;
}

@media (max-width: 900px) {
  .micro-pill.p4,
  .micro-pill.p5,
  .micro-pill.p6 {
    display: none;
  }
  .glass-node {
    opacity: 0.36;
  }
}

@media (max-width: 680px) {
  .glass-node.n2,
  .glass-node.n3 {
    display: none;
  }
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 860px;
  will-change: transform, opacity;
}

.hero h1 {
  font-size: clamp(42px, 8vw, 96px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 0 0 20px;
  background: linear-gradient(180deg, var(--text) 30%, var(--muted) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.06em;
  word-break: break-word;
}

.hero__tagline {
  font-size: clamp(17px, 2.2vw, 22px);
  line-height: 1.45;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 36px;
  font-weight: 450;
  letter-spacing: -0.01em;
}

.hero__links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero__scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  translate: -50% 0;
  width: 26px;
  height: 42px;
  border: 2px solid var(--scroll-border);
  border-radius: 14px;
}

.hero__scroll span {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--scroll-pill);
  animation: scrollhint 2s var(--ease) infinite;
}

@keyframes scrollhint {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    transform: translateY(14px);
    opacity: 0;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--text);
  border: 1px solid var(--line);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.2s var(--ease);
  white-space: nowrap;
}

.btn:hover {
  background: var(--btn-bg-hover);
  border-color: var(--faint);
}

.btn:active {
  transform: scale(0.97);
}

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

.btn--primary:hover {
  background: var(--btn-primary-bg);
  opacity: 0.92;
}

.btn--sm {
  font-size: 14px;
  padding: 8px 16px;
}

.link {
  color: var(--link);
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
}

/* ---------- Sections ---------- */
.section {
  padding: 100px 0 120px;
}

.section--alt {
  background: var(--bg-alt);
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.section__title {
  font-size: clamp(36px, 5.5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin: 0;
}

.section__sub {
  color: var(--faint);
  margin: 0;
  font-size: 15px;
}

/* ---------- Featured Project Cards ---------- */
.featured {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.feature {
  --accent: #58a6ff;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 540px;
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--line-subtle);
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease);
}

.feature:nth-child(even) .feature__visual {
  order: -1;
}

.feature__text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 52px;
}

.feature__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.feature__title {
  font-size: clamp(34px, 4.2vw, 48px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  margin: 0 0 14px;
}

.feature__tagline {
  font-size: 19px;
  line-height: 1.4;
  font-weight: 550;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
  color: var(--text);
}

.feature__desc {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 15.5px;
  line-height: 1.55;
}

.highlights {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0 0 32px;
  list-style: none;
}

.highlights li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-size: 14.5px;
  color: var(--text);
}

.highlights li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  translate: 0 -2px;
}

.feature__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.feature__langs {
  margin-top: 28px;
}

/* Visual Panel */
.feature__visual {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-left: 1px solid var(--line-subtle);
  background: radial-gradient(120% 90% at 50% 110%, color-mix(in srgb, var(--accent) 18%, var(--bg-alt)) 0%, transparent 70%),
    linear-gradient(160deg, color-mix(in srgb, var(--accent) 6%, var(--bg-alt)), color-mix(in srgb, var(--accent) 14%, var(--bg-alt)));
}

.feature:nth-child(even) .feature__visual {
  border-left: none;
  border-right: 1px solid var(--line-subtle);
}

.art {
  position: relative;
  display: grid;
  place-items: center;
  gap: 20px;
  text-align: center;
  will-change: transform;
}

.art__icon {
  width: 160px;
  height: 160px;
  display: grid;
  place-items: center;
  font-size: 80px;
  border-radius: 38px;
  background: var(--art-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 50px color-mix(in srgb, var(--accent) 22%, transparent), inset 0 1px 0 var(--art-border);
  border: 1px solid var(--line);
}

.art__icon img {
  width: 60%;
  height: 60%;
  object-fit: contain;
}

.art__name {
  font-size: 14px;
  font-weight: 550;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.shot {
  width: 86%;
  border-radius: var(--r-md);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
  will-change: transform;
  border: 1px solid var(--line);
}

/* Phone Mockup */
.phone {
  --w: 390px;
  --h: 844px;
  --s: 0.56;
  position: relative;
  width: calc(var(--w) * var(--s) + 20px);
  height: calc(var(--h) * var(--s) + 20px);
  padding: 10px;
  border-radius: 46px;
  background: #10141a;
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.28), inset 0 0 0 2px rgba(255, 255, 255, 0.12);
  will-change: transform;
  margin: 48px 0;
}

.phone__screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 36px;
  overflow: hidden;
  background: #fff;
}

.phone__screen::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 50%;
  width: 64px;
  height: 18px;
  margin-left: -32px;
  border-radius: 12px;
  background: #10141a;
}

.phone iframe {
  width: var(--w);
  height: var(--h);
  border: 0;
  transform: scale(var(--s));
  transform-origin: 0 0;
  pointer-events: none;
}

/* Language bar */
.langs__bar {
  display: flex;
  height: 5px;
  border-radius: 99px;
  overflow: hidden;
  gap: 2px;
  background: var(--line);
}

.langs__bar span {
  height: 100%;
  border-radius: 99px;
}

.langs__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--faint);
}

.langs__legend i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
}

.status {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 99px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ---------- Skeleton ---------- */
.feature--skeleton {
  background: linear-gradient(90deg, var(--bg-alt) 0%, var(--surface) 50%, var(--bg-alt) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  box-shadow: none;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.notice {
  margin-top: 32px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* ---------- Footer ---------- */
.footer {
  padding: 36px 0 48px;
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--faint);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Motion ---------- */
.load-in {
  opacity: 0;
  transform: translateY(24px);
  filter: blur(6px);
  animation: loadin 1.1s var(--ease) forwards;
  animation-delay: calc(var(--d, 0) * 110ms + 100ms);
}

@keyframes loadin {
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

.reveal {
  opacity: 0;
  transform: translateY(48px) scale(0.98);
  transition: opacity 1s var(--ease), transform 1.2s var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .feature {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .feature:nth-child(even) .feature__visual {
    order: 0;
    border-right: none;
  }
  .feature__visual {
    min-height: 360px;
    order: -1 !important;
    border-left: none;
    border-bottom: 1px solid var(--line-subtle);
  }
  .feature__text {
    padding: 38px 28px 42px;
  }
  .section {
    padding: 72px 0 90px;
  }
  .nav__links {
    gap: 16px;
  }
}

@media (max-width: 520px) {
  .phone {
    --s: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .load-in,
  .reveal {
    opacity: 1;
    transform: none;
    filter: none;
  }
}
