/* gp3mlpy documentation polish layer
   Loaded after extra.css so this file can refine dense/reference pages without
   destabilising the base visual system. */

html {
  scroll-behavior: smooth;
}

.md-content :is(h2, h3, h4)[id] {
  scroll-margin-top: 6rem;
}

.md-typeset a {
  text-underline-offset: .14em;
  text-decoration-thickness: .08em;
}

.md-typeset :is(a, button, summary):focus-visible,
.gp-button:focus-visible,
.gp-gallery-card:focus-visible,
.gp-api-jump a:focus-visible {
  outline: 3px solid var(--gp-sky-400);
  outline-offset: 3px;
  border-radius: 6px;
}

.md-typeset code {
  border-radius: 6px;
}

.md-typeset__table {
  width: 100%;
}

.md-typeset table:not([class]) {
  width: 100%;
  border: 1px solid var(--gp-line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(7, 27, 47, .04);
}

.md-typeset table:not([class]) th {
  background: rgba(20, 90, 141, .075);
  color: var(--gp-navy-800);
  font-weight: 800;
}

.md-typeset table:not([class]) tr:hover td {
  background: rgba(114, 199, 244, .035);
}

.md-typeset details {
  border: 1px solid var(--gp-line);
  border-radius: 14px;
  box-shadow: none;
}

.md-typeset details summary {
  font-weight: 800;
}

.md-typeset .admonition,
.md-typeset details {
  font-size: .82rem;
}

/* -------------------------------------------------------------------------- */
/* Complete API reference                                                     */
/* -------------------------------------------------------------------------- */

.gp-reference-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 1.4rem;
  align-items: center;
  margin: .4rem 0 1.1rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--gp-line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0, rgba(114, 199, 244, .18), transparent 38%),
    linear-gradient(135deg, rgba(20, 90, 141, .07), rgba(114, 199, 244, .025));
}

.gp-reference-hero h2 {
  margin: .25rem 0 .55rem;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1.12;
}

.gp-actions-dark {
  margin-top: 1rem;
}

.gp-actions-dark .gp-button {
  border-color: rgba(20, 90, 141, .24);
  background: transparent;
  color: var(--gp-blue-700) !important;
}

.gp-actions-dark .gp-button:hover {
  background: rgba(31, 120, 173, .07);
  border-color: rgba(20, 90, 141, .4);
}

.gp-actions-dark .gp-button-primary,
.gp-actions-dark a:first-child {
  border-color: var(--gp-navy-900);
  background: var(--gp-navy-900);
  color: #fff !important;
}

.gp-reference-stats,
.gp-diagnostics-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
}

.gp-reference-stats > div,
.gp-diagnostics-stats > div {
  padding: .9rem;
  border: 1px solid rgba(20, 90, 141, .13);
  border-radius: 14px;
  background: rgba(255, 255, 255, .58);
}

.gp-reference-stats strong,
.gp-diagnostics-stats strong {
  display: block;
  color: var(--gp-blue-700);
  font-size: 1.25rem;
  line-height: 1;
}

.gp-reference-stats span,
.gp-diagnostics-stats span {
  display: block;
  margin-top: .28rem;
  color: var(--gp-muted);
  font-size: .68rem;
  line-height: 1.35;
}

.gp-reference-tip {
  margin: 0 0 1.6rem;
  padding: .8rem 1rem;
  border: 1px solid var(--gp-line);
  border-radius: 12px;
  background: rgba(114, 199, 244, .055);
}

.gp-reference-list {
  margin-top: .8rem;
}

.gp-reference-list ul {
  columns: 3 18rem;
  column-gap: 2rem;
  padding-left: 0;
}

.gp-reference-list li {
  break-inside: avoid;
  margin: 0 0 .36rem;
  list-style: none;
}

.gp-reference-list li a {
  display: block;
  padding: .38rem .52rem;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--gp-ink);
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}

.gp-reference-list li a:hover {
  transform: translateX(2px);
  border-color: var(--gp-line);
  background: rgba(114, 199, 244, .065);
}

.gp-reference-list li code {
  background: transparent;
  color: inherit;
  font-size: .77rem;
}

/* -------------------------------------------------------------------------- */
/* API-map navigation                                                         */
/* -------------------------------------------------------------------------- */

.gp-api-intro {
  display: grid;
  grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr);
  gap: 1.2rem;
  align-items: start;
  margin: 1rem 0 1.7rem;
  padding: 1.2rem;
  border: 1px solid var(--gp-line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(20, 90, 141, .05), rgba(114, 199, 244, .025));
}

.gp-api-intro h2 {
  margin: .22rem 0 .35rem;
  font-size: 1.45rem;
}

.gp-api-jump {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem;
}

.gp-api-jump a {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 42px;
  padding: .48rem .6rem;
  border: 1px solid var(--gp-line);
  border-radius: 10px;
  background: var(--md-default-bg-color);
  color: var(--gp-ink);
  font-size: .72rem;
  font-weight: 750;
  text-decoration: none;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}

.gp-api-jump a:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 120, 173, .34);
  background: rgba(114, 199, 244, .07);
}

.gp-api-jump span {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 auto;
  border-radius: 8px;
  background: rgba(31, 120, 173, .09);
  color: var(--gp-blue-700);
  font-size: .62rem;
  font-weight: 900;
}

