@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&display=swap");

/* ---- Universal GPCs cosmos palette ---- */
:root {
  --md-primary-fg-color: #0a0718;
  --md-primary-fg-color--light: #1a1233;
  --md-primary-fg-color--dark: #04030a;
  --md-accent-fg-color: #cbb8ff;
  --ugpc-accent: #a88dff;
  --ugpc-accent-soft: rgba(168, 141, 255, 0.35);
  --ugpc-panel: rgba(20, 14, 42, 0.72);
}

[data-md-color-scheme="slate"] {
  --md-default-bg-color: #04030a;
  --md-default-fg-color: #e7e2f7;
  --md-default-fg-color--light: #cfc8e8;
  --md-default-fg-color--lighter: #a89fce;
  --md-default-fg-color--lightest: rgba(168, 141, 255, 0.12);
  --md-typeset-a-color: #a88dff;
  --md-accent-fg-color: #cbb8ff;
  --md-code-bg-color: rgba(26, 18, 51, 0.85);
  --md-code-fg-color: #cbb8ff;
  --md-footer-bg-color: #06040f;
  --md-footer-bg-color--dark: #04030a;
}

/* The storefront's space backdrop — same asset, same overlay technique */
body {
  background-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: #04030a;
  background-image:
    linear-gradient(180deg, rgba(4, 3, 10, 0.86) 0%, rgba(4, 3, 10, 0.74) 48%, rgba(4, 3, 10, 0.42) 100%),
    radial-gradient(ellipse at 50% 30%, rgba(132, 108, 255, 0.1), transparent 34rem),
    url("../assets/universal-space-backdrop.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* Headings in Space Grotesk like the storefront */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-header__topic {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.md-typeset h1 {
  color: #f1ecff;
  font-weight: 700;
}

.md-header {
  background: rgba(4, 3, 10, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(168, 141, 255, 0.16);
}

/* Header hugs the viewport — logo pinned left like the storefront */
.md-header__inner {
  max-width: 100%;
  padding: 0 0.8rem 0 0.4rem;
}

.md-header__button.md-logo {
  padding: 0.15rem 0.1rem 0.15rem 0.2rem;
  margin-right: 0;
}

.md-header__title {
  margin-left: 0.15rem;
}

.md-header__button.md-logo img {
  height: 2.35rem;
}

/* Holographic treatment — the storefront's "Precision Tuning" shimmer */
@keyframes holo-shift {
  from { background-position: 0% center, 0% center; }
  to   { background-position: 300% center, 250% center; }
}

.ugpc-holo {
  background-image:
    linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.92) 50%, transparent 65%),
    linear-gradient(100deg, #c4c9dd 0%, #f4f6ff 12%, #f0b6dd 26%, #cbd2e4 38%, #b6e0f0 50%, #f6f8ff 60%, #d4bdf0 72%, #e8ddb6 84%, #f0f2fa 92%, #c4c9dd 100%);
  background-size: 300% 100%, 250% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 6px rgba(200, 215, 255, 0.38));
  animation: holo-shift 30s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .ugpc-holo { animation: none; }
}

/* "Guides" wordmark — holographic */
.md-header__topic {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.md-header__topic .md-ellipsis {
  background-image:
    linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.92) 50%, transparent 65%),
    linear-gradient(100deg, #c4c9dd 0%, #f4f6ff 12%, #f0b6dd 26%, #cbd2e4 38%, #b6e0f0 50%, #f6f8ff 60%, #d4bdf0 72%, #e8ddb6 84%, #f0f2fa 92%, #c4c9dd 100%);
  background-size: 300% 100%, 250% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 6px rgba(200, 215, 255, 0.38));
  animation: holo-shift 30s linear infinite;
  text-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .md-header__topic .md-ellipsis { animation: none; }
}

/* Sidebar + TOC polish */
.md-nav__item--active > .md-nav__link,
.md-nav__link--active {
  color: var(--ugpc-accent);
}

/* Controller-button chips */
.md-typeset kbd {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  color: #e7e2f7;
  background: var(--ugpc-panel);
  border: 1px solid var(--ugpc-accent-soft);
  border-radius: 6px;
  padding: 2px 8px;
  box-shadow: none;
  white-space: nowrap;
  vertical-align: baseline;
}

