/*
 * dart7.com stylesheet. Obsidian direction for the web.
 * Colours come from packages/ui/src/tokens.ts (light and dark theme colours).
 * System fonts only; the site loads nothing from third parties.
 */

:root {
  color-scheme: light dark;

  --canvas: #f7f7f4;
  --surface: #ffffff;
  --soft: #eeefea;
  --ink: #191b1b;
  --muted: #626a65;
  --line: #d8dcd8;
  --accent: #b94718;
  --accent-strong: #963610;
  --accent-soft: #fbe6db;
  --edge: #cdd2cc;
  --contact: rgba(17, 17, 19, 0.14);
  --track: #eeefea;
  --raised: #ffffff;

  --font:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial,
    system-ui, sans-serif;
  --measure: 40rem; /* about 70 characters of body text; rem keeps every container aligned */
  --gutter: 20px;
  --radius-sm: 12px;
  --radius-md: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #101111;
    --surface: #202222;
    --soft: #292c2b;
    --ink: #f7f7f2;
    --muted: #a7adaa;
    --line: #3a3f3c;
    --accent: #ff783e;
    --accent-strong: #ff9a6e;
    --accent-soft: #3b251d;
    --edge: #050606;
    --contact: rgba(0, 0, 0, 0.5);
    --track: #171a18;
    --raised: #343b36;
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-strong);
  text-decoration-thickness: 2px;
}

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  z-index: 10;
}

.skip-link:focus {
  top: 12px;
}

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

.site-header__inner,
.site-main,
.site-footer__inner {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.wordmark {
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  text-decoration: none;
}

.wordmark span {
  color: var(--accent);
}

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

/* Language switch: a raised two-way control with the current language pressed in. */
.lang-switch {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--track);
  border: 1px solid var(--line);
}

.lang-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

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

.lang-switch a[aria-current] {
  background: var(--raised);
  color: var(--ink);
  box-shadow:
    1px 2px 0 var(--edge),
    1px 2px 3px var(--contact);
}

/* Document -------------------------------------------------------------- */

.site-main {
  flex: 1;
  padding-top: 40px;
  padding-bottom: 64px;
}

.site-main:focus {
  outline: none;
}

.doc__head {
  margin-bottom: 32px;
}

