/* ==========================================================================
   Halden Labs: shared styles
   Order: tokens, base, type, layout, components, page sections.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --surface-100: #f3f4f1;
  --surface-200: #e6e9e4;
  --surface-raised: #fbfbf9;
  --ink: #15191b;
  --ink-muted: #4f5a57;
  --line: #cdd3cd;
  --line-strong: #7e8a86;
  --halden: #1f4d3f;
  --on-halden: #f3f4f1;
  --halden-tint: #d6e3dc;
  --slate: #2c3a47;
  --brass: #9a6f22;

  /* The one dark band (lead journey on the home page) */
  --band-bg: var(--slate);
  --band-ink: var(--surface-100);
  --band-muted: var(--line);
  --band-line: var(--line-strong);
  --band-edge: var(--slate);

  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-text: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
  --space-48: 48px;
  --space-64: 64px;
  --space-96: 96px;
  --space-128: 128px;

  --container: 1200px;
  --gutter: 24px;
  --section-pad: 96px;

  --radius-input: 2px;
  --radius-button: 4px;
  --radius-image: 8px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-100: #121615;
    --surface-200: #1a1f1e;
    --surface-raised: #1f2523;
    --ink: #e8ece8;
    --ink-muted: #a3aeaa;
    --line: #2f3735;
    --line-strong: #5f6b67;
    --halden: #7fb8a2;
    --on-halden: #0e1a16;
    --halden-tint: #1d2f29;
    --slate: #9fb2c4;
    --brass: #d2a954;

    --band-bg: var(--surface-raised);
    --band-ink: var(--ink);
    --band-muted: var(--ink-muted);
    --band-line: var(--line);
    --band-edge: var(--line);
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--surface-100);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 26px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img, svg { display: block; max-width: 100%; height: auto; }
img { border-radius: var(--radius-image); }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  color: inherit;
  text-wrap: balance;
}

p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; }
p { max-width: 64ch; }

a {
  color: var(--halden);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--halden);
  outline-offset: 2px;
}

::selection { background: var(--halden-tint); color: var(--ink); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-16);
  top: -100px;
  z-index: 20;
  padding: var(--space-12) var(--space-16);
  background: var(--halden);
  color: var(--on-halden);
  border-radius: var(--radius-button);
  font-weight: 500;
}
.skip-link:focus { top: var(--space-16); }

/* ---------- Type ---------- */
.t-hero {
  font-size: clamp(42px, 3.2vw + 26px, 72px);
  line-height: 1.056;              /* 72/76 */
  letter-spacing: -0.015em;
}
.t-page {
  font-size: clamp(36px, 1.6vw + 25px, 48px);
  line-height: 1.125;              /* 48/54 */
  letter-spacing: -0.015em;
}
.t-section {
  font-size: clamp(28px, 0.8vw + 22.5px, 34px);
  line-height: 1.176;              /* 34/40 */
  letter-spacing: -0.015em;
}
.t-sub {
  font-size: clamp(22px, 0.4vw + 20px, 26px);
  line-height: 1.231;              /* 26/32 */
  letter-spacing: -0.005em;
}

.intro { font-size: 18px; line-height: 29px; }
.small { font-size: 14px; line-height: 22px; }
.muted { color: var(--ink-muted); }

.eyebrow {
  display: block;
  margin-bottom: var(--space-16);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.mono {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 22px;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-block;
  padding: 2px var(--space-8);
  background: var(--halden-tint);
  color: var(--ink);
  border-radius: var(--radius-input);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Placeholder copy that must be replaced before launch */
.ph {
  background: var(--halden-tint);
  color: var(--ink);
  padding: 1px var(--space-4);
  border-radius: var(--radius-input);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.stack-8 > * + * { margin-top: var(--space-8); }
.stack-16 > * + * { margin-top: var(--space-16); }
.stack-24 > * + * { margin-top: var(--space-24); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--space-24);
}

.col-1-4  { grid-column: 1 / 5; }
.col-1-5  { grid-column: 1 / 6; }
.col-1-6  { grid-column: 1 / 7; }
.col-1-7  { grid-column: 1 / 8; }
.col-1-8  { grid-column: 1 / 9; }
.col-5-11 { grid-column: 5 / 12; }
.col-5-12 { grid-column: 5 / 13; }
.col-6-12 { grid-column: 6 / 13; }
.col-7-12 { grid-column: 7 / 13; }
.col-8-12 { grid-column: 8 / 13; }
.col-9-12 { grid-column: 9 / 13; }
.col-10-12 { grid-column: 10 / 13; }

.section { padding-block: var(--section-pad); }
.band { background: var(--surface-200); }
.hairline-top { border-top: 1px solid var(--line); }

.section-head { margin-bottom: var(--space-48); }
.section-head .intro,
.section-head p { margin-top: var(--space-16); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.btn-primary {
  background: var(--halden);
  border-color: var(--halden);
  color: var(--on-halden);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--halden) 86%, var(--ink));
  border-color: color-mix(in srgb, var(--halden) 86%, var(--ink));
}
.btn-secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-secondary:hover { border-color: var(--ink); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
  margin-top: var(--space-32);
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface-100);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--space-32);
  min-height: 72px;
}

