/* ==========================================================
   Aron Ingi Lenvig, portfolio
   Dark industrial / control-panel theme. No external assets.
   ========================================================== */

:root {
  --bg: #0b0e12;
  --bg-2: #0f1318;
  --panel: #131820;
  --panel-2: #1a212b;
  --line: #2a3442;
  --line-soft: #1e2632;
  --text: #e7ebf0;
  --muted: #9aa6b5;
  --accent: #ffb000;
  --accent-soft: rgba(255, 176, 0, .12);
  --ok: #3ddc84;
  --err: #ff5c5c;
  --info: #4fc3f7;
  --radius: 12px;
  --wrap: 1120px;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -.01em; }

p { margin: 0 0 1em; }

.mono { font-family: var(--mono); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 700px) { .wrap { padding: 0 32px; } }

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: #111; padding: 8px 12px; border-radius: 6px;
}
.skip:focus { top: 8px; }

/* ---------- LEDs ---------- */
.led {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #2b333e;
  flex-shrink: 0;
  transition: background .25s, box-shadow .25s;
}
.led.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.led.warn { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.led.err { background: var(--err); box-shadow: 0 0 10px var(--err); }
.led.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 2px var(--ok); opacity: .7; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  font: 600 15px/1 var(--sans);
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 13px 20px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #14100a; }
.btn.primary:hover { background: #ffc233; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 14, 18, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  display: flex; align-items: center; gap: 20px;
  height: 60px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 700; white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.nav {
  display: flex; gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted);
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 7px;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); text-decoration: none; background: var(--panel); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }

.lang {
  display: flex;
  font: 600 12px/1 var(--mono);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
}
.lang span { padding: 6px 8px; border-radius: 5px; transition: background .15s, color .15s; }
html[lang="en"] .lang [data-lang="en"],
html[lang="da"] .lang [data-lang="da"] { background: var(--accent); color: #14100a; }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 6px 12px; }
  .lang { margin-left: auto; }
  .nav {
    order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 0 40px 8px 12px;
    /* fade on the right hints that the row scrolls */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent);
  }
  .nav a { padding: 6px 10px; }
  html { scroll-padding-top: 104px; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: min(calc(100vh - 60px), 1080px);
  min-height: min(calc(100svh - 60px), 1080px);
  display: flex; align-items: center;
  padding: 72px 0 96px;
  overflow: hidden;
  isolation: isolate;
}
.hero-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: -1;
}
.hero::after {
  /* fade the circuit into the page and keep text readable */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 25% 50%, rgba(11,14,18,.88), rgba(11,14,18,.35) 70%, transparent),
    linear-gradient(to bottom, transparent 70%, var(--bg));
}
.hero-content { position: relative; width: 100%; }

.kicker {
  color: var(--accent);
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.hero-title {
  font-size: clamp(44px, 8vw, 88px);
  letter-spacing: -.03em;
  line-height: 1;
  margin-bottom: 22px;
}
.hero-pitch {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  max-width: 26em;
  margin-bottom: 12px;
  line-height: 1.3;
  text-wrap: balance;
}
.hero-sub {
  color: var(--muted);
  max-width: 34em;
  font-size: 18px;
  text-wrap: pretty;
}

.status-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border: 1px solid rgba(61, 220, 132, .35);
  background: rgba(61, 220, 132, .07);
  border-radius: 99px;
  font-size: 15px;
  margin: 8px 0 28px;
}

.manual {
  color: var(--err);
  border: 1px dashed var(--err);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  max-width: 36em;
}

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 56px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  max-width: 820px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat {
  background: rgba(19, 24, 32, .92);
  padding: 18px 20px;
}
.stat-num {
  font-size: 34px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.stat dd { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; }

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding-top: 48px; }
}

.scroll-hint {
  position: absolute; left: 50%; bottom: 22px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 14px;
  animation: bob 2.4s ease-in-out infinite;
}
.scroll-hint:hover { color: var(--accent); text-decoration: none; }
@keyframes bob { 50% { transform: translate(-50%, 6px); } }

