/* Storytime site. Plain CSS, no build step.
   Colours are tokens on :root, for light and dark. Check any change with a
   contrast checker: text needs 4.5:1, focus rings and borders 3:1. */

/* Nunito, the same typeface as on Storytime's printed stickers. The file is
   served from this site (see assets/fonts/README.md). */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("assets/fonts/nunito-latin.woff2") format("woff2");
}

:root {
  color-scheme: light dark;
  /* The page matches the app: white in light mode, a warm near black in
     dark mode. */
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #58585e;
  /* Plum, the colour of the app icon (docs/brand/palette.md in the app's
     repository). In light mode one Plum does everything: fills with white
     text on top, links, the word "Your" and the focus ring. */
  --accent: #73415f;
  --on-accent: #ffffff;
  --link: #73415f;
  --line: #77777d;
  --shadow: rgba(20, 20, 40, 0.3);
  --ring: #73415f;
  --rounded: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #211f1c;
    --surface: #2f2c28;
    --ink: #f5f1ea;
    --muted: #c9c2b8;
    /* A light Plum, made for dark backgrounds, with a deep Plum ink on
       top of it where it is a fill. */
    --accent: #dba8c6;
    --on-accent: #2a1622;
    --link: #dba8c6;
    --line: #9a938a;
    --shadow: rgba(0, 0, 0, 0.5);
    --ring: #dba8c6;
  }
}

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

html {
  scroll-padding-top: 1rem;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

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

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

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

/* A link in running text is only as tall as its letters, about 23px here.
   A little padding above and below makes every text link at least 24px tall
   (WCAG 2.5.8), including one that stands alone in a paragraph or a list
   item. Padding on an inline link does not move the lines around it. */

p a,
li a {
  padding-block: 0.12em;
}

/* The small print's letters are smaller, so its links need a little more. */

.small a {
  padding-block: 0.2em;
}

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

h1,
h2,
h3 {
  font-family: var(--rounded);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0;
}

p {
  margin: 0;
}

.wrap {
  width: min(100% - 2.5rem, 68rem);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 10;
  background: var(--ink);
  color: var(--bg);
  padding: 0.75rem 1rem;
  border-radius: 0.6rem;
  font-weight: 600;
}

.skip:focus {
  top: 1rem;
}

/* Header: the app's icon and name, and the App Store button at the far end.
   It stays at the top of the screen while the page scrolls, on a solid
   background with a thin line under it. On a short screen (a phone on its
   side, or a page zoomed to 400%) it scrolls away with the page, so it never
   takes up a large share of the screen. */

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

@media (min-height: 30rem) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 5;
  }
  /* Whatever is scrolled to, or takes keyboard focus, stays clear of the
     header. */
  html {
    scroll-padding-top: 5.5rem;
  }
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
  padding-block: 0.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--rounded);
  font-weight: 700;
  font-size: 1.35rem;
}

.brand img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.site-footer nav a,
.follow a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-weight: 600;
}

/* Hero */

.hero {
  text-align: center;
  padding-top: clamp(1.5rem, 5vw, 3.5rem);
}

.hero-icon {
  display: block;
  width: clamp(88px, 14vw, 128px);
  height: auto;
  margin: 0 auto 1.5rem;
  border-radius: 22.5%;
  box-shadow: 0 12px 30px var(--shadow);
}

.hero h1 {
  font-size: clamp(2.2rem, 6.4vw, 4.25rem);
  font-weight: 800;
  /* Lines of about the same length, not one word left alone. */
  text-wrap: balance;
}

/* One or two sentences under the headline that say what Storytime is. */

.hero-lede {
  max-width: 40rem;
  margin: clamp(1rem, 3vw, 1.5rem) auto 0;
  font-size: clamp(1.15rem, 2.6vw, 1.4rem);
  text-wrap: pretty;
}

/* The App Store button under the headline, on the message-test pages
   (getting-ready/, know-whats-coming/, hard-things/, real-child/). */