.wordmark {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  line-height: 32px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.site-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-32);
}
.site-nav a:not(.btn) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-size: 15px;
  line-height: 24px;
  text-decoration: none;
}
.site-nav a:not(.btn):hover { color: var(--halden); }
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--halden);
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}
.site-nav .nav-cta { display: none; }

.menu-toggle {
  display: none;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-button);
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  cursor: pointer;
}

@media (max-width: 860px) {
  .header-inner { column-gap: var(--space-12); }
  .js .menu-toggle { display: inline-flex; }
  .js .site-nav { display: none; }
  .site-nav {
    order: 5;
    flex-basis: 100%;
    border-top: 1px solid var(--line);
    padding-block: var(--space-8) var(--space-16);
  }
  .js .site-header[data-open="true"] .site-nav { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav li + li { border-top: 1px solid var(--line); }
  .site-nav a:not(.btn) { display: flex; width: 100%; min-height: 48px; }
}

@media (max-width: 480px) {
  .header-cta { display: none; }
  .site-nav .nav-cta { display: block; padding-top: var(--space-16); border-top: 0; }
  .site-nav .nav-cta .btn { width: 100%; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--space-48);
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 22px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-24) var(--space-48);
}
.footer-company .wordmark-small {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  line-height: 24px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.footer-company p { margin-top: var(--space-8); }
.footer-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-24);
}
.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-muted);
}
.site-footer a:hover { color: var(--ink); }

/* ---------- Home: hero ---------- */
.hero { padding-block: var(--space-96); }
.hero .grid { align-items: end; row-gap: var(--space-64); }
.hero .intro { margin-top: var(--space-24); }

.log { border-top: 1px solid var(--line); }
.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  padding-block: var(--space-12);
  border-bottom: 1px solid var(--line);
}
.log-head .eyebrow { margin: 0; }
.log-list { list-style: none; }
.log-list li {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  column-gap: var(--space-16);
  padding-block: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  line-height: 22px;
}
.log-list time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}
.log figcaption {
  margin-top: var(--space-16);
  font-size: 14px;
  line-height: 22px;
  color: var(--ink-muted);
}
.log figcaption::after,
.journey-caption::after {
  content: "";
  display: block;
  width: 48px;
  height: 1px;
  margin-top: var(--space-16);
  background: var(--brass);
}

/* ---------- Home: the numbers you already know ---------- */
.ledger {
  width: 100%;
  border-collapse: collapse;
}
.ledger caption { text-align: left; }
.ledger th,
.ledger td {
  padding: var(--space-16) 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: bottom;
  font-weight: 400;
}
.ledger thead th {
  padding-top: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom-color: var(--line-strong);
}
.ledger tbody th { padding-right: var(--space-24); }
.ledger td { width: 104px; }
.blank {
  display: block;
  height: 22px;
  border-bottom: 1px solid var(--line-strong);
}
.ledger-note { margin-top: var(--space-32); }

/* ---------- Home: systems ---------- */
.systems {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-24);
  row-gap: var(--space-48);
}
.system {
  border-top: 1px solid var(--line);
  padding-top: var(--space-24);
}
.system .eyebrow { margin-bottom: var(--space-12); }
.system p { margin-top: var(--space-12); }
.system .how { color: var(--ink-muted); font-size: 14px; line-height: 22px; }
.system .text-link { margin-top: var(--space-4); }

/* ---------- Numbered steps (engagement) ---------- */
.steps { list-style: none; }
.steps > li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  column-gap: var(--space-24);
  padding-block: var(--space-32);
  border-top: 1px solid var(--line);
}
.steps > li:last-child { border-bottom: 1px solid var(--line); }
.step-num {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 32px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}
.steps p { margin-top: var(--space-8); }
.steps .deliver {
  margin-top: var(--space-12);
  font-size: 14px;
  line-height: 22px;
  color: var(--ink-muted);
}
.deliver .label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: var(--space-8);
}

/* ---------- Home: lead journey (the one dark band) ---------- */
.band-dark {
  background: var(--band-bg);
  color: var(--band-ink);
  border-block: 1px solid var(--band-edge);
}
.band-dark .eyebrow,
.band-dark .muted { color: var(--band-muted); }

