/* planimator.se — brand identity.
 *
 * Scales, reset and .wrapper come from assets/shared/. This file carries only
 * what is specific to planimator.se: colour, typefaces and components.
 * optimering.se and simulering.se deliberately look nothing like this.
 *
 * The look is an engineering drawing sheet: cool ink on cool paper, hairlines
 * with nodes, and DIN for anything that behaves like a label on a drawing.
 */

:root {
  /* Three type roles. All resident on the target machines, so nothing falls
     back silently — no webfont request, no layout shift.
       display   transitional serif, continues the 1997 wordmark
       body      neutral grotesque
       tech      DIN — the engineering-drawing face; Bahnschrift ships on Windows */
  --font-display: Constantia, "Iowan Old Style", "Palatino Linotype", Charter, Cambria, Georgia, serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-tech: Bahnschrift, "DIN Alternate", "Roboto Condensed", "Segoe UI", sans-serif;

  /* Cool paper, blue-biased neutrals, and one accent: the oxide red of a
     revision mark on a technical drawing. Used at hairline scale only. */
  --paper:     #F4F5F6;
  --surface:   #FFFFFF;
  --ink:       #14181D;
  --ink-soft:  #333C45;
  --graphite:  #5A646E;
  --rule:      #D6DADE;

  --accent:    #9E2B20;

  --focus-ring: 2px solid var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #101418;
    --surface:  #161B21;
    --ink:      #E4E7EA;
    --ink-soft: #C2C9D0;
    --graphite: #98A2AC;
    --rule:     #262D35;

    --accent:   #D96A57;
  }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-variant-numeric: lining-nums tabular-nums;
}

/* ============================================================
   Masthead
   ============================================================ */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-block-end: 1px solid var(--rule);
}

.masthead-inner {
  max-width: var(--wrapper-max);
  margin-inline: auto;
  padding: var(--space-s) var(--wrapper-pad);
  display: flex;
  align-items: center;
  gap: var(--space-m);
  flex-wrap: wrap;
}

/* The wordmark. Antikva, as it has been since 1997 — the old flourish reduced
   to a single node on a hairline. */
.wordmark {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--step-2);
  letter-spacing: 0.005em;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
}
.wordmark:hover { color: var(--ink); }

.wordmark .node {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transform: translateY(-0.28em);
}
.wordmark .node i { display: block; width: 15px; height: 1px; background: var(--rule); }
.wordmark .node b { display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

.nav {
  display: flex;
  gap: var(--space-xs);
  margin-inline-start: auto;
  flex-wrap: wrap;
}
.nav a {
  border-block-end: 2px solid transparent;
  padding: var(--space-3xs) var(--space-2xs);
  font-family: var(--font-tech);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--graphite);
  text-decoration: none;
  transition: color 120ms, border-color 120ms;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-block-end-color: var(--accent); }

/* ============================================================
   Page furniture
   ============================================================ */
.page-top { padding-block-start: var(--space-3xl); }

.eyebrow {
  font-family: var(--font-tech);
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--graphite);
}

/* Section rule carrying a node — the flow-network motif, at its smallest. */
.node-rule {
  display: flex;
  align-items: center;
  margin-block: var(--space-2xl) var(--space-xl);
}
.node-rule::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.node-rule::after {
  content: "";
  height: 1px;
  background: var(--rule);
  flex: 1;
}

.section-head { margin-block-end: var(--space-l); }
.section-head h1,
.section-head h2 {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 400;
  margin-block-start: var(--space-2xs);
}
.section-head .prose { margin-block-start: var(--space-m); }

.lede {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 46ch;
}
.prose { max-width: var(--measure); color: var(--ink-soft); }
.prose + .prose { margin-block-start: var(--space-s); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding-block: var(--space-3xl) var(--space-xl);
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: var(--space-2xl);
  align-items: start;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  /* Own clamp rather than --step-5: Swedish compounds ("flödesoptimering") are
     wide enough that the shared floor crowds the margins on a 320px phone.
     Same ceiling, gentler floor. */
  font-size: clamp(2.1rem, 1.63rem + 2.49vw, 3.62rem);
  line-height: 1.06;
  letter-spacing: -0.012em;
  margin-block: var(--space-s) var(--space-m);
  max-width: 17ch;
  /* Deliberately NOT hyphens:auto. With lang="sv" Safari runs the Swedish
     hyphenation dictionary and will set "flö-desoptimering" — which reads as
     the opposite of what the line says. Manual leaves exactly one permitted
     break: the &shy; at the compound seam in the markup. */
  hyphens: manual;
  overflow-wrap: anywhere;
}
.hero h1 em { font-style: italic; color: var(--accent); }

.portrait-frame {
  border: 1px solid var(--rule);
  padding: 7px;
  background: var(--surface);
  max-width: 320px;
  margin-inline-start: auto;
}
/* The background is a container terminal — held back so the face leads and the
   colour sits inside the sheet's cool palette rather than fighting it. */
.portrait-frame img { width: 100%; height: auto; filter: saturate(0.78); }

.portrait-cap {
  font-family: var(--font-tech);
  font-size: var(--step--2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--graphite);
  margin-block-start: var(--space-2xs);
  display: flex;
  justify-content: space-between;
  gap: var(--space-s);
}

