/* Sparqs — temporary site, until the new product launches.
   One family (Familjen Grotesk), one signal colour (Sparqs yellow), one motif: the bar. */

@font-face {
  font-family: "Familjen Grotesk";
  src: url("../fonts/familjen-grotesk-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* Metric-matched fallback so the swap to the webfont doesn't shift the layout. */
@font-face {
  font-family: "Familjen Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica");
  size-adjust: 95%;
  ascent-override: 107.4%;
  descent-override: 24.2%;
  line-gap-override: 0%;
}

:root {
  --paper: #ffffff;
  --band: #f3f4f2;
  --ink: #1d1d1b;       /* the wordmark's own ink */
  --ink-soft: #5c5c57;
  --rule: #e4e4e0;
  --signal: #fcc043;    /* Sparqs yellow, from the brandmark */
  --signal-tint: rgb(252 192 67 / 0.38);

  --font: "Familjen Grotesk", "Familjen Fallback", system-ui, sans-serif;

  --gutter: clamp(1.25rem, 0.5rem + 3.5vw, 4rem);
  --max: 84rem;
  --space-section: clamp(5rem, 3rem + 9vw, 11rem);

  --line: #a8770f;      /* drafting line: Sparqs yellow taken down to ochre so 1px lines hold on white */
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-draw: cubic-bezier(0.65, 0, 0.15, 1);
  --ease-settle: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.6;
  font-weight: 400;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 2px;
}

.nowrap {
  white-space: nowrap;
}

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: 0.75rem;
  z-index: 20;
  padding: 0.5rem 0.875rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus-visible {
  transform: none;
  outline-color: var(--signal);
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Placeholders that still need real content. Remove the class once filled in. */
.ph {
  background: var(--signal-tint);
  color: inherit;
  padding: 0 0.08em;
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ---------- Header ---------- */

.masthead {
  padding-block: clamp(1.25rem, 0.75rem + 1.5vw, 2.25rem);
}

.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.masthead__home {
  display: block;
  border-radius: 2px;
}

/* The logo files have a large empty artboard around the artwork.
   These wrappers crop to the artwork's bounds without touching the files. */
.logo {
  position: relative;
  display: block;
  width: clamp(7.75rem, 6.5rem + 4vw, 10rem);
  aspect-ratio: 602.01 / 140.36;
  overflow: hidden;
}

.logo img {
  position: absolute;
  width: 139.847%;
  max-width: none;
  height: auto;
  left: -20.340%;
  top: -146.368%;
}

.mark {
  position: relative;
  display: block;
  width: 1.75rem;
  aspect-ratio: 1;
  overflow: hidden;
  flex: none;
}

.mark img {
  position: absolute;
  width: 297.005%;
  max-width: none;
  height: auto;
  left: -90.429%;
  top: -52.452%;
}

.lang {
  display: flex;
  align-items: center;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
}

.lang a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 160ms ease;
}

/* Drawn in from the left, withdrawn to the right */
.lang a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.55rem;
  width: 1.15rem;
  height: 2px;
  margin-left: -0.575rem;
  background: var(--signal);
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 420ms var(--ease-draw);
}

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

.lang a:hover::after,
.lang a[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: 0 50%;
}

.lang a[aria-current="page"] {
  color: var(--ink);
}

.lang__sep {
  color: var(--rule);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  /* Fills the first screen, but stops growing on very tall windows */
  min-height: min(calc(100svh - 7rem), 60rem);
  display: flex;
  flex-direction: column;
  padding-block: clamp(2.5rem, 1rem + 4vw, 5rem);
}

/* Optical centre: the free space splits 2:3, so the headline sits a little above the middle */
.hero::before,
.hero::after {
  content: "";
}

.hero::before {
  flex: 2 1 0;
}

.hero::after {
  flex: 3 1 0;
}

.hero > .wrap {
  position: relative;
  z-index: 1;
  display: grid;
  row-gap: 0;
}

.hero__title {
  position: relative;
  font-size: clamp(3.5rem, 10vw, 10rem);
  line-height: 0.92;
  font-weight: 600;
  letter-spacing: -0.045em;
  text-wrap: balance;
  margin-left: -0.05em; /* optical alignment of the V/W with the grid edge */
}

/* The headline is split into letters for the animation; screen readers get the .sr-only copy. */
.hero__title .word {
  white-space: nowrap;
}

html.js .hero__title .g {
  display: inline-block;
  transform-origin: 50% 70%;
}

/* The bar — "där lägger vi ribban". */
.bar {
  height: clamp(0.4rem, 0.25rem + 0.45vw, 0.75rem);
  margin-top: clamp(1.75rem, 1rem + 2.5vw, 3.25rem);
  background: var(--signal);
}

.hero__lede {
  margin-top: clamp(1.75rem, 1rem + 2.5vw, 3rem);
  max-width: 30ch;
  font-size: clamp(1.25rem, 0.95rem + 1.1vw, 1.875rem);
  line-height: 1.32;
  letter-spacing: -0.012em;
  text-wrap: pretty;
}

/* Hero animation: guidelines and spacing brackets (js/hero.js) */
.hero__guides,
.hero__marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero__guides {
  overflow: hidden;
}

.guide {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
  transform-origin: 0 50%;
}

.guide-label {
  position: absolute;
  right: var(--gutter);
  padding-bottom: 5px;
  font: 400 10px/1 var(--mono);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--line);
  transform: translateY(-100%);
}

