/* Anthropic-flavored palette: coral primary on warm ivory. */

:root {
  --md-primary-fg-color: #c15f3c;
  --md-primary-fg-color--light: #d97757;
  --md-primary-fg-color--dark: #9c4a2f;
  --md-accent-fg-color: #d97757;
}

[data-md-color-scheme="default"] {
  --md-default-bg-color: #faf9f5;
  --md-code-bg-color: #f0eee6;
}

[data-md-color-scheme="slate"] {
  --md-default-bg-color: #1f1e1b;
  --md-code-bg-color: #2a2924;
}

.md-typeset h1,
.md-typeset h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

/* Certificate gallery images breathe a little. */
.md-typeset table img {
  border-radius: 4px;
}

/* Practice-question answer panels get room around them. */
.md-typeset details.success {
  margin-top: 1em;
  margin-bottom: 1.8em;
}

/* Practice engine. Colors come from the theme so both schemes work. */
.quiz__card {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 6px;
  padding: 1.4rem;
  margin: 1.4rem 0 2rem;
}

.quiz__title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.quiz__label {
  display: block;
  margin: 0.9rem 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
}

.quiz__select {
  width: 100%;
  max-width: 30rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 4px;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  font-size: 0.78rem;
}

/* Themed dropdown. The native select paints its open list in the operating
   system's colors; dropdown.js swaps it for this, which takes the palette. */
.pick {
  position: relative;
  width: 100%;
  max-width: 30rem;
}

.pick__native {
  display: none;
}

.pick__button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 4px;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  font-family: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}

.pick__button:hover,
.pick__button[aria-expanded="true"] {
  border-color: var(--md-primary-fg-color);
}

.pick__button:focus-visible {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 1px;
}

.pick__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick__caret {
  width: 12px;
  height: 8px;
  flex: none;
  color: var(--md-default-fg-color--light);
  transition: transform 0.15s ease;
}

.pick__button[aria-expanded="true"] .pick__caret {
  transform: rotate(180deg);
}

.pick__list {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 17rem;
  overflow-y: auto;
  padding: 0.25rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 4px;
  background: var(--md-default-bg-color);
  box-shadow: 0 6px 20px rgb(31 30 27 / 12%);
}

.pick__option {
  padding: 0.5rem 0.6rem;
  border-radius: 3px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--md-default-fg-color);
  cursor: pointer;
}

.pick__option:hover,
.pick__option:focus {
  outline: none;
  background: var(--md-code-bg-color);
}

.pick__option.is-selected {
  color: var(--md-primary-fg-color);
  font-weight: 600;
}

.pick__option.is-selected::after {
  content: "\2713";
  float: right;
}

.quiz__button {
  margin: 1.2rem 0.5rem 0 0;
  padding: 0.55rem 1.2rem;
  border: 1px solid var(--md-primary-fg-color);
  border-radius: 4px;
  background: transparent;
  color: var(--md-primary-fg-color);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.quiz__button--primary {
  background: var(--md-primary-fg-color);
  color: #ffffff;
}

.quiz__button:hover {
  background: var(--md-accent-fg-color);
  border-color: var(--md-accent-fg-color);
  color: #ffffff;
}

.quiz__meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--md-default-fg-color--light);
}

.quiz__bar {
  height: 3px;
  margin: 0.5rem 0 1.2rem;
  background: var(--md-default-fg-color--lightest);
  border-radius: 2px;
}

.quiz__bar-fill {
  height: 100%;
  background: var(--md-primary-fg-color);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.quiz__question {
  font-weight: 600;
  line-height: 1.6;
}

.quiz__options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz__option {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 4px;
  background: transparent;
  color: var(--md-default-fg-color);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}

.quiz__option:hover {
  border-color: var(--md-primary-fg-color);
}

.quiz__option.is-selected {
  border-color: var(--md-primary-fg-color);
  box-shadow: inset 0 0 0 1px var(--md-primary-fg-color);
}

.quiz__option.is-correct {
  border-color: #4c9a6a;
  box-shadow: inset 0 0 0 1px #4c9a6a;
}

.quiz__option.is-incorrect {
  border-color: var(--md-primary-fg-color);
  opacity: 0.75;
}

.quiz__nav {
  display: flex;
  gap: 0.5rem;
}

.quiz__table {
  width: 100%;
  margin: 1rem 0 1.5rem;
  font-size: 0.76rem;
  border-collapse: collapse;
}

.quiz__table th,
.quiz__table td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

.quiz__review {
  margin: 1.2rem 0;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--md-default-fg-color--lighter);
  font-size: 0.78rem;
}

