.component-gallery {
  margin: 0;
  color: var(--book-ink);
  background: var(--book-paper);
  font-family: "Nunito", Arial, sans-serif;
  line-height: 1.5;
}
.component-gallery *,
.component-gallery *::before,
.component-gallery *::after {
  box-sizing: border-box;
}
.component-gallery [hidden] {
  display: none !important;
}
.component-gallery :is(h1, h2, h3, p, figure) {
  margin: 0;
}
.component-gallery fieldset {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}
.component-gallery
  :is(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--ui-focus, var(--book-leaf));
  outline-offset: 3px;
}
.component-gallery :is(.visually-hidden, .gallery-skip:not(:focus)) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.gallery-skip:focus {
  position: fixed;
  z-index: 10;
  top: 12px;
  left: 12px;
  background: var(--book-paper);
  color: var(--book-ink);
  padding: 10px;
}
.component-gallery main,
.gallery-header,
.gallery-footer {
  width: min(1160px, calc(100% - clamp(36px, 9vw, 144px)));
  margin-inline: auto;
}
.gallery-header,
.gallery-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.gallery-header {
  height: 77px;
}
.gallery-wordmark {
  font:
    700 clamp(23px, 2.35vw, 34px) / 1 "Fraunces",
    Georgia,
    serif;
  letter-spacing: -0.045em;
  text-decoration: none;
  color: var(--book-ink);
}
.gallery-header nav {
  display: flex;
  gap: clamp(16px, 3vw, 38px);
}
.gallery-header nav a,
.gallery-footer > a:last-child {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--book-ink);
  font-weight: 700;
  text-decoration: none;
}
.gallery-header nav a:hover,
.gallery-footer > a:last-child:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.gallery-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  align-items: center;
  min-height: clamp(300px, 31vw, 420px);
  padding: clamp(28px, 4.1vw, 64px);
  color: var(--ui-on-sage, var(--book-ink));
  background: var(--book-sage);
  border-radius: 1px;
}
.gallery-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("/creator-art/sky-background.webp") 65% 42% / cover;
  opacity: 0.55;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.gallery-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 41ch;
}
.gallery-hero h1 {
  font:
    600 clamp(51px, 6.6vw, 94px) / 0.91 "Fraunces",
    Georgia,
    serif;
  letter-spacing: -0.043em;
}
.gallery-hero h1 span {
  color: inherit;
}
.gallery-hero-copy p {
  max-width: 40ch;
  margin-top: 21px;
  font-size: clamp(15px, 1.33vw, 19px);
  line-height: 1.45;
}
.gallery-hero-art {
  position: relative;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 190px;
}
.gallery-hero-art img {
  width: clamp(165px, 23vw, 310px);
  height: clamp(160px, 21vw, 270px);
  object-fit: contain;
  filter: drop-shadow(0 6px 4px rgb(35 48 36 / 0.09));
}
.gallery-hero-art figcaption {
  position: absolute;
  right: 0;
  bottom: -0.45rem;
  max-width: 26ch;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 700;
}
.gallery-section {
  padding-top: clamp(38px, 4.8vw, 74px);
  scroll-margin-top: 12px;
}
.gallery-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  column-gap: 24px;
  row-gap: 6px;
  margin-bottom: 22px;
}
.gallery-section h2,
.component-gallery dialog h2 {
  font:
    600 clamp(29px, 3.5vw, 48px) / 1.07 "Fraunces",
    Georgia,
    serif;
  letter-spacing: -0.034em;
}
.gallery-section-head p,
.specimen-label p {
  color: var(--book-muted);
}
#palette-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
#palette-list .palette-option {
  display: block;
  min-width: 0;
  padding: 12px 14px 13px;
  border-radius: 9px;
  cursor: pointer;
}
.palette-option strong {
  line-height: 1.15;
}
.palette-option .palette-name {
  display: flex;
  align-items: center;
  gap: 9px;
}
.palette-option .palette-swatches {
  display: flex;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--book-ink) 22%, transparent);
  border-radius: 4px;
  height: 21px;
}
.palette-swatches i {
  flex: 1;
  min-width: 0;
}
.gallery-tuner {
  border-bottom: 1px solid var(--book-rule);
  padding-bottom: 6px;
}
.gallery-tuner summary {
  width: fit-content;
  cursor: pointer;
  margin-top: 7px;
  padding: 10px 3px;
  font-weight: 700;
  color: var(--ui-leaf-text);
}
.gallery-tuning-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  padding: 4px 3px 17px;
  align-items: center;
}
.gallery-tuning-controls label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}
.gallery-tuning-controls input[type="color"] {
  width: 42px;
  height: 42px;
  padding: 3px;
  cursor: pointer;
  border-radius: 6px;
  background: var(--ui-surface, var(--book-paper));
  border: 1px solid var(--book-muted);
}
.specimen-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.6fr) minmax(0, 1.7fr);
  column-gap: clamp(22px, 5vw, 80px);
  padding: 30px 0 34px;
  border-top: 1px solid var(--book-rule);
}
.specimen-label h3 {
  font:
    600 clamp(22px, 2.2vw, 29px) / 1.12 "Fraunces",
    Georgia,
    serif;
  letter-spacing: -0.025em;
}
.specimen-label p {
  margin-top: 7px;
  max-width: 25ch;
  font-size: 0.94rem;
}
.specimen-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
  align-items: start;
}
.specimen-fields > label,
.specimen-fields legend,
.sample-progress label {
  font-weight: 700;
  font-size: 0.96rem;
}
.specimen-fields > label > .ui-field,
.sample-scale > .ui-range {
  display: block;
  width: 100%;
  margin-top: 5px;
}
.specimen-fields legend {
  margin-bottom: 8px;
}
/* A drawn menu sizes its box to its text: put it under its label at that width. */
.specimen-fields > label > wired-combo.wired-field {
  display: block;
  width: fit-content;
  margin-top: 5px;
}
.sample-email .ui-error {
  display: block;
  margin: 4px 0 0;
}
.sample-wide {
  grid-column: 1/-1;
}
.specimen-line,
.specimen-actions,
.sample-feedback-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.specimen-actions {
  align-content: start;
  align-items: flex-start;
}
.sample-checks {
  display: grid;
  gap: 3px;
}
.sample-checks label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
}
/* Disabled controls are exempt from text contrast; keep them clearly faded. */
.sample-checks label:has(:disabled) {
  color: color-mix(in srgb, var(--book-muted) 65%, transparent);
}
.sample-scale span,
.sample-progress > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sample-scale output,
.sample-progress output {
  color: var(--book-muted);
  font-weight: 600;
  font-size: 0.9rem;
}
.sample-feedback {
  display: grid;
  gap: 22px;
  align-items: start;
}
.sample-feedback .ui-nav {
  width: fit-content;
  max-width: 100%;
}
.sample-progress {
  max-width: 520px;
}
.sample-progress progress {
  width: 100%;
  margin-top: 7px;
}
.sample-feedback-actions {
  justify-content: space-between;
  max-width: 520px;
}
.sample-feedback-actions .ui-status {
  margin: 0;
}
.gallery-footer {
  border-top: 1px solid var(--book-rule);
  padding-block: 22px 30px;
}
#sample-dialog {
  width: min(460px, calc(100vw - 30px));
  max-height: 90svh;
  overflow: auto;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.component-gallery dialog h2 {
  font-size: 28px;
}
.sample-art-well {
  background: var(--book-sand);
  border-radius: 7px;
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 10px;
  overflow: hidden;
}
/* The sample sits on the shared paper sheet; the size control scales the sheet, not the art inside it. */
.sample-paper {
  --ui-paper-background: white;
  width: 80%;
  box-sizing: border-box;
}
#sample-art {
  display: block;
  width: 100%;
  height: auto;
}
#sample-caption {
  margin-top: 12px;
}
@media (max-width: 760px) {
  .gallery-header {
    height: 64px;
  }
  .gallery-hero {
    min-height: 255px;
  }
  .gallery-section-head {
    display: block;
  }
  .gallery-section-head p {
    margin-top: 7px;
  }
  #palette-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .specimen-row {
    grid-template-columns: 1fr;
    gap: 19px;
    padding-block: 25px;
  }
  .specimen-label p {
    max-width: none;
  }
}
@media (max-width: 510px) {
  .gallery-hero {
    grid-template-columns: 1fr 0.65fr;
    gap: 0;
    padding: 23px 15px;
    min-height: 225px;
  }
  .gallery-hero-art {
    min-height: 130px;
    align-self: center;
  }
  .gallery-hero-art img {
    width: 105%;
    max-width: 160px;
    height: 130px;
  }
  .gallery-hero-art figcaption {
    display: none;
  }
  .gallery-hero h1 {
    font-size: clamp(36px, 10vw, 52px);
  }
  .gallery-hero-copy p {
    font-size: 14px;
    margin-top: 15px;
    width: 115%;
    max-width: 27ch;
  }
  .gallery-header nav a {
    font-size: 0.9rem;
  }
  .gallery-hero-art {
    transform: translate(4px, -22px);
  }
  .specimen-fields {
    grid-template-columns: 1fr;
  }
  #palette-list .palette-option {
    padding: 11px;
  }
}

