:root {
  color-scheme: light;
  --ink: #29251f;
  --muted: #70685e;
  --paper: #fffdf9;
  --cream: #f5eee3;
  --peach: #e9a77e;
  --sage: #aebca4;
  --line: #ded5ca;
  --warning: #8c3529;
  --gutter: 1rem;
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, #f9d9c4 0 6rem, transparent 6.1rem),
    radial-gradient(circle at 93% 22%, #dce5d6 0 8rem, transparent 8.1rem),
    var(--cream);
  background-repeat: no-repeat;
  line-height: 1.5;
}

main {
  width: min(calc(100% - 2 * var(--gutter)), 680px);
  margin: 0 auto;
  padding: 3.5rem 0 4rem;
}

header { margin-bottom: 1.75rem; }

.eyebrow {
  margin: 0 0 .5rem;
  color: var(--warning);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 12vw, 5.6rem);
  font-weight: 500;
  letter-spacing: -.06em;
  line-height: .9;
}

.intro {
  max-width: 31rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.warning {
  margin: 1.5rem 0;
  padding: 1.15rem 1.25rem;
  border: 2px solid var(--warning);
  border-radius: 1rem;
  background: #fff7f2;
}

.warning strong {
  display: block;
  margin-bottom: .25rem;
  color: var(--warning);
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* A smaller, quieter note than the main warning. */
.notice {
  margin: -.6rem 0 1.5rem;
  padding: .8rem 1.25rem;
  border: 1px solid var(--peach);
  border-radius: 1rem;
  background: #fdf1e6;
  font-size: .95rem;
}

.notice strong {
  display: block;
  margin-bottom: .1rem;
  color: var(--warning);
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Search and topic chips stay reachable while the guide scrolls. */
.finder {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 calc(-1 * var(--gutter));
  padding: .6rem var(--gutter) .55rem;
  padding-top: max(.6rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.search {
  display: flex;
  align-items: center;
  gap: .5rem;
  height: 3rem;
  padding: 0 .4rem 0 .9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

.search:focus-within {
  border-color: var(--warning);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--peach) 45%, transparent);
}

.search svg {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  color: inherit;
  font: inherit;
  /* 16px keeps iOS from zooming the page on focus. */
  font-size: 1rem;
  appearance: none;
}

.search input::placeholder { color: var(--muted); opacity: .85; }
.search input::-webkit-search-cancel-button { display: none; }

.search button {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--cream);
  cursor: pointer;
}

.search button[hidden] { display: none; }

.chips {
  display: flex;
  gap: .45rem;
  margin: .55rem calc(-1 * var(--gutter)) 0;
  padding: 0 var(--gutter) .1rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chips a {
  flex: none;
  padding: .42rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: inherit;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.chips a[aria-current="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.chips a[hidden] { display: none; }

.status {
  margin: .9rem 0 0;
  color: var(--muted);
  font-size: .95rem;
}

.status b { color: var(--ink); }

.topic {
  margin-top: 2rem;
  scroll-margin-top: 7.4rem;
}

.topic[hidden] { display: none; }

.topic-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.9rem;
  font-weight: 500;
  letter-spacing: -.02em;
}

.count {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
}

.topic-intro {
  margin: .15rem 0 0;
  color: var(--muted);
}

/* Horizontal, snap-aligned row of video cards that bleeds to the screen edge. */
.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(82%, 300px);
  gap: .8rem;
  margin: .9rem calc(-1 * var(--gutter)) 0;
  padding: 0 var(--gutter) .4rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}

.rail::-webkit-scrollbar { display: none; }

.clip {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: var(--paper);
  scroll-snap-align: start;
  scroll-margin-top: 7.4rem;
}

.clip[hidden] { display: none; }

.player {
  position: relative;
  aspect-ratio: 5 / 6;
  overflow: hidden;
  background: #2b2620;
  isolation: isolate;
}

/* The portrait clip sits on a blurred copy of its own poster. */
.player::before {
  content: "";
  position: absolute;
  inset: -24px;
  z-index: -1;
  background: var(--poster) center / cover;
  filter: blur(18px) brightness(.62) saturate(1.1);
}

.player video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.duration {
  position: absolute;
  top: .6rem;
  right: .6rem;
  padding: .12rem .5rem;
  border-radius: 999px;
  background: rgb(20 17 13 / .66);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.player.playing .duration { display: none; }

.clip-body { padding: 1rem 1.1rem 1.1rem; }

.tag {
  margin: 0 0 .3rem;
  color: var(--warning);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

h3 {
  margin: 0 0 .4rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.2;
}

.when {
  margin: 0 0 .7rem;
  color: var(--muted);
  font-size: .95rem;
}

ol, ul {
  margin: 0;
  padding-left: 1.15rem;
}

li + li { margin-top: .55rem; }

ol {
  padding: 0;
  list-style: none;
  counter-reset: step;
}

ol li {
  position: relative;
  padding-left: 2.1rem;
  counter-increment: step;
}

ol li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: .05rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--cream);
  font-size: .8rem;
  font-weight: 800;
}

details {
  margin-top: .9rem;
  padding-top: .7rem;
  border-top: 1px solid var(--line);
  font-size: .9rem;
}

summary {
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

details p {
  margin: .5rem 0 0;
  color: var(--muted);
  font-style: italic;
}

.dots {
  display: flex;
  justify-content: center;
  gap: .1rem;
  margin-top: .2rem;
}

.dots[hidden] { display: none; }

.dots button {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.dots button::before {
  content: "";
  width: .45rem;
  height: .45rem;
  border-radius: 999px;
  background: var(--line);
  transition: width .2s, background-color .2s;
}

.dots button[aria-current="true"]::before {
  width: 1.1rem;
  background: var(--ink);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
  margin-top: .9rem;
}

.card {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
}

.card[hidden] { display: none; }
.card:first-child { background: #fff5ec; }
.card:nth-child(2) { background: #f3f7f0; }
.card h3 { margin-bottom: .65rem; font-size: 1.45rem; }

.wide { grid-column: 1 / -1; }

mark {
  padding: 0 .1em;
  border-radius: .25em;
  background: color-mix(in srgb, var(--peach) 55%, transparent);
  color: inherit;
}

footer {
  margin-top: 2.5rem;
  color: var(--muted);
  text-align: center;
  font-size: .9rem;
}

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

.search input:focus-visible { outline: 0; }

/* A topic with one clip gets a wide card: video beside the steps. */
@media (min-width: 600px) {
  .rail.single { grid-auto-columns: 100%; }
  .rail.single .clip { flex-direction: row; }
  .rail.single .player { flex: 0 0 44%; aspect-ratio: 9 / 16; }
  .rail.single .clip-body { align-self: center; padding: 1.5rem; }
}

@media (max-width: 560px) {
  main { padding-top: 2.75rem; }
  .grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .card { padding: 1.15rem; }
  .rail.single { grid-auto-columns: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dots button::before { transition: none; }
}
