/* ==========================================================================
   openterms.no — the terms document (doc.css)
   One stylesheet for every place the terms are read: the editor's live
   preview and result (.paper .ot-doc), and the hosted page /t/<id>
   (body.ot-page), which loads NOTHING else — so this file brings its own
   fonts, tokens and box-sizing (openlink's lesson: a stylesheet a page
   loads on its own must carry its own base).

   Hosted pages follow the reader's system theme; the editor's paper
   follows the editor's theme (the tokens below yield to styles.css
   there, because they are declared on .ot-page only).
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-var-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1EFF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

/* ------------------------------------------------ the hosted page's base */

.ot-page {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --text: #171717;
  --text-2: #555555;
  --text-3: #6f6f6f;
  --border: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.12);
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  .ot-page {
    --bg: #0e0e0e;
    --surface: #171717;
    --surface-2: #0e0e0e;
    --text: #ededed;
    --text-2: #b0b0b0;
    --text-3: #9a9a9a;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    color-scheme: dark;
  }
}

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

.ot-bar {
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 20px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  font-size: 13.5px;
}

.ot-back {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

@media (hover: hover) { .ot-back:hover { text-decoration: underline; text-underline-offset: 3px; } }

.ot-langs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface);
}

.ot-langs a {
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
}

.ot-langs a[aria-current] { background: var(--text); color: var(--bg); font-weight: 600; }
@media (hover: hover) { .ot-langs a:not([aria-current]):hover { color: var(--text); } }

.ot-main {
  max-width: 820px;
  margin: 16px auto 48px;
  padding: 0 20px;
}

.ot-main > .ot-doc {
  background: var(--surface);
  border-radius: 24px;
  padding: clamp(24px, 5vw, 56px);
}

.ot-missing .ot-doc h1 { margin-bottom: 8px; }

/* ------------------------------------------------------------ the article */

.ot-doc {
  color: var(--text);
  overflow-wrap: break-word;
}

.ot-doc h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 4.4vw, 40px);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.ot-doc h2 {
  margin: 2.2em 0 0.6em;
  font-size: 1.3em;
  font-weight: 620;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.ot-doc h3 {
  margin: 1.7em 0 0.5em;
  font-size: 1.05em;
  font-weight: 620;
  line-height: 1.3;
}

.ot-doc p, .ot-doc ul { margin: 0 0 1em; }
.ot-doc ul { padding-left: 1.2em; }
.ot-doc li + li { margin-top: 0.35em; }
.ot-doc strong { font-weight: 620; }

.ot-doc a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

@media (hover: hover) { .ot-doc a:hover { text-decoration-color: currentColor; } }

.ot-doc .ot-meta {
  margin: 0 0 1.8em;
  font-family: var(--font-mono);
  font-size: 0.72em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.ot-doc .ot-head + p { font-size: 1.06em; }

.ot-doc .ot-summary {
  margin: 1.4em 0 0;
  padding: 1.2em 1.4em 0.4em;
  border-radius: 16px;
  background: var(--surface-2);
}

.ot-doc .ot-summary h2 { margin: 0 0 0.6em; font-size: 1.05em; }
.ot-doc .ot-summary ul { list-style: none; padding: 0; }


.ot-doc .ot-lines { line-height: 1.55; }


.ot-doc .ot-credit {
  margin: 3em 0 0;
  font-family: var(--font-mono);
  font-size: 0.72em;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

/* A missing answer in the editor's preview */
.ot-doc .ot-ph {
  padding: 0 0.25em;
  border-radius: 4px;
  background: rgba(217, 45, 32, 0.1);
  color: inherit;
  box-shadow: inset 0 -1px 0 rgba(217, 45, 32, 0.45);
}

@media (max-width: 600px) {
  .ot-main { padding: 0 12px; }
  .ot-main > .ot-doc { border-radius: 20px; }
  .ot-bar { padding: 14px 12px 0; }
}

@media print {
  .ot-page { background: #fff; color: #000; }
  .ot-bar { display: none; }
  .ot-main { margin: 0; padding: 0; max-width: none; }
  .ot-main > .ot-doc { padding: 0; border-radius: 0; }
  .ot-doc .ot-summary { background: none; border: 1px solid #ccc; }
  .ot-doc a { color: inherit; }
}