.bracket {
  position: absolute;
  height: 9px;
  margin-top: -4.5px;
  border-inline: 1px solid var(--line);
  background: linear-gradient(var(--line), var(--line)) center / 100% 1px no-repeat;
  opacity: 0;
}

.bracket--click {
  height: 7px;
  margin-top: 0;
  border-top: 0;
  background-position: bottom;
}

/* ---------- Sections ---------- */

.section {
  padding-block: var(--space-section);
}

.section:not(.section--band) + .section:not(.section--band) {
  padding-top: 0;
}

.section--band {
  background: var(--band);
}

.grid {
  display: grid;
  align-items: start;
}

.label {
  font-size: 0.9375rem;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--ink-soft);
}

.eyebrow {
  margin-bottom: clamp(1rem, 0.75rem + 0.75vw, 1.5rem);
}

/* Headings sit on the outer axis, like the hero headline; text runs on the inner axis */
.statement {
  position: relative;
  max-width: 18ch;
  font-size: clamp(2.125rem, 1.25rem + 3.4vw, 4.25rem);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.032em;
  text-wrap: balance;
}

.body {
  display: grid;
  row-gap: 1.25em;
  max-width: 38rem;
  margin-top: clamp(2rem, 1.25rem + 2.5vw, 3.5rem);
  text-wrap: pretty;
}

.body p {
  hanging-punctuation: first;
}

/* A larger reading size for the sections that make one point */
.body--lede {
  max-width: 34ch;
  font-size: clamp(1.25rem, 1rem + 0.85vw, 1.75rem);
  line-height: 1.38;
  letter-spacing: -0.01em;
}

/* How we work */
.principles {
  list-style: none;
  margin: clamp(2rem, 1.25rem + 2.5vw, 3.5rem) 0 0;
  padding: 0;
}

.principle {
  position: relative;
  display: grid;
  row-gap: 0.75rem;
  padding-block: clamp(1.75rem, 1.25rem + 1.5vw, 2.75rem);
}

.principle::before,
.principle::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: var(--rule);
  transform-origin: 0 50%;
}

/* Hover: an ink line is drawn over the hairline from the left, and withdrawn to the right */
.principle::after {
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 700ms var(--ease-draw);
}

.principle:hover::after {
  transform: scaleX(1);
  transform-origin: 0 50%;
}

.principle:last-child {
  padding-bottom: 0;
}