.hero-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin: clamp(1.25rem, 3vw, 1.75rem) 0 0;
  color: var(--muted);
}

/* Each sentence of the headline starts on its own line. */

.hero h1 span {
  display: block;
}

/* "Your" is the word the page repeats. It is set in Storytime's Plum
   (see --link). */

.hero h1 em,
.card h2 em,
.point h2 em {
  font-style: normal;
  color: var(--link);
}

/* Email signup */

.signup {
  max-width: 34rem;
  margin: 1.75rem auto 0;
  padding: 1.5rem;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 18px;
  text-align: left;
}

.signup h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.signup-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 0.6rem;
  margin-top: 1rem;
}

.signup label {
  grid-column: 1 / -1;
  font-weight: 600;
}

.signup input[type="email"] {
  min-width: 0;
  min-height: 48px;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 10px;
}

.signup button {
  min-height: 48px;
  padding: 0.5rem 1.25rem;
  font: inherit;
  font-family: var(--rounded);
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 10px;
  cursor: pointer;
}

.signup-note {
  margin-top: 0.9rem;
  font-size: 0.95rem;
  color: var(--muted);
}

@media (max-width: 26rem) {
  .signup-row {
    grid-template-columns: 1fr;
  }
}

/* Apple's "Download on the App Store" badge, 44px tall: Apple's smallest
   allowed size is 40px. The artwork is 119.66 by 40, so the width follows the
   height. */

.badge {
  display: inline-flex;
  border-radius: 8px;
}

.badge img {
  display: block;
  width: 132px;
  height: 44px;
}

/* On the narrowest screens the icon, name and badge shrink a little so they
   still share one line. */

@media (max-width: 24rem) {
  .brand {
    gap: 0.5rem;
    font-size: 1.15rem;
  }
  .brand img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }
  .badge img {
    width: 120px;
    height: 40px;
  }
}

/* The cover photograph sits above the headline. */

.hero-photo {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: clamp(15px, 3vw, 30px);
}

/* Features: a row of cards that scrolls sideways, by touch, trackpad,
   scrollbar, the arrow keys when the row has focus, and the Previous and Next
   buttons. Nothing moves by itself. Each card is narrower than the screen, so
   reading one never needs sideways scrolling. */

.features {
  margin-top: clamp(3rem, 8vw, 5.5rem);
}

.carousel {
  /* The first card lines up with the rest of the page (see .wrap). */
  --gutter: max(1.25rem, (100% - 68rem) / 2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--gutter);
  padding: 0.5rem var(--gutter) 1.25rem;
}

/* The row is as wide as the screen, so its focus ring is drawn inside it. */

.carousel:focus-visible {
  outline-offset: -3px;
  border-radius: 0;
}

.carousel ul {
  display: flex;
  gap: clamp(1rem, 2.5vw, 1.5rem);
  width: max-content;
  list-style: none;
  margin: 0;
  padding: 0;
}

.card {
  flex: none;
  width: min(78vw, 19.5rem);
  scroll-snap-align: start;
}

.card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: clamp(15px, 3vw, 24px);
}

.card h2 {
  font-size: 1.45rem;
  font-weight: 800;
  margin-top: 1rem;
  text-wrap: balance;
}

.card p {
  margin-top: 0.4rem;
  color: var(--muted);
}

/* Previous and Next. carousel.js shows them; without it the row still
   scrolls every other way. */

