:root {
  --ground: #e8ecee;
  --paper: #f6f8f8;
  --ink: #121a20;
  --slate: #5b6873;
  --rule: #c9d1d6;
  --rec: #c63a1e;
  --osd: #f2c94c;
  --menu-bg: rgba(246, 248, 248, 0.86);
  --menu-hi: #2b62d9;
  --frame-edge: #0b1014;
  --code-bg: #dde3e6;

  --display: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body: "Public Sans", -apple-system, "Segoe UI", sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --s-1: 0.8125rem;
  --s0: 1rem;
  --s1: 1.1875rem;
  --s2: 1.5rem;
  --s3: 2.25rem;
  --s4: clamp(2.5rem, 5.4vw, 4.25rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0f1519;
    --paper: #161e23;
    --ink: #e4eaed;
    --slate: #8d9aa4;
    --rule: #2a353c;
    --rec: #ff6a4a;
    --menu-bg: rgba(34, 42, 48, 0.9);
    --menu-hi: #3b73ea;
    --frame-edge: #05080a;
    --code-bg: #1d272d;
  }
}

:root[data-theme="dark"] {
  --ground: #0f1519;
  --paper: #161e23;
  --ink: #e4eaed;
  --slate: #8d9aa4;
  --rule: #2a353c;
  --rec: #ff6a4a;
  --menu-bg: rgba(34, 42, 48, 0.9);
  --menu-hi: #3b73ea;
  --frame-edge: #05080a;
  --code-bg: #1d272d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--s0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--rec); }
:focus-visible { outline: 2px solid var(--rec); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: var(--s4); }
h2 { font-size: var(--s3); }
h3 { font-size: var(--s1); letter-spacing: -0.01em; line-height: 1.25; }
p { margin: 0; text-wrap: pretty; }

code, .mono { font-family: var(--mono); font-size: 0.82em; }
p code, li code, td code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.wrap { width: min(1160px, 100% - 3rem); margin-inline: auto; }

.label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
}

/* ---------- Site header ---------- */
.site-head {
  border-bottom: 1px solid var(--rule);
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.125rem;
  text-decoration: none;
}
.brand-dot {
  width: 0.95rem; height: 0.95rem;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: grid; place-items: center;
}
.brand-dot::after {
  content: ""; width: 0.35rem; height: 0.35rem; border-radius: 50%; background: currentColor;
}
.site-nav { display: flex; gap: 1.5rem; font-size: 0.9375rem; }
.site-nav a { text-decoration: none; color: var(--slate); }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -1px 0 currentColor; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding-block: clamp(3rem, 7vw, 6rem) clamp(2.5rem, 5vw, 4rem);
}
.hero h1 em { font-style: normal; color: var(--slate); }
.hero .lede { font-size: var(--s1); color: var(--slate); max-width: 34rem; margin-top: 1.5rem; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; margin-top: 2rem; }

.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  background: var(--ink); color: var(--ground);
  padding: 0.8rem 1.25rem;
  border-radius: 999px;
  font-weight: 600; font-size: 0.9375rem;
  text-decoration: none;
}
.btn:hover { color: var(--ground); background: var(--rec); }
.btn .rec-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--rec); }
.btn:hover .rec-dot { background: var(--ground); }
.quiet-link { font-size: 0.9375rem; color: var(--slate); }

/* ---------- macOS menu mock ---------- */
.menubar-mock {
  position: relative;
  font-family: -apple-system, "SF Pro Text", var(--body);
  font-size: 13px;
  line-height: 1;
  user-select: none;
}
.menubar-strip {
  display: flex; justify-content: flex-end; align-items: center; gap: 1.1rem;
  padding: 0.45rem 0.9rem;
  background: var(--menu-bg);
  border: 1px solid var(--rule);
  border-radius: 10px 10px 0 0;
  color: var(--ink);
  backdrop-filter: blur(12px);
}
.menubar-strip .muted { color: var(--slate); }
.status-item {
  position: relative;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
  font-size: 15px;
  width: 1.9rem; text-align: center;
}
.status-item .busy { display: none; }
.menubar-mock.is-running .status-item .idle { display: none; }
.menubar-mock.is-running .status-item .busy { display: inline; }