/* Tables — match the storefront guide tables */
.md-typeset table:not([class]) {
  border: 1px solid rgba(168, 141, 255, 0.18);
  border-radius: 10px;
  background: rgba(10, 7, 24, 0.55);
}

.md-typeset table:not([class]) th {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ugpc-accent);
  background: rgba(26, 18, 51, 0.6);
}

.md-typeset table:not([class]) td {
  border-top: 1px solid rgba(168, 141, 255, 0.14);
}

/* Product cards on the home grid */
.ugpc-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  margin: 1.6rem 0;
}

@media screen and (max-width: 59.9375em) {
  .ugpc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media screen and (max-width: 37.5em) {
  .ugpc-cards { grid-template-columns: 1fr; }
}

.ugpc-card {
  display: block;
  position: relative;
  background: var(--ugpc-panel);
  border: 1px solid rgba(168, 141, 255, 0.22);
  border-radius: 14px;
  padding: 1.1rem 1.2rem 1.2rem;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  color: inherit;
}

/* Universal Vision comet: bright head + RGB tail circling the card edge; hover = full RGB ring */
@property --a {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes spinrgb {
  to { --a: 360deg; }
}

.ugpc-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 2px;
  z-index: 4;
  pointer-events: none;
  background: conic-gradient(from var(--a),
    transparent 0deg 300deg,
    rgba(255, 45, 85, 0.12) 312deg,
    rgba(255, 238, 0, 0.45) 330deg,
    rgba(0, 224, 255, 0.85) 346deg,
    #ffffff 358deg,
    transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: spinrgb 14s linear infinite;
}

.ugpc-card:hover::before,
.ugpc-card:focus::before {
  background: conic-gradient(from var(--a), #c084fc, #22d3ee, #f0abfc, #818cf8, #67e8f9, #c084fc);
  animation-duration: 8s;
  filter: drop-shadow(0 0 9px rgba(168, 85, 247, 0.75));
}

.ugpc-card:nth-child(2)::before { animation-delay: -4.6s; }
.ugpc-card:nth-child(3)::before { animation-delay: -9.3s; }

@media (prefers-reduced-motion: reduce) {
  .ugpc-card::before { animation: none; }
}

.ugpc-card:hover,
.ugpc-card:focus {
  transform: translateY(-4px);
  border-color: rgba(172, 151, 255, 0.45);
  box-shadow: 0 26px 54px rgba(0, 0, 0, 0.4);
}

.ugpc-card img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  margin-bottom: 0.8rem;
  filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.5));
}

.ugpc-card .ugpc-card-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1ecff;
  margin: 0 0 0.15rem;
}

.ugpc-card .ugpc-card-tag {
  display: inline-block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  background-image:
    linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.92) 50%, transparent 65%),
    linear-gradient(100deg, #c4c9dd 0%, #f4f6ff 12%, #f0b6dd 26%, #cbd2e4 38%, #b6e0f0 50%, #f6f8ff 60%, #d4bdf0 72%, #e8ddb6 84%, #f0f2fa 92%, #c4c9dd 100%);
  background-size: 300% 100%, 250% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 5px rgba(200, 215, 255, 0.34));
  animation: holo-shift 30s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .ugpc-card .ugpc-card-tag { animation: none; }
}

.ugpc-card p {
  margin: 0.2rem 0 0.6rem;
  font-size: 0.72rem;
  color: var(--md-default-fg-color--light);
}

.ugpc-card .ugpc-card-cta {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ugpc-accent);
}

/* Admonition tint to match brand */
.md-typeset .admonition,
.md-typeset details {
  border-radius: 12px;
  background: var(--ugpc-panel);
}

/* Buttons (Material attr_list .md-button) */
.md-typeset .md-button {
  border-color: var(--ugpc-accent-soft);
  color: var(--ugpc-accent);
  border-radius: 999px;
}

.md-typeset .md-button--primary {
  background-color: #6d4ddc;
  border-color: #6d4ddc;
  color: #fff;
}
