/* From src/theme (the burgundy variant), written by website/build.mjs. */
:root {
  --bg: #000000;
  --surface: #121214;
  --surface-raised: #1A1A1D;
  --surface-high: #242428;
  --border: #26262B;
  --border-strong: #3A3A41;
  --text: #F5F5F7;
  --text-secondary: #A1A1AA;
  --text-tertiary: #8A8A93;
  --text-on-accent: #FFFFFF;
  --success: #3DBE7A;
  --warning: #E2A93B;
  --danger: #FF6B5E;
  --accent: #9E1B40;
  --accent-pressed: #831634;
  --accent-text: #E8597C;
  --accent-subtle: rgba(158, 27, 64, 0.16);
  --warning-subtle: rgba(226, 169, 59, 0.16);
  --space-xxs: 0.125rem;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.5rem;
  --space-xxl: 2rem;
  --space-xxxl: 3rem;
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;
}

/*
 * KOTC website: the one stylesheet. Hand-written, no framework, no JavaScript.
 *
 * The look follows docs/design-direction.md: black is the canvas, burgundy is the only accent,
 * depth comes from slightly lighter surfaces and hairlines, shapes are rounded rectangles and
 * pills. Colours, spacing and radii are NOT written here: build.mjs reads them from src/theme
 * (the burgundy variant) and puts them above this file as custom properties (--bg, --text,
 * --accent-text, --space-lg, --radius-md and so on), so the site follows the app's theme.
 * The only colours written in this file are the print ones at the bottom (ink on white paper).
 *
 * Text rule from the design doc: burgundy you READ is --accent-text (6.2:1 on black); burgundy
 * you FILL and put white on is --accent. Raw burgundy on black is only 2.7:1, so it is never text.
 */

/* Fonts: the app's two families, served from this site (no request goes to Google). */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Inter_400Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Inter_400Regular_Italic.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/Inter_500Medium.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/Inter_600SemiBold.ttf') format('truetype');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/BarlowCondensed_600SemiBold.ttf') format('truetype');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/BarlowCondensed_700Bold.ttf') format('truetype');
}

:root {
  --font-text:
    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Barlow Condensed', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  /* The widest the page gets, and the reading column (about 70 characters of Inter). */
  --page-width: 68rem;
  --measure: 34em;
  --hairline: 1px;
  /* The smallest thing you can tap, as in the app (44 points). */
  --touch: 2.75rem;
}

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

html {
  color-scheme: dark;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--space-xl);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1;
  width: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

/* Links you read are underlined, in the accent that passes contrast on black. */
a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-thickness: 0.14em;
}

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

::selection {
  background: var(--accent);
  color: var(--text-on-accent);
}

.wrap {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding-inline: var(--space-lg);
}

