/* Candy AI Guide: editorial paper and teal */

:root {
  --paper: #FBFAF7;
  --sheet: #FFFFFF;
  --ink: #1B1A17;
  --muted: #5F5B52;
  --rule: #E4E0D6;
  --rule-firm: #CFC9BA;
  --band: #F3F0E8;
  --head: #ECE8DD;
  --teal: #0F766E;
  --teal-deep: #0B5750;
  --teal-wash: #EDF5F3;
  --amber: #B45309;
  --amber-wash: #FDF8EE;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

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

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;
}

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

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.45rem + 2.4vw, 2.85rem);
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
}

h2 {
  font-size: clamp(1.45rem, 1.3rem + 0.7vw, 1.75rem);
  margin: 2.75rem 0 0.9rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule-firm);
  scroll-margin-top: 1rem;
}

h3 {
  font-size: 1.25rem;
  margin: 1.75rem 0 0.5rem;
}

p,
ul,
ol {
  margin: 0 0 1.15rem;
}

ul,
ol {
  padding-left: 1.4rem;
}

li {
  margin-bottom: 0.45rem;
}

a {
  color: var(--teal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--teal-deep);
  text-decoration-thickness: 2px;
}

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

strong {
  font-weight: 700;
}

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

.skip:focus {
  top: 1rem;
  color: var(--paper);
}

/* Masthead */

.masthead {
  background: var(--paper);
}

.masthead__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem 0.5rem;
  padding-block: 0.6rem;
}

.masthead__name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  text-decoration: none;
}

.masthead__name:hover {
  color: var(--teal-deep);
}

.masthead__mark {
  flex: none;
  width: 26px;
  height: 26px;
}

.masthead__strap {
  display: none;
  margin: 0 auto 0 0.25rem;
  padding-left: 1rem;
  border-left: 1px solid var(--rule-firm);
  font-size: 0.9rem;
  line-height: 1.3;
  color: var(--muted);
}

.sections {
  position: relative;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule-firm);
}

.sections::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.25rem;
  background: linear-gradient(to right, rgba(251, 250, 247, 0), var(--paper));
  pointer-events: none;
}

.sections__list {
  display: flex;
  gap: 0 1.4rem;
  margin: 0;
  padding: 0 2.5rem 0 1.125rem;
  list-style: none;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.sections__list li {
  margin: 0;
}

.sections__list a {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  border-bottom: 3px solid transparent;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  outline-offset: -3px;
}

.sections__list a:hover {
  color: var(--teal-deep);
  border-bottom-color: var(--rule-firm);
}

.sections__list a[aria-current="page"] {
  border-bottom-color: var(--teal);
  color: var(--teal-deep);
  font-weight: 700;
}

/* Buttons */

.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.55rem 1.15rem;
  border: 2px solid var(--teal);
  border-radius: 4px;
  background: var(--teal);
  color: #FFFFFF;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.action:hover {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  color: #FFFFFF;
}

.action--quiet {
  min-height: 44px;
  padding: 0.3rem 0.6rem;
  background: transparent;
  color: var(--teal-deep);
  font-size: 0.88rem;
}

.action--quiet:hover {
  background: var(--teal);
  color: #FFFFFF;
}

/* Page furniture */

.page {
  padding-bottom: 1rem;
}

.crumbs {
  margin: 0.9rem 0 0.6rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.crumbs li {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
}

.crumbs li + li::before {
  content: "\203A";
  margin-right: 0.5rem;
  color: var(--muted);
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
}

.column {
  max-width: 45rem;
}

.dateline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 1.25rem;
  margin: 0 0 1.4rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--rule-firm);
  border-bottom: 1px solid var(--rule-firm);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
}

.dateline__by {
  font-weight: 700;
  color: var(--ink);
}

.standfirst {
  margin: 0 0 1.5rem;
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.5;
}

.checked {
  font-size: 0.95rem;
  color: var(--muted);
}

/* Article layout */

.story__head,
.story__body {
  max-width: 45rem;
}

.contents {
  max-width: 45rem;
  margin: 0 0 2rem;
  padding: 1rem 1.15rem 0.5rem;
  border: 1px solid var(--rule-firm);
  background: var(--sheet);
}

.contents__title {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.contents ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.contents li {
  margin: 0;
  border-top: 1px solid var(--rule);
  counter-increment: toc;
}

.contents a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 44px;
  padding: 0.4rem 0;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
}