.quiz__review.is-right {
  border-left-color: #4c9a6a;
}

.quiz__review.is-wrong {
  border-left-color: var(--md-primary-fg-color);
}

.quiz__review-q {
  font-weight: 600;
}

.quiz__review-o {
  margin: 0.2rem 0;
  color: var(--md-default-fg-color--light);
}

.quiz__review-o.is-answer {
  color: var(--md-default-fg-color);
  font-weight: 600;
}

.quiz__review-r {
  margin-top: 0.6rem;
  font-style: italic;
}

/* Embedded videos stay 16:9 at any width. */
.video-embed {
  position: relative;
  width: 100%;
  max-width: 46rem;
  padding-top: 56.25%;
  margin: 1.2em 0 2em;
  border-radius: 4px;
  overflow: hidden;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Show the right Anthropic wordmark for the active color scheme. */
[data-md-color-scheme="default"] .only-dark {
  display: none;
}

[data-md-color-scheme="slate"] .only-light {
  display: none;
}

/* Footer links carry the theme color so the maintainer credit reads as a link. */
.md-copyright a,
.md-copyright__highlight a {
  color: var(--md-primary-fg-color--light) !important;
}

.md-copyright a:hover,
.md-copyright__highlight a:hover {
  color: var(--md-accent-fg-color) !important;
  text-decoration: underline;
}

/* Mermaid pie and timeline text stays readable in dark mode; slice
   percentage labels keep their dark fill against the colored slices. */
[data-md-color-scheme="slate"] .mermaid .pieTitleText,
[data-md-color-scheme="slate"] .mermaid g.legend text,
[data-md-color-scheme="slate"] .mermaid .timeline-node text,
[data-md-color-scheme="slate"] .mermaid .sectionTitle,
[data-md-color-scheme="slate"] .mermaid .titleText {
  fill: #e3e1dc !important;
}

/* Flashcards. The card turns on its vertical axis, slowly enough to read as
   paper rather than as an effect, and not at all for readers who ask for that. */

/* The deck's own chrome runs the full width of its panel, so the controls, the
   counter, and the card all share one left and right edge. */
#deck .quiz__card {
  padding: 1.8rem 1.8rem 1.6rem;
}

#deck .quiz__label {
  margin: 0 0 0.5rem;
}

#deck .quiz__select,
#deck .pick {
  max-width: none;
  width: 100%;
}

#deck .quiz__meta {
  align-items: baseline;
  gap: 1rem;
  margin-top: 1.1rem;
}

#deck .quiz__bar {
  margin: 0.6rem 0 0;
}

#deck .quiz__nav {
  margin-top: 0.4rem;
}

.flip {
  perspective: 1400px;
  margin: 1.4rem 0 0.6rem;
  cursor: pointer;
  outline: none;
}

.flip__inner {
  position: relative;
  min-height: 14rem;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0.1, 0.2, 1);
}

.flip__inner.is-turned {
  transform: rotateY(180deg);
}

.flip__face {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 17rem;
  padding: 1.9rem 2rem 1.6rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 10px;
  background: #ffffff;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

[data-md-color-scheme="slate"] .flip__face {
  background: var(--md-code-bg-color);
}

/* The olive rule the printed cards carry across the top. */
.flip__face::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: #7d8c5c;
}

.flip__face--back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  border-color: #7d8c5c;
}

.flip__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.flip__kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6d7b4e;
}

.flip__mark img {
  width: 30px;
  height: 30px;
  display: block;
}

.flip__text {
  margin: 1.1rem 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--md-default-fg-color);
}

.flip__face--back .flip__text {
  font-weight: 500;
}

.flip__hint,
.flip__tags,
.flip__tagline {
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--md-default-fg-color--light);
}

.flip__tags {
  margin-top: 0.7rem;
  font-size: 0.66rem;
  color: var(--md-default-fg-color--lighter);
}

.flip__tagline {
  margin-top: 0.5rem;
}

