/* Layout for the static site. Colors, dots, and type stacks live in tokens.css.
   The only web font is Bangers from fonts/. No third-party requests. */

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

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--paper);
  background-image: var(--dots-ink);
  background-size: 14px 14px;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
}

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

.skip {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 10;
  transform: translateY(-160%);
  background: var(--yellow);
  color: var(--ink);
  border: var(--line) solid var(--ink);
  padding: 0.4rem 0.7rem;
  font-weight: 800;
}

.skip:focus {
  transform: none;
}

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

a:hover {
  text-decoration-color: var(--vermilion);
  text-decoration-thickness: 3px;
}

a:focus-visible {
  outline: 3px solid var(--vermilion);
  outline-offset: 3px;
}

/* Lettering */

h1,
h2,
h3,
.wordmark,
.kicker,
.caption,
.burst,
.price {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.035em;
  line-height: 1;
}

h1 {
  margin: 0.4rem 0 1rem;
  font-size: clamp(3rem, 9vw, 6.4rem);
  line-height: 0.92;
  text-wrap: balance;
}

h2 {
  margin: 2.25rem 0 0.6rem;
  font-size: clamp(1.8rem, 3.6vw, 2.4rem);
  text-wrap: balance;
}

p,
li,
dd {
  max-width: 40rem;
  text-wrap: pretty;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.92em;
}

/* Header */

.site-header,
.site-footer,
.page,
.wrap {
  width: min(72rem, calc(100% - 2rem));
  margin-inline: auto;
}

.wrap {
  width: min(48rem, calc(100% - 2rem));
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 1.5rem;
  padding: 1.4rem 0 1.2rem;
}

.wordmark {
  display: inline-block;
  font-size: clamp(2.2rem, 5vw, 2.9rem);
  color: var(--vermilion);
  text-decoration: none;
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-2deg);
}

.wordmark:hover {
  color: var(--vermilion);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.site-nav a {
  padding: 0.25rem 0.7rem;
  background: var(--panel);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-small);
  font-weight: 800;
  font-size: 0.92rem;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.site-nav a:hover {
  background: var(--yellow);
}

.site-nav a:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

.site-nav a[aria-current="page"] {
  background: var(--yellow);
}

/* Panels */

.panel {
  position: relative;
  background: var(--panel);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow);
  padding: clamp(1.1rem, 2.4vw, 1.75rem);
  min-width: 0;
}

.panel h2 {
  margin-top: 0;
}

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

.dots-cyan {
  background-image: var(--dots-cyan);
  background-size: 11px 11px;
}

.dots-red {
  background-image: var(--dots-red);
  background-size: 12px 12px;
}

.fill-yellow {
  background-color: var(--yellow);
}

/* Narration box, the yellow rectangle in the corner of a comic panel. */
.caption,
.kicker {
  display: inline-block;
  width: fit-content;
  align-self: flex-start;
  margin: 0 0 0.9rem;
  padding: 0.3rem 0.65rem 0.25rem;
  background: var(--yellow);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-small);
  font-size: 1.15rem;
  transform: rotate(-1.2deg);
}

.panel > .caption:first-child {
  margin-top: -0.25rem;
}

/* Home page: a comic page of panels */

.page {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--gutter);
  padding: 0.75rem 0 2.5rem;
}

.hero {
  grid-column: 1 / span 4;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 24rem;
  background-color: var(--panel);
  background-image: var(--dots-cyan);
  background-size: 11px 11px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, var(--panel) 38%, transparent 78%);
  pointer-events: none;
}

.hero > * {
  position: relative;
}

.lede {
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  font-weight: 600;
  max-width: 33rem;
  margin: 0;
}

.offer {
  grid-column: 5 / span 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1.1rem;
  text-align: center;
  background-color: var(--yellow);
  background-image: var(--dots-red);
  background-size: 12px 12px;
}