.carousel-buttons {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.carousel-buttons[hidden] {
  display: none;
}

.carousel-buttons button {
  min-height: 48px;
  padding: 0.5rem 1.25rem;
  font: inherit;
  font-family: var(--rounded);
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

/* At either end of the row one button has nothing to do. It keeps its place
   and its focus, and says so with a dashed border as well as a paler look. */

.carousel-buttons button[aria-disabled="true"] {
  color: var(--muted);
  border-style: dashed;
  cursor: default;
}

/* A section that makes one point: a big "Your ..." heading, a few short
   statements and one picture. On a phone the picture is above the words. On
   a wide screen they sit side by side: the picture on the right, or on the
   left with .point-flip. */

.point {
  margin-top: clamp(3rem, 8vw, 5.5rem);
}

.point .wrap {
  display: grid;
  gap: clamp(1.25rem, 4vw, 3.5rem);
  align-items: center;
}

.point-photo {
  order: -1;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: clamp(15px, 3vw, 24px);
}

@media (min-width: 48rem) {
  .point .wrap {
    grid-template-columns: 1fr 1fr;
  }
  .point-photo {
    order: 0;
  }
  .point-flip .point-photo {
    order: -1;
  }
}

.point h2 {
  font-size: clamp(1.8rem, 4.6vw, 2.75rem);
  font-weight: 800;
}

.point ul {
  display: grid;
  gap: 1rem;
  list-style: none;
  margin: clamp(1.25rem, 3vw, 1.75rem) 0 0;
  padding: 0;
}

.point li {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 1.15rem;
}

.point p {
  margin-top: 1rem;
}

.point p a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

/* Footer */

.site-footer {
  margin-top: clamp(3.5rem, 9vw, 6rem);
  border-top: 1px solid var(--line);
}

.site-footer .wrap {
  padding-block: 1.75rem 2.25rem;
}

.site-footer nav ul,
.follow ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer .small {
  font-size: 0.9rem;
  margin-top: 0.9rem;
  max-width: 70ch;
  color: var(--muted);
}

/* The email signup sits in the footer, on the footer's own colour, so it
   needs no box of its own. */

.site-footer .signup {
  max-width: 34rem;
  margin: 0 0 2rem;
  padding: 0;
  background: transparent;
  border: 0;
}

/* The note on accessibility, diversity and inclusion, after the signup. */

.pledge {
  max-width: 40rem;
  margin: 0 0 2rem;
}

.pledge h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.pledge p {
  margin-top: 0.7rem;
}

.pledge a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

/* Social media accounts, as plain links that say where they go. */

.follow {
  margin: 0 0 1.5rem;
}

.follow h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

/* Long text pages (privacy and terms) */

.prose {
  max-width: 44rem;
  padding-top: clamp(1.5rem, 4vw, 3rem);
}

.prose h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
}

.prose h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.prose h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 1.9rem;
}

.prose p,
.prose ul {
  margin-top: 0.8rem;
}

.prose ul {
  padding-left: 1.3rem;
}

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

.prose .meta {
  color: var(--muted);
}

.prose .jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  list-style: none;
  padding: 0;
}

/* Items sit side by side, so they take no gap above (see li + li). */

.prose .jump li + li {
  margin-top: 0;
}

.prose .jump a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

/* Numbered steps on a long text page (the gift page). */

.prose ol {
  margin-top: 0.8rem;
  padding-left: 1.5rem;
}

.prose ol li + li {
  margin-top: 0.9rem;
}

/* The App Store badge inside a step sits on its own line under the words. */

.prose li .badge {
  display: flex;
  width: max-content;
  margin-top: 0.6rem;
  padding-block: 0;
}

/* The gift page: the code, large and easy to select, and a button to copy
   it. The code may break after any group of four on a narrow screen. */

.gift-code {
  max-width: max-content;
  padding: 0.9rem 1.2rem;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1.1rem, 5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 14px;
  -webkit-user-select: all;
  user-select: all;
}

/* The give page: a line under the heading, one photograph, and the steps
   for recording a book in your own voice. */

.give-lede {
  font-size: clamp(1.2rem, 2.8vw, 1.45rem);
  font-weight: 600;
}

.give-photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: 50% 30%;
  margin-top: 1.5rem;
  border-radius: clamp(15px, 3vw, 24px);
}

.prose ol.voice-steps li {
  padding-left: 0.25rem;
}