/* -------------------------------------------------------------------------- */
/* Diagnostics hub                                                            */
/* -------------------------------------------------------------------------- */

.gp-diagnostics-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr);
  gap: 1.4rem;
  align-items: center;
  margin: .4rem 0 1rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--gp-line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 10%, rgba(114, 199, 244, .18), transparent 34%),
    linear-gradient(135deg, rgba(11, 42, 74, .045), rgba(114, 199, 244, .025));
}

.gp-diagnostics-hero h2 {
  margin: .25rem 0 .45rem;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.12;
}

.gp-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin: 1rem 0 2rem;
}

.gp-gallery-card {
  overflow: hidden;
  border: 1px solid var(--gp-line);
  border-radius: 16px;
  background: var(--md-default-bg-color);
  color: var(--gp-ink) !important;
  text-decoration: none !important;
  box-shadow: 0 8px 26px rgba(7, 27, 47, .05);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.gp-gallery-card:hover {
  transform: translateY(-3px);
  border-color: rgba(31, 120, 173, .34);
  box-shadow: 0 14px 34px rgba(7, 27, 47, .09);
}

.gp-gallery-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: #fff;
}

.gp-gallery-card > div {
  padding: .75rem .82rem .85rem;
}

.gp-gallery-card span,
.gp-gallery-card strong,
.gp-gallery-card small {
  display: block;
}

.gp-gallery-card span {
  color: var(--gp-blue-700);
  font-size: .6rem;
  font-weight: 850;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.gp-gallery-card strong {
  margin: .18rem 0 .28rem;
  font-size: .87rem;
}

.gp-gallery-card small {
  color: var(--gp-muted);
  font-size: .67rem;
  line-height: 1.4;
}

.gp-diagnostic-block {
  display: grid;
  grid-template-columns: minmax(320px, .95fr) minmax(0, 1.05fr);
  gap: 1.2rem;
  align-items: center;
  margin: 1rem 0 .65rem;
  padding: 1rem;
  border: 1px solid var(--gp-line);
  border-radius: 18px;
  background: rgba(114, 199, 244, .025);
}

.gp-diagnostic-visual {
  overflow: hidden;
  border: 1px solid rgba(20, 90, 141, .1);
  border-radius: 13px;
  background: #fff;
}

.gp-diagnostic-visual img {
  display: block;
  width: 100%;
}

.gp-diagnostic-copy h3 {
  margin: .25rem 0 .4rem;
}

.gp-contract-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .7rem;
  margin: 1rem 0 1.5rem;
}

.gp-contract-grid > div {
  padding: .8rem .9rem;
  border: 1px solid var(--gp-line);
  border-radius: 12px;
  background: rgba(114, 199, 244, .04);
  font-size: .75rem;
  line-height: 1.45;
}

/* -------------------------------------------------------------------------- */
/* Dark mode                                                                  */
/* -------------------------------------------------------------------------- */

[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
  background: rgba(114, 199, 244, .085);
  color: var(--gp-sky-200);
}

[data-md-color-scheme="slate"] .gp-reference-hero,
[data-md-color-scheme="slate"] .gp-api-intro,
[data-md-color-scheme="slate"] .gp-diagnostics-hero {
  background:
    radial-gradient(circle at 100% 0, rgba(114, 199, 244, .09), transparent 38%),
    rgba(15, 31, 45, .48);
}

[data-md-color-scheme="slate"] .gp-reference-stats > div,
[data-md-color-scheme="slate"] .gp-diagnostics-stats > div,
[data-md-color-scheme="slate"] .gp-api-jump a,
[data-md-color-scheme="slate"] .gp-gallery-card {
  background: rgba(15, 31, 45, .76);
}

[data-md-color-scheme="slate"] .gp-reference-list li a,
[data-md-color-scheme="slate"] .gp-api-jump a,
[data-md-color-scheme="slate"] .gp-gallery-card {
  color: var(--md-default-fg-color) !important;
}

[data-md-color-scheme="slate"] .gp-actions-dark .gp-button {
  border-color: rgba(114, 199, 244, .24);
  color: var(--gp-sky-200) !important;
}

[data-md-color-scheme="slate"] .gp-actions-dark .gp-button-primary,
[data-md-color-scheme="slate"] .gp-actions-dark a:first-child {
  background: var(--gp-sky-200);
  border-color: var(--gp-sky-200);
  color: var(--gp-navy-950) !important;
}

/* -------------------------------------------------------------------------- */
/* Responsive and motion preferences                                          */
/* -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .gp-gallery-grid,
  .gp-contract-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gp-api-jump {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .gp-reference-hero,
  .gp-diagnostics-hero,
  .gp-api-intro,
  .gp-diagnostic-block {
    grid-template-columns: 1fr;
  }

  .gp-reference-list ul {
    columns: 2 15rem;
  }
}

@media (max-width: 620px) {
  .gp-gallery-grid,
  .gp-contract-grid,
  .gp-api-jump,
  .gp-reference-stats,
  .gp-diagnostics-stats {
    grid-template-columns: 1fr;
  }

  .gp-reference-list ul {
    columns: 1;
  }

  .gp-reference-hero,
  .gp-diagnostics-hero {
    padding: 1.05rem;
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
}
