/* =====================================================================
   TechNerd – hovedstilark
   Mørk, teknisk stil med neon-aksenter. Ren CSS, ingen avhengigheter.
   Innhold:
     1.  Variabler & tema
     2.  Reset & grunnstiler
     3.  Layout-hjelpere
     4.  Bakgrunnseffekter
     5.  Knapper
     6.  Header / navigasjon
     7.  Hero
     8.  Seksjoner (Om, kort)
     9.  Prosjekter
     10. Kontakt / skjema
     11. Footer
     12. Scroll-animasjoner (reveal)
     13. Responsivt / mobil
     14. Redusert bevegelse (a11y)
   ===================================================================== */

/* ============ 1. VARIABLER & TEMA ============ */
:root {
  --bg:            #0a0e14;
  --bg-2:          #0d1117;
  --surface:       rgba(22, 29, 41, 0.55);
  --surface-solid: #141b26;
  --border:        rgba(120, 160, 220, 0.14);
  --border-strong: rgba(120, 160, 220, 0.30);

  --text:          #e8eef7;
  --text-muted:    #9aa7bd;
  --text-dim:      #6b7688;

  --accent:        #00e5ff;   /* cyan  */
  --accent-2:      #5b8cff;   /* blå   */
  --accent-3:      #a855f7;   /* lilla */
  --accent-green:  #39ff9e;

  --grad: linear-gradient(120deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  --glow-cyan: 0 0 24px rgba(0, 229, 255, 0.35);

  --radius:    16px;
  --radius-sm: 10px;
  --maxw:      1140px;

  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', ui-monospace, monospace;

  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --header-h: 72px;
}

/* ============ 2. RESET & GRUNNSTILER ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }

::selection { background: rgba(0, 229, 255, 0.28); color: #fff; }

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

/* ============ 3. LAYOUT-HJELPERE ============ */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }

.section { padding: 96px 0; position: relative; }
.section--alt { background: linear-gradient(180deg, transparent, rgba(13, 17, 23, 0.6) 50%, transparent); }

.grad-text {
  background: linear-gradient(120deg, var(--accent), var(--accent-2) 35%, var(--accent-3) 65%, var(--accent) 100%);
  background-size: 250% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 9s ease-in-out infinite;
}
@keyframes gradientShift {
  0%   { background-position: 0% center; }
  50%  { background-position: 100% center; }
  100% { background-position: 0% center; }
}

.section-head { max-width: 720px; margin-bottom: 48px; }
.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.section-title { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 16px; }
.section-lead { color: var(--text-muted); font-size: 1.08rem; }

/* ============ 4. BAKGRUNNSEFFEKTER ============ */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--bg); }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.45; will-change: transform; }
.orb--1 { width: 520px; height: 520px; top: -160px; left: -120px;
  background: radial-gradient(circle, rgba(0,229,255,0.55), transparent 70%);
  animation: floatOrb1 22s ease-in-out infinite; }
.orb--2 { width: 560px; height: 560px; bottom: -200px; right: -140px;
  background: radial-gradient(circle, rgba(168,85,247,0.5), transparent 70%);
  animation: floatOrb2 26s ease-in-out infinite; }
@keyframes floatOrb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(60px, 40px) scale(1.08); }
}
@keyframes floatOrb2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-50px, -30px) scale(1.1); }
}
.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(120,160,220,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,160,220,0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

/* ============ 5. KNAPPER ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 600; font-size: 0.98rem;
  cursor: pointer; border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
  white-space: nowrap;
}
.btn--primary {
  background: var(--grad);
  color: #061018;
  box-shadow: 0 8px 24px -8px rgba(0, 229, 255, 0.5);
  position: relative; overflow: hidden;
}
/* Lys-sweep som glir over knappen ved hover */
.btn--primary::after {
  content: ''; position: absolute; top: 0; left: -75%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.45), transparent);
  transform: skewX(-20deg); transition: left 0.6s ease;
}
.btn--primary:hover::after { left: 130%; }
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 34px -8px rgba(0, 229, 255, 0.7), 0 0 0 1px rgba(0,229,255,0.4);
}
.btn--ghost {
  background: rgba(255,255,255,0.02);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--accent); color: #fff; box-shadow: var(--glow-cyan); transform: translateY(-2px); }
.btn--full { width: 100%; }

/* Scroll-fremdriftslinje øverst */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--grad); z-index: 200;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.6);
  transition: width 0.1s linear;
}