/* Credential rail — the strip along the bottom of a drawing sheet. */
.rail {
  border-block: 1px solid var(--rule);
  padding-block: var(--space-s);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-l);
  font-family: var(--font-tech);
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--graphite);
}
.rail span { display: flex; align-items: center; gap: var(--space-2xs); }
.rail span::before {
  content: "";
  width: 4px; height: 4px;
  background: var(--accent);
  flex: none;
}

/* ============================================================
   The two doors
   ============================================================ */
.doors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-block-start: var(--space-2xl);
}
.door {
  background: var(--paper);
  padding: var(--space-l);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  transition: background 140ms;
}
.door:hover { background: var(--surface); }
.door h2 {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 400;
}
.door p { color: var(--graphite); font-size: var(--step--1); max-width: 34ch; }
.door .go {
  font-family: var(--font-tech);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-block-start: var(--space-2xs);
}

/* ============================================================
   Hairline rows — Uppdrag and Erfarenhet.
   Rows, not cards: a document, not a dashboard.
   ============================================================ */
.rows { border-block-start: 1px solid var(--rule); }
.row {
  border-block-end: 1px solid var(--rule);
  padding-block: var(--space-l);
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: var(--space-m);
  align-items: start;
}
.row-key {
  font-family: var(--font-tech);
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  padding-block-start: 0.35em;
}
.row-key .org {
  display: block;
  color: var(--graphite);
  letter-spacing: 0.08em;
  margin-block-start: var(--space-3xs);
}
.row h3 {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 400;
  margin-block-end: var(--space-2xs);
}
.row p { color: var(--ink-soft); max-width: var(--measure); }
.row .scope {
  margin-block-start: var(--space-xs);
  font-family: var(--font-tech);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  color: var(--graphite);
}

/* ============================================================
   References
   ============================================================ */
.customers {
  columns: 3 12rem;
  column-gap: var(--space-l);
  margin-block-start: var(--space-m);
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.customers li { break-inside: avoid; padding-block: 2px; }

.note {
  font-size: var(--step--1);
  color: var(--graphite);
  border-inline-start: 2px solid var(--rule);
  padding-inline-start: var(--space-s);
  max-width: 54ch;
  margin-block-start: var(--space-m);
}

/* ============================================================
   MapVisualizer
   ============================================================ */
.pullquote {
  border-block: 1px solid var(--rule);
  padding-block: var(--space-xl);
  margin-block: var(--space-xl);
}
.pullquote blockquote {
  font-family: var(--font-display);
  font-size: var(--step-3);
  line-height: 1.25;
  font-style: italic;
  max-width: 24ch;
  margin: 0;
}
.schematic { margin-block: var(--space-xl); overflow-x: auto; }
.schematic svg { min-width: 30rem; }

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: var(--space-xl);
  margin-block-start: var(--space-xl);
}
.split h3 {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 400;
  margin-block-end: var(--space-2xs);
}
.split p { color: var(--ink-soft); font-size: var(--step--1); }
.split .tag {
  margin-block-start: var(--space-2xs);
  font-family: var(--font-tech);
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--graphite);
}

/* ============================================================
   Contact and footer
   ============================================================ */
.contact {
  border: 1px solid var(--rule);
  background: var(--surface);
  padding: var(--space-xl);
  margin-block: var(--space-2xl);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: var(--space-l);
  align-items: center;
}
.contact h2 {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 400;
  margin-block-end: var(--space-2xs);
}
.contact p { color: var(--graphite); font-size: var(--step--1); max-width: 38ch; }

.mail,
.outlink {
  font-family: var(--font-display);
  font-size: var(--step-1);
  color: var(--ink);
  text-decoration: none;
  border-block-end: 1px solid var(--accent);
  padding-block-end: 2px;
  transition: color 120ms;
  word-break: break-word;
}

/* The address is 31 characters of display serif and must not wrap. On a 375px
   phone it wants 284px and the box offers 242, so size it against the box it
   sits in rather than the viewport: full size wherever there is room, smaller
   only where there isn't — and correct for whatever serif the device
   substitutes. Browsers without container queries keep the --step-1 above. */
.mail-cell { container-type: inline-size; }
.mail { font-size: min(var(--step-1), 6cqi); }

.mail:hover,
.outlink:hover { color: var(--accent); }

.site-foot {
  border-block-start: 1px solid var(--rule);
  margin-block-start: var(--space-2xl);
  padding-block: var(--space-l) var(--space-2xl);
  font-family: var(--font-tech);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  color: var(--graphite);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-m);
}
.site-foot a { color: inherit; text-decoration: none; border-block-end: 1px solid var(--rule); }
.site-foot a:hover { color: var(--ink); border-block-end-color: var(--accent); }

@media (max-width: 60rem) {
  .hero { grid-template-columns: 1fr; gap: var(--space-xl); }
  .portrait-frame { margin-inline-start: 0; }
  .row { grid-template-columns: 1fr; gap: var(--space-2xs); }
  .row-key { padding-block-start: 0; }
}

/* 3rem a side is a quarter of a 375px screen. Give the phone its width back. */
@media (max-width: 40rem) {
  .contact { padding: var(--space-l); }
}