.wired-showcase {
  scroll-margin-top: 2rem;
  color: var(--book-ink);
  --wired-combo-popup-bg: var(--ui-surface);
  --wired-item-selected-bg: var(--book-sage);
  --wired-item-selected-color: var(--ui-on-sage);
  --wired-radio-icon-color: var(--book-leaf);
  --wired-checkbox-icon-color: var(--book-leaf);
  --wired-slider-knob-color: var(--book-orange);
  --wired-slider-knob-outline-color: var(--book-ink);
  --wired-slider-bar-color: var(--book-muted);
}
.wired-workbench {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  margin-block: 1.2rem;
  padding-block: 1.2rem;
  gap: 1.5rem;
  border-block: 1px solid var(--book-rule);
}
.wired-setting {
  display: grid;
  align-content: start;
  gap: 0.65rem;
}
.wired-setting strong {
  font-size: 1rem;
}
.wired-setting output {
  font-weight: 400;
}
.wired-setting wired-combo {
  width: fit-content;
  min-width: 8.5rem;
}
.wired-setting wired-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.75rem;
}
.wired-setting wired-radio,
.wired-setting wired-checkbox {
  padding-block: 0.45rem;
}
.wired-setting wired-slider {
  max-width: 100%;
  width: 14rem;
}
.wired-showcase wired-button {
  background-color: var(--book-orange);
  color: var(--ui-on-accent);
  font-weight: 700;
}
#sample-art[data-bordered] {
  border: 2px solid var(--book-ink);
}
@media (max-width: 480px) {
  .gallery-header nav {
    gap: 0.65rem;
  }
  .gallery-header nav a {
    font-size: 0.86rem;
  }
}
.wired-showcase .gallery-section-head a {
  color: var(--ui-leaf-text);
  text-underline-offset: 0.2em;
}

#rocket-orbit { justify-self: start; width: 112px; --orbit-center-y: 21%; }
#rocket-orbit img { width: 100%; object-fit: contain; }

/* Twinkling stars specimen */
.stars-demo { display: grid; gap: clamp(16px, 3vw, 32px); grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.stars-sky { position: relative; isolation: isolate; min-height: 280px; border-radius: 14px; overflow: hidden;
  background: var(--book-sage) url("/creator-art/sky-background.webp") 60% 40% / cover; }
.stars-controls { margin: 0; border: 0; padding: 0; display: grid; gap: 14px; }
.stars-controls legend { font-weight: 700; margin-bottom: 8px; }
.stars-density { display: grid; gap: 6px; font-weight: 700; }
.stars-usage { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--ui-surface, #fffdfa); border: 1px solid var(--book-rule); white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; }
.stars-note { margin: 0; color: var(--book-muted); font-size: .92rem; }
@media (max-width: 720px) { .stars-demo { grid-template-columns: 1fr; } }