.offer p {
  margin: 0;
  font-weight: 800;
}

.burst {
  display: grid;
  place-items: center;
  width: min(15rem, 100%);
  aspect-ratio: 1;
  padding: 2.2rem;
  color: var(--panel);
  background: var(--vermilion);
  font-size: clamp(2.6rem, 4.6vw, 3.6rem);
  line-height: 0.9;
  text-align: center;
  -webkit-text-stroke: 1px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
  clip-path: polygon(50% 0%, 58% 12%, 72% 4%, 74% 19%, 89% 16%, 84% 31%, 99% 35%, 88% 47%, 99% 59%, 85% 64%, 91% 79%, 75% 78%, 72% 93%, 59% 86%, 50% 100%, 41% 86%, 28% 93%, 25% 78%, 9% 79%, 15% 64%, 1% 59%, 12% 47%, 1% 35%, 16% 31%, 11% 16%, 26% 19%, 28% 4%, 42% 12%);
  filter: drop-shadow(4px 4px 0 var(--ink));
  transform: rotate(-7deg);
}

.burst small {
  display: block;
  font-size: 0.45em;
  margin-top: 0.15em;
}

@media (prefers-reduced-motion: no-preference) {
  .burst {
    animation: pow 520ms cubic-bezier(0.2, 1.6, 0.4, 1);
  }

  @keyframes pow {
    from {
      transform: rotate(-24deg) scale(0.4);
    }
    to {
      transform: rotate(-7deg) scale(1);
    }
  }
}

/* The three-pose strip */

.pose {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 0;
}

.pose svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 15rem;
}

.pose figcaption {
  margin-top: auto;
  font-weight: 600;
}

.pose figcaption strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.7rem;
  letter-spacing: 0.035em;
  line-height: 1;
  margin-bottom: 0.3rem;
}

/* Scroll-driven motion. Browsers without scroll timelines, and visitors who ask for
   reduced motion, get the finished drawings and panels with no movement. */

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .page > .panel {
      animation: ink-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 70%;
    }

    /* Drawings follow their figure's timeline. A shape scaled to nothing has no box of its own to track. */
    .pose {
      view-timeline: --pose;
    }

    .pose .leaf {
      transform-box: view-box;
      transform-origin: 150px 115px;
      animation: unfold linear both;
      animation-timeline: --pose;
      animation-range: entry 30% entry 100%;
    }

    .pose .lid {
      transform-box: view-box;
      transform-origin: 130px 142px;
      animation: lift linear both;
      animation-timeline: --pose;
      animation-range: entry 30% entry 100%;
    }

    .pose .ink {
      transform-box: fill-box;
      transform-origin: center;
      animation: pop linear both;
      animation-timeline: --pose;
    }

    .pose .ink:nth-of-type(3) { animation-range: entry 25% entry 55%; }
    .pose .ink:nth-of-type(4) { animation-range: entry 40% entry 70%; }
    .pose .ink:nth-of-type(5) { animation-range: entry 55% entry 85%; }
    .pose .ink:nth-of-type(6) { animation-range: entry 70% entry 100%; }

    @keyframes ink-in {
      from {
        transform: translate(-0.4rem, 1.6rem);
        box-shadow: 0 0 0 var(--ink);
      }
    }

    /* A page swinging open from the spine: thin and dark at first, flat and lit at the end. */
    @keyframes unfold {
      from {
        transform: scaleX(0.04);
        filter: brightness(0.7);
      }
      60% {
        filter: brightness(0.92);
      }
    }

    @keyframes lift {
      from {
        transform: scaleY(0.12);
      }
    }

    @keyframes pop {
      from {
        transform: scale(0) rotate(-12deg);
      }
      70% {
        transform: scale(1.12) rotate(2deg);
      }
      to {
        transform: none;
      }
    }
  }
}

/* Feature panels of different sizes */

.feature {
  grid-column: span 3;
}

