/*
 * Shared surface system
 *
 * The product catalogue is the visual reference for elevated dark surfaces.
 * This layer is loaded after page palettes so surface treatment is owned in
 * one place while component files continue to own layout, imagery, and motion.
 * `.shell` remains a layout primitive; only shell instances that are real
 * surfaces receive a treatment here.
 */

/* The header shell is a navigation surface, while other `.shell` elements
 * remain transparent layout containers. */
html:not([data-theme="light"]) .site-header .header-container {
  background: color-mix(in srgb, var(--paper-2) 86%, transparent);
  border-color: color-mix(in srgb, var(--copper) 24%, var(--line));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}

html[data-theme="light"] .site-header .header-container {
  background: color-mix(in srgb, var(--paper-2) 88%, transparent);
  border-color: var(--line);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--ink) 8%, transparent);
}

/* Structural frames and feature panels ------------------------------------ */
html:not([data-theme="light"]) :is(
  .home-process-feature,
  .home-quality-frame,
  .home-certificates-frame,
  .products-certificates-frame,
  .process-panel,
  .contact-panel,
  .mission-pipeline-panel,
  .vision-network-panel,
  .vision-v1-panel,
  .lightbox-frame,
  .site-footer .footer-grid
) {
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--paper-2) 90%, var(--copper) 10%) 0%,
    var(--paper-2) 100%
  );
  border: 1px solid color-mix(in srgb, var(--copper) 32%, var(--line));
  box-shadow:
    0 20px 48px rgba(0, 0, 0, .45),
    inset 0 1px 0 rgba(255, 255, 255, .04);
}

/* Keep the light theme's existing quiet, paper-led frames intact. */
html[data-theme="light"] :is(
  .home-process-feature,
  .home-quality-frame,
  .home-certificates-frame,
  .products-certificates-frame,
  .process-panel,
  .contact-panel,
  .site-footer .footer-grid
) {
  background: var(--paper-2);
  border-color: color-mix(in srgb, var(--copper) 22%, var(--line));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 7%, transparent);
}

/* The map/network panel has its own dark cartography variables. The shared
 * border and elevation still place it in the same family without changing
 * the map's intentional near-black canvas. */
html:not([data-theme="light"]) .vision-network-panel {
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--paper-2) 88%, var(--copper) 12%) 0%,
    var(--paper-2) 100%
  );
}

/* Interactive cards -------------------------------------------------------- */
html:not([data-theme="light"]) :is(
  .home-product-card,
  .product-card,
  .products-card,
  .related-card,
  .news-card,
  .home-news-card,
  .home-quality-card,
  .home-certificate-card,
  .products-certificate-card,
  .certificate-card,
  .quality-feature,
  .quality-bento-card,
  .quality-bento-pillar,
  .quality-certificate-preview,
  .news-tiles > a,
  .vision-v1-corridor-card,
  .mission-stage-tab
) {
  background: color-mix(in srgb, var(--paper-2) 94%, var(--copper) 6%);
  border-style: solid;
  border-width: 1px;
  border-color: color-mix(in srgb, var(--copper) 26%, var(--line));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .32);
}

html:not([data-theme="light"]) .products-page .products-card {
  border-top-width: 3px;
}

html:not([data-theme="light"]) :is(
  .home-product-card,
  .product-card,
  .products-card,
  .related-card,
  .news-card,
  .home-news-card,
  .home-certificate-card,
  .products-certificate-card,
  .quality-feature,
  .quality-bento-card,
  .quality-bento-pillar,
  .quality-certificate-preview,
  .news-tiles > a,
  .vision-v1-corridor-card,
  .mission-stage-tab
):is(:hover, :focus-within, :focus-visible) {
  border-color: var(--copper);
  background: color-mix(in srgb, var(--copper) 7%, var(--paper-2));
  box-shadow: 0 14px 34px color-mix(in srgb, var(--copper) 18%, transparent);
}

/* Featured cards retain their existing accent signal. */
html:not([data-theme="light"]) :is(
  .home-product-card.is-featured,
  .products-page .products-card.is-featured
) {
  border-color: var(--copper);
}

/* Image stages, galleries, and map frames --------------------------------- */
html:not([data-theme="light"]) :is(
  .home-product-image,
  .product-image,
  .detail-hero-image,
  .detail-gallery > a,
  .editorial-image,
  .news-card-media,
  .vision-v1-live-map-frame,
  .vision-map-frame,
  .mission-stage-visual,
  .story-slider .slider-images
) {
  background: color-mix(in srgb, var(--paper) 82%, var(--paper-2) 18%);
  border-color: color-mix(in srgb, var(--copper) 20%, var(--line));
}