/* The credit sits inside the card, as it does on the printed cards. */
.flip__credit {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

.flip__avatar {
  width: 28px;
  height: 28px;
  flex: none;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 2px;
  object-fit: cover;
}

.flip__who {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  font-size: 0.64rem;
  line-height: 1.35;
  color: var(--md-default-fg-color--light);
}

.flip__who strong {
  font-size: 0.7rem;
  color: var(--md-default-fg-color);
  white-space: nowrap;
}

.flip__who span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flip__brand {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.flip__wordmark {
  width: 84px;
  height: auto;
}

.flip__note {
  font-size: 0.6rem;
  color: var(--md-default-fg-color--lighter);
}

.flip:focus-visible .flip__face,
.flip:hover .flip__face {
  border-color: var(--md-primary-fg-color);
  border-top-color: #7d8c5c;
}

[data-md-color-scheme="slate"] .flip__kicker {
  color: #9aad74;
}

@media (prefers-reduced-motion: reduce) {
  .flip__inner {
    transition: none;
  }
}

/* The card keeps its layout and type at every width. The only concession to a
   narrow screen is that the padding tightens and the buttons share the row. */
@media screen and (max-width: 44.9375em) {
  #deck .quiz__card {
    padding: 1.2rem 1.1rem 1.1rem;
  }

  .flip__face {
    padding: 1.6rem 1.3rem 1.3rem;
  }

  .quiz__nav {
    flex-wrap: wrap;
  }

  #deck .quiz__button {
    flex: 1 1 auto;
    margin-right: 0;
  }
}

/* Progress tracker rows. */
.tracker__row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  font-size: 0.78rem;
  cursor: pointer;
}

.tracker__row:hover .tracker__label {
  color: var(--md-primary-fg-color);
}

.tracker__row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--md-primary-fg-color);
  flex: none;
}

.tracker__label {
  flex: 1;
  line-height: 1.4;
}

.tracker__weight {
  color: var(--md-default-fg-color--light);
  font-variant-numeric: tabular-nums;
}

/* The 404 page. Same palette and spacing as the rest of the site, so a wrong
   link reads as part of the documentation rather than a dead end. */
.notfound {
  max-width: 48rem;
  margin: 0 auto;
  padding: 3.5rem 0 4rem;
}

.notfound__code {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.4rem;
  line-height: 1;
  color: var(--md-primary-fg-color);
}

.notfound__title {
  margin: 0.6rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--md-default-fg-color);
}

.notfound__lead {
  max-width: 34rem;
  margin: 1rem 0 0;
  font-size: 0.8rem;
  line-height: 1.75;
  color: var(--md-default-fg-color--light);
}

.notfound__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1.6rem 2.4rem;
  margin-top: 2.8rem;
  padding-top: 2rem;
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

.notfound__group h2 {
  margin: 0 0 0.7rem;
  /* The section labels are kickers, not headings, so they keep the body face
     rather than the serif the theme gives every other h2. */
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
}

.notfound__group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  line-height: 1.5;
}

.notfound__group li {
  margin: 0 0 0.55rem;
  color: var(--md-default-fg-color--light);
}

.notfound__group a {
  color: var(--md-primary-fg-color);
  text-decoration: none;
}

.notfound__group a:hover {
  color: var(--md-accent-fg-color);
  text-decoration: underline;
}

.notfound__foot {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 2.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

.notfound__avatar {
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 2px;
  object-fit: cover;
}

.notfound__who {
  display: flex;
  flex-direction: column;
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--md-default-fg-color--light);
}

.notfound__who strong {
  color: var(--md-default-fg-color);
}

.notfound__who a {
  color: var(--md-primary-fg-color);
}

@media screen and (max-width: 44.9375em) {
  .notfound {
    padding: 2.5rem 0 3rem;
  }

  .notfound__code {
    font-size: 2.8rem;
  }

  .notfound__title {
    font-size: 1.4rem;
  }
}

/* Printing: drop the interface, keep the document. */
@media print {
  .md-header,
  .md-tabs,
  .md-sidebar,
  .md-footer,
  .md-top,
  .md-dialog,
  .md-content__button,
  .quiz__button,
  #taster,
  #quiz-app,
  #tracker {
    display: none !important;
  }

  .md-main__inner,
  .md-content,
  .md-grid {
    margin: 0 !important;
    max-width: none !important;
  }

  .md-typeset {
    color: #000;
    font-size: 10.5pt;
  }

  .md-typeset a {
    color: #000;
    text-decoration: underline;
  }

  .md-typeset h1,
  .md-typeset h2,
  .md-typeset h3 {
    page-break-after: avoid;
    color: #000;
  }

  .md-typeset table,
  .md-typeset pre,
  .md-typeset .admonition,
  .md-typeset details,
  .md-typeset .mermaid,
  .video-embed {
    page-break-inside: avoid;
  }

  .md-typeset img,
  .md-typeset .mermaid svg {
    max-width: 100% !important;
    height: auto !important;
  }

  .video-embed {
    display: none;
  }

  /* Answers stay hidden on paper unless the reader opened them. */
  .md-typeset details[open] {
    border: 1px solid #999;
  }

  @page {
    margin: 16mm;
  }
}