/* ---------- Sections ---------- */
.section { padding: 110px 0 40px; }
.section-tight { padding-top: 80px; }

.section-head { margin-bottom: 44px; max-width: 46em; }
.tag {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: .14em;
  margin-bottom: 10px;
}
.tag::before { content: "// "; color: var(--muted); }
.section-head h2, .pi h2, .contact h2 { font-size: clamp(30px, 4.4vw, 44px); }
.section-lead { color: var(--muted); margin-top: 14px; font-size: 18px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.about-text p { font-size: 18px; color: #d4dae2; max-width: 38em; }
.about-text .about-lead {
  font-size: clamp(20px, 2.2vw, 23px);
  line-height: 1.5;
  color: var(--text);
  font-weight: 500;
}
.about-text .lessons-label {
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 28px 0 10px;
}
.lessons {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: grid;
  gap: 10px;
  max-width: 38em;
}
.lessons li {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 4px 16px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: 17px;
  color: #d4dae2;
}
.lesson-from { color: var(--accent); font-weight: 600; }
@media (max-width: 520px) { .lessons li { grid-template-columns: 1fr; } }

.facts { padding: 22px 24px; }
.card-label {
  font-size: 12px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.facts dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- Skills rack ---------- */
.rack {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255,255,255,.015) 22px 24px),
    #0e1217;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
}
.rack::before, .rack::after {
  /* DIN rail screws */
  content: ""; position: absolute; top: 50%; width: 6px; height: 6px; border-radius: 50%;
  background: #39424f; box-shadow: inset 0 0 0 1px #111;
}
.rack::before { left: 4px; } .rack::after { right: 4px; }

.module {
  background: linear-gradient(#1b222c, #151a22);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.module-head {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  padding: 10px 12px;
  background: #222b37;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.module-head span:last-child { color: var(--text); text-align: right; }
.channels { list-style: none; margin: 0; padding: 8px 0; }
.channels li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  font-size: 15px;
  line-height: 1.3;
}
.channels li:hover { background: rgba(255,255,255,.025); }
.addr { font-size: 11px; color: #6b7686; width: 40px; flex-shrink: 0; }

@media (max-width: 980px) { .rack { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .rack { grid-template-columns: 1fr; } }

/* ---------- Projects ---------- */
.projects {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}
@media (min-width: 720px) {
  .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project.featured { grid-column: 1 / -1; flex-direction: row; }
  .project.featured .project-art {
    width: 44%; flex-shrink: 0;
    display: flex; align-items: center;
    border-bottom: 0; border-right: 1px solid var(--line);
  }
  .project.featured .project-art svg { height: 150px; }
  .project.featured .project-body { justify-content: center; }
  .project.featured .project-body > p:not(.project-meta) { flex: 0 1 auto; }
}
@media (min-width: 1060px) {
  .projects { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .project.featured { grid-column: span 2; }
}
.project {
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.project:hover { border-color: #3a4657; transform: translateY(-2px); }
.project-art {
  color: #5d6a7c;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 16px 16px,
    var(--bg-2);
  border-bottom: 1px solid var(--line);
  padding: 18px 24px;
}
.project-art svg { height: 110px; margin: 0 auto; }
.project-art .acc { stroke: var(--accent); }
.project:hover .project-art { color: #7d8a9c; }
.project-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.project-body h3 { font-size: 21px; margin-bottom: 10px; }
.project-body > p:not(.project-meta) { color: #c8cfd8; font-size: 16px; flex: 1; }
.project-meta {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 12px; color: var(--muted);
  letter-spacing: .04em;
  margin-bottom: 8px;
}
.project-meta span:first-child { color: var(--accent); }

.tags { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font: 12px/1 var(--mono);
  padding: 6px 9px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: #b9c2cd;
}

/* ---------- Games ---------- */
.games {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 760px) { .games { grid-template-columns: 1fr; } }

.game {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.game:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 14px 44px -20px rgba(255, 176, 0, .4);
}
.game-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #07090c;
  border-bottom: 1px solid var(--line);
}
.game-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.game:hover .game-thumb img { transform: scale(1.035); }
.game-chip {
  position: absolute; top: 12px; left: 12px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 6px;
  background: rgba(11, 14, 18, .85);
  border: 1px solid var(--accent);
  color: var(--accent);
}
.game-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.game-body h3 { font-size: 21px; margin-bottom: 8px; }
.game-body p:not(.game-tag) { color: #c8cfd8; font-size: 16px; flex: 1; }
.game-tag { font-size: 12px; color: var(--accent); letter-spacing: .05em; margin-bottom: 8px; }
.play { color: var(--accent); font-size: 14px; transition: transform .2s; display: inline-block; }
.game:hover .play { transform: translateX(4px); }

/* ---------- Timeline ---------- */
.timeline {
  list-style: none; margin: 0; padding: 0;
  position: relative;
  max-width: 860px;
}
.timeline::before {
  content: ""; position: absolute;
  left: 150px; top: 8px; bottom: 8px;
  width: 2px; background: var(--line);
}
.timeline li {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0 36px;
  position: relative;
  padding-bottom: 28px;
}
.timeline li::before {
  content: ""; position: absolute;
  left: 145px; top: 7px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline li:first-child::before { background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.t-date { color: var(--muted); font-size: 14px; padding-right: 20px; padding-top: 1px; margin: 0; }
.t-card h3 { font-size: 19px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.t-role { color: var(--accent); margin: 4px 0 6px; font-size: 15px; }
.t-card p:last-child { color: #c0c8d2; font-size: 16px; margin: 0; }
.badge {
  font-size: 11px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 5px;
  background: rgba(79, 195, 247, .1); color: var(--info);
  border: 1px solid rgba(79, 195, 247, .3);
}
@media (max-width: 640px) {
  .timeline::before { left: 5px; }
  .timeline li { grid-template-columns: 1fr; padding-left: 30px; }
  .timeline li::before { left: 0; }
  .t-date { margin-bottom: 4px; }
}

/* ---------- Raspberry Pi panel ---------- */
.pi {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 36px;
  padding: 32px;
  align-items: center;
  background:
    radial-gradient(ellipse at 100% 0, rgba(255,176,0,.06), transparent 60%),
    var(--panel);
}
.pi h2 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 12px; }
.pi-text p:last-child { color: var(--muted); margin: 0; }
.hmi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: #07090c;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.hmi-cell {
  background: #0d1a12;
  border: 1px solid #1b3324;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex; flex-direction: column;
}
.hmi-label { font-size: 11px; color: #5f8f72; text-transform: uppercase; letter-spacing: .1em; }
.hmi-val { font-size: 24px; color: var(--ok); text-shadow: 0 0 10px rgba(61,220,132,.35); }
.hmi-foot {
  grid-column: 1 / -1; margin: 2px 0 0;
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
@media (max-width: 760px) { .pi { grid-template-columns: 1fr; padding: 22px; } }
@media (max-width: 480px) { .hmi { grid-template-columns: 1fr; } }
.hmi-cell[hidden] { display: none; }

/* ---------- Footer / contact ---------- */
.footer {
  margin-top: 100px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg-2);
  padding: 80px 0 28px;
}
.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.contact-text h2 { margin-bottom: 16px; }
.contact-text p:last-child { color: #c8cfd8; font-size: 18px; max-width: 30em; }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.contact-list li { display: flex; gap: 8px; }
.contact-item {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  transition: border-color .15s;
  overflow-wrap: anywhere;
}
a.contact-item:hover { border-color: var(--accent); text-decoration: none; }
.contact-item svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.contact-item > span { display: flex; flex-direction: column; line-height: 1.35; }
.ci-label { font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.copy { padding: 0 16px; font-size: 14px; }
.copy.done { border-color: var(--ok); color: var(--ok); }
.cv-item { align-items: flex-start; }
.cv-item svg { margin-top: 2px; }
.cv-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.cv-langs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cv-langs .btn { padding: 8px 14px; font-size: 14px; }
@media (max-width: 760px) { .contact { grid-template-columns: 1fr; gap: 28px; } }

.copyright {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  margin: 64px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: #6b7686;
}

/* ---------- Reveal on scroll (only when JS is available) ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