/* A button that does the page's main action, in the same Plum as the
   Sign up button. */

.button {
  min-height: 48px;
  padding: 0.5rem 1.25rem;
  font: inherit;
  font-family: var(--rounded);
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 10px;
  cursor: pointer;
}

/* A link that looks like the main button: the home page's "Join Storytime
   early" and the two email links on join/. */

a.button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* The two ways to join on join/: each in a box with its own heading. */

.prose .choice {
  margin-top: 2rem;
  padding: 0 1.25rem 0.25rem;
  border: 2px solid var(--line);
  border-radius: 14px;
}

.prose .choice h2 {
  margin-top: 1.25rem;
  padding-top: 0;
  border-top: 0;
}

/* The line that says "Code copied." takes no room until it has words. It
   stays on the page while empty, so a screen reader hears the words arrive. */

#copy-status:empty {
  margin: 0;
}

/* The Reading Together lessons (reading-together/). The pages are written
   by Tools/Lessons/make_lesson_pages.py in the app's repository. */

.lesson .lesson-photo {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  border-radius: 22px;
}

.lesson .lead {
  margin-top: 1.5rem;
  font-size: 1.3rem;
  line-height: 1.45;
}

/* An example as a script: who it is, then what they say or do. */

.lesson .script {
  list-style: none;
  padding-left: 0;
}

.lesson .script li {
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: 14px;
}

.lesson .script li + li {
  margin-top: 0.5rem;
}

.lesson .script strong {
  color: var(--link);
}

/* The one thing to do, set apart so it is found again at a glance. */

.lesson .try {
  padding: 1rem 1.2rem;
  font-size: 1.2rem;
  font-weight: 600;
  border-left: 5px solid var(--accent);
  background: var(--surface);
}

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

.lesson .lesson-list a {
  font-family: var(--rounded);
  font-size: 1.15rem;
  font-weight: 700;
}

/* The prompt to read on in the app, at the foot of every lesson. */

.app-prompt {
  margin-top: 3rem;
  padding: 1.5rem;
  border: 2px solid var(--accent);
  border-radius: 22px;
}

.prose .app-prompt h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  font-size: 1.5rem;
}

.app-prompt .badge {
  display: flex;
  width: max-content;
  margin-top: 1rem;
  padding-block: 0;
}

@media (prefers-contrast: more) {
  :root {
    --muted: var(--ink);
    --line: var(--ink);
  }
}

@media (forced-colors: active) {
  .signup {
    border: 2px solid CanvasText;
  }
  .hero-icon,
  .brand img,
  .badge {
    forced-color-adjust: none;
  }
  .button {
    border: 2px solid ButtonText;
  }
}

/* The press kit (press/): the contact box at the top, the fact sheet as a
   table, and the screenshots as previews that link to the full-size files. */

.press-top {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--line);
  border-radius: 14px;
}

.prose .press-top p:first-child {
  margin-top: 0;
}

.facts {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
}

.facts th,
.facts td {
  padding: 0.7rem 0.75rem 0.7rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.facts th {
  width: 9.5rem;
  font-weight: 700;
}

.facts tr:first-child th,
.facts tr:first-child td {
  border-top: 1px solid var(--line);
}

.prose .facts td p:first-child {
  margin-top: 0;
}

@media (max-width: 30em) {
  .facts th,
  .facts td {
    display: block;
    width: auto;
    padding-right: 0;
  }

  .facts th {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .facts td {
    padding-top: 0.15rem;
  }

  .facts tr:first-child td {
    border-top: 0;
  }
}

.prose ul.press-shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 8rem), 1fr));
  gap: 1.75rem 1.25rem;
  margin-top: 1.25rem;
  padding: 0;
  list-style: none;
}

.prose .press-shots li + li {
  margin-top: 0;
}

.press-shots figure {
  margin: 0;
}

.press-shots img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.press-shots figcaption {
  margin-top: 0.6rem;
  font-size: 1rem;
}
