/* Villra – en fil, inga externa typsnitt eller ramverk. Färger som tokens; mörkt läge följer systemet
   eller valet i sidhuvudet (data-theme på <html>). */

:root {
  --bg: #f7f3ec;
  --bg-soft: #efe8dc;
  --surface: #fffdf9;
  --text: #1c2622;
  --muted: #5a6661;
  --line: #ddd3c3;
  --brand: #17332d;
  --brand-text: #f3ead8;
  --accent: #a4572a;
  --accent-strong: #d9874f;
  --logo-bg: #17332d;
  --logo-fg: #f3ead8;
  --term-bg: #17332d;
  --term-text: #e9e1d1;
  --term-dim: #93a69f;
  --shadow: 0 1px 2px rgb(23 51 45 / 0.06), 0 12px 32px -16px rgb(23 51 45 / 0.25);

  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --wrap: 68rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #101b18;
    --bg-soft: #15241f;
    --surface: #172823;
    --text: #ece6da;
    --muted: #a5b2ac;
    --line: #2a3d37;
    --brand: #e9dfcb;
    --brand-text: #13221e;
    --accent: #e8a173;
    --accent-strong: #d9874f;
    --logo-bg: #e9dfcb;
    --logo-fg: #17332d;
    --term-bg: #0b1412;
    --term-text: #e0d8c8;
    --term-dim: #7f948c;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -16px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #101b18;
  --bg-soft: #15241f;
  --surface: #172823;
  --text: #ece6da;
  --muted: #a5b2ac;
  --line: #2a3d37;
  --brand: #e9dfcb;
  --brand-text: #13221e;
  --accent: #e8a173;
  --accent-strong: #d9874f;
  --logo-bg: #e9dfcb;
  --logo-fg: #17332d;
  --term-bg: #0b1412;
  --term-text: #e0d8c8;
  --term-dim: #7f948c;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -16px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img,
svg {
  display: block;
  max-width: 100%;
}
a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 3px;
  border-radius: 4px;
}
h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
p {
  margin: 0 0 1em;
}
.wrap {
  width: min(100% - 2rem, var(--wrap));
  margin-inline: auto;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--brand);
  color: var(--brand-text);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  z-index: 20;
}
.skip:focus {
  top: 1rem;
}

/* ---------- Sidhuvud ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}
.brand svg {
  width: 2.1rem;
  height: 2.1rem;
}
.brand-name {
  font: 700 1.45rem/1 var(--serif);
  letter-spacing: 0.01em;
}
.logo-bg {
  fill: var(--logo-bg);
}
.logo-line {
  stroke: var(--logo-fg);
}
.logo-dot {
  fill: var(--logo-fg);
}
.logo-merge {
  fill: var(--accent-strong);
}
.nav {
  display: flex;
  gap: 1.4rem;
  font-size: 0.95rem;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover {
  color: var(--text);
}
.tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 2.25rem;
  min-width: 2.25rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: 600 0.8rem/1 var(--mono);
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}
.chip-btn:hover {
  border-color: var(--accent);
}
.chip-btn svg {
  width: 1.05rem;
  height: 1.05rem;
}
.icon-moon {
  display: none;
}
:root[data-theme='dark'] .icon-sun {
  display: none;
}
:root[data-theme='dark'] .icon-moon {
  display: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon-sun {
    display: none;
  }
  :root:not([data-theme='light']) .icon-moon {
    display: block;
  }
}
@media (max-width: 760px) {
  .nav {
    display: none;
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem);
  position: relative;
  overflow: hidden;
}
.hero::after {
  /* Stort, svagt "V" i bakgrunden – logotypens två spår. */
  content: '';
  position: absolute;
  right: -6rem;
  top: 50%;
  width: 34rem;
  height: 34rem;
  transform: translateY(-50%);
  background: url('logo-trace.svg') center / contain no-repeat;
  opacity: 0.55;
  pointer-events: none;
}
:root[data-theme='dark'] .hero::after {
  opacity: 0.22;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .hero::after {
    opacity: 0.22;
  }
}
@media (max-width: 760px) {
  /* På smal skärm skulle motivet hamna bakom texten. */
  .hero::after {
    display: none;
  }
}
.hero .wrap {
  position: relative;
  z-index: 1;
}
.prompt {
  font: 500 0.85rem/1.4 var(--mono);
  color: var(--muted);
  margin-bottom: 1.4rem;
}
.prompt b {
  color: var(--accent);
  font-weight: 600;
}
.hero h1 {
  font-size: clamp(2.5rem, 6.5vw, 4.6rem);
  max-width: 15ch;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.lead {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--muted);
  max-width: 38rem;
  margin: 1.5rem 0 2.2rem;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--brand);
  transition: transform 0.15s ease;
}
.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}
.btn-primary {
  background: var(--brand);
  color: var(--brand-text);
}
.btn-ghost {
  color: var(--text);
}