.skip-link {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 10;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus {
  transform: none;
  outline-color: var(--text);
}

/* Small capitals label, the app's "micro" style. */
.overline {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ header */

.site-header {
  border-bottom: var(--hairline) solid var(--border);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 var(--space-lg);
  padding-block: var(--space-sm);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--touch);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
  text-decoration: none;
}
.brand img {
  display: block;
  width: 2.25rem;
  height: 2.25rem;
}
.brand:hover {
  text-decoration: none;
}

.site-nav ul,
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav ul {
  gap: 0 var(--space-xl);
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover {
  color: var(--text);
  text-decoration: underline;
}
/* The page you are on: the app's text-tab style, a short accent bar under the label. */
.site-nav a[aria-current='page'] {
  color: var(--text);
  box-shadow: inset 0 -3px 0 var(--accent-text);
}

/* ------------------------------------------------------------------ footer */

.site-footer {
  margin-top: var(--space-xxxl);
  border-top: var(--hairline) solid var(--border);
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}
.site-footer .wrap {
  padding-block: var(--space-xl) var(--space-xxl);
}
.site-footer ul {
  gap: 0 var(--space-xl);
  margin-bottom: var(--space-lg);
}
.site-footer li a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  color: var(--text);
  font-weight: 500;
  text-decoration-color: var(--border-strong);
}
.site-footer li a:hover {
  text-decoration-color: currentColor;
}
.site-footer p {
  max-width: var(--measure);
  margin: 0 0 var(--space-sm);
}

/* ------------------------------------------------------------- shared bits */

/* A part still to be confirmed by the founder: loud on purpose, never colour alone (it says so). */
.blank {
  padding: 0.1em 0.45em;
  border: var(--hairline) dashed var(--warning);
  border-radius: var(--radius-xs);
  background: var(--warning-subtle);
  color: var(--warning);
  font-style: normal;
  font-weight: 500;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.blank-label {
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* A notice at the top of a draft page. */
.notice {
  display: flex;
  gap: var(--space-md);
  margin: 0 0 var(--space-xl);
  padding: var(--space-md) var(--space-lg);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-md);
  background: var(--accent-subtle);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.notice strong {
  font-weight: 600;
}

/* The one filled button on a page: a burgundy pill with white text, as in the app. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: var(--space-sm) var(--space-xl);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  transition: background-color 120ms cubic-bezier(0.2, 0, 0, 1);
}
.button:hover,
.button:active {
  background: var(--accent-pressed);
}
.button:focus-visible {
  outline-color: var(--text);
  border-radius: var(--radius-pill);
}

/* ---------------------------------------------------------------- the home page */

.home {
  padding-block: var(--space-xxxl) 0;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero h1 {
  width: min(20rem, 78%);
  margin: 0 0 var(--space-xl);
  line-height: 0;
}
.hero h1 img {
  display: block;
  width: 100%;
}
.hero-line {
  max-width: 14em;
  margin: 0 0 var(--space-lg);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 1.6rem + 4.5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0.005em;
  text-wrap: balance;
}
.hero-lead {
  max-width: 33em;
  margin: 0 0 var(--space-xl);
  color: var(--text-secondary);
  font-size: 1.125rem;
  line-height: 1.6;
  text-wrap: pretty;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
  padding: var(--space-sm) var(--space-lg);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}
.pill::before {
  content: '';
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent-text);
}

.features {
  display: grid;
  gap: var(--space-md);
  margin: var(--space-xxxl) 0 0;
  padding: 0;
  list-style: none;
}
.features li {
  padding: var(--space-xl) var(--space-lg);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.features h2 {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
}
.features p {
  margin: 0;
  color: var(--text-secondary);
}

/* Help and legal: the app's list rows. One card, hairline dividers, a chevron at the end. */
.rows-title {
  margin: var(--space-xxxl) 0 var(--space-md);
  padding-inline: var(--space-xs);
}
.rows {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  list-style: none;
}
.rows li + li {
  border-top: var(--hairline) solid var(--border);
}
.rows a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  min-height: 3.5rem;
  padding: var(--space-md) var(--space-lg);
  color: var(--text);
  text-decoration: none;
  transition: background-color 120ms cubic-bezier(0.2, 0, 0, 1);
}
.rows a:hover {
  background: var(--surface-raised);
}
.rows a:focus-visible {
  outline-offset: -3px;
  border-radius: var(--radius-md);
}
.rows a::after {
  content: '';
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-top: 2px solid var(--text-tertiary);
  border-right: 2px solid var(--text-tertiary);
  transform: rotate(45deg);
}
.row-title {
  display: block;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.22em;
}
.rows a:hover .row-title {
  text-decoration-color: currentColor;
}
.row-note {
  display: block;
  margin-top: var(--space-xxs);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.4;
}

@media (min-width: 44rem) {
  .home {
    padding-top: 5rem;
  }
  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-lg);
  }
  .features li {
    padding: var(--space-xl);
  }
  .home .wrap {
    max-width: 56rem;
  }
}

/* ------------------------------------------------------------ document pages */

.doc {
  padding-block: var(--space-xxl) 0;
}
.doc-layout {
  max-width: var(--measure);
  margin: 0 auto;
  font-size: 1.0625rem;
}
.doc h1 {
  margin: 0 0 var(--space-xl);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 1.9rem + 3vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.005em;
  overflow-wrap: break-word;
  text-wrap: balance;
}

/* "On this page". */
.toc {
  margin: 0 0 var(--space-xxl);
  padding: var(--space-lg);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.9375rem;
  line-height: 1.4;
}
.toc ol {
  margin: var(--space-sm) 0 0;
  padding: 0;
  list-style: none;
}
.toc a {
  display: block;
  padding: var(--space-sm) 0;
  color: var(--text);
  text-decoration-color: var(--border-strong);
}
.toc a:hover {
  color: var(--accent-text);
  text-decoration-color: currentColor;
}

/* Long text: comfortable to read. About 70 characters a line, generous leading, clear steps. */
.prose {
  line-height: 1.7;
  overflow-wrap: break-word;
}
.prose > :first-child {
  margin-top: 0;
}
.prose > :last-child {
  margin-bottom: 0;
}
.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.15em;
}
.prose h2 {
  margin: 1.5em 0 0.5em;
  padding-top: 0.9em;
  border-top: var(--hairline) solid var(--border);
  font-family: var(--font-display);
  font-size: 1.875em;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-wrap: balance;
}
.prose h3 {
  margin: 2em 0 0.5em;
  font-size: 1.125em;
  font-weight: 600;
  line-height: 1.35;
}
.prose h2 + h3 {
  margin-top: 1em;
}
.prose h2,
.prose h3 {
  scroll-margin-top: var(--space-xl);
}
.prose strong {
  font-weight: 600;
}
.prose ul,
.prose ol {
  padding-left: 1.4em;
}
.prose li {
  margin: 0.4em 0;
  padding-left: 0.2em;
}
.prose li::marker {
  color: var(--text-tertiary);
}
.prose ol > li::marker {
  color: var(--text-secondary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.prose li > ul,
.prose li > ol {
  margin: 0.4em 0 0.6em;
}
.prose li > p {
  margin: 0 0 0.6em;
}

/* A table scrolls sideways inside its own box, so the page never does. */
.table-scroll {
  margin: 0 0 1.4em;
  overflow-x: auto;
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.table-scroll:focus-visible {
  outline-offset: 2px;
  border-radius: var(--radius-md);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
}
/* Each column keeps room for a few words a line; a table with more columns scrolls further. */
.prose .cols-3 {
  min-width: 28rem;
}
.prose .cols-4 {
  min-width: 38rem;
}
.prose .cols-5 {
  min-width: 47rem;
}
.prose .cols-6 {
  min-width: 56rem;
}
.prose th,
.prose td {
  padding: var(--space-md);
  border-bottom: var(--hairline) solid var(--border);
  text-align: left;
  vertical-align: top;
}
.prose th {
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.prose tbody tr:last-child td {
  border-bottom: 0;
}
.prose .right {
  text-align: right;
}
.prose .center {
  text-align: center;
}

/* The support page's email card. */
.contact {
  margin: 0 0 var(--space-xxl);
  padding: var(--space-xl) var(--space-lg);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.contact p {
  margin: 0;
}
.contact .contact-lead {
  margin-bottom: var(--space-lg);
  color: var(--text-secondary);
}
/* The address as plain text you can select and copy: one tap or click selects all of it. */
.contact-email {
  margin: var(--space-xs) 0 var(--space-lg) !important;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1rem + 2.6vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}

@media (min-width: 64rem) {
  .doc {
    padding-top: var(--space-xxxl);
  }
  /* With "On this page": the list sits beside the text and stays put while you read. */
  .doc-layout.has-toc {
    display: grid;
    grid-template-columns: 15rem minmax(0, var(--measure));
    grid-template-areas:
      '. head'
      'toc text';
    justify-content: center;
    column-gap: var(--space-xxxl);
    max-width: none;
  }
  .has-toc .doc-head {
    grid-area: head;
  }
  .has-toc .doc-text {
    grid-area: text;
  }
  .has-toc .toc {
    position: sticky;
    top: var(--space-xl);
    grid-area: toc;
    align-self: start;
    max-height: calc(100vh - 2 * var(--space-xl));
    margin: 0;
    padding: 0 var(--space-lg) 0 0;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    background: none;
    font-size: 0.875rem;
  }
  .has-toc .toc a {
    padding: 0.4rem 0;
    color: var(--text-secondary);
    text-decoration: none;
  }
  .has-toc .toc a:hover {
    color: var(--text);
    text-decoration: underline;
  }
}

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

/* Windows high contrast and similar: keep the edges that colour alone would lose. */
@media (forced-colors: active) {
  .button,
  .pill,
  .blank {
    border: 1px solid;
  }
  .site-nav a[aria-current='page'] {
    text-decoration: underline;
  }
}

/* ------------------------------------------------------------------- print */

/* On paper: black ink on white, no navigation, addresses written out after links. */
@media print {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --border: #b5b5b5;
    --border-strong: #8a8a8a;
    --text: #000000;
    --text-secondary: #333333;
    --text-tertiary: #555555;
    --accent-text: #000000;
    --accent-subtle: transparent;
    --warning: #000000;
    --warning-subtle: transparent;
  }
  @page {
    margin: 18mm 16mm;
  }
  html {
    color-scheme: light;
  }
  html,
  body {
    background: #ffffff;
    color: #000000;
  }
  body {
    display: block;
    min-height: 0;
    font-size: 11pt;
  }
  .skip-link,
  .site-nav,
  .site-footer nav,
  .toc,
  .button,
  .brand img,
  .hero h1 img {
    display: none !important;
  }
  .wrap {
    max-width: none;
    padding-inline: 0;
  }
  .site-header .wrap {
    padding-block: 0 6pt;
  }
  .brand {
    min-height: 0;
    font-size: 16pt;
  }
  .site-footer {
    margin-top: 24pt;
  }
  .site-footer .wrap {
    padding-block: 8pt 0;
  }
  .doc,
  .home {
    padding-block: 14pt 0;
  }
  .doc-layout,
  .doc-layout.has-toc {
    display: block;
    max-width: none;
    font-size: 11pt;
  }
  .doc h1 {
    margin-bottom: 12pt;
    font-size: 26pt;
  }
  .prose {
    line-height: 1.5;
  }
  .prose h2 {
    font-size: 16pt;
  }
  .prose h2,
  .prose h3 {
    break-after: avoid;
    page-break-after: avoid;
  }
  .prose p,
  .prose li {
    orphans: 3;
    widows: 3;
  }
  .prose tr,
  .contact,
  .features li,
  .notice {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .table-scroll {
    overflow: visible;
    border-radius: 0;
  }
  .prose table {
    min-width: 0 !important;
  }
  .prose th {
    color: #000000;
  }
  a {
    text-decoration-thickness: 0.5pt;
  }
  /* A link's address is no use on paper unless it is written out. */
  .prose a[href^='https://']:not(.url)::after {
    content: ' (' attr(href) ')';
    font-size: 0.9em;
    overflow-wrap: anywhere;
  }
  .hero {
    align-items: flex-start;
    text-align: left;
  }
  .hero-line {
    font-size: 22pt;
  }
  .pill {
    border-color: var(--border);
  }
  .pill::before {
    display: none;
  }
  .features {
    display: block;
    margin-top: 16pt;
  }
  .features li {
    margin-bottom: 8pt;
    padding: 8pt 10pt;
  }
  .rows-title {
    margin-top: 16pt;
  }
  .rows {
    overflow: visible;
  }
  .rows li {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .rows a::after {
    display: none;
  }
  .hero h1 {
    margin: 0;
  }
  .contact-email {
    font-size: 16pt;
  }
}
