:root {
  --bg: #0a0a0a;
  --bg-elevated: #121212;
  --bg-code: #0e0e0e;
  --fg: #f4f4f2;
  --muted: #8a8a86;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #e4a84b;
  --comment: #3d9b6e;
  --kw: #c792ea;
  --str: #c3e88d;
  --num: #f78c6c;
  --cls: #ffcb6b;
  --fn: #82aaff;
  --dec: #89ddff;
  --cm: #546e7a;
  --django: #44b78b;
  --radius: 0;
  --font: "Schibsted Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar: 260px;
  --topbar: 56px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar) + 24px);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

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

code {
  font-family: var(--mono);
}

.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.07) 1px, transparent 0),
    linear-gradient(to right, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 32px 32px, 48px 48px, 48px 48px;
  opacity: 0.85;
}

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.22;
}

.glow-a {
  width: 420px;
  height: 420px;
  background: #c48a2a;
  top: -120px;
  right: -80px;
  animation: drift 18s ease-in-out infinite;
}

.glow-b {
  width: 360px;
  height: 360px;
  background: #1f6b4a;
  bottom: 10%;
  left: -100px;
  animation: drift 22s ease-in-out infinite reverse;
}

@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(24px, -30px) scale(1.08);
  }
}

/* Top bar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: linear-gradient(145deg, var(--django), #1a5c40);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px 7px;
  border-left: 2px solid rgba(255, 255, 255, 0.85);
  border-right: 2px solid rgba(255, 255, 255, 0.45);
}

.brand-name {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 500;
}

.top-links {
  display: none;
  gap: 22px;
  margin-left: auto;
}

.top-links a {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
}

.top-links a:hover {
  color: var(--fg);
}

.top-actions {
  display: none;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: 4px;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--fg);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 0;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
  text-decoration: none;
  appearance: none;
  -webkit-appearance: none;
  color: inherit;
}

.btn-primary {
  background: var(--fg);
  color: #0a0a0a;
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
}

.btn-ghost:hover {
  color: var(--fg);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
}

/* Layout */
.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  max-width: 1180px;
  margin: 0 auto;
  padding-top: var(--topbar);
  min-height: 100vh;
}

.sidebar {
  display: none;
  position: sticky;
  top: var(--topbar);
  align-self: start;
  height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 28px 18px 40px 8px;
  border-right: 1px solid var(--border);
}

.sidebar-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  padding-left: 8px;
}

.file-tree,
.file-tree ul {
  list-style: none;
}

.file-tree ul {
  padding-left: 14px;
  margin-top: 2px;
  border-left: 1px solid var(--border);
  margin-left: 10px;
}

.tree-file,
.tree-folder-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
}

.tree-file:hover,
.tree-folder-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
}

.tree-file.active {
  background: rgba(68, 183, 139, 0.12);
  color: var(--django);
}

.tree-icon {
  font-size: 12px;
  opacity: 0.7;
}

.ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 14px;
  padding: 0 3px;
  border-radius: 0;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(68, 183, 139, 0.18);
  color: var(--django);
}

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

.chev {
  font-size: 10px;
  opacity: 0.5;
  width: 12px;
}

.tree-folder:not(.open) > ul {
  display: none;
}

.tree-folder:not(.open) .chev {
  transform: rotate(-90deg);
  display: inline-block;
}

.docs {
  padding: 36px 20px 80px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

/* Hero */
.hero {
  padding: 28px 0 56px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--comment);
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(2.4rem, 7vw, 3.75rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-bottom: 18px;
}

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

.availability {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--django);
  margin-bottom: 14px;
}

.avail-dot {
  width: 8px;
  height: 8px;
  background: var(--django);
  box-shadow: 0 0 0 3px rgba(68, 183, 139, 0.2);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(68, 183, 139, 0.2);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(68, 183, 139, 0.08);
  }
}

.lede {
  font-size: clamp(1.05rem, 2.4vw, 1.2rem);
  color: var(--muted);
  max-width: 36rem;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

.meta-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(18, 18, 18, 0.85);
  overflow: hidden;
}

.meta-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.meta-row:last-child {
  border-bottom: none;
}

.meta-key {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.meta-row code {
  font-size: 13px;
  color: var(--fg);
}

/* Sections */
.doc-section {
  padding: 20px 0 56px;
  border-bottom: 1px solid var(--border);
}

.doc-section:last-of-type {
  border-bottom: none;
}

.section-head {
  margin-bottom: 24px;
}

.path {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--django);
  margin-bottom: 8px;
}

.section-head h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.section-head > p:last-child {
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 40rem;
}

/* Code windows */
.code-window {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-code);
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.code-chrome {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 0;
}