/* ---------- Avsnitt ---------- */
.section {
  padding: clamp(3.5rem, 8vw, 6rem) 0;
}
.section-alt {
  background: var(--bg-soft);
  border-block: 1px solid var(--line);
}
.eyebrow {
  font: 600 0.78rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}
.section h2 {
  font-size: clamp(2rem, 4.2vw, 2.9rem);
  max-width: 22ch;
  margin-bottom: 1rem;
}
.intro {
  color: var(--muted);
  max-width: 40rem;
  margin-bottom: 2.5rem;
}

/* Tjänster */
.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  counter-reset: svc;
}
.service {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.6rem 1.5rem 1.5rem;
  box-shadow: var(--shadow);
  counter-increment: svc;
}
.service::before {
  content: '0' counter(svc);
  display: block;
  font: 600 0.8rem/1 var(--mono);
  color: var(--accent);
  margin-bottom: 1.2rem;
}
.service h3 {
  font-size: 1.35rem;
  margin-bottom: 0.6rem;
}
.service p {
  color: var(--muted);
  margin: 0;
  font-size: 0.98rem;
}

/* Projekt */
.case {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(1.5rem, 4vw, 3rem);
  box-shadow: var(--shadow);
}
@media (max-width: 860px) {
  .case {
    grid-template-columns: 1fr;
  }
}
.case-meta {
  font: 500 0.82rem/1.4 var(--mono);
  color: var(--muted);
  margin-bottom: 0.8rem;
}
.case h3 {
  font-size: clamp(2rem, 4vw, 2.6rem);
  margin-bottom: 1rem;
}
.principle {
  margin: 1.6rem 0;
  padding: 1.1rem 1.3rem;
  border-left: 4px solid var(--accent-strong);
  background: var(--bg-soft);
  border-radius: 0 12px 12px 0;
}
.principle strong {
  display: block;
  font: 700 1.25rem/1.3 var(--serif);
  margin-bottom: 0.35rem;
}
.principle p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}
.ticks {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}
.ticks li {
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: 0.55rem;
  font-size: 0.98rem;
}
.ticks li::before {
  content: '';
  position: absolute;
  left: 0.15rem;
  top: 0.55em;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  border: 2px solid var(--accent-strong);
}
.case-side h4 {
  font: 600 0.78rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.8rem;
}
.tags li {
  font: 500 0.82rem/1 var(--mono);
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.note {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.9rem;
}

/* Om – berättelse + tidslinje */
.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 860px) {
  .about {
    grid-template-columns: 1fr;
  }
}
.about-text p {
  max-width: 36rem;
}
.terminal {
  margin: 0;
  background: var(--term-bg);
  color: var(--term-text);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
  font: 500 0.78rem/1 var(--mono);
  color: var(--term-dim);
}
.terminal-bar i {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.16);
}
.terminal-bar span {
  margin-left: 0.6rem;
}
.terminal pre {
  margin: 0;
  padding: 1.2rem 1.2rem 1.4rem;
  overflow-x: auto;
  font: 400 0.84rem/1.75 var(--mono);
}
.terminal .g {
  color: var(--accent-strong);
}
.terminal .y {
  color: #e6c77a;
}
.terminal .d {
  color: var(--term-dim);
}
.terminal figcaption {
  padding: 0 1.2rem 1.1rem;
  font-size: 0.85rem;
  color: var(--term-dim);
}

/* Kompetens */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.5rem 2rem;
}
.skills h3 {
  font: 600 0.78rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
}
.skills .tags {
  margin: 0;
}
.skills .tags li {
  background: var(--surface);
}

/* Kontakt */
.contact {
  text-align: center;
}
.contact h2 {
  margin-inline: auto;
}
.contact .intro {
  margin-inline: auto;
}
.contact .actions {
  justify-content: center;
}
.contact .place {
  margin-top: 1.5rem;
  font: 500 0.85rem/1.4 var(--mono);
  color: var(--muted);
}

/* Sidfot */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.5rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}
.site-footer p {
  margin: 0;
}

/* 404 */
.notfound {
  min-height: 70vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 1rem;
}
.notfound h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
}