.journey {
  list-style: none;
  border-top: 1px solid var(--band-line);
}
.journey > li {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--space-24);
  padding-block: var(--space-16);
  border-bottom: 1px solid var(--band-line);
}
.journey .when {
  grid-column: 1 / 3;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 26px;
  font-variant-numeric: tabular-nums;
}
.journey .when .day { color: var(--band-muted); margin-right: var(--space-8); }
.journey .what { grid-column: 3 / 10; max-width: 64ch; }
.journey .via {
  grid-column: 10 / 13;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 26px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--band-muted);
}
.journey .tag { margin-left: var(--space-8); vertical-align: 1px; }
.journey-caption {
  margin-top: var(--space-24);
  font-size: 14px;
  line-height: 22px;
  color: var(--band-muted);
}

/* ---------- Inner pages ---------- */
.page-head { padding-block: var(--space-96) var(--space-64); }
.page-head .grid { align-items: end; row-gap: var(--space-48); }
.page-head .intro { margin-top: var(--space-24); }

.page-index { list-style: none; border-top: 1px solid var(--line); }
.page-index li { border-bottom: 1px solid var(--line); }
.page-index a {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  min-height: 44px;
  text-decoration: none;
}
.page-index a:hover { text-decoration: underline; }
.page-index .mono { color: var(--ink-muted); }

/* Services: what it connects to / what you get / what you provide */
.service .intro { margin-top: var(--space-16); }
.service .mechanism { margin-top: var(--space-16); color: var(--ink-muted); }

.facts > div {
  border-top: 1px solid var(--line);
  padding-block: var(--space-24);
}
.facts > div:last-child { border-bottom: 1px solid var(--line); }
.facts dt {
  margin-bottom: var(--space-12);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.facts-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--space-24);
  margin-top: var(--space-48);
}
.facts-row > div:last-child { border-bottom: 0; }

.list { padding-left: 20px; }
.list li { max-width: 64ch; }
.list li + li { margin-top: var(--space-8); }
.list li::marker { color: var(--line-strong); }

/* About */
.principles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-24);
  row-gap: var(--space-32);
}
.principles > div {
  border-top: 1px solid var(--line);
  padding-top: var(--space-24);
}
.principles p { margin-top: var(--space-8); }

/* Contact */
.contact .grid { row-gap: var(--space-64); align-items: start; }
.panel {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  padding: var(--space-32);
}
.field + .field { margin-top: var(--space-24); }
.field label {
  display: block;
  font-size: 14px;
  line-height: 22px;
  font-weight: 500;
  color: var(--ink);
}
.field .optional { font-weight: 400; color: var(--ink-muted); }
.field .hint {
  margin-top: 2px;
  font-size: 14px;
  line-height: 22px;
  color: var(--ink-muted);
}
.field input,
.field textarea {
  display: block;
  width: 100%;
  margin-top: var(--space-8);
  min-height: 44px;
  padding: 10px 12px;
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 24px;
  color: var(--ink);
  background: var(--surface-100);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-input);
}
.field textarea { min-height: 168px; resize: vertical; }
.field input:focus-visible,
.field textarea:focus-visible { border-color: var(--halden); }
.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-16) var(--space-24);
  margin-top: var(--space-32);
}
.form-foot p { font-size: 14px; line-height: 22px; color: var(--ink-muted); max-width: 40ch; }

.next-steps { list-style: none; margin-top: var(--space-24); border-top: 1px solid var(--line); }
.next-steps li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  column-gap: var(--space-12);
  padding-block: var(--space-12);
  border-bottom: 1px solid var(--line);
}
.next-steps .mono { color: var(--ink-muted); line-height: 26px; }

.email-line { margin-top: var(--space-32); }
.email-line .email {
  display: block;
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 26px;
  color: var(--ink);
  user-select: all;
  -webkit-user-select: all;
}

/* ---------- Closing CTA ---------- */
.cta .grid { align-items: end; row-gap: var(--space-48); }
.cta p { margin-top: var(--space-16); }

/* ---------- Scroll-in (subtle) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  :root { --section-pad: 64px; }
  .grid { row-gap: var(--space-48); }
  .grid > [class*="col-"] { grid-column: 1 / -1; }
  .hero { padding-block: var(--space-64); }
  .page-head { padding-block: var(--space-64) var(--space-48); }
  .systems,
  .principles,
  .facts-row { grid-template-columns: minmax(0, 1fr); }
  .facts-row > div:last-child { border-bottom: 1px solid var(--line); }
  .journey > li { row-gap: var(--space-4); }
  .journey .when { grid-column: 1 / 7; }
  .journey .via { grid-column: 7 / 13; text-align: right; }
  .journey .what { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 480px) {
  :root { --gutter: 16px; }
  .panel { padding: var(--space-24); }
  .actions .btn { flex: 1 1 auto; }
  .ledger td { width: 72px; }
}
