/* Odyssia website. Brand colours (src/constants/theme.ts, Brand), Marcellus for headings
   (self-hosted from /fonts, SIL Open Font License), system fonts for body text. */

@font-face {
  font-family: 'Marcellus';
  src: url('/fonts/marcellus-regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand */
  --ivory: #f1ece0;
  --emerald: #0e3a2f;
  --brass: #a8864e; /* small accents only, never text: 2.9:1 on ivory */
  --ink: #14171c;

  /* Contrast on --background, WCAG AA needs 4.5 for text: ink 15.2, emerald 10.7,
     text-secondary 7.0; ivory on an emerald button 10.7. */
  --text: var(--ink);
  --text-secondary: #4b5047;
  --heading: var(--emerald);
  --link: var(--emerald);
  --button: var(--emerald);
  --on-button: var(--ivory);
  --background: var(--ivory);
  --background-element: #e7e0cf;
  --border: #b9ae96;
  --border-soft: #dcd3c0;
  --accent: var(--brass);
  --draft-bg: #ebdfc6;
  --draft-text: #4a3815;

  --font-display: 'Marcellus', Georgia, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --measure: 42rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* On --background: ivory 12.8, links 7.4, text-secondary 8.4; emerald on a light green
       button 6.2. */
    --text: var(--ivory);
    --text-secondary: #b8c4bb;
    --heading: var(--ivory);
    --link: #7fc4a5;
    --button: #7fc4a5;
    --on-button: var(--emerald);
    --background: #0e2b25;
    --background-element: #143a32;
    --border: #4c6b60;
    --border-soft: #21443b;
    --accent: #c9a66b;
    --draft-bg: #2f2a17;
    --draft-text: #f0ddb4;
  }
}

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

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

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.wrap,
main {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
}

main {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

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

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--background);
  padding: 0.5rem 0.75rem;
  z-index: 1;
}

/* Header and footer */

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

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--heading);
  text-decoration: none;
}

.brand svg {
  display: block;
  flex: none;
}

/* The wordmark is drawn as outlines; this is its name for screen readers and copy-paste. */
.brand-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.site-header nav,
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
}

.site-header nav a {
  text-decoration: none;
  color: var(--text-secondary);
}

.site-header nav a:hover {
  color: var(--text);
}

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

.site-footer .wrap {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.site-footer a {
  color: var(--text-secondary);
}

/* Text */

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--heading);
  line-height: 1.25;
  margin: 2rem 0 0.75rem;
}

h1 {
  font-size: 2rem;
  margin-top: 0.5rem;
}

/* A short brass rule under the page title. */
h1::after {
  content: '';
  display: block;
  width: 2.5rem;
  height: 2px;
  margin-top: 0.6rem;
  background: var(--accent);
}

h2 {
  font-size: 1.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-soft);
}

h3 {
  font-size: 1.15rem;
}

p,
ul,
ol {
  margin: 0 0 1rem;
}

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

.lead {
  font-size: 1.2rem;
  color: var(--text-secondary);
}

.updated {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-top: -0.25rem;
}

.note,
.coming-soon {
  background: var(--background-element);
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
}

.draft {
  background: var(--draft-bg);
  color: var(--draft-text);
  border: 1px solid var(--accent);
  border-left-width: 4px;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
}

.draft strong {
  margin-right: 0.4rem;
  letter-spacing: 0.06em;
}

.toc {
  background: var(--background-element);
  border-radius: 0.5rem;
  padding: 0.85rem 1rem 0.85rem 2.2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25rem;
  font-size: 0.9688rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border-soft);
}

th {
  color: var(--text-secondary);
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
}

.cards {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.cards li {
  margin: 0;
}

.cards a {
  display: block;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.8rem 1rem;
  text-decoration: none;
}

.cards a:hover {
  background: var(--background-element);
}

.cards span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.button {
  display: inline-block;
  background: var(--button);
  color: var(--on-button);
  border-radius: 0.5rem;
  padding: 0.6rem 1rem;
  text-decoration: none;
  font-weight: 600;
}

details {
  border-bottom: 1px solid var(--border-soft);
  padding: 0.6rem 0;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

details[open] summary {
  margin-bottom: 0.5rem;
}

@media (min-width: 40rem) {
  h1 {
    font-size: 2.4rem;
  }

  .cards {
    grid-template-columns: 1fr 1fr;
  }
}
