:root {
  --color-text: #1b1f24;
  --color-text-muted: #6b7280;
  --color-background: #f4f3ef;
  --color-surface: #ffffff;
  --color-border: #e2e0d8;
  --color-accent: #1e4946;
  --color-accent-soft: #e5efe9;
  --color-highlight: #e94b35;
  --color-button: #1e4946;
  --color-button-text: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 20, 0.06), 0 8px 24px rgba(20, 30, 20, 0.06);
  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --container: 1280px;
}

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

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

body {
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
}

h1,
h2,
h3,
p {
  margin-block: 0;
}

img {
  block-size: auto;
  display: block;
  max-inline-size: 100%;
}

kbd {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85em;
  padding: 0 0.35em;
}

.visually-hidden {
  block-size: 1px;
  clip: rect(0 0 0 0);
  inline-size: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}

.container {
  margin-inline: auto;
  max-inline-size: var(--container);
  padding-inline: clamp(16px, 4vw, 40px);
}

/* Header */

.page-header {
  background: var(--color-surface);
  border-block-end: 1px solid var(--color-border);
  padding-block: 40px 24px;
}

.page-header__title {
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.page-header__back {
  margin-block-start: 12px;
}

.page-header__back a {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
}

.page-header__back a:hover {
  text-decoration: underline;
}

/* Card mode (?component=…&card=1): the row alone, screenshotted by scripts/render-cards.mjs */

.is-card .page-header,
.is-card .page-footer,
.is-card .component__actions,
.is-card .component__template,
.is-card .component__expand,
.is-card .variations {
  display: none;
}

.is-card body,
.is-card .components {
  padding: 0;
}

.is-card .component {
  border-radius: 0;
  box-shadow: none;
  inline-size: 1200px;
  transform: none;
}

/* One component only (?component=…): the online reference a template links to */

.is-single .page-header__lead,
.is-single .steps,
.is-single .notice,
.is-single .toolbar {
  display: none;
}

.page-header__lead {
  color: var(--color-text-muted);
  font-size: 16px;
  margin-block-start: 12px;
  max-inline-size: 72ch;
}

/* The three steps of the tutorial */

.steps {
  counter-reset: step;
  display: grid;
  gap: 16px 32px;
  grid-template-columns: minmax(0, 1fr);
  list-style: none;
  margin-block: 24px 0;
  padding: 0;
}

@media (min-width: 600px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1000px) {
  .steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.steps__item {
  counter-increment: step;
  display: grid;
  gap: 2px 14px;
  grid-template-columns: auto minmax(0, 1fr);
}

.steps__item::before {
  align-items: center;
  background: var(--color-accent);
  border-radius: 999px;
  block-size: 32px;
  color: var(--color-button-text);
  content: counter(step);
  display: flex;
  font-size: 16px;
  font-weight: 700;
  grid-row: 1 / 3;
  inline-size: 32px;
  justify-content: center;
}

.steps__title {
  font-weight: 600;
  line-height: 1.3;
  padding-block-start: 5px;
}

.steps__text {
  color: var(--color-text-muted);
  font-size: 14px;
}

.notice {
  background: var(--color-accent-soft);
  border-radius: var(--radius);
  margin-block-start: 24px;
  padding: 16px 20px;
}

.notice__summary {
  cursor: pointer;
  font-weight: 600;
}

.notice__body {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr);
  margin-block-start: 12px;
}


.notice__text p + p {
  margin-block-start: 8px;
}

.notice__fields {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-block-start: 12px;
}

.notice__fields strong {
  color: var(--color-text);
}

.notice__examples {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 760px) {
  .notice__examples {
    align-items: start;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.notice__example {
  margin: 0;
}

.notice__example-button {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: zoom-in;
  display: block;
  inline-size: 100%;
  overflow: hidden;
  padding: 0;
}

.notice__example-button:hover,
.notice__example-button:focus-visible {
  border-color: var(--color-accent);
  outline: none;
}

.notice__example img {
  inline-size: 100%;
}

.notice__example figcaption {
  color: var(--color-text-muted);
  font-size: 13px;
  margin-block-start: 6px;
}

/* Toolbar: sticks to the top while scrolling */

.toolbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-block-end: 1px solid var(--color-border);
  inset-block-start: 0;
  padding-block: 10px;
  position: sticky;
  z-index: 5;
}

.toolbar__inner {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.toolbar__jump select,
.toolbar__search input {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text);
  font: inherit;
  max-inline-size: 100%;
  padding: 8px 16px;
}

.toolbar__jump select {
  appearance: none;
  background: var(--color-surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='16' height='16'><path fill='none' stroke='%231b1f24' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/></svg>") no-repeat right 12px center;
  cursor: pointer;
  inline-size: 240px;
  padding-inline-end: 36px;
}

.toolbar__search input {
  inline-size: 280px;
}

@media (max-width: 599px) {
  .toolbar__jump,
  .toolbar__search {
    flex: 1 1 140px;
  }

  .toolbar__jump select,
  .toolbar__search input {
    inline-size: 100%;
  }

  .toolbar__count {
    display: none;
  }
}

.toolbar__jump select:focus-visible,
.toolbar__search input:focus-visible {
  border-color: var(--color-accent);
  outline: 2px solid var(--color-accent-soft);
}

.toolbar__count {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* Component rows */

.components {
  display: grid;
  gap: 24px;
  padding-block: 32px 48px;
}

.component {
  scroll-margin-block-start: 80px; /* the sticky toolbar */
}

.component {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: copy;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr);
  padding: 24px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.component:hover,
.component:focus-visible {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft), 0 2px 4px rgba(20, 30, 20, 0.08), 0 16px 40px rgba(20, 30, 20, 0.16);
  outline: none;
  transform: translateY(-3px);
}

.component:hover .button--primary,
.component:focus-visible .button--primary {
  box-shadow: 0 0 0 4px var(--color-accent-soft);
}

.component.is-copied,
.component.is-target {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft), var(--shadow);
}

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

  .component:hover,
  .component:focus-visible {
    transform: none;
  }
}

@media (min-width: 900px) {
  .component {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }
}

.component__preview {
  cursor: default;
}

/* The preview sits in a 4:3 box on a light background; the expand button shows it at full size. */

.component__figure {
  aspect-ratio: 4 / 3;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.component__image {
  block-size: 100%;
  cursor: zoom-in;
  inline-size: 100%;
  object-fit: contain;
}

/* The page settings' preview: a search result and a shared link, drawn with CSS */

.component__figure--snippet {
  align-content: center;
  background: var(--color-surface);
  display: grid;
  font-family: Arial, sans-serif;
  gap: 24px;
  padding: 8%;
}

.snippet__site {
  align-items: center;
  color: #4d5156;
  display: flex;
  font-size: 13px;
  gap: 8px;
}

.snippet__favicon {
  background: var(--color-accent);
  block-size: 20px;
  border-radius: 50%;
  display: inline-block;
  inline-size: 20px;
}

.snippet__title {
  color: #1a0dab;
  font-size: 20px;
  line-height: 1.3;
  margin-block: 6px 4px;
}

.snippet__text {
  color: #4d5156;
  font-size: 14px;
  line-height: 1.5;
}

.share {
  border: 1px solid #dadde1;
  border-radius: 8px;
  overflow: hidden;
}

.share__image {
  align-items: center;
  background: var(--color-accent-soft);
  block-size: 150px;
  color: var(--color-accent);
  display: flex;
  font-size: 14px;
  justify-content: center;
}

.share__body {
  background: #f0f2f5;
  padding: 10px 12px;
}

.share__domain {
  color: #65676b;
  font-size: 12px;
  text-transform: uppercase;
}

.share__title {
  color: #050505;
  font-size: 16px;
  font-weight: 600;
  margin-block: 2px;
}

.share__text {
  color: #65676b;
  font-size: 13px;
}

.component__expand {
  align-items: center;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  inset-block-end: 8px;
  inset-inline-end: 8px;
  justify-content: center;
  opacity: 0.75;
  padding: 6px;
  position: absolute;
  transition: opacity 0.15s ease;
}

.component__expand:hover,
.component__expand:focus-visible,
.component__figure:hover .component__expand {
  opacity: 1;
}

.variations {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  margin-block-start: 12px;
}

.variations__item {
  align-content: start;
  background: none;
  border: 2px solid transparent;
  border-radius: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
  display: grid;
  font: inherit;
  font-size: 12px;
  line-height: 1.3;
  padding: 4px;
  text-align: start;
}

.variations__item img {
  aspect-ratio: 4 / 3;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  inline-size: 100%;
  margin-block-end: 4px;
  object-fit: contain;
}

.variations__item:hover {
  color: var(--color-text);
}

.variations__item.is-selected {
  border-color: var(--color-accent);
  color: var(--color-text);
}

.component__header {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.component__title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.component__figma {
  color: var(--color-text-muted);
  font-size: 13px;
}

.component__description {
  color: var(--color-text-muted);
  margin-block-start: 6px;
}

.component__variation {
  font-size: 14px;
  margin-block-start: 10px;
  min-block-size: 1.5em;
}

.component__variation strong {
  color: var(--color-text);
  font-weight: 600;
}

/* Specs: the fields of the selected variation, as a plain list like the Figma library */

.specs {
  font-size: 14px;
  margin-block: 12px 0;
  padding-inline-start: 18px;
}

.specs .specs {
  margin-block: 2px 0;
}

.specs__item {
  margin-block: 3px;
}

.specs__item--note {
  color: var(--color-text-muted);
  font-size: 13px;
  list-style: none;
  margin-inline-start: -18px;
}

.specs__label {
  font-weight: 600;
}

.specs__required {
  color: var(--color-highlight);
}

.specs__tag {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  margin-inline-start: 6px;
  padding: 0 4px;
  vertical-align: 1px;
}

.specs__hint {
  color: var(--color-text-muted);
}

.specs__options {
  color: var(--color-text-muted);
  font-size: 13px;
  margin-block-start: 10px;
}

/* Actions */

.component__actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-block-start: 20px;
}

.button {
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  color: var(--color-accent);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 8px 18px;
}

.button--primary {
  background: var(--color-button);
  color: var(--color-button-text);
}

.button--ghost {
  border-color: transparent;
  color: var(--color-text-muted);
}

.button:hover {
  filter: brightness(1.08);
}

.component__intro-toggle {
  align-items: center;
  color: var(--color-text-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  gap: 6px;
}

.component__intro-toggle input {
  accent-color: var(--color-accent);
  margin: 0;
}

/* Template preview: what lands in the document */

.component__template {
  background: var(--color-background);
  border: 1px dashed var(--color-border);
  border-radius: 6px;
  cursor: default;
  font-family: Arial, sans-serif;
  font-size: 14px;
  margin-block-start: 16px;
  padding: 16px 20px;
}

.component__template p + p {
  margin-block-start: 0;
}

.component__template h1,
.component__template h2 {
  font-weight: 700;
  line-height: 1.25;
  margin-block: 8px 6px;
}

.component__template h1 {
  font-size: 22px;
}

.component__template h2 {
  font-size: 18px;
}

.component__template p {
  margin-block: 0 6px;
}

.component__template ol,
.component__template ul {
  margin-block: 0 6px;
  padding-inline-start: 24px;
}

.component__template li {
  margin-block: 2px;
}

.component__template a {
  color: #1155cc;
}

.component__template table {
  margin-block: 0 8px;
}

.component__template td p:last-child {
  margin-block-end: 0;
}

.component__template img {
  margin-block: 8px;
}

.component__template hr {
  border: 0;
  border-block-start: 1px solid var(--color-text-muted);
  margin-block: 12px 0;
}

/* Footer, toast */

.page-footer {
  color: var(--color-text-muted);
  font-size: 13px;
  padding-block: 0 48px;
}

.toast {
  background: var(--color-text);
  border-radius: 999px;
  bottom: 24px;
  color: var(--color-surface);
  font-size: 14px;
  inset-inline: 0;
  margin-inline: auto;
  max-inline-size: 90vw;
  padding: 10px 20px;
  position: fixed;
  text-align: center;
  width: max-content;
  z-index: 10;
}

.toast--error {
  background: var(--color-highlight);
}

/* Lightbox: the full screenshot, scrollable when it's a long component */

.lightbox {
  background: transparent;
  border: 0;
  max-block-size: 94vh;
  max-inline-size: min(1440px, 94vw);
  overflow: visible;
  padding: 0;
}

.lightbox::backdrop {
  background: rgba(20, 30, 20, 0.72);
}

.lightbox__figure {
  background: var(--color-surface);
  border-radius: var(--radius);
  margin: 0;
  max-block-size: 94vh;
  overflow: auto;
}

.lightbox__image {
  inline-size: 100%;
}

.lightbox__caption {
  color: var(--color-text-muted);
  font-size: 13px;
  padding: 10px 16px;
}

.lightbox__close {
  background: var(--color-surface);
  border: 0;
  border-radius: 999px;
  block-size: 36px;
  color: var(--color-text);
  cursor: pointer;
  font-size: 22px;
  inline-size: 36px;
  inset-block-start: -14px;
  inset-inline-end: -14px;
  line-height: 1;
  position: absolute;
  z-index: 1;
}