.dot.red {
  background: #ff5f56;
}
.dot.yellow {
  background: #ffbd2e;
}
.dot.green {
  background: #27c93f;
}

.chrome-title {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.copy-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 0;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.copy-btn:hover,
.copy-btn.copied {
  color: var(--django);
  border-color: rgba(68, 183, 139, 0.4);
}

.code {
  padding: 18px 16px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: #c8d0db;
}

.code .kw {
  color: #c792ea;
}
.code .cls {
  color: var(--cls);
}
.code .fn {
  color: var(--fn);
}
.code .str {
  color: var(--str);
}
.code .num {
  color: var(--num);
}
.code .dec {
  color: var(--dec);
}
.code .cm {
  color: var(--cm);
  font-style: italic;
}

.prose {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: rgba(244, 244, 242, 0.82);
  font-size: 1.02rem;
  max-width: 42rem;
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.job {
  display: grid;
  gap: 12px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

.job:first-child {
  border-top: none;
  padding-top: 0;
}

.job h3 {
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.company {
  color: var(--accent);
  font-weight: 550;
  font-size: 0.95rem;
  margin-top: 2px;
}

.period {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.job ul {
  padding-left: 1.1rem;
  color: rgba(244, 244, 242, 0.8);
  font-size: 0.95rem;
}

.job li + li {
  margin-top: 8px;
}

/* Skills */
.skill-grid {
  display: grid;
  gap: 18px;
}

.skill-group h3 {
  font-size: 0.85rem;
  font-weight: 650;
  margin-bottom: 10px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 0;
  border: 1px solid rgba(68, 183, 139, 0.25);
  background: rgba(68, 183, 139, 0.08);
  color: #b7e4cf;
}

/* Projects */
.project-list {
  display: grid;
  gap: 14px;
}

.project {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(18, 18, 18, 0.6);
  transition: border-color 0.2s, transform 0.2s;
}

.project:hover {
  border-color: rgba(228, 168, 75, 0.35);
  transform: translateY(-2px);
}

.project-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.project h3 {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.project > p {
  color: rgba(244, 244, 242, 0.8);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.tech {
  font-family: var(--mono) !important;
  font-size: 12px !important;
  color: var(--django) !important;
  margin-bottom: 0 !important;
}

.contact-cta {
  text-align: center;
  padding: 36px 20px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 0;
  background: rgba(68, 183, 139, 0.05);
}

.contact-cta p {
  color: var(--muted);
  margin-bottom: 16px;
}

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

.site-footer a,
.footer-link {
  color: var(--muted);
  transition: color 0.15s;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.site-footer a:hover,
.footer-link:hover {
  color: var(--django);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 40px;
  margin-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.site-footer code {
  color: var(--comment);
  font-size: 12.5px;
}

/* Email modal */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  margin: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  animation: modal-in 0.22s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-body {
  padding: 22px 20px 20px;
}

.modal-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--comment);
  margin-bottom: 10px;
}

.modal-body h2 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.modal-copy {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 18px;
}

.email-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 20px;
}

.email-row code {
  flex: 1;
  font-size: 13.5px;
  color: var(--fg);
  word-break: break-all;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

body.modal-open {
  overflow: hidden;
}

/* Reveal motion */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.7s ease forwards;
}

.delay-1 {
  animation-delay: 0.08s;
}
.delay-2 {
  animation-delay: 0.16s;
}
.delay-3 {
  animation-delay: 0.24s;
}
.delay-4 {
  animation-delay: 0.32s;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile sidebar drawer */
@media (max-width: 899px) {
  .sidebar.open {
    display: block;
    position: fixed;
    top: var(--topbar);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    height: auto;
    background: rgba(10, 10, 10, 0.97);
    padding: 24px 20px;
    border-right: none;
  }

  body.nav-open {
    overflow: hidden;
  }

  .top-actions {
    display: none;
  }
}

@media (min-width: 640px) {
  .job {
    grid-template-columns: minmax(180px, 240px) 1fr;
    gap: 24px;
  }

  .skill-grid {
    grid-template-columns: 1fr;
  }

  .project-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .top-links {
    display: flex;
  }

  .menu-toggle {
    display: none;
  }

  .topbar {
    padding: 0 28px;
  }

  .top-actions {
    display: flex;
    margin-left: 0;
  }

  .shell {
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    padding-left: 12px;
    padding-right: 28px;
  }

  .sidebar {
    display: block;
  }

  .docs {
    margin: 0;
    padding: 48px 40px 100px 48px;
    max-width: none;
  }

  .hero {
    padding-top: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .glow-a,
  .glow-b,
  .project {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