.contents a::before {
  content: counter(toc);
  flex: none;
  min-width: 1.2rem;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--teal);
}

.contents a:hover {
  color: var(--teal-deep);
  text-decoration: underline;
}

.story__body > p,
.story__body > ul,
.story__body > ol,
.column > p,
.column > ul,
.column > ol {
  max-width: 68ch;
}

.story__body > h2:first-child {
  margin-top: 0;
}

/* Key points and callouts */

.keypoints {
  margin: 0 0 2rem;
  padding: 1.1rem 1.25rem 0.75rem;
  border-left: 4px solid var(--teal);
  background: var(--teal-wash);
}

.keypoints__title {
  margin: 0 0 0.6rem;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
}

.keypoints ul {
  margin: 0;
  padding-left: 1.2rem;
}

.note {
  margin: 1.6rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--amber);
  background: var(--amber-wash);
}

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

.note__label {
  margin: 0 0 0.3rem;
  font-weight: 700;
  color: var(--amber);
}

/* Steps */

.steps {
  margin: 1.4rem 0 1.6rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  position: relative;
  min-height: 2.2rem;
  margin: 0 0 0.85rem;
  padding: 0.15rem 0 0 3rem;
  counter-increment: step;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: var(--teal);
  color: #FFFFFF;
  font-weight: 700;
  line-height: 2.2rem;
  text-align: center;
}

/* Strengths and limits */

.ledger {
  margin: 1.2rem 0 1.5rem;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--rule);
}

.ledger > li {
  position: relative;
  margin: 0;
  padding: 0.7rem 0 0.7rem 2.2rem;
  border-top: 1px solid var(--rule);
}

.ledger > li::before {
  position: absolute;
  left: 0.15rem;
  top: 0.55rem;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.3;
}

.ledger--plus > li::before {
  content: "+";
  color: var(--teal);
}

.ledger--minus > li::before {
  content: "\2212";
  color: var(--amber);
}

/* Tables */

.tablewrap {
  margin: 1.5rem 0 1.6rem;
  overflow-x: auto;
  border: 1px solid var(--rule-firm);
  background: var(--sheet);
}

.datatable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.45;
}

.datatable caption {
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--rule-firm);
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: left;
}

.datatable th,
.datatable td {
  padding: 0.6rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.datatable thead th {
  border-bottom: 2px solid var(--ink);
  background: var(--head);
  font-size: 0.9rem;
  font-weight: 700;
  vertical-align: bottom;
}

.datatable tbody tr:nth-child(even) {
  background: var(--band);
}

.datatable tbody tr + tr > * {
  border-top: 1px solid var(--rule);
}

.datatable tbody th {
  font-weight: 700;
}

.datatable td {
  font-variant-numeric: tabular-nums;
}

/* Figures */

.diagram {
  margin: 1.8rem 0;
}

.diagram img {
  display: block;
  width: 100%;
  max-width: 520px;
}

.diagram figcaption {
  max-width: 68ch;
  margin-top: 0.6rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
}

/* Link-out box */

.nextstep {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 1.5rem;
  margin: 2rem 0;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--rule-firm);
  border-top: 3px solid var(--teal);
  background: var(--sheet);
}

.nextstep p {
  flex: 1 1 16rem;
  margin: 0;
}

.nextstep small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Sources and related */

.sources {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 1rem;
  line-height: 1.5;
}

.sources li {
  margin: 0;
  padding: 0 0 0.6rem;
  border-top: 1px solid var(--rule);
}

.sources a {
  display: inline-block;
  padding: 0.65rem 0 0.2rem;
  min-height: 44px;
  font-weight: 600;
}

.sources__meta {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Lists whose items start with a link: roomy rows so each link is easy to tap */

.roomy {
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--rule);
}

.roomy li {
  margin: 0;
  border-top: 1px solid var(--rule);
}

.roomy a {
  display: block;
  min-height: 44px;
  padding: 0.55rem 0;
  font-weight: 600;
}

.roomy span {
  display: block;
  margin-top: -0.45rem;
  padding-bottom: 0.65rem;
  font-size: 1rem;
  color: var(--muted);
}

.related {
  margin: 0;
  padding: 0;
  list-style: none;
}

