/* 110.dk — one stylesheet for every page. The page is a kept ledger sheet:
   near-white paper, near-black ink, one red margin rule. See DESIGN.md. */

@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('/fonts/schibsted-grotesk-var.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: 'Geist';
  src: url('/fonts/geist-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Fragment Mono';
  src: url('/fonts/fragment-mono.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #fbfbf9;
  --paper-deep: #f4f4f1;
  --ink: #141519;
  --ink-soft: rgba(20, 21, 25, 0.6);
  --feint: #dededa;
  --rule: #c73e2c;
  --margin: clamp(1.5rem, 7vw, 6rem);
  --gutter: var(--margin);   /* text sits as far from the rule as the rule sits from the edge */
  --right: clamp(1.25rem, 5vw, 4rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: 'Geist', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Fragment Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}
@supports (color: oklch(50% 0 0)) {
  :root {
    --paper: oklch(98.4% 0.002 95);
    --paper-deep: oklch(96.3% 0.003 95);
    --ink: oklch(17% 0.012 265);
    --ink-soft: oklch(17% 0.012 265 / 0.6);
    --feint: oklch(89% 0.003 95);
    --rule: oklch(55% 0.185 27);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
body {
  position: relative;   /* the margin rule spans the whole page and scrolls with it */
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100svh;
}
::selection { background: rgba(199, 62, 44, 0.16); }   /* a tint, not a block: the red blocks looked goofy on the headline */
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--rule); outline-offset: 3px; }
strong, b { font-weight: 500; color: var(--ink); }
.stop { color: var(--rule); }

/* ---------- the red margin rule ---------- */
.margin-rule {
  /* one line from the top of the page to the bottom, part of the page, not the screen;
     the branch to the button on the contact screen grows out of it */
  position: absolute;
  top: 0; bottom: 0;
  left: var(--margin);
  width: 2px;
  background: var(--rule);
  transform-origin: top;
  z-index: 3;
  pointer-events: none;
}

/* ---------- page frame: everything hangs right of the rule ---------- */
.frame {
  position: relative;
  z-index: 2;
  padding-left: calc(var(--margin) + 2px + var(--gutter));   /* +2px: the rule's own width */
  padding-right: var(--right);
}
header.site {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-top: clamp(1.5rem, 3.5vh, 2.75rem);
}
.mark { font-weight: 700; font-size: 1.3rem; letter-spacing: -0.01em; }
.mark a { text-decoration: none; }

/* ---------- the login link: quiet, top right, out of the headline's way ---------- */
.login {
  position: fixed;
  top: clamp(1rem, 2.6vh, 1.75rem);
  right: var(--right);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  height: 3.25rem;
  padding: 0 0.9rem;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--feint);
  box-shadow: 0 1px 2px rgba(20, 21, 25, 0.06), 0 8px 24px -12px rgba(20, 21, 25, 0.25);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.login:hover {
  color: var(--ink);
  border-color: rgba(20, 21, 25, 0.28);
  box-shadow: 0 1px 2px rgba(20, 21, 25, 0.08), 0 12px 28px -12px rgba(20, 21, 25, 0.32);
}
.login:focus-visible { outline: 2px solid var(--rule); outline-offset: 3px; }

/* ---------- the language toggle: two flags, one knob, top centre ---------- */
.lang {
  --w: 6.75rem;
  --h: 3.25rem;
  --pad: 0.3rem;
  --disc: calc(var(--h) - 2 * var(--pad));
  position: fixed;
  top: clamp(1rem, 2.6vh, 1.75rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: var(--w);
  height: var(--h);
  border: 1px solid var(--feint);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(20, 21, 25, 0.06), 0 8px 24px -12px rgba(20, 21, 25, 0.25);
  cursor: pointer;
  padding: 0 var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.lang:hover { border-color: rgba(20, 21, 25, 0.28); box-shadow: 0 1px 2px rgba(20, 21, 25, 0.08), 0 12px 28px -12px rgba(20, 21, 25, 0.32); }
.lang:focus-visible { outline: 2px solid var(--rule); outline-offset: 3px; }
.lang:active .knob { transform: translateX(var(--x)) scale(0.9); }
.flag {
  position: relative;
  z-index: 2;
  width: var(--disc);
  height: var(--disc);
  border-radius: 50%;
  overflow: hidden;
  opacity: 0.32;
  filter: grayscale(1);
  transform: scale(0.74);
  transition: opacity 0.5s var(--ease), filter 0.5s var(--ease), transform 0.5s var(--ease);
}
/* the SVGs are set to slice, so each flag fills its circle instead of fitting inside it */
.flag svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.knob {
  --x: 0;
  position: absolute;
  /* measured from the pill's padding box (inside its 1px border), exactly where the flags sit */
  top: calc(var(--pad) - 1px);
  left: var(--pad);
  width: var(--disc);
  height: var(--disc);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--feint), 0 2px 6px -1px rgba(20, 21, 25, 0.28);
  transform: translateX(var(--x));
  transition: transform 0.5s var(--ease);
  z-index: 1;
}
.flag-en { opacity: 1; filter: none; transform: scale(0.9); }
.en .knob { --x: calc(var(--w) - 2px - var(--disc) - 2 * var(--pad)); }
html:not(.en) .flag-en { opacity: 0.32; filter: grayscale(1); transform: scale(0.74); }
html:not(.en) .flag-da { opacity: 1; filter: none; transform: scale(0.9); }
.js h1.reveal.in { transition-duration: 0.4s; }
.js h1.reveal.in.swap { opacity: 0; transform: translateY(6px); transition-duration: 0.22s; }

/* ---------- the one page: headline left, the field right ---------- */
.split {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);   /* a long rolling word must never widen the page */
}
.left {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding-right: 4.5rem;
}
.left h1 { margin: auto 0; }
h1 {
  /* two-column layouts: the column is 50vw minus margin, gutter (both 7vw) and the toggle lane;
     the longest line ("automatiserings") is ~7.6em wide, so the size follows the column */
  font-size: clamp(1.8rem, calc((36vw - 4.5rem) / 7.7), 5.6rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
  max-width: min(14ch, 100%);   /* never wider than the column, whatever word is rolling */
  padding: clamp(2rem, 6vh, 4rem) 0;
}
h1 .line { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1 .line.end { display: inline; }
/* the rotating word: a one-line window on a column of words; it is the red thing */
.rotor {
  overflow: hidden;
  /* slack on the left so an optically shifted word is never clipped by the window */
  margin-left: -0.09em;
  padding-left: 0.09em;
  /* exactly one line tall, rows one line apart: the window never overlaps its neighbours,
     and the 1.1 leading leaves room for ascenders and descenders. The top and bottom few
     percent fade out, so a neighbouring word's descender can never show as a sliver. */
  height: 1.08em;   /* Geist's tallest ink (ascender to descender) is 1.06em at this leading */
  color: var(--rule);
}
.rotor.rolling {
  /* only while a roll is in progress: descenders crossing the edges fade instead of being cut */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 90%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 90%, transparent 100%);
}
.rotor .column {
  display: block;
  transition: transform 0.95s cubic-bezier(0.77, 0, 0.175, 1);
}
.rotor .word { display: block; height: 1.08em; white-space: nowrap; }
.rotor { -webkit-user-select: none; user-select: none; }   /* the hidden words in the column would otherwise select and copy */
.right { min-height: 100svh; }
.field {
  /* the whole page is the field; the mask lets it drift into the left half and
     thin out around the headline, so paper and dots meet softly, not at an edge */
  position: absolute;
  inset: 0 0 -55svh 0;   /* overhangs the second screen by half a viewport */
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2s var(--ease);
  -webkit-mask-image:
    linear-gradient(to right, transparent 30%, #000 72%),
    radial-gradient(70% 60% at 24% 52%, transparent 0 34%, #000 100%),
    linear-gradient(to bottom, #000 55%, transparent 98%);
  -webkit-mask-composite: source-in;
          mask-image:
    linear-gradient(to right, transparent 30%, #000 72%),
    radial-gradient(70% 60% at 24% 52%, transparent 0 34%, #000 100%),
    linear-gradient(to bottom, #000 55%, transparent 98%);
          mask-composite: intersect;
}
.field.on { opacity: 1; }
.field canvas { display: block; width: 100%; height: 100%; }

/* ---------- the second screen: one line, one button ---------- */
.contact {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.contact-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(2.5rem, 7vh, 4.5rem);
  padding: clamp(3rem, 8vh, 6rem) 0;
  /* span the whole page width, so the line and the button centre under the toggle */
  margin-left: calc(-1 * (var(--margin) + 2px + var(--gutter)));
  margin-right: calc(-1 * var(--right));
}
.say {
  font-size: clamp(1.5rem, 3.2vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
/* the red rule turns the corner and leads to the button */
.beam-row {
  display: flex;
  align-items: center;
  align-self: stretch;
}
.lead, .lead-spacer { flex: 1; height: 2px; }
.lead { margin-left: var(--margin); }          /* starts on the rule */
.lead-spacer { margin-right: var(--margin); }  /* same on the right, so the button stays centred */
.lead {
  background: var(--rule);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 2.6s var(--ease);
}
.contact.in .lead { transform: scaleX(1); }

/* the button: an ink pill with a red beam running round it */
@property --a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.beam {
  --spin: 7s;
  position: relative;
  display: inline-flex;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.4s var(--ease);
  flex: none;
}
.beam:hover, .beam:focus-visible { transform: translateY(-2px); }  /* speed-up is eased in script, so the beam never jumps */
.beam:focus-visible { outline: 2px solid var(--rule); outline-offset: 6px; }
.beam-glow, .beam-ring {
  background: conic-gradient(from var(--a) at 50% 50%, transparent 0 58%, var(--rule) 92%, transparent 100%);
  animation: beam var(--spin) linear infinite;
}
.beam-glow {
  position: absolute;
  inset: -7px;
  border-radius: 999px;
  filter: blur(12px);
  opacity: 0.55;
  transition: opacity 0.4s var(--ease);
}
.beam:hover .beam-glow { opacity: 0.85; }
.beam-ring {
  position: relative;
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background-color: rgba(20, 21, 25, 0.35);
  box-shadow: 0 10px 30px -18px rgba(20, 21, 25, 0.5);
}
.beam-face {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.95em 1.7em;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  font-weight: 500;
  letter-spacing: 0.005em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.beam-face svg { transition: transform 0.35s var(--ease); }
.beam:hover .beam-face svg { transform: translateX(3px); }
@keyframes beam { to { --a: 360deg; } }

/* ---------- footer ---------- */
footer.site {
  line-height: 2;
  padding-top: 1.25rem;
  padding-bottom: clamp(1.5rem, 4vh, 2.5rem);
  border-top: 1px solid var(--feint);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
footer.site a { text-decoration: none; }
footer.site a:hover { color: var(--ink); }
/* one dot after every item but the last; inline-block so a link's underline does not run under it */
footer.site > *:not(:last-child)::after { content: '·'; display: inline-block; margin: 0 1em; color: var(--ink-soft); text-decoration: none; }

/* ---------- legal pages ---------- */
.legal main {
  padding-top: clamp(2.5rem, 7vh, 4.5rem);
  padding-bottom: clamp(3rem, 8vh, 5rem);
}
.legal article { max-width: 40rem; }
.legal h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  max-width: none;
}
.legal .updated {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 0.75rem;
  margin-bottom: 2.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--feint);
}
.legal h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2.25rem 0 0.5rem;
}
.legal p { margin-bottom: 1rem; max-width: 65ch; }
.legal p:last-child { margin-bottom: 0; }
.legal article a {
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}

/* ---------- responsive ---------- */
@media (max-width: 560px) {
}

@media (max-width: 820px) {
  .lang { --w: 5.75rem; --h: 2.75rem; }
  .login { height: 2.75rem; padding: 0 0.6rem; }
  header.site { padding-top: clamp(1.5rem, 3.5vh, 2.75rem); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .left, .right { min-height: 50svh; }
  /* the toggle sits at the top on phones, so the headline starts below it and the
     right-hand lane reserved for it on desktop is not needed */
  .left { padding-top: calc(2.75rem + clamp(1rem, 2.6vh, 1.75rem) + 2rem); padding-right: var(--right); }
  .left h1 { margin: 0; }
  /* phones: sized to the width so "110 løsninger" and the longest rolling word stay on one line */
  h1 { font-size: clamp(1.9rem, 10.3vw, 3.4rem); padding: clamp(1.5rem, 5vh, 3rem) 0; }
  .field {
    inset: 0 0 -16svh 0;   /* a shorter overhang: the dots must be gone before the contact line */
    -webkit-mask-image: linear-gradient(to bottom, transparent 34%, #000 50%, #000 72%, transparent 98%);
    -webkit-mask-composite: source-over;
            mask-image: linear-gradient(to bottom, transparent 34%, #000 50%, #000 72%, transparent 98%);
            mask-composite: add;
  }
}

/* ---------- leaving for the client login ---------- */
/* The login page loads a background video, and a loading video makes Chrome skip the
   cross-document transition (measured: block the video and it runs). So going that way the site
   fades to the login's own colour instead — dark on desktop, white on phones, matching its
   breakpoint — while the browser loads the page. The navigation is not delayed: the old document
   stays on screen until the new one is ready, which is exactly when the veil is doing its work. */
.veil {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: #0a0b0d;
  opacity: 0;
  transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1);   /* most of the way dark within ~120ms, before the page swaps */
  pointer-events: none;
}
.veil.on { opacity: 1; }
@media (max-width: 720px) { .veil { background: #ffffff; } }

/* ---------- moving between this site and the client login at /login ---------- */
/* Same origin (the login is proxied under 110.dk), so the two documents can hand over with a
   cross-document view transition instead of a hard cut: paper dissolves into the dark login and
   back. Pure CSS — the login page's CSP allows no scripts. The matching opt-in lives in
   110-books' web/static/style.css; both documents must declare it or nothing happens. */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 420ms;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- motion: only when scripts run; the page reads fine without ---------- */
.js .margin-rule { transform: scaleY(0); transition: transform 3.2s var(--ease); }
.js body.loaded .margin-rule { transform: none; }
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .beam-glow, .beam-ring { animation: none; }
  .rotor .column { transition: none; }
  .lead { transition: none; }
  .js .margin-rule, .js .reveal, .field { transition: none; }
  .js .margin-rule, .js .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
