/* Continuous page readers for the School on Analytical Connectionism notebooks. */

html {
  background: #e9e2ca;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body.ac-reader-page {
  --reader-bg: #e9e2ca;
  --reader-paper: #f5efd8;
  --reader-ink: #241711;
  --reader-copy: #5e4438;
  --reader-rule: rgba(79, 36, 31, 0.24);
  --reader-rule-soft: rgba(31, 91, 109, 0.09);
  --reader-red: #8a2638;
  --reader-blue: #1f5b6d;
  background:
    radial-gradient(circle at 12% 4%, rgba(255, 250, 226, 0.74), transparent 31rem),
    radial-gradient(circle at 88% 24%, rgba(138, 38, 56, 0.055), transparent 27rem),
    var(--reader-bg);
  color: var(--reader-copy);
  isolation: isolate;
  min-height: 100vh;
  overflow-x: hidden;
  padding-top: 68px;
}

body.ac-reader-page::before {
  background:
    linear-gradient(var(--reader-rule-soft) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 91, 109, 0.055) 1px, transparent 1px);
  background-size: 28px 28px;
  content: "";
  inset: 0;
  opacity: 0.74;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

.ac-reader-page a {
  color: var(--reader-blue);
}

.ac-reader-page a:hover {
  color: var(--reader-red);
}

.ac-skip-link {
  background: var(--reader-ink);
  color: var(--reader-paper) !important;
  left: 1rem;
  padding: 0.65rem 0.85rem;
  position: fixed;
  top: 0;
  transform: translateY(-140%);
  z-index: 100;
}

.ac-skip-link:focus {
  transform: translateY(0.75rem);
}

.ac-reader-bar {
  backdrop-filter: blur(13px);
  background: rgba(245, 239, 216, 0.91);
  border-bottom: 1px solid var(--reader-rule);
  box-shadow: 0 8px 24px rgba(79, 36, 31, 0.08);
  color: var(--reader-ink);
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 20;
}

.ac-reader-bar-inner {
  align-items: center;
  display: grid;
  gap: 0.8rem clamp(1rem, 3vw, 2.5rem);
  grid-template-columns: auto minmax(12rem, 1fr) auto;
  margin: 0 auto;
  max-width: 1180px;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
}