.related li {
  margin: 0;
  border-top: 1px solid var(--rule);
}

.related a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0.5rem 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
}

/* Home */

.opening {
  max-width: 45rem;
  padding-top: 1.75rem;
}

.opening p {
  max-width: 68ch;
}

.guides {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.guide-card {
  position: relative;
  margin: 0;
  padding: 1rem 1.15rem 1.15rem;
  border: 1px solid var(--rule-firm);
  border-top: 3px solid var(--ink);
  background: var(--sheet);
}

.guide-card:hover {
  border-top-color: var(--teal);
}

.guide-card__kicker {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
}

.guide-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.3rem;
}

.guide-card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.guide-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.guide-card:hover h3 a {
  color: var(--teal-deep);
  text-decoration: underline;
}

.guide-card p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--muted);
}

/* Colophon */

.colophon {
  margin-top: 4rem;
  padding: 2rem 0 2.5rem;
  border-top: 2px solid var(--ink);
  background: var(--band);
  font-size: 1rem;
}

.colophon__cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem 2.5rem;
}

.colophon__label {
  margin: 0 0 0.3rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.colophon ul {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 1.5rem;
}

.colophon li {
  margin: 0;
  break-inside: avoid;
}

.colophon li a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
}

.colophon li a:hover {
  color: var(--teal-deep);
}

.colophon__disclosure {
  max-width: 62ch;
  margin: 0;
  line-height: 1.55;
}

.colophon__fine {
  margin: 1.75rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule-firm);
  font-size: 0.9rem;
  color: var(--muted);
}

/* Redirect page */

.handoff {
  max-width: 34rem;
  margin: 12vh auto 0;
  padding: 0 1.125rem;
}

.handoff h1 {
  font-size: 1.8rem;
}

/* Wider screens */

@media (min-width: 30em) {
  .masthead__bar {
    gap: 0.4rem 1rem;
  }

  .masthead__name {
    gap: 0.6rem;
    font-size: 1.3rem;
  }

  .masthead__mark {
    width: 30px;
    height: 30px;
  }

  .action--quiet {
    padding: 0.4rem 0.85rem;
    font-size: 0.95rem;
  }
}

@media (min-width: 40em) {
  .standfirst {
    font-size: 1.32rem;
  }

  .datatable {
    font-size: 1rem;
  }

  .datatable caption,
  .datatable th,
  .datatable td {
    padding-inline: 1rem;
  }

  .guides {
    grid-template-columns: 1fr 1fr;
  }

  .colophon__cols {
    grid-template-columns: 1.2fr 0.9fr;
  }

  .colophon__cols > :last-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 48em) {
  .masthead__name {
    font-size: 1.55rem;
  }

  .masthead__mark {
    width: 34px;
    height: 34px;
  }

  .masthead__strap {
    display: block;
  }
}

@media (min-width: 60em) {
  .sections::after {
    display: none;
  }

  .sections__list {
    width: min(100% - 2.25rem, 66rem);
    margin-inline: auto;
    padding: 0;
    overflow: visible;
  }
}

@media (min-width: 64em) {
  .guides {
    grid-template-columns: repeat(3, 1fr);
  }

  .colophon__cols {
    grid-template-columns: 1.3fr 0.8fr 1.4fr;
  }

  .colophon__cols > :last-child {
    grid-column: auto;
  }
}

@media (min-width: 66em) {
  .story {
    display: grid;
    grid-template-columns: minmax(0, 45rem) 15rem;
    grid-template-areas:
      "head toc"
      "body toc";
    justify-content: space-between;
    align-items: start;
    column-gap: 3rem;
  }

  .story__head {
    grid-area: head;
  }

  .story__body {
    grid-area: body;
  }

  .contents {
    grid-area: toc;
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    margin: 0;
    padding: 0 0 0 1.25rem;
    overflow-y: auto;
    border: 0;
    border-left: 1px solid var(--rule-firm);
    background: transparent;
  }

  .contents li:first-child {
    border-top: 0;
  }

  .contents a {
    font-size: 0.95rem;
  }
}

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

@media print {
  .sections,
  .nextstep,
  .masthead .action,
  .contents,
  .skip {
    display: none;
  }

  body {
    background: #FFFFFF;
    font-size: 11pt;
  }

  .colophon {
    background: #FFFFFF;
  }
}