/* ============ 6. HEADER / NAVIGASJON ============ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center;
  transition: background 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: rgba(10, 14, 20, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
  box-shadow: 0 8px 30px -18px rgba(0,0,0,0.9);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; transition: filter 0.3s ease; }
.brand:hover { filter: drop-shadow(0 0 10px rgba(0,229,255,0.4)); }

.nav-menu { display: flex; align-items: center; gap: 6px; }
.nav-menu a {
  padding: 9px 15px; border-radius: 999px;
  color: var(--text-muted); font-size: 0.96rem; font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease;
}
.nav-menu a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
/* Animert understrek på vanlige menylenker (ikke CTA-knappen) */
.nav-menu a:not(.nav-cta) { position: relative; }
.nav-menu a:not(.nav-cta)::after {
  content: ''; position: absolute; left: 15px; right: 15px; bottom: 4px; height: 2px;
  background: var(--grad); border-radius: 2px;
  transform: scaleX(0); transform-origin: left; transition: transform 0.28s ease;
}
.nav-menu a:not(.nav-cta):hover::after { transform: scaleX(1); }
.nav-menu .nav-cta {
  color: var(--accent);
  border: 1px solid var(--border-strong);
  margin-left: 6px;
}
.nav-menu .nav-cta:hover { background: rgba(0,229,255,0.1); border-color: var(--accent); box-shadow: var(--glow-cyan); }

/* Hamburger (skjult på desktop) */
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 8px;
}
.nav-toggle span {
  width: 24px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ 7. HERO ============ */
.hero { padding: clamp(70px, 12vw, 130px) 0 90px; position: relative; }
.hero-inner { max-width: 860px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-muted);
  padding: 7px 16px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); margin-bottom: 26px;
}
.hero-eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green); animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.hero-title { font-size: clamp(2.2rem, 6vw, 4rem); margin-bottom: 22px; }
.hero-sub { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--text-muted); max-width: 660px; margin-bottom: 34px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 56px; }

/* Entré-animasjon: hero-elementene glir inn ved innlasting (forskjøvet) */
.hero-eyebrow, .hero-title, .hero-sub, .hero-cta, .terminal {
  animation: heroIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hero-eyebrow { animation-delay: 0.05s; }
.hero-title   { animation-delay: 0.15s; }
.hero-sub     { animation-delay: 0.28s; }
.hero-cta     { animation-delay: 0.40s; }
.terminal     { animation-delay: 0.52s; }
@keyframes heroIn {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

/* Terminal-detalj */
.terminal {
  max-width: 560px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(13, 17, 23, 0.7);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.terminal-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.terminal-bar span { width: 12px; height: 12px; border-radius: 50%; background: #303a48; }
.terminal-bar span:nth-child(1) { background: #ff5f57; }
.terminal-bar span:nth-child(2) { background: #febc2e; }
.terminal-bar span:nth-child(3) { background: #28c840; }
.terminal-bar em { margin-left: auto; font-style: normal; font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim); }
.terminal-body { padding: 18px 20px; font-family: var(--font-mono); font-size: 0.86rem; line-height: 1.8; overflow-x: auto; }
.t-prompt { color: var(--accent); }
.t-out { color: var(--text-muted); }
.t-cursor { color: var(--accent-green); position: relative; }
.t-cursor::after {
  content: '▋'; margin-left: 2px; color: var(--accent-green);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ============ 8. SEKSJONER: KORT ============ */
.card-grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 26px;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  position: relative; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(400px circle at 50% 0%, rgba(0,229,255,0.08), transparent 60%);
  opacity: 0; transition: opacity 0.3s ease;
}
.card:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.card-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center; margin-bottom: 20px;
  background: rgba(0,229,255,0.08); border: 1px solid var(--border-strong);
  color: var(--accent);
}
.card-icon { transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease; }
.card:hover .card-icon {
  transform: translateY(-3px) scale(1.06);
  background: rgba(0,229,255,0.14);
  box-shadow: 0 0 18px rgba(0,229,255,0.35);
}
.card-icon svg { width: 26px; height: 26px; }
.card h3 { font-size: 1.25rem; margin-bottom: 10px; }
.card p { color: var(--text-muted); font-size: 0.98rem; }

/* ============ 9. PROSJEKTER ============ */
.project-grid {
  display: grid; gap: 26px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  display: flex; flex-direction: column;
}
.project-card:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.project-media { aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1px solid var(--border); }
.project-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.project-card:hover .project-media img { transform: scale(1.04); }
.project-placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(120,160,220,0.05) 0 12px, transparent 12px 24px),
    linear-gradient(135deg, rgba(0,229,255,0.06), rgba(168,85,247,0.06));
  color: var(--text-dim); font-family: var(--font-mono); font-size: 0.9rem;
}
.project-body { padding: 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.project-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--font-mono); font-size: 0.74rem;
  padding: 4px 11px; border-radius: 999px;
  background: rgba(0,229,255,0.08); border: 1px solid var(--border-strong); color: var(--accent);
}
.project-body h3 { font-size: 1.35rem; }
.project-body p { color: var(--text-muted); font-size: 0.98rem; flex: 1; }
.project-link {
  color: var(--accent); font-weight: 600; font-size: 0.95rem;
  align-self: flex-start; transition: gap 0.2s ease, color 0.2s ease;
}
.project-link:hover { color: #fff; text-shadow: 0 0 12px rgba(0,229,255,0.6); }

/* ============ 10. KONTAKT / SKJEMA ============ */
.contact-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.contact-points { margin-top: 24px; display: grid; gap: 10px; }
.contact-points li { color: var(--text-muted); font-size: 1rem; }

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  backdrop-filter: blur(10px);
  display: grid; gap: 18px;
}
.field { display: grid; gap: 7px; }
.field label { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.field .req { color: var(--accent); }
.field .opt { color: var(--text-dim); font-weight: 400; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px;
  background: rgba(10, 14, 20, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-family: inherit; font-size: 0.98rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  resize: vertical;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-dim); }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.12);
  background: rgba(10, 14, 20, 0.85);
}
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] {
  border-color: #ff6b6b; box-shadow: 0 0 0 3px rgba(255,107,107,0.12);
}
.field .error { color: #ff8585; font-size: 0.82rem; min-height: 1em; }
.form-status {
  margin-top: 4px; padding: 14px 16px; border-radius: var(--radius-sm);
  font-size: 0.95rem; text-align: center;
}
.form-status.success {
  background: rgba(57, 255, 158, 0.1);
  border: 1px solid rgba(57, 255, 158, 0.35);
  color: var(--accent-green);
}
.form-status.error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: #ff8585;
}

