/* hamrlog user manual. Same tokens and fonts as the EA7KLX home page. */

@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: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/barlow-semi-condensed-latin-500-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/barlow-semi-condensed-latin-600-normal.woff2') format('woff2');
}

:root {
  color-scheme: light dark;

  --paper: #eef1f5;
  --sheet: #ffffff;
  --ink: #16202e;
  --muted: #566273;
  --rule: #c5cdd8;
  --cota: #0a3fa8;
  --mark: #c4281c;
  --area: #fbe9d8;
  --terminal: #101a28;
  --terminal-ink: #dbe4f0;

  --serif: 'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: 'Barlow Semi Condensed', 'DIN Alternate', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'DejaVu Sans Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c1829;
    --sheet: #12233a;
    --ink: #e7edf5;
    --muted: #9fb0c6;
    --rule: #34496a;
    --cota: #9dbdff;
    --mark: #ff8f7f;
    --area: #2b3443;
    --terminal: #08111e;
    --terminal-ink: #dbe4f0;
  }
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
}

a {
  color: var(--cota);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.12em;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--sheet);
  font-family: var(--sans);
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

.wrap {
  max-width: 68rem;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* ---------- Masthead ---------- */

.masthead {
  background: var(--sheet);
  border-bottom: 1px solid var(--rule);
  padding: 2.5rem 0 2rem;
}

.masthead-kind {
  margin: 0;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1.125rem;
  color: var(--muted);
}

.masthead-kind a {
  color: inherit;
}

.masthead h1 {
  margin: 0.4rem 0 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(2.6rem, 7vw, 4.75rem);
  line-height: 0.95;
  color: var(--cota);
}

.masthead-lead {
  margin: 1rem 0 0;
  max-width: 40rem;
  font-size: 1.1875rem;
  line-height: 1.5;
}

/* ---------- Layout: chapter index and text ---------- */

.layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.toc {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: 2rem 0;
  font-family: var(--sans);
  font-weight: 500;
}

.toc summary {
  font-weight: 600;
  font-size: 1.125rem;
  cursor: pointer;
  list-style: none;
}

.toc summary::-webkit-details-marker {
  display: none;
}

.toc ol {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: chapter;
}

.toc li {
  counter-increment: chapter;
  display: grid;
  grid-template-columns: 1.9rem 1fr;
  padding: 0.18rem 0;
  line-height: 1.3;
}

.toc li::before {
  content: counter(chapter);
  color: var(--mark);
  font-weight: 600;
}

.toc a {
  color: var(--ink);
  text-decoration: none;
}

.toc a:hover {
  color: var(--cota);
  text-decoration: underline;
}

/* ---------- The text ---------- */

.manual {
  padding: 1rem 0 4rem;
  counter-reset: chapter;
}

.chapter {
  counter-increment: chapter;
  padding-top: 2.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.chapter:first-child {
  border-top: 0;
  margin-top: 0;
}

.manual h2,
.manual h3,
.manual h4 {
  font-family: var(--sans);
  font-weight: 600;
  line-height: 1.15;
  scroll-margin-top: 1rem;
}

.manual h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
}

.manual h2::before {
  content: counter(chapter) ". ";
  color: var(--mark);
}

.manual h3 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.5rem;
}

.manual .headerlink {
  margin-left: 0.4rem;
  color: var(--rule);
  text-decoration: none;
  opacity: 0;
}

.manual h2:hover .headerlink,
.manual h3:hover .headerlink,
.manual .headerlink:focus {
  opacity: 1;
}

.manual p,
.manual ul,
.manual ol {
  max-width: 42rem;
}

.manual li + li {
  margin-top: 0.3rem;
}

.manual code,
kbd {
  font-family: var(--mono);
  font-size: 0.85em;
}

.manual :not(pre) > code {
  padding: 0.05em 0.3em;
  border-radius: 3px;
  background: var(--area);
}

kbd {
  display: inline-block;
  padding: 0.05em 0.4em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--sheet);
  line-height: 1.35;
}

.manual pre {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  background: var(--terminal);
  color: var(--terminal-ink);
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.manual pre code {
  font-size: inherit;
}

.manual table {
  width: 100%;
  margin: 1.25rem 0;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.45;
}

.manual th {
  font-family: var(--sans);
  font-weight: 600;
  text-align: left;
  border-bottom: 2px solid var(--ink);
}

.manual th,
.manual td {
  padding: 0.45rem 0.75rem 0.45rem 0;
  vertical-align: top;
}

.manual td {
  border-bottom: 1px solid var(--rule);
}

.manual td:first-child {
  white-space: nowrap;
}

.shot,
.cast {
  margin: 1.75rem 0;
}

.shot img,
.cast img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: var(--terminal);
}

.shot figcaption,
.cast figcaption {
  margin-top: 0.6rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

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

.page-footer {
  background: var(--sheet);
  border-top: 1px solid var(--rule);
}

.page-footer p {
  margin: 0;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  font-family: var(--sans);
  color: var(--muted);
}

@media (max-width: 56rem) {
  body {
    font-size: 1.0625rem;
  }

  .wrap {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .toc {
    position: static;
    max-height: none;
    padding: 1.25rem 0 0;
    border-bottom: 1px solid var(--rule);
  }

  .toc summary::after {
    content: " ▾";
    color: var(--muted);
  }

  .toc ol {
    padding-bottom: 1rem;
  }

  .manual td:first-child {
    white-space: normal;
  }

  .manual table {
    display: block;
    overflow-x: auto;
  }
}