h1,
h2,
h3 {
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 1.4rem + 3vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.updated {
  display: inline-block;
  margin: 14px 0 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.updated time {
  color: var(--ink);
  font-weight: 600;
}

.doc__body {
  max-width: var(--measure);
}

.doc__body > :first-child {
  margin-top: 0;
}

h2 {
  margin: 2em 0 0.6em;
  padding-top: 1em;
  border-top: 1px solid var(--line);
  font-size: 1.375rem;
  font-weight: 700;
  scroll-margin-top: 16px;
}

h3 {
  margin: 1.8em 0 0.4em;
  font-size: 1.125rem;
  font-weight: 700;
}

p,
ul,
ol,
address {
  margin: 0 0 1em;
}

ul,
ol {
  padding-left: 1.4em;
}

li + li {
  margin-top: 0.35em;
}

li::marker {
  color: var(--muted);
}

address {
  font-style: normal;
}

strong {
  font-weight: 700;
}

.anchor {
  margin-left: 0.25em;
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
  opacity: 0.55;
}

h2:hover .anchor,
.anchor:focus-visible {
  color: var(--accent);
  opacity: 1;
}

/* Raised surface: opaque face, one down-right edge, tight contact shadow. */
.table-card,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow:
    3px 3px 0 var(--edge),
    3px 4px 6px var(--contact);
}

/*
 * Tables. Below 960px every row is a stacked block inside the card. From 960px
 * the table is a real grid that breaks out of the text column (up to 64rem) so
 * four columns keep readable line lengths. Neither layout should ever scroll;
 * overflow-x is only a safety net.
 */
.table-card {
  margin: 1.25em 3px 1.75em 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
}

caption {
  padding: 14px 16px 0;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: left;
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
}

thead th {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tbody tr {
  border-top: 1px solid var(--line);
}

tbody th {
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 959px) {
  .table-card thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .table-card table,
  .table-card tbody,
  .table-card tr,
  .table-card th,
  .table-card td {
    display: block;
  }

  .table-card tbody tr {
    padding: 14px 16px;
  }

  .table-card tbody tr:first-child {
    border-top: 0;
  }

  .table-card tbody th,
  .table-card tbody td {
    padding: 0;
  }

  .table-card tbody th {
    margin-bottom: 6px;
    font-size: 1.0625rem;
    line-height: 1.35;
  }

  .table-card td + td,
  .table-card th + td {
    margin-top: 8px;
  }

  /* Long German compounds in narrow cells; English and row headers wrap at spaces only. */
  .table-card td:lang(de) {
    hyphens: auto;
  }

  .table-card td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
}

@media (min-width: 960px) {
  .table-card {
    --table-width: min(64rem, calc(100vw - 2 * var(--gutter) - 32px));
    width: var(--table-width);
    margin-left: calc((100% - var(--table-width)) / 2);
  }

  .table-card table {
    table-layout: fixed;
  }

  .table-card thead th:first-child {
    width: 24%;
  }
}

/* Home ------------------------------------------------------------------ */

.doc--home h1 {
  font-size: clamp(3rem, 2rem + 6vw, 4.5rem);
  letter-spacing: -0.045em;
}

.doc--home .doc__head {
  margin-bottom: 12px;
}

.lede {
  margin-bottom: 40px;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1.5;
}

.doc--home h2 {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.doc--home h2 .anchor {
  display: none;
}

.link-list {
  margin: 0 3px 40px 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow:
    3px 3px 0 var(--edge),
    3px 4px 6px var(--contact);
  overflow: hidden;
}

.link-list li + li {
  margin: 0;
  border-top: 1px solid var(--line);
}

.link-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 18px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.link-list a::after {
  content: "→";
  color: var(--accent);
  font-weight: 400;
}

.link-list a:hover {
  background: var(--soft);
}

/* Error ----------------------------------------------------------------- */

.doc--error .doc__body p:last-child {
  margin-top: 24px;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

.site-footer__inner {
  padding-top: 24px;
  padding-bottom: 32px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.footer-links li + li {
  margin: 0;
}

.footer-links a {
  display: inline-block;
  padding: 6px 0;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a[aria-current] {
  color: var(--accent);
}

.footer-note {
  margin: 0;
}

/* Motion: only small colour changes, and none for reduced-motion users. */
@media (prefers-reduced-motion: no-preference) {
  a,
  .lang-switch a {
    transition:
      color 120ms ease,
      background-color 120ms ease;
  }

  html {
    scroll-behavior: smooth;
  }
}

@media (min-width: 720px) {
  :root {
    --gutter: 32px;
  }

  .site-main {
    padding-top: 64px;
    padding-bottom: 96px;
  }

  body {
    font-size: 1.125rem;
  }
}

@media (max-width: 359px) {
  :root {
    --gutter: 16px;
  }

  .lang-switch a {
    padding: 0 10px;
  }
}

/* Print: black on white, link targets written out. */
@media print {
  :root {
    --canvas: #ffffff;
    --surface: #ffffff;
    --soft: #ffffff;
    --ink: #000000;
    --muted: #000000;
    --line: #000000;
    --accent: #000000;
    --accent-strong: #000000;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
  }

  .skip-link,
  .lang-switch,
  .anchor,
  .site-footer nav {
    display: none;
  }

  .site-header,
  .site-footer {
    border: 0;
  }

  .site-main {
    padding: 12pt 0;
  }

  .table-card,
  .link-list,
  .lang-switch a[aria-current] {
    box-shadow: none;
    overflow: visible;
  }

  table {
    min-width: 0;
  }

  .updated {
    padding: 0;
  }

  a {
    text-decoration: underline;
  }

  .doc__body a[href^="/"]::after {
    content: " (https://dart7.com" attr(href) ")";
  }

  .doc__body a[href^="http"]::after,
  .doc__body a[href^="mailto:"]::after,
  .doc__body a[href^="tel:"]::after {
    content: " (" attr(href) ")";
  }

  h2,
  h3 {
    break-after: avoid;
  }

  tr,
  address {
    break-inside: avoid;
  }
}