/* ============ 11. FOOTER ============ */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; background: rgba(13, 17, 23, 0.5); }
.footer-inner {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px;
  padding: 56px 24px 40px;
}
.footer-tagline { color: var(--text-muted); font-size: 0.95rem; margin-top: 14px; max-width: 320px; }
.footer-nav h4, .footer-contact h4 {
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); margin-bottom: 16px;
}
.footer-nav ul, .footer-contact ul { display: grid; gap: 10px; }
.footer-nav a, .footer-contact a { color: var(--text-muted); font-size: 0.95rem; transition: color 0.2s ease; }
.footer-nav a:hover, .footer-contact a:hover { color: var(--accent); }
.socials { display: flex; gap: 12px; margin-top: 18px; }
.socials a {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 10px; color: var(--text-muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--glow-cyan); }
.footer-bottom { border-top: 1px solid var(--border); padding: 20px 0; }
.footer-bottom p { color: var(--text-dim); font-size: 0.88rem; text-align: center; }

/* ============ 12. SCROLL-ANIMASJONER (reveal) ============ */
/* Kun armet når JS er aktiv (.js settes av inline-script i <head>).
   Uten JS forblir innholdet fullt synlig – aldri usynlig ved feil. */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.visible { opacity: 1; transform: none; }
/* Liten forskyvning når kort i samme rad avsløres */
.card-grid .card:nth-child(2).visible,
.project-grid .project-card:nth-child(2).visible { transition-delay: 0.08s; }
.card-grid .card:nth-child(3).visible { transition-delay: 0.16s; }

/* ============ 13. RESPONSIVT / MOBIL ============ */
@media (max-width: 860px) {
  .contact-wrap { grid-template-columns: 1fr; gap: 36px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .section { padding: 72px 0; }

  /* Mobilmeny */
  .nav-toggle { display: flex; z-index: 110; }
  .nav-menu {
    position: fixed; inset: 0 0 0 auto;
    width: min(78vw, 320px);
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 8px;
    padding: calc(var(--header-h) + 20px) 24px 40px;
    background: rgba(10, 14, 20, 0.96);
    backdrop-filter: blur(16px);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .nav-menu.open { transform: translateX(0); }
  .nav-menu a { padding: 14px 16px; font-size: 1.05rem; }
  .nav-menu .nav-cta { margin-left: 0; text-align: center; }
}

@media (max-width: 480px) {
  .footer-inner { grid-template-columns: 1fr; }
  .hero-cta .btn { flex: 1; }
}

/* ============ 14. REDUSERT BEVEGELSE (a11y) ============ */
@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 { opacity: 1; transform: none; }
}
