/* ==========================================================================
   Northline Digital — single stylesheet
   Design tokens, base, layout, components, responsive, a11y.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-alt: #efeee8;
  --ink: #191c21;
  --ink-soft: #43484f;
  --muted: #6b7078;
  --line: #e2e0d8;
  --line-strong: #c9c6bb;
  --accent: #2f5fd0;
  --accent-ink: #24489f;
  --accent-soft: #e8eefb;
  --focus: #2f5fd0;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  /* spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4.5rem;
  --sp-9: 7rem;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(25, 28, 33, 0.05), 0 8px 24px rgba(25, 28, 33, 0.06);
  --container: 72rem;
  --header-h: 4.25rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4 {
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 var(--sp-4);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 1.5rem + 3.2vw, 3.75rem);
}

h2 {
  font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 var(--sp-4);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

:where(a, button, summary, input, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

ul,
ol {
  margin: 0 0 var(--sp-4);
  padding-left: 1.25rem;
}

li {
  margin-bottom: var(--sp-2);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--sp-6) 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

/* ---------- Utilities ---------- */
.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.section {
  padding-block: var(--sp-8);
  scroll-margin-top: calc(var(--header-h) + var(--sp-4));
}

@media (min-width: 768px) {
  .section {
    padding-block: var(--sp-9);
  }
}

.section--alt {
  background: var(--surface);
  border-block: 1px solid var(--line);
}

.section-head {
  max-width: 46rem;
  margin-bottom: var(--sp-7);
}

.eyebrow {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: var(--sp-3);
}

.lede {
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.3125rem);
  color: var(--ink-soft);
}

.muted {
  color: var(--muted);
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: var(--sp-4);
  color: #fff;
}

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 0.8rem 1.5rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-ink);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn--ghost:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 246, 242, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}

.logo:hover {
  color: var(--ink);
}

.logo svg {
  flex: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.site-nav a {
  display: inline-block;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  padding: var(--sp-2) var(--sp-3);
  border-radius: 6px;
}

.site-nav a:hover {
  color: var(--ink);
  background: var(--surface-alt);
}

.site-nav a[aria-current="page"] {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.site-nav .btn {
  margin-left: var(--sp-2);
  padding: 0.55rem 1.1rem;
}

/* Keep button colours above the generic .site-nav a link colours. */
.site-nav a.btn--primary,
.site-nav a.btn--primary:hover {
  color: #fff;
}

.site-nav a.btn--primary:hover {
  background: var(--accent-ink);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  background: transparent;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink);
}

.nav-toggle .icon-close {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

.nav-toggle[aria-expanded="true"] .icon-menu {
  display: none;
}

@media (max-width: 767.98px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-1);
    padding: var(--sp-4);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: none;
    overflow-y: auto;
    max-height: calc(100dvh - var(--header-h));
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: var(--sp-3) var(--sp-4);
    font-size: 1.0625rem;
  }

  .site-nav .btn {
    margin: var(--sp-2) 0 0;
    text-align: center;
  }

  /* Without JavaScript the toggle cannot open the menu, so keep the
     links visible as a wrapped list under the logo instead. */
  html.no-js .nav-toggle {
    display: none;
  }

  html.no-js .site-header__inner {
    flex-wrap: wrap;
    padding-block: var(--sp-3);
  }

  html.no-js .site-nav {
    display: flex;
    position: static;
    flex-wrap: wrap;
    max-height: none;
    padding: 0;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }
}

/* ---------- Hero ---------- */
.hero {
  padding-block: var(--sp-8);
  overflow: hidden;
}

.hero__grid {
  display: grid;
  gap: var(--sp-7);
  align-items: center;
}

@media (min-width: 900px) {
  .hero {
    padding-block: var(--sp-9);
  }

  .hero__grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: var(--sp-8);
  }
}

.hero h1 {
  margin-bottom: var(--sp-5);
}

.hero .lede {
  max-width: 38rem;
  margin-bottom: var(--sp-6);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.hero__art {
  width: min(100%, 30rem);
  margin-inline: auto;
}

.hero__art svg {
  width: 100%;
  height: auto;
}

/* ---------- Facts strip ---------- */
.facts {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  padding-block: var(--sp-6);
  border-top: 1px solid var(--line);
}

.fact h3 {
  font-size: 1rem;
  margin-bottom: var(--sp-2);
}

.fact p {
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.section--alt .card {
  background: var(--bg);
}

.card__icon {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border-radius: var(--radius);
  color: var(--accent-ink);
  margin-bottom: var(--sp-2);
}

.card h3 {
  margin-bottom: 0;
}

.card p {
  color: var(--ink-soft);
  font-size: 0.9688rem;
}

.card__link {
  margin-top: auto;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent-ink);
}

.card__link:hover {
  text-decoration: underline;
}

/* ---------- Approach / steps ---------- */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-5);
  counter-reset: step;
}