.principle h3 {
  position: relative;
  font-size: clamp(1.375rem, 1.05rem + 1.1vw, 2rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.principle p {
  max-width: 38rem;
  text-wrap: pretty;
}

/* Contact: the address rests on the bar, which closes the page the way the hero opens it */
.contact {
  margin-top: clamp(2.5rem, 1.5rem + 3vw, 4rem);
}

.email {
  position: relative;
  display: inline-block;
  padding-bottom: 0.32em;
  font-size: clamp(1.75rem, 1.1rem + 2.6vw, 3.25rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.email::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.12em;
  background: var(--signal);
  transform-origin: 0 100%;
  transition: transform 320ms var(--ease-settle);
}

.email:hover::after,
.email:focus-visible::after {
  transform: scaleY(1.9);
}

/* Words in headings are wrapped by js/sections.js so they can settle */
.w {
  display: inline-block;
}

/* A baseline drawn under a heading as it is set, then withdrawn */
.hguide {
  position: absolute;
  left: 0;
  height: 1px;
  background: var(--line);
  transform-origin: 0 50%;
  pointer-events: none;
  animation: hguide 1700ms var(--ease-draw) both;
}

@keyframes hguide {
  0% { transform: scaleX(0); opacity: 0.85; }
  45% { transform: scaleX(1); opacity: 0.85; }
  70% { opacity: 0.85; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* Hero letter inspector (desktop): the ink edges of a letter and the spacing either side, in font units */
.edge {
  position: absolute;
  width: 1px;
  background: var(--line);
  opacity: 0;
  pointer-events: none;
}

.edge.is-on {
  opacity: 0.75;
  transition: opacity 160ms ease;
}

.bracket.is-on {
  opacity: 1;
  transition: opacity 160ms ease;
}

.bracket b {
  position: absolute;
  left: 50%;
  bottom: 100%;
  padding-bottom: 4px;
  font: 400 10px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--line);
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ---------- 404 ---------- */

.notfound {
  min-height: min(calc(100svh - 7rem), 44rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(3rem, 2rem + 4vw, 6rem);
}

.notfound .statement {
  font-size: clamp(2.75rem, 1.1rem + 6.4vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.042em;
  max-width: none;
}

.notfound__links {
  display: grid;
  gap: 0.75rem;
  margin-top: clamp(1.75rem, 1rem + 2.5vw, 3rem);
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
}

.notfound__links span {
  color: var(--ink-soft);
}

.notfound__links a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.notfound__links a:hover {
  text-decoration-color: var(--signal);
  text-decoration-thickness: 2px;
}

/* ---------- Footer ---------- */

.colophon {
  padding-block: clamp(2.5rem, 2rem + 2vw, 4rem) clamp(2.5rem, 2rem + 2vw, 3.5rem);
}

.colophon .wrap > div {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-top: clamp(2rem, 1.5rem + 1.5vw, 3rem);
  border-top: 1px solid var(--rule);
}

.colophon p {
  max-width: 42ch;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink-soft);
  padding-top: 0.12rem;
}

/* ---------- Reading progress: the bar again, filling as you read ---------- */

.progress {
  display: none;
}

@supports (animation-timeline: scroll()) {
  .progress {
    display: block;
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 10;
    height: 3px;
    background: var(--signal);
    transform-origin: 0 50%;
    transform: scaleX(0);
    animation: progress linear both;
    animation-timeline: scroll(root block);
    pointer-events: none;
  }
}

@keyframes progress {
  to {
    transform: scaleX(1);
  }
}

/* ---------- Wide screens ---------- */

@media (min-width: 60rem) {
  .grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 2rem;
    row-gap: 0;
  }

  .grid > * {
    grid-column: 4 / -1;
  }

  .grid > .statement,
  .grid > .eyebrow {
    grid-column: 1 / span 9;
  }

  .grid > .body {
    grid-column: 4 / span 7;
  }

  .grid > .body--lede {
    grid-column: 4 / span 8;
  }

  .hero > .wrap {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 2rem;
  }

  .hero__title,
  .bar {
    grid-column: 1 / -1;
  }

  .hero__lede {
    grid-column: 4 / span 7;
  }

  .principle {
    grid-template-columns: repeat(9, minmax(0, 1fr));
    column-gap: 2rem;
  }

  .principles {
    grid-column: 4 / -1;
  }

  .principle h3 {
    grid-column: 1 / span 4;
    max-width: 16ch;
  }

  .principle p {
    grid-column: 5 / span 5;
  }

  .colophon .wrap > div {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 2rem;
  }

  .colophon .mark {
    grid-column: 1 / span 3;
  }

  .colophon p {
    grid-column: 4 / span 6;
  }
}

/* Long Swedish compounds on narrow screens */
@media (max-width: 30rem) {
  :lang(sv) .body p,
  :lang(sv) .principle p {
    -webkit-hyphens: auto;
    hyphens: auto;
    hyphenate-limit-chars: 12 5 5;
  }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  /* Typography rebuilt: every letter is readable from the first frame, just not yet set.
     The script settles them; .is-set (or .hero-static if the script never runs) is the final state. */
  html.js:not(.hero-static) .hero__title:not(.is-set) .g {
    transform: translate(calc(var(--j) * 0.014em), var(--dy)) rotate(var(--r));
    opacity: 0.5;
  }

  .hero__lede {
    animation: settle 900ms var(--ease-out) 350ms both;
  }

  /* On scroll (js/sections.js marks elements .is-pending, then .is-in as they arrive).
     Headings are set like the hero: words start a touch too loose and settle into place,
     against a baseline that is drawn and withdrawn. Text then appears; it does not slide. */
  .is-pending .w {
    transform: translate(calc(var(--k) * 0.045em), var(--dy));
    opacity: 0.3;
  }

  .is-in .w {
    transition:
      transform 1300ms var(--ease-settle) calc(var(--i) * 80ms + 120ms),
      opacity 900ms ease calc(var(--i) * 80ms + 120ms);
  }

  .body.is-pending,
  .eyebrow.is-pending,
  .principle.is-pending p {
    opacity: 0;
  }

  .body.is-in,
  .eyebrow.is-in {
    transition: opacity 1000ms ease 550ms;
  }

  .eyebrow.is-in {
    transition-delay: 0ms;
  }

  .principle.is-in p {
    transition: opacity 1000ms ease 650ms;
  }

  .principle.is-pending::before {
    transform: scaleX(0);
  }

  .principle.is-in::before {
    transition: transform 1300ms var(--ease-draw);
  }

  /* The bar is set under the address */
  .contact.is-pending .email::after {
    transform: scaleX(0);
  }

  .contact.is-in .email::after {
    transition: transform 1400ms var(--ease-draw) 350ms;
  }
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .lang a::after,
  .principle::after,
  .email::after {
    transition: none;
  }

  .hguide {
    display: none;
  }

  .progress {
    display: none;
  }
}

@media print {
  .progress,
  .skip,
  .lang {
    display: none;
  }

  .hero {
    min-height: 0;
  }
}
