/* sidelaget.no — two colours, two typefaces, one index. */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibmplexsans.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibmplexsans-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #EBEEE8;
  --ink: #1A2E2A;
  --ink-soft: color-mix(in oklab, var(--ink) 74%, var(--paper));
  --rule: color-mix(in oklab, var(--ink) 22%, var(--paper));
  --rule-strong: color-mix(in oklab, var(--ink) 45%, var(--paper));

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;

  --measure: 62ch;
  --index-w: 11.5rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --section-gap: clamp(4.5rem, 12vh, 8rem);
}

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

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 100%;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--paper);
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--index-w) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "top   top"
    "index page"
    "foot  foot";
  column-gap: var(--gutter);
  padding: 0 var(--gutter);
}

/* Language switching: the other målform is simply not rendered. */
html[data-lang="nb"] [lang="nn"],
html[data-lang="nn"] [lang="nb"] { display: none; }

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

/* Header */
.top {
  grid-area: top;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.25rem 0 0;
  font-size: 0.9375rem;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.top-right { display: flex; gap: 1.75rem; align-items: baseline; }
.top-mail { white-space: nowrap; }
.lang { display: flex; gap: 0.75rem; }
.lang button {
  all: unset;
  cursor: pointer;
  color: var(--ink-soft);
  padding-bottom: 0.1em;
  border-bottom: 1px solid transparent;
}
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); cursor: default; }
.lang button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* The index: thumb tabs down the margin. It is the navigation and the signature. */
.index {
  grid-area: index;
  align-self: start;
  position: sticky;
  top: 0;
  padding-top: var(--section-gap);
  font-size: 0.875rem;
  line-height: 1.3;
}
.index ul { list-style: none; margin: 0; padding: 0; border-right: 1px solid var(--rule); }
.index li { margin: 0; }
.index a {
  display: block;
  position: relative;
  padding: 0.55rem 1.25rem 0.55rem 0;
  color: var(--ink-soft);
  text-decoration: none;
}
.index a::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 0.75rem;
  height: 1px;
  background: var(--rule-strong);
  transform: translateY(-50%);
  transition: width 180ms ease, height 180ms ease;
}
.index a:hover { color: var(--ink); }
.index a.is-active { color: var(--ink); }
.index a.is-active::after { width: 1.5rem; height: 2px; background: var(--ink); }

/* Content column */
.page { grid-area: page; max-width: calc(var(--measure) + 4rem); }
section { padding-top: var(--section-gap); scroll-margin-top: 2rem; }
section:last-of-type { padding-bottom: var(--section-gap); }

h1, h2, .lede, .pull, .big-mail, .steps li::before, .ladder dt {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 400;
}
h1 {
  font-size: clamp(2.5rem, 6.5vw, 4.75rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 1.5rem;
  max-width: 14ch;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
}
p { margin: 0 0 1.1rem; max-width: var(--measure); font-size: 1.0625rem; }
.lede {
  font-size: clamp(1.25rem, 2.2vw, 1.5rem);
  line-height: 1.4;
  max-width: 40ch;
  margin-bottom: 2rem;
}
.byline { color: var(--ink-soft); font-size: 0.9375rem; }
.hero { padding-top: clamp(3rem, 10vh, 6rem); }

/* The ladder of what you can get: one rule between each rung, no cards. */
.ladder { margin: 0 0 2rem; max-width: var(--measure); border-top: 1px solid var(--rule); }
.ladder > div {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) 1fr;
  gap: 0.5rem 2rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}
.ladder dt { font-size: 1.375rem; line-height: 1.2; margin: 0; }
.ladder dd { margin: 0; font-size: 1rem; color: var(--ink-soft); padding-top: 0.2rem; }
.pull { font-size: 1.375rem; line-height: 1.35; font-style: italic; max-width: 34ch; }

/* The steps are the one real sequence on the page, so they are the one numbered thing. */
.steps {
  list-style: none;
  counter-reset: step;
  margin: 2rem 0 0;
  padding: 0;
  max-width: var(--measure);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  border-top: 1px solid var(--rule);
}
.steps li { counter-increment: step; padding-top: 0.9rem; font-size: 0.9375rem; line-height: 1.35; }
.steps li::before {
  content: counter(step);
  display: block;
  font-size: 2.25rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  font-variant-numeric: lining-nums;
}

/* The example: two real screenshots in hairline frames, no shadow, no device chrome. */
.shots { position: relative; margin: 0 0 1.5rem; max-width: var(--measure); }
.shots img { display: block; height: auto; border: 1px solid var(--rule-strong); background: #EDE9E0; }
.shot-desktop { width: 86%; }
.shot-phone { position: absolute; right: 0; bottom: 2.5rem; width: 22%; }
.shots figcaption { margin-top: 0.75rem; font-size: 0.9375rem; }

.big-mail {
  display: inline-block;
  font-size: clamp(1.75rem, 4.5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0.25rem 0 1.25rem;
  text-decoration-thickness: 1px;
  word-break: break-all;
}
.big-mail:hover { text-decoration-thickness: 2px; }

/* Footer */
.foot {
  grid-area: foot;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.foot p { margin: 0; }

/* Language cross-fade */
.page, .index { transition: opacity 160ms ease; }
html.is-switching .page, html.is-switching .index { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .page, .index, .index a::after { transition: none; }
}

/* Narrow screens: the index becomes a row under the header. */
@media (max-width: 56rem) {
  body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      "top"
      "index"
      "page"
      "foot";
  }
  .top { flex-wrap: wrap; row-gap: 0.5rem; }
  .top-right { gap: 1.25rem; }
  .index {
    top: 0;
    padding: 0.75rem 0 0;
    margin: 0 calc(-1 * var(--gutter));
    background: var(--paper);
    z-index: 1;
  }
  .index ul {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 0 var(--gutter);
  }
  .index ul::-webkit-scrollbar { display: none; }
  .index a { white-space: nowrap; padding: 0.5rem 0.75rem 0.6rem 0; }
  .index a::after {
    right: auto; left: 0; top: auto; bottom: -1px;
    width: 0; height: 2px; transform: none;
    transition: width 180ms ease;
  }
  .index a.is-active::after { width: 100%; }
  section { padding-top: 3.5rem; scroll-margin-top: 3.5rem; }
  .hero { padding-top: 2.5rem; }
  .ladder > div { grid-template-columns: 1fr; gap: 0.25rem; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .shot-desktop { width: 100%; }
  .shot-phone { width: 26%; bottom: -1.5rem; right: -0.25rem; }
  .shots { margin-bottom: 3rem; }
  .foot { flex-direction: column; }
}
@media (max-width: 24rem) {
  .top-right { flex-wrap: wrap; }
}