.menu {
  margin: 0.35rem 0 0 auto;
  width: min(100%, 300px);
  background: var(--menu-bg);
  border: 1px solid var(--rule);
  border-radius: 9px;
  padding: 5px;
  box-shadow: 0 24px 50px -20px rgba(8, 14, 20, 0.45), 0 2px 6px rgba(8, 14, 20, 0.12);
  backdrop-filter: blur(20px);
  color: var(--ink);
}
.menu li {
  list-style: none;
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 5px 10px;
  border-radius: 5px;
  white-space: nowrap;
}
.menu ul { margin: 0; padding: 0; }
.menu .sep { height: 1px; padding: 0; margin: 5px 10px; background: var(--rule); }
.menu .dim { color: var(--slate); }
.menu .hi { background: var(--menu-hi); color: #fff; }
.menu .hi .dim { color: rgba(255,255,255,0.8); }
.menu .check { display: inline-block; width: 1em; }

/* ---------- Contact sheet ---------- */
.sheet {
  background: var(--paper);
  border-block: 1px solid var(--rule);
  padding-block: clamp(2.5rem, 5vw, 4rem);
}
.sheet-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem 2rem;
  margin-bottom: 1.75rem;
}
.sheet-head p { color: var(--slate); max-width: 38rem; }
.frames {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem 1rem;
}
.frame-card { margin: 0; display: grid; gap: 0.5rem; }
.frame-card figcaption {
  font-family: var(--mono); font-size: 0.625rem; color: var(--slate);
  overflow-wrap: anywhere; line-height: 1.5;
}

.frame {
  --sky: #9fb0ba; --far: #7e8e96; --ground-a: #6c7a70; --ground-b: #4d5a52; --obj: #3b4449;
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 3px;
  overflow: hidden;
  background:
    linear-gradient(to bottom, var(--sky) 0 46%, var(--far) 46% 52%, var(--ground-a) 52%, var(--ground-b) 100%);
  outline: 1px solid var(--frame-edge);
  filter: saturate(0.55) contrast(1.05);
}
.frame::before {          /* the scene's main object */
  content: "";
  position: absolute;
  background: var(--obj);
}
.frame::after {           /* sensor grain + vignette */
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.45) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='90'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  pointer-events: none;
}
.osd {
  position: absolute; z-index: 2;
  font-family: var(--mono); font-size: 0.5625rem; letter-spacing: 0.04em;
  color: var(--osd);
  text-shadow: 0 1px 0 #000, 0 0 3px rgba(0,0,0,0.8);
  text-transform: uppercase;
}
.osd.cam { top: 6px; left: 8px; }
.osd.time { bottom: 6px; right: 8px; font-variant-numeric: tabular-nums; }
.flash {
  position: absolute; inset: 0; z-index: 3;
  background: #fff; opacity: 0; pointer-events: none;
}
.frame.is-capturing .flash { animation: flash 0.9s ease-out; }
@keyframes flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }

