/* Structure shared by every design. A design is one file in themes/ and sets the look; this file
   holds what must not differ between designs: the grid, the margin place of the note, the subtitle
   switch, the preview bar. Designs tune the layout through the custom properties below. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Oxanium';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/oxanium-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Oxanium';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/oxanium-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Oxanium';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/oxanium-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/source-serif-4-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/source-serif-4-latin-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/source-serif-4-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/source-serif-4-latin-600-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2');
}

:root {
  --measure: 44rem;
  --margin-col: 14rem;
  --margin-gap: 3rem;
  --pad: 1.25rem;
  --header-h: 6rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body { margin: 0; overflow-x: hidden; }

h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }

/* The subtitle: the page carries all five candidates, ?sub= shows one. */
.subtitle > span { display: none; }
html[data-sub="1"] .subtitle > [data-sub="1"],
html[data-sub="2"] .subtitle > [data-sub="2"],
html[data-sub="3"] .subtitle > [data-sub="3"],
html[data-sub="4"] .subtitle > [data-sub="4"],
html[data-sub="5"] .subtitle > [data-sub="5"] { display: inline; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; }
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
}
.site-nav {
  display: flex;
  gap: 0.25rem 1.25rem;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }

/* Page grid. Lines: the hero spans full-start/full-end, the blocks sit in content, the note in the margin.
   On a phone the margin collapses onto the content column and the note stays low in the flow. */
.page {
  display: grid;
  grid-template-columns: [full-start] var(--pad) [content-start margin-start] minmax(0, 1fr) [content-end margin-end] var(--pad) [full-end];
}
.page > .hero { grid-column: full-start / full-end; }
.page > .block { grid-column: content-start / content-end; }
.page > .note { grid-column: margin-start / margin-end; }

@media (min-width: 72rem) {
  .page {
    grid-template-columns:
      [full-start] minmax(var(--pad), 1fr)
      [content-start] minmax(0, var(--measure))
      [content-end] var(--margin-gap)
      [margin-start] minmax(0, var(--margin-col))
      [margin-end] minmax(var(--pad), 1fr)
      [full-end];
  }
  /* Row 3 is the block "What Longtörn does" (row 1 is the hero, row 2 the problem). */
  .page > .note { grid-row: 3; align-self: start; }
}

.hero-inner {
  max-width: calc(var(--measure) + var(--margin-gap) + var(--margin-col));
  margin: 0 auto;
}

/* The margin note is a dictionary entry: headword, pronunciation, word class, origin, numbered senses. */
.note .headword { font-weight: 700; }
.note .word-class { font-style: italic; }
.note .origin { margin-top: 0.5rem; }
.note .senses { margin: 0.5rem 0 0; padding-left: 1.3rem; }
.note .senses li { padding-left: 0.2rem; }

/* Buttons and link-like controls: only the behaviour, the look comes from the design. */
.btn, .linklike { cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.linklike { background: none; border: 0; padding: 0; text-decoration: underline; }
[aria-disabled="true"] { cursor: default; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Preview bar (preview.js, never on longtoern.com): neutral on purpose, so it looks the same on every design. */
.preview-bar {
  position: fixed;
  left: 50%;
  bottom: 0.75rem;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  gap: 1rem;
  padding: 0.45rem 0.9rem;
  background: #16181d;
  color: #e8e9ec;
  border: 1px solid #3a3e48;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  font: 13px/1.2 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.preview-bar label { display: flex; align-items: center; gap: 0.4rem; }
.preview-bar select {
  font: inherit;
  color: #e8e9ec;
  background: #23262d;
  border: 1px solid #4a4f5b;
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
}
.preview-bar :focus-visible { outline-color: #8fb7ff; }
body.has-preview-bar { padding-bottom: 4rem; }

@media (max-width: 30rem) {
  .preview-bar { left: 0.5rem; right: 0.5rem; bottom: 0.5rem; transform: none; justify-content: space-between; gap: 0.5rem; }
}