html:not([data-theme="light"]) :is(
  .vision-v1-live-map-frame,
  .vision-map-frame,
  .mission-stage-visual
) {
  box-shadow: 0 16px 38px rgba(0, 0, 0, .34);
}

/* Tables, matrices, metric grids, and bordered ribbons -------------------- */
html:not([data-theme="light"]) :is(
  .comparison-table,
  .standard-grid,
  .mini-process,
  .process-steps,
  .certificate-ribbon
) {
  background: var(--paper-2);
  border-style: solid;
  border-width: 1px;
  border-color: color-mix(in srgb, var(--copper) 28%, var(--line));
  box-shadow: 0 12px 32px rgba(0, 0, 0, .30);
}

html:not([data-theme="light"]) :is(
  .comparison-table .table-row,
  .standard-item,
  .process-steps > div,
  .mini-process > div,
  .certificate-ribbon > span,
  .certificate-ribbon > a
) {
  border-color: var(--line);
}

html:not([data-theme="light"]) .comparison-table .table-row:nth-child(odd):not(.table-head),
html:not([data-theme="light"]) :is(.standard-item, .process-steps > div, .mini-process > div):nth-child(odd) {
  background: color-mix(in srgb, var(--paper-subtle) 62%, var(--paper-2));
}

html:not([data-theme="light"]) .comparison-table .table-head,
html:not([data-theme="light"]) .comparison-table .table-row:hover:not(.table-head) {
  background: color-mix(in srgb, var(--copper) 4%, var(--paper-2));
}

html:not([data-theme="light"]) :is(
  .comparison-table .table-product-name,
  .comparison-table .spec-value,
  .standard-item h3,
  .process-steps b,
  .mini-process h3,
  .certificate-ribbon > span
) {
  color: var(--ink);
}

html:not([data-theme="light"]) :is(
  .comparison-table .spec-value,
  .standard-item p,
  .process-steps span,
  .mini-process p,
  .certificate-ribbon > a
) {
  color: var(--muted);
}

/* Search, filter, navigation, and result surfaces ------------------------ */
html:not([data-theme="light"]) :is(
  .search-page-form,
  .news-directory .search-field,
  .search-results,
  .search-result,
  .empty-state,
  .filter-bar,
  .products-filter-bar,
  .category-tabs,
  .quality-anchor-nav
) {
  background: var(--paper-2);
  border-style: solid;
  border-width: 1px;
  border-color: color-mix(in srgb, var(--copper) 25%, var(--line));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
}

html:not([data-theme="light"]) :is(
  .search-result,
  .category-tabs > a,
  .filter-bar button,
  .filter-bar a
):is(:hover, :focus-visible, .is-active) {
  background: color-mix(in srgb, var(--copper) 7%, var(--paper-2));
  border-color: color-mix(in srgb, var(--copper) 58%, var(--line));
}

/* Story slider remains a full-bleed composition, but its meta and image
 * plates now read as deliberate dark surfaces instead of unstructured paper. */
html:not([data-theme="light"]) :is(
  .story-slider,
  .story-slider .meta,
  .story-slider .stage
) {
  background: var(--paper-2);
}

html:not([data-theme="light"]) .story-slider .meta {
  border-color: color-mix(in srgb, var(--copper) 22%, var(--line));
}

/* Shared dark-surface typography ------------------------------------------ */
html:not([data-theme="light"]) :is(
  .home-product-body,
  .product-card-body,
  .news-card-body,
  .home-news-card > div,
  .home-process-copy,
  .process-copy,
  .contact-panel,
  .home-quality-card,
  .quality-pillar-body,
  .quality-feature-body,
  .quality-certificate-preview > div,
  .search-result-copy
) :is(h2, h3, h4, strong) {
  color: var(--ink);
}

html:not([data-theme="light"]) :is(
  .home-product-body,
  .product-card-body,
  .news-card-body,
  .home-news-card > div,
  .home-process-copy,
  .process-copy,
  .contact-panel,
  .home-quality-card,
  .quality-pillar-body,
  .quality-feature-body,
  .quality-certificate-preview > div,
  .search-result-copy
) p:not(.eyebrow) {
  color: var(--muted);
}

/* Preserve existing component motion while ensuring reduced-motion users do
 * not receive a new surface transition from this shared layer. */
@media (prefers-reduced-motion: reduce) {
  html:not([data-theme="light"]) :is(
    .home-product-card,
    .product-card,
    .products-card,
    .related-card,
    .news-card,
    .home-news-card,
    .home-certificate-card,
    .products-certificate-card,
    .quality-feature,
    .quality-bento-card,
    .quality-bento-pillar,
    .quality-certificate-preview,
    .news-tiles > a,
    .vision-v1-corridor-card,
    .mission-stage-tab
  ):is(:hover, :focus-within, :focus-visible) {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .32);
  }
}