/* Scenes: simple geometry that reads as a doorway, a driveway, a yard. */
.scene-door::before { left: 40%; width: 20%; top: 18%; height: 60%; background: linear-gradient(90deg, #2f363a, #444e53); box-shadow: 0 0 0 5px #8d9796; }
.scene-drive { --ground-a: #7d8586; --ground-b: #5b6364; }
.scene-drive::before { left: 18%; width: 42%; top: 44%; height: 26%; border-radius: 30% 36% 8% 8%; background: #2c3438; }
.scene-garden { --ground-a: #5f7a5b; --ground-b: #3e5140; }
.scene-garden::before { left: 64%; width: 18%; top: 10%; height: 50%; border-radius: 50% 50% 10% 10%; background: #3f5540; }
.scene-garage { --sky: #b3bcc0; --far: #9aa3a6; }
.scene-garage::before { left: 15%; width: 70%; top: 22%; height: 52%; background: repeating-linear-gradient(to bottom, #6a7478 0 6px, #58626a 6px 8px); }
.scene-night { --sky: #1d2a24; --far: #243029; --ground-a: #2e3d33; --ground-b: #1a241e; filter: saturate(0.9) hue-rotate(40deg) brightness(1.1); }
.scene-night::before { left: 30%; width: 12%; top: 30%; height: 44%; background: #121a15; box-shadow: 70px 10px 0 -2px #16201a; }
.scene-porch { --sky: #c4cbc9; --far: #8f9790; }
.scene-porch::before { left: 8%; right: 8%; top: 58%; height: 6%; background: #3b3f3d; box-shadow: 0 -40px 0 -10px #55595a; }
.scene-side { --sky: #8c9ba3; --ground-a: #6b6f66; }
.scene-side::before { left: 0; width: 38%; top: 0; bottom: 0; background: linear-gradient(90deg, #545d61, #6c767a); }
.scene-shed { --sky: #a8b5b8; --ground-a: #6f8468; --ground-b: #4a5a45; }
.scene-shed::before { left: 50%; width: 30%; top: 26%; height: 34%; background: #5d534b; clip-path: polygon(0 30%, 50% 0, 100% 30%, 100% 100%, 0 100%); }

/* ---------- Content sections ---------- */
.section { padding-block: clamp(3rem, 6vw, 5rem); }
.section + .section { border-top: 1px solid var(--rule); }
.split {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.split-intro { display: grid; gap: 1rem; position: sticky; top: 2rem; }
.split-intro p { color: var(--slate); max-width: 28rem; }

.jobs { display: grid; gap: 0; }
.job {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 1.5rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--rule);
}
.job:last-child { border-bottom: 1px solid var(--rule); }
.job .when { font-family: var(--mono); font-size: 0.75rem; color: var(--slate); padding-top: 0.2rem; line-height: 1.5; }
.job .when strong { display: block; color: var(--ink); font-weight: 500; font-size: 0.8125rem; }
.job-body { display: grid; gap: 0.5rem; max-width: 36rem; }
.job-body p { color: var(--slate); }

/* The memory figures: the one place numbers lead. */
.weights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 2px solid var(--ink);
}
.weight { padding: 1.25rem 1.25rem 0 0; display: grid; gap: 0.4rem; align-content: start; }
.weight + .weight { padding-left: 1.25rem; border-left: 1px solid var(--rule); }
.weight .num {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  letter-spacing: -0.04em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.weight .num small { font-size: 0.4em; letter-spacing: 0; color: var(--slate); margin-left: 0.15em; }
.weight p { color: var(--slate); font-size: 0.9375rem; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 2rem 2.5rem;
}
.fact { display: grid; gap: 0.5rem; align-content: start; }
.fact p { color: var(--slate); font-size: 0.9375rem; }

/* Terminal-ish blocks for paths and trees */
.tree {
  background: var(--frame-edge);
  color: #cfd8dc;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.9;
  padding: 1.25rem 1.5rem;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}
.tree .k { color: var(--osd); }
.tree .c { color: #7d8b93; }

table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
.table-wrap { overflow-x: auto; }
th, td { text-align: left; padding: 0.8rem 1rem 0.8rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-family: var(--mono); font-size: 0.6875rem; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate); }
td.n { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }

.note {
  border-left: 3px solid var(--rec);
  padding: 0.25rem 0 0.25rem 1.25rem;
  display: grid; gap: 0.5rem;
  max-width: 40rem;
}
.note p { color: var(--slate); }

.prose { display: grid; gap: 1rem; max-width: 40rem; }
.prose p { color: var(--slate); }
.prose ul { margin: 0; padding-left: 1.1rem; color: var(--slate); display: grid; gap: 0.4rem; }

/* ---------- CTA band ---------- */
.cta {
  background: var(--ink);
  color: var(--ground);
  padding-block: clamp(3rem, 6vw, 4.5rem);
}
.cta .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 2rem; }
.cta p { color: color-mix(in srgb, var(--ground) 70%, var(--ink)); max-width: 34rem; margin-top: 0.75rem; }
.cta .btn { background: var(--ground); color: var(--ink); }
.cta .btn:hover { background: var(--rec); color: var(--ground); }

/* ---------- Contact page ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 6rem);
  padding-block: clamp(3rem, 7vw, 6rem);
  align-items: start;
}
.contact-grid .lede { font-size: var(--s1); color: var(--slate); margin-top: 1.5rem; max-width: 30rem; }
.envelope {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  display: grid; gap: 1.5rem;
}
.envelope .addr {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.envelope ul { margin: 0; padding-left: 1.1rem; color: var(--slate); display: grid; gap: 0.45rem; }
.status-list { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.status-list div { display: flex; justify-content: space-between; gap: 1rem; padding-block: 0.7rem; border-bottom: 1px solid var(--rule); font-size: 0.9375rem; }
.status-list dt { color: var(--slate); }
.status-list dd { margin: 0; text-align: right; font-weight: 500; }
.status-list { margin: 0; }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--rule); padding-block: 2rem; font-size: 0.8125rem; color: var(--slate); }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .hero, .split, .contact-grid { grid-template-columns: 1fr; }
  .split-intro { position: static; }
  .frames { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .weights { grid-template-columns: 1fr; }
  .weight + .weight { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .weight { padding-bottom: 1.25rem; }
}
@media (max-width: 560px) {
  .job { grid-template-columns: 1fr; gap: 0.5rem; }
  .site-nav { gap: 1rem; font-size: 0.875rem; }
  .menubar-strip .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .frame.is-capturing .flash { animation: none; }
}