.feature.wide {
  grid-column: span 4;
}

.feature.narrow {
  grid-column: span 2;
}

.feature h2 {
  font-size: clamp(1.9rem, 3.2vw, 2.5rem);
}

.feature p {
  margin: 0.4rem 0 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.1rem 0.5rem;
  border: 2px solid var(--ink);
  background: var(--panel);
  font-weight: 800;
  font-size: 0.85rem;
}

/* Price */

.price-block {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 1rem 2rem;
  align-items: center;
}

.price {
  margin: 0;
  color: var(--vermilion);
  font-size: clamp(3.6rem, 9vw, 6.5rem);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 5px 5px 0 var(--ink);
}

.price-block p {
  margin: 0 0 0.7rem;
}

.status {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.35rem 0.7rem;
  border: 2px solid var(--ink);
  background: var(--yellow);
  font-weight: 800;
}

/* Inner pages: one tall panel */

main.wrap {
  margin-top: 0.5rem;
  margin-bottom: 2.5rem;
  background: var(--panel);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 4vw, 2.75rem);
}

main.wrap h1 {
  font-size: clamp(2.8rem, 8vw, 4.6rem);
}

main.wrap h2 {
  padding-top: 1.4rem;
  border-top: var(--line) solid var(--ink);
}

main.wrap h1 + h2,
main.wrap .effective + h2 {
  border-top: 0;
  padding-top: 0;
}

/* Guides */

main.wrap li {
  margin-bottom: 0.4rem;
}

.table-scroll {
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table-scroll th,
.table-scroll td {
  border: 2px solid var(--ink);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.table-scroll th {
  background: var(--yellow);
}

.table-scroll code {
  overflow-wrap: anywhere;
}

@media (max-width: 40rem) {
  .table-scroll thead {
    display: none;
  }

  .table-scroll tr,
  .table-scroll td {
    display: block;
  }

  .table-scroll tr {
    border: 2px solid var(--ink);
    margin-bottom: 0.75rem;
  }

  .table-scroll td {
    border: 0;
  }

  .table-scroll td:first-child {
    background: var(--yellow);
    font-weight: 800;
  }

  .table-scroll td + td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
}

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

.guide-list li {
  margin: 0 0 1.4rem;
}

.guide-list a {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.4vw, 1.9rem);
  letter-spacing: 0.03em;
  line-height: 1.1;
  text-decoration-color: var(--vermilion);
}

.guide-list p {
  margin: 0.3rem 0 0;
}

.more {
  font-weight: 800;
}

.mail {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  letter-spacing: 0.03em;
  text-decoration-color: var(--vermilion);
}

blockquote {
  margin: 1.2rem 0;
  padding: 1rem 1.2rem;
  background-color: var(--paper);
  border: 2px solid var(--ink);
  border-left-width: 8px;
}

.effective,
.note {
  font-size: 0.95rem;
}

.effective {
  font-weight: 700;
}

/* Footer */

.site-footer {
  padding: 0.5rem 0 3rem;
  font-size: 0.92rem;
}

.site-footer .caption {
  font-size: 1.5rem;
  margin-bottom: 1.1rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin-bottom: 0.9rem;
  font-weight: 700;
}

.site-footer p {
  margin: 0.35rem 0;
  max-width: 44rem;
}

/* Small screens: panels stack in reading order */

@media (max-width: 860px) {
  .hero,
  .offer {
    grid-column: 1 / -1;
  }

  .hero {
    min-height: 0;
  }

  .pose {
    grid-column: span 3;
  }

  .pose:last-of-type {
    grid-column: 1 / -1;
  }

  .feature,
  .feature.wide,
  .feature.narrow {
    grid-column: 1 / -1;
  }

  .price-block {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .pose {
    grid-column: 1 / -1;
  }

  .site-nav a {
    font-size: 0.85rem;
  }

  .burst {
    width: min(12rem, 100%);
  }
}
