/* Enjoy The Road: the channel's own stylesheet. Its tokens and fonts stay here,
   out of the app's theme. Served from /static/ on the channel host. */

@font-face {
  font-family: "Newsreader";
  src: url("fonts/Newsreader.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("fonts/Newsreader-Italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/SourceSans3.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/SourceSans3-Italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #faf6f0;
  --ink: #332a23;
  --soft-ink: #6b5a4c;
  --amber: #8c4a1f;
  --line: #e4d3bf;
  --surface: #ffffff;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: 16px;
  --measure: 40rem;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

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

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

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 1.6em 0 0.5em;
}

h1 {
  font-size: 2.25rem;
  margin-top: 0.75em;
}

h2 {
  font-size: 1.625rem;
}

h3 {
  font-size: 1.3rem;
}

h4 {
  font-size: 1.125rem;
}

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

ul,
ol {
  padding-left: 1.25em;
}

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

blockquote {
  margin: 0 0 1em;
  padding-left: 1em;
  border-left: 3px solid var(--line);
  color: var(--soft-ink);
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

.skip:focus {
  left: var(--gutter);
  top: 8px;
  background: var(--paper);
  padding: 4px 8px;
}

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

/* The road at sunrise: a band at the top of a page, never stretched past its crop. */
.hero-band {
  display: block;
  width: 100%;
  margin-top: 8px;
  border-radius: 6px;
}

.band-caption {
  margin: 0.4em 0 0;
}

.about-photo {
  margin: 0 0 1em;
}

.about-photo img {
  display: block;
  border-radius: 6px;
}

.about-photo figcaption {
  margin-top: 0.6em;
  color: var(--soft-ink);
}

/* Header and footer */

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding-top: 18px;
  padding-bottom: 14px;
}

.site-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.site-mark {
  display: block;
  width: 36px;
  height: 36px;
}

.site-links {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-links li + li {
  margin-top: 0;
}

.site-footer {
  margin-top: 3rem;
  padding-bottom: 2.5rem;
  color: var(--soft-ink);
  font-size: 1rem;
}

.site-footer h2 {
  font-size: 1.125rem;
  margin-top: 0;
}

.stretch-list {
  list-style: none;
  padding: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  list-style: none;
  padding: 0;
}

.footer-links li + li {
  margin-top: 0;
}

.made-by {
  margin-top: 1.5rem;
}

/* A link or heading with an icon beside its words */

/* Top-aligned, so the icon doesn't set the line's baseline and the words sit level with plain links. */
.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: top;
}

.icon-link svg,
.icon-heading svg {
  flex: none;
}

/* The icon follows its words' size. */
.icon-link svg {
  width: 1em;
  height: 1em;
}

/* On a name that wraps, the icon stays beside the first line. */
.icon-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.icon-heading svg {
  width: 0.85em;
  height: 0.85em;
  margin-top: 0.175em;
  color: var(--amber);
}

/* The road line between sections */

.road {
  border: 0;
  border-top: 2px dashed var(--line);
  margin: 2.5rem 0;
}

.lede {
  font-family: var(--serif);
  font-size: 1.375rem;
  line-height: 1.4;
  color: var(--soft-ink);
}

/* Home's h1 is its lede: above an h2 in size, in the lede's weight */
h1.lede {
  font-size: 1.875rem;
  font-weight: 400;
}

.soft {
  color: var(--soft-ink);
}

.small {
  font-size: 1rem;
}

/* An idea */

.idea {
  margin: 0 0 1.25rem;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.idea-text {
  margin: 0 0 0.75em;
  font-family: var(--serif);
  font-size: 1.375rem;
  line-height: 1.45;
}

.idea-text a {
  color: inherit;
  text-decoration: none;
}

.idea-text a:hover {
  text-decoration: underline;
  text-decoration-color: var(--line);
}

.idea-large .idea-text {
  font-size: 1.625rem;
}

.credit {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: var(--soft-ink);
  font-size: 1rem;
}

.credit svg {
  flex: none;
  margin-top: 0.25em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.actions[hidden] {
  display: none;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--amber);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.button:hover {
  border-color: var(--amber);
}

.button[aria-pressed="true"] {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--paper);
}

.button svg {
  flex: none;
}

/* Under an idea: where to go next, then the Sunday road */

.idea-links {
  list-style: none;
  padding: 0;
}

.idea-links > li + li {
  margin-top: 0.5rem;
}

.offer {
  margin: 1.5rem 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.offer h2 {
  margin-top: 0;
}

/* The account's Sunday box, when a link points at it */
.sunday {
  scroll-margin-top: 16px;
}

.sunday:target {
  padding: 4px 16px 0;
  border: 2px solid var(--amber);
  border-radius: 6px;
  background: var(--surface);
}

.sunday:target h2 {
  margin-top: 0.75em;
}

/* The deck on a book page: one idea at a time, side to side */

.deck {
  display: flex;
  gap: 12px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 4px var(--gutter) 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  list-style: none;
}

.deck > li {
  flex: 0 0 86%;
  max-width: 34rem;
  margin: 0;
  scroll-snap-align: start;
}

.deck .idea {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.deck .idea-text {
  flex: 1;
}

.deck-count {
  margin: -0.25em 0 0.75em;
  color: var(--soft-ink);
  font-size: 1rem;
}

/* The card's blocks */

.card-block {
  margin: 0 0 1.25rem;
  padding: 16px 18px;
  border-left: 3px solid var(--amber);
  background: var(--surface);
}

.card-block h3 {
  margin: 0 0 0.4em;
  font-size: 1.125rem;
}

.card-block > :last-child {
  margin-bottom: 0;
}

/* Lists of books and days */

.plain-list {
  list-style: none;
  padding: 0;
}

.plain-list > li + li {
  margin-top: 1rem;
}

.day-date {
  margin: 0 0 0.25em;
  color: var(--soft-ink);
  font-size: 1rem;
}

/* For the little ones */

.primer {
  font-size: 1.25rem;
  line-height: 1.7;
}

/* Home's taste of a story: its first stanza, then where it's from */
.primer-opening {
  margin: 0 0 1em;
}

.primer-opening blockquote {
  margin-bottom: 0.25em;
  color: var(--ink);
}

.primer-opening blockquote p {
  margin: 0 0 0.75em;
}

.primer-opening blockquote p:last-child {
  margin-bottom: 0;
}

details.grown-up {
  margin: 0 0 1.5em;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 1rem;
}

details.grown-up summary {
  cursor: pointer;
  color: var(--amber);
  font-weight: 600;
}

details.grown-up[open] summary {
  margin-bottom: 0.5em;
}

details.grown-up p {
  margin: 0;
}

/* A primer on its own page, for reading aloud: bigger lines, more air */

.primer-read {
  font-size: 1.5rem;
  line-height: 1.75;
}

.primer-read h2 {
  margin-top: 1.75em;
}

.primer-read details.grown-up {
  margin-top: 1.5em;
  line-height: 1.6;
}

/* The ladder: the same book at three levels */

.ladder {
  margin: 1.25rem 0;
}

.ladder p {
  margin: 0 0 0.5em;
  color: var(--soft-ink);
  font-size: 1rem;
}

.ladder ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ladder li {
  margin: 0;
}

.ladder a,
.ladder span {
  display: inline-block;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.ladder span {
  border-color: var(--amber);
  background: var(--amber);
  color: var(--paper);
}

/* Sign-in and the account */

.form {
  display: grid;
  gap: 12px;
  max-width: 24rem;
  margin: 1.5rem 0;
}

.form[hidden],
.button[hidden] {
  display: none;
}

.form label:not(.check) {
  font-weight: 600;
}

/* At 16px or more, a phone doesn't zoom into the field. */
.form input[type="email"] {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--soft-ink);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
}

.check input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--amber);
}

.form .button {
  justify-self: start;
}

.button-solid {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--paper);
}

/* A field people never see, for bots that fill in every field. */
.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Screen: a warm dark page, and one idea at a time across the whole screen */

body[data-page="screen"] {
  --paper: #1f1813;
  --ink: #f2e8dc;
  --soft-ink: #c4b19d;
  --amber: #e5a46f;
  --line: #4a3b30;
  --surface: #2a211b;
  color-scheme: dark;
}

.screen-form fieldset {
  display: grid;
  gap: 10px;
  margin: 0 0 0.5rem;
  padding: 0;
  border: 0;
}

.screen-form legend {
  margin-bottom: 0.5em;
  padding: 0;
  font-weight: 600;
}

.screen-stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8vmin;
  background: var(--paper);
  color: var(--ink);
  cursor: none;
}

.screen-stage[hidden] {
  display: none;
}

.screen-idea {
  max-width: 60rem;
}

/* Sized by the screen's shorter side, so the longest idea fits a landscape phone and a TV alike. */
.screen-text {
  max-width: 32ch;
  margin: 0 0 1em;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 0.5rem + 4vmin, 4.5rem);
  line-height: 1.3;
}

.screen-credit {
  margin: 0;
  color: var(--soft-ink);
  font-size: clamp(1rem, 0.75rem + 1.5vmin, 1.75rem);
}

.screen-stop {
  position: absolute;
  right: 16px;
  bottom: 16px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--soft-ink);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  .screen-in {
    animation: screen-in 1.2s ease-out;
  }

  @keyframes screen-in {
    from {
      opacity: 0;
    }
  }
}

@media (min-width: 640px) {
  h1 {
    font-size: 2.75rem;
  }

  h1.lede {
    font-size: 2.125rem;
  }

  .idea-large .idea-text {
    font-size: 1.875rem;
  }

  .deck > li {
    flex-basis: 70%;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .deck {
    scroll-behavior: smooth;
  }
}