@media (min-width: 900px) {
  .steps {
    grid-template-columns: repeat(4, 1fr);
  }
}

.steps li {
  margin: 0;
  padding: var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  position: relative;
}

.section--alt .steps li {
  background: var(--bg);
}

.steps li::before {
  counter-increment: step;
  content: "0" counter(step);
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-ink);
  margin-bottom: var(--sp-3);
}

.steps h3 {
  font-size: 1.0625rem;
  margin-bottom: var(--sp-2);
}

.steps p {
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

/* ---------- Work / concepts ---------- */
.work-grid {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
}

.work-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.section--alt .work-card {
  background: var(--bg);
}

.work-card__art {
  aspect-ratio: 16 / 10;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
}

.work-card__art svg {
  width: 100%;
  height: 100%;
}

.work-card__body {
  padding: var(--sp-5) var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  flex: 1;
}

.work-card__body h3 {
  margin-bottom: 0;
  font-size: 1.125rem;
}

.work-card__body p {
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  width: fit-content;
}

/* ---------- Contact ---------- */
.contact-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(var(--sp-6), 5vw, var(--sp-8));
  display: grid;
  gap: var(--sp-6);
  align-items: center;
}

@media (min-width: 900px) {
  .contact-card {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

.contact-mail {
  font-size: clamp(1.125rem, 1rem + 1vw, 1.5rem);
  font-weight: 650;
  color: var(--accent-ink);
  overflow-wrap: anywhere;
}

/* ---------- Page hero (subpages) ---------- */
.page-hero {
  padding-block: var(--sp-8) var(--sp-7);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(42rem 20rem at 85% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}

.page-hero p.lede {
  max-width: 44rem;
  margin-bottom: 0;
}

/* ---------- Prose ---------- */
.prose {
  max-width: 46rem;
}

.prose h2 {
  margin-top: var(--sp-7);
  scroll-margin-top: calc(var(--header-h) + var(--sp-4));
}

.prose h2:first-of-type {
  margin-top: 0;
}

.prose h3 {
  margin-top: var(--sp-6);
}

.prose--wide {
  max-width: 56rem;
}

/* ---------- Two-column feature rows ---------- */
.feature-list {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.feature-list li {
  margin: 0;
  padding: var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.section--alt .feature-list li {
  background: var(--bg);
}

.feature-list h3 {
  font-size: 1.0625rem;
  margin-bottom: var(--sp-2);
}

.feature-list p {
  color: var(--ink-soft);
  font-size: 0.9375rem;
  margin-bottom: 0;
}

/* ---------- Service detail blocks ---------- */
.service-block {
  display: grid;
  gap: var(--sp-5);
  padding-block: var(--sp-7);
  border-bottom: 1px solid var(--line);
}

.service-block:last-of-type {
  border-bottom: 0;
}

@media (min-width: 900px) {
  .service-block {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--sp-8);
  }
}

.service-block__aside h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  margin-bottom: var(--sp-3);
}

.service-block__aside .tag {
  margin-bottom: var(--sp-4);
}

.service-block h3 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: var(--sp-5);
}

.service-block ul {
  margin-bottom: 0;
}

.service-block li {
  color: var(--ink-soft);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-block: var(--sp-7);
  margin-top: var(--sp-8);
  font-size: 0.9375rem;
}

.site-footer__grid {
  display: grid;
  gap: var(--sp-6);
}

@media (min-width: 768px) {
  .site-footer__grid {
    grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr));
  }
}

.site-footer h2,
.site-footer h3 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: var(--sp-4);
}

.site-footer nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer nav li {
  margin: 0 0 var(--sp-2);
}

.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent-ink);
  text-decoration: underline;
}

.site-footer__meta {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  justify-content: space-between;
}

/* ---------- 404 ---------- */
.error-page {
  min-height: calc(100dvh - var(--header-h));
  display: grid;
  place-items: center;
  padding-block: var(--sp-8);
  text-align: center;
}

.error-page .code {
  font-family: var(--font-mono);
  font-size: clamp(4rem, 10vw, 7rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: var(--sp-4);
}

.error-page p {
  max-width: 32rem;
  margin-inline: auto;
}

.error-page .hero__actions {
  justify-content: center;
  margin-top: var(--sp-6);
}

/* ---------- Reveal animation ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal-ready .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }

  .reveal-ready .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Print ---------- */
@media print {
  .site-header,
  .site-footer,
  .hero__art,
  .btn {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}