.ac-reader-back,
.ac-reader-download {
  align-items: center;
  border: 1px solid var(--reader-rule);
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 700;
  gap: 0.4rem;
  letter-spacing: 0.035em;
  min-height: 42px;
  padding: 0.48rem 0.7rem;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.ac-reader-back:hover,
.ac-reader-download:hover {
  background: rgba(255, 250, 226, 0.58);
  border-color: rgba(138, 38, 56, 0.52);
}

.ac-reader-heading {
  min-width: 0;
  text-align: center;
}

.ac-reader-speaker {
  color: var(--reader-red);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0 0 0.12rem;
  text-transform: uppercase;
}

.ac-reader-heading h1 {
  color: var(--reader-ink);
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-wrap: balance;
}

.ac-reader-tools {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.ac-reader-progress {
  color: var(--reader-copy);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ac-reader-main {
  margin: 0 auto;
  max-width: 820px;
  padding: clamp(1.6rem, 5vw, 3.4rem) clamp(0.9rem, 4vw, 2rem) 5rem;
  position: relative;
}

.ac-reader-intro {
  color: var(--reader-copy);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  margin: 0 auto clamp(1.8rem, 5vw, 3.4rem);
  max-width: 62ch;
  text-align: center;
  text-transform: uppercase;
}

.ac-reader-intro a {
  color: inherit;
  font-weight: 700;
  text-underline-offset: 0.2em;
}

.ac-reader-summary {
  background: rgba(245, 239, 216, 0.68);
  border: 1px solid var(--reader-rule);
  box-shadow: 6px 6px 0 rgba(79, 36, 31, 0.08);
  margin: 0 auto clamp(2.4rem, 7vw, 5.2rem);
  max-width: 760px;
  padding: clamp(1rem, 3vw, 1.45rem);
}

.ac-reader-summary h2 {
  color: var(--reader-ink);
  font-size: clamp(1.15rem, 3vw, 1.55rem);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

.ac-reader-summary p {
  color: var(--reader-copy);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0.8rem 0 0;
}

.ac-reader-summary ul {
  display: grid;
  gap: 0.45rem 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.ac-reader-summary li {
  border-left: 2px solid rgba(31, 91, 109, 0.42);
  color: var(--reader-copy);
  font-size: 0.79rem;
  line-height: 1.5;
  padding-left: 0.62rem;
}

.ac-reader-pages {
  display: grid;
  gap: clamp(2.4rem, 7vw, 5.5rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.ac-reader-page-item {
  margin: 0;
  min-width: 0;
  position: relative;
}

.ac-reader-sheet {
  margin: 0 auto;
  max-width: 760px;
  position: relative;
  width: 100%;
}

.ac-reader-sheet::after {
  border: 1px solid rgba(79, 36, 31, 0.14);
  box-shadow: 0 16px 28px rgba(79, 36, 31, 0.08);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.ac-reader-sheet img {
  background: transparent;
  border: 0;
  border-radius: 0;
  display: block;
  height: auto;
  margin: 0;
  mix-blend-mode: multiply;
  width: 100%;
}

.ac-reader-sheet figcaption {
  color: rgba(79, 36, 31, 0.6);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  margin-top: 0.55rem;
  text-align: center;
  text-transform: uppercase;
}

.ac-reader-end {
  align-items: center;
  border-top: 1px solid var(--reader-rule);
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.5rem;
  justify-content: center;
  margin-top: clamp(3.5rem, 9vw, 7rem);
  padding-top: 1.5rem;
}

.ac-reader-end a {
  font-size: 0.8rem;
  font-weight: 700;
  text-underline-offset: 0.25em;
}

@media screen and (max-width: 760px) {
  html {
    scroll-padding-top: 124px;
  }

  body.ac-reader-page {
    padding-top: 112px;
  }

  .ac-reader-bar-inner {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ac-reader-heading {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .ac-reader-back {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  .ac-reader-back span {
    display: none;
  }

  .ac-reader-tools {
    grid-column: 2;
    grid-row: 2;
  }

  .ac-reader-progress {
    display: none;
  }

  .ac-reader-main {
    padding-inline: clamp(0.45rem, 2.5vw, 1rem);
  }

  .ac-reader-summary ul {
    grid-template-columns: 1fr;
  }

  .ac-reader-pages {
    gap: clamp(1.8rem, 9vw, 3.2rem);
  }

  .ac-reader-sheet::after {
    box-shadow: 0 9px 20px rgba(79, 36, 31, 0.08);
  }
}

@media screen and (max-width: 430px) {
  .ac-reader-back,
  .ac-reader-download {
    font-size: 0.67rem;
    min-height: 38px;
    padding: 0.38rem 0.52rem;
  }

}

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

@media (forced-colors: active) {
  body.ac-reader-page::before {
    display: none;
  }

  .ac-reader-sheet img {
    mix-blend-mode: normal;
  }
}

@media print {
  .ac-reader-bar,
  .ac-reader-intro,
  .ac-reader-summary,
  .ac-reader-end,
  .ac-reader-sheet figcaption {
    display: none;
  }

  body.ac-reader-page,
  body.ac-reader-page::before {
    background: #fff;
  }

  body.ac-reader-page {
    padding-top: 0;
  }

  .ac-reader-main {
    max-width: none;
    padding: 0;
  }

  .ac-reader-pages {
    display: block;
  }

  .ac-reader-page-item {
    break-after: page;
  }

  .ac-reader-sheet::after {
    display: none;
  }

  .ac-reader-sheet img {
    filter: none;
    mix-blend-mode: normal;
  }
}
