/* Shared dark palette; last in the cascade so every page uses the same surfaces. */
@media screen and (prefers-color-scheme: dark) {
  :root {
    color-scheme: only dark;
    --flower-paper: #181818;
    --flower-card: #242424;
    --flower-white: #202020;
    --flower-ink: #f5f5f5;
    --flower-muted: #bdbdbd;
    --flower-line: #484848;
    --flower-card-edge: #525252;
    --flower-yellow: #5a1f01;
    --flower-on-accent: #f5f5f5;
    --flower-purple: #f5f5f5;
    --ink: var(--flower-ink);
    --paper: var(--flower-paper);
    --olive: var(--flower-ink);
    --line: var(--flower-line);
    --dark-input: #292929;
    --dark-control: #333;
    --dark-control-edge: #8a8a8a;
    --dark-error: #ffb4b4;
  }
  html body, html body[class] { background: var(--flower-paper); color: var(--flower-ink); }
  html body .feature-section { background: var(--flower-paper); color: var(--flower-ink); }
  html body .feature-section::before { border-color: var(--flower-line); }
  html body :is(.contact-main, .account-main, .licence-checkout, .reviews-main,
    .sustainability-article, .policy-content, .policy-article, .storage-envelope,
    .stack-output, .stack-builder, .stack-preview, .review-dialog) { color: var(--flower-ink); }

  html body :is(.contact-message, .account-card, .checkout-summary, .licence-cart[open],
    .order-issue-card, .review-dialog, .review-source, .review-summary, .source-review-card,
    .stack-preview, .stack-output, .sustainability-article, .closing-build,
    .stl-offer, .stl-size-guide, .storage-envelope, .stack-empty, #guide-result) {
    background: var(--flower-white); color: var(--flower-ink); border-color: var(--flower-card-edge);
  }
  html body :is(.stack-builder, .stack-rule, .stack-confirmed .stack-preview-bottom,
    .checkout-fields .checkout-section-label, .stack-builder-bottom) {
    background: var(--flower-card); color: var(--flower-muted); border-color: var(--flower-line);
  }
  html body[data-mobile-tools-trial="on"] .stack-builder-bottom { background: var(--flower-card); }
  html body :is(.policy-hero, .policy-main, .shipping-policy-main, .site-back-top,
    .explorer-info, .model-explorer, .licence-checkout-page, .order-issue-page) {
    background-color: var(--flower-paper); color: var(--flower-ink);
  }
  html body :is(.sustainability-page, .about-us-page) .site-back-top {
    background-image: linear-gradient(to right, transparent var(--sustainability-rail), var(--flower-white) var(--sustainability-rail));
  }
  html body .stack-stage { background: radial-gradient(ellipse at bottom, #444 0, #292929 52%, #202020 78%); }
  html body :is(.home-hero-stage, .home-guide-stage, :where(.account-dashboard:not(.account-settings-view)) .account-stage)::before {
    --intro-grid-line: #777;
    background-image: radial-gradient(ellipse at center, #181818f5 10%, #181818b8 42%, transparent 85%),
      linear-gradient(to right, var(--intro-grid-line) 1px, transparent 1px),
      linear-gradient(to bottom, var(--intro-grid-line) 1px, transparent 1px);
  }
  html body :is(.sustainability-main, .site-back-top)::before {
    background-image: linear-gradient(to right, #777 1px, transparent 1px), linear-gradient(to bottom, #777 1px, transparent 1px);
  }

  html body :is(.contact-form input, .contact-form select, .contact-form textarea,
    .account-entry input, .checkout-fields input:not([type="checkbox"]), .checkout-fields select,
    .order-issue-fields input, #issue-other-field textarea, #review-details input,
    #review-details textarea, #review-sort, .model-explorer select, .model-explorer input) {
    background: var(--dark-input); color: var(--flower-ink); border-color: var(--dark-control-edge); color-scheme: dark;
  }
  html body :is(input, textarea)::placeholder { color: var(--flower-muted); opacity: 1; }
  html body :is(input[type="checkbox"], input[type="radio"], meter, progress) { accent-color: var(--flower-yellow); }
  html body :is(.intro .intro-build-link, .starter-details .starter-actions a, .arrangement-label,
    .arrangement-tabs, .arrangement-links a, .size-views button, .starter-options button,
    .explorer-modes a, .explorer-tabs button, .printer-mode, .size-picker-options button,
    .stack-choice, .stack-secondary, .stack-column-tabs button, .order-issue-card button,
    :where(#guide-controls) button, :where(#review-pages) button) {
    background-color: var(--dark-control); color: var(--flower-ink); border-color: var(--dark-control-edge);
  }
  html body :is(.intro .intro-build-link, .starter-details .starter-actions a):hover { background-color: #414141; }
  html body .contact-support-link { background: transparent; color: var(--flower-ink); border-color: var(--dark-control-edge); }
  html body .contact-support-link:hover { background: var(--dark-control); }
  html body :is(.button.dark, .button.light, .contact-form .contact-submit,
    .order-issue-card .order-issue-button, .account-primary, .stack-primary, header .nav-shop),
  html body :is(.starter-options, .arrangement-tabs, .size-views, .size-picker-options,
    .explorer-tabs, .stack-column-tabs) button[aria-pressed="true"],
  html body .explorer-modes a[aria-current], html body #review-pages button[aria-current="page"],
  html body .stack-choice[aria-pressed="true"], html body #guide-controls button[aria-pressed="true"] {
    background-color: var(--flower-yellow); color: var(--flower-on-accent); border-color: var(--flower-yellow);
  }
  html body :is(.starter-options button, .stack-choice)[aria-pressed="true"] * { color: inherit; }
  html body :is(.button.dark, .button.light, .contact-form .contact-submit,
    .order-issue-card .order-issue-button, .account-primary, .stack-primary, header .nav-shop):hover {
    background-color: var(--flower-yellow); color: var(--flower-on-accent); outline: 1px solid var(--flower-on-accent); outline-offset: 2px;
  }
  html body .stack-choice[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--flower-on-accent); }

  html body :is(.support-email-label, .contact-form .contact-privacy, .required-fields,
    .account-preview-note, .checkout-vat-note, .review-public-note, :where(#review-media-help),
    .review-summary small, .source-review-heading time, .source-review-row .review-byline small,
    .source-review-score, .stack-preview-top > span, .stack-builder p, .stack-choice span,
    .stack-layer-list p, .stack-status, .stack-save-note, :where(#stack-confirmed-note),
    .starter-section-sub, .intro-dispatch-copy, .starter-actions small,
    .sustainability-growth-figure figcaption, .policy-updated, .storage-stats span) { color: var(--flower-muted); }
  html body .stack-choice[aria-pressed="true"] :is(span, strong) { color: var(--flower-on-accent); }
  html body main a.support-email { color: var(--flower-ink); }
  html body.shipping-policy-page :is(.policy-title h1, .policy-copy h2, .policy-copy h3, .policy-copy a),
  html body.care-reference-page :is(.policy-copy h2, .policy-copy h3, .policy-copy a) { color: var(--flower-ink); }
  html body .policy-copy thead { background: var(--flower-card); }
  html body .policy-copy :is(th, td) { border-color: var(--flower-line); }
  html body .faq-questions a { color: var(--flower-ink); }
  html body .hardware-table caption { color: var(--flower-muted); }
  html body :is(.contact-status:not(:empty), .contact-main > .contact-status:not(:empty)) {
    background: var(--flower-card); color: var(--flower-ink);
  }
  html body :is(.contact-form .field-error, .account-email-error, #issue-reason-error) { color: var(--dark-error); }
  html body :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--dark-error); }
  html body :is(.account-switch, .checkout-summary dl div:last-child, .licence-cart-header,
    .licence-cart-actions, .sustainability-end, #reviews-list article, .source-review-row,
    .stack-output, .stack-steps button) { border-color: var(--flower-line); }
  html body .order-issue-progress span { background: var(--flower-line); }
  html body .order-issue-progress[aria-valuenow="1"] span:first-child,
  html body .order-issue-progress[aria-valuenow="2"] span:last-child { background: var(--flower-ink); }
  html body :is(a, button, input, select, textarea, summary):focus-visible { outline-color: var(--flower-ink); }
  html body .contact-form :is(input, select, textarea, button, a):focus-visible { outline-color: var(--flower-ink); }
  html body .review-star-choice:has(input:focus-visible) { outline-color: var(--flower-ink); }
  html body header :is(.brand-logo, .checkout-brand img, .order-issue-brand img) { filter: invert(1); }

  /* Product media and measurement diagrams keep their original studio lighting. */
  html body :is(.sustainability-growth-figure, .starter-image, .hardware-render,
    .arrangement-image, .explorer-figure > img, .feature-media) { color-scheme: only light; }
  html body .sustainability-growth-figure { background: transparent; }
  html body .sustainability-body .sustainability-growth-figure { background: transparent; }
  html body .sustainability-growth-figure img { background: #fff; border-radius: 8px; }
  html body .feature-card h3 { color: var(--flower-ink); }
  html body .feature-volume-labels { background: #fff; color: #222; color-scheme: only light; }
  html body .hero-review-badge { background: var(--flower-card); color: var(--flower-ink); }
  html body .storage-envelope :is(.storage-outer-label, .storage-inner-label) { color: var(--flower-ink); }
  html body .stack-mini i { background: #555; color: var(--flower-ink); }
  html body .stack-empty.active { background: var(--flower-card); border-color: var(--flower-ink); }
}
