/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

:root {
  color-scheme: light dark;
  --primary-color: #da291c;
  --secondary-color: #ffeb3b;
  --light-color: #fff;
  --dark-color: #222;
  --muted-color: #888;
}

::-moz-selection {
  background: var(--primary-color);
  color: var(--light-color);
  text-shadow: none;
}

::selection {
  background: light-dark(var(--primary-color), var(--secondary-color));
  color: light-dark(var(--light-color), var(--dark-color));
  text-shadow: none;
}

html {
  color: light-dark(var(--dark-color), var(--light-color));
  background-color: light-dark(var(--light-color), var(--dark-color));
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-size: clamp(1.1rem, 2.5cqi, 3rem);
}

a,
a:visited,
a:hover,
a:active {
  color: inherit;
}

a:hover,
a:active {
  color: light-dark(var(--primary-color), var(--secondary-color));
}

ul {
  list-style-type: square;
}

ul,
ol {
  padding-inline-start: 1.25em;
}

.line-block {
  margin: 1em 0;
  padding-left: -0.75em;
  text-indent: 0.75em each-line hanging;
}

.container {
  margin: 0 2cqi 1cqi;
}

.site-nav-list {
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  padding: 1rem 0 0;
  font-size: smaller;
  font-weight: 300;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "DejaVu Sans Mono", "Liberation Mono", "Courier New", monospace;
  color: var(--muted-color);
}

.site-nav-list li {
  display: flex;
  align-items: baseline;
  white-space: nowrap;
}

.site-nav-list li:first-child,
.site-nav-list li:last-child {
  flex: 1 1 0;
  min-width: 0;
}

.site-nav-list li:first-child::after,
.site-nav-list li:last-child::before {
  content: "" / "";
  flex: 1;
  min-width: 0;
  margin-inline: 1ch;
  align-self: baseline;
  height: 2px;
  background-image: radial-gradient(circle, currentColor 1px, transparent 1.2px);
  background-size: 8px 2px;
  background-repeat: repeat-x;
  opacity: 0.5;
}

.site-nav-list li:first-child:nth-last-child(2) {
  flex: none;
}

.site-nav-list li:first-child:nth-last-child(2)::after {
  content: none;
}

.hero {
  container-type: inline-size;
  width: 100%;
}

.book-title {
  font-size: clamp(2em, 12cqi, 12cqi);
  font-weight: 800;
  line-height: 1;
  margin: 0;
  text-align: justify;
  text-transform: uppercase;
  word-break: normal;
}

.book-subtitle {
  font-size: clamp(1em, 6cqi, 6cqi);
  font-weight: 600;
  line-height: 1;
  margin: 0;
  text-transform: none;
}

.hero mark {
  background: linear-gradient(
    to bottom,
    transparent 28%,
    light-dark(var(--secondary-color), var(--primary-color)) 28%,
    light-dark(var(--secondary-color), var(--primary-color)) 72%,
    transparent 72%
  );

  padding: 0;
  color: inherit;
}

mark {
  color: light-dark(var(--dark-color), var(--light-color));
  background: linear-gradient(
    to bottom,
    transparent 15%,
    light-dark(var(--secondary-color), var(--primary-color)) 15%,
    light-dark(var(--secondary-color), var(--primary-color)) 95%,
    transparent 95%
  );
}

.chapter {
  margin: 2.5em 0;
}

.chapter-header {
  margin-bottom: 1em;
}

.chapter-title,
.chapter-author {
  margin: 0.2em 0;
  line-height: 1;
}

.chapter-title,
.chapter-nav-title {
  font-weight: 700;
  font-size: clamp(1em, 6cqi, 6cqi);
  text-transform: uppercase;
}

.chapter-subtitle {
  font-size: smaller;
  color: light-dark(var(--primary-color), var(--secondary-color));
}

.chapter-author,
.chapter-nav-author {
  font-size: clamp(1em, 4cqi, 4cqi);
  font-weight: 300;
}

.chapter-license {
  font-size: 0.75em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "DejaVu Sans Mono", "Liberation Mono", "Courier New", monospace;
  color: var(--muted-color);
}

.chapter-section h1,
.chapter-section h2,
.chapter-section h3,
.chapter-section h4,
.chapter-section h5,
.chapter-section h6 {
  text-transform: uppercase;
  font-size: smaller;
  color: light-dark(var(--primary-color), var(--secondary-color));
}

.chapter-nav {
  scroll-margin-top: 2em;
}

.chapter-nav-list,
.footer-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chapter-nav-item {
  padding: 0.5em 0 0.5em;
}

.chapter-nav-item:first-of-type {
  padding-top: 0;
}

.chapter-nav-item:last-of-type {
  padding-bottom: 0;
}

.chapter-nav-item + .chapter-nav-item {
  border-top: 1px solid #ccc;
}

.chapter-nav-link,
.chapter-nav-link:visited,
.chapter-nav-link:hover,
.chapter-nav-link:active {
  color: inherit;
  text-decoration: inherit;
}

.chapter-nav-link:hover .chapter-nav-title,
.chapter-nav-link:active .chapter-nav-title {
  text-decoration: underline;
}

.chapter-nav-link:hover .chapter-nav-title,
.chapter-nav-link:active .chapter-nav-title,
.chapter-nav-link.chapter-nav-link-active .chapter-nav-title {
  color: light-dark(var(--primary-color), var(--secondary-color));
}

.chapter-nav-title,
.chapter-nav-author {
  display: block;
  margin: 0.2em 0;
  line-height: 1;
}

.uri {
  overflow-wrap: anywhere;
}

a.footnote-ref {
  text-decoration: none;
}

a.footnote-ref sup {
  line-height: 0;
  text-decoration: underline;
  font-weight: 500;
}

.footnotes {
  font-size: smaller;
}

.text-thin {
  font-weight: 300;
}

.hr-thick {
  border-top: 4px solid light-dark(var(--dark-color), var(--light-color));
}

footer {
  margin: 2.5em 0 2em;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1em;
}

.footer-grid .footer-section:last-of-type {
  grid-column: span 2;
}

.footer-row {
  margin-top: 1em; /* match the grid gap, or increase for more separation */
}

.footer-section-heading {
  margin: 0.2em 0;
  line-height: 1;
  text-transform: uppercase;
}

.footer-section-content {
  font-weight: 300;
}

@media (min-width: 560px) {
  .footer-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  /* 1 */
}

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
  (-webkit-min-device-pixel-ratio: 1.25),
  (min-resolution: 1.25dppx),
  (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}
