/*
 * Godspark Refinement — Zensical Theme
 * Nature + futuristic aurora pastel/iridescent upgrade.
 * Additive CSS layer. Preserves toolbar readability.
 */

:root {
  /* Refined iris palette */
  --gp-bg:             #f6fbf7;
  --gp-surface:        #ffffff;
  --gp-text:           #1c2b1c;
  --gp-text-muted:     #4e5e4b;
  --gp-primary:        #4a8262;  /* darker sage — visible link color */
  --gp-secondary:      #a8c5b6;
  --gp-tertiary:       #e9dfc6;
  --gp-accent:         #b9a5d7;  /* soft aurora purple */

  /* Iridescent atmosphere tokens */
  --gp-iris-1:         #f1f6f3;
  --gp-iris-2:         #eef3f6;
  --gp-iris-3:         #f6f2f8;
  --gp-iris-4:         #f5f1ec;

  --gp-aurora-iris: linear-gradient(
    135deg,
    var(--gp-iris-1), var(--gp-iris-2), var(--gp-iris-3), var(--gp-iris-4)
  );

  --gp-card-bg:        rgba(255, 255, 255, 0.74);
  --gp-card-border:    rgba(122, 170, 150, 0.22);
  --gp-card-shadow:    0 8px 28px rgba(122, 170, 150, 0.10);
  --gp-card-hover:     0 18px 40px rgba(122, 170, 150, 0.16);

  --gp-glow:           rgba(141, 184, 160, 0.35);
  --gp-glow-intense:   rgba(160, 130, 210, 0.45);

  --gp-ease:           cubic-bezier(0.22, 0.61, 0.36, 1);
  --gp-duration:       0.78s;
  --gp-distance:       20px;
}

/* Base atmosphere */
body {
  background-color: var(--gp-bg);
  background-image:
    radial-gradient(ellipse at 12% -8%, rgba(210, 230, 240, 0.38), transparent 56%),
    radial-gradient(ellipse at 88% 108%, rgba(215, 210, 235, 0.34), transparent 58%),
    var(--gp-aurora-iris);
  background-attachment: fixed;
  background-size: 100% 100%, 100% 100%, 200% 200%;
  color: var(--gp-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: no-preference) {
  body.godspark-breathe {
    animation: gp-breathe 36s ease-in-out infinite;
  }
  @keyframes gp-breathe {
    0%, 100% { background-position: 0 0, 0 0, 0% 50%; }
    50%      { background-position: 0 0, 0 0, 100% 50%; }
  }
}

/* Typography */
h1, h2, h3, h4, h5, h6,
article h1, article h2, article h3 {
  font-weight: 650;
  letter-spacing: -0.012em;
  line-height: 1.2;
  color: var(--gp-text);
}

a {
  color: var(--gp-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.22s var(--gp-ease), text-decoration-color 0.22s;
}
a:hover {
  color: var(--gp-accent);
}

/* Layout helpers */
.zensical article,
.zensical .content,
main, article {
  position: relative;
  z-index: 1;
}
.zensical article > *,
.zensical .content > *,
main > *,
article > *,
section {
  position: relative;
  z-index: 1;
}

/* Cards */
.zensical .card,
section.card,
div.card,
article.card,
article section,
main section {
  background: var(--gp-card-bg);
  border: 1px solid var(--gp-card-border);
  border-radius: 22px;
  backdrop-filter: blur(14px) saturate(145%);
  -webkit-backdrop-filter: blur(14px) saturate(145%);
  padding: 1.6rem 1.8rem;
  box-shadow: var(--gp-card-shadow);
  transition:
    transform var(--gp-duration) var(--gp-ease),
    box-shadow var(--gp-duration) var(--gp-ease),
    border-color 0.3s ease;
}
.zensical .card:hover,
section.card:hover,
div.card:hover,
article.card:hover {
  transform: translateY(-4px);
  border-color: rgba(122, 170, 150, 0.48);
  box-shadow: var(--gp-card-hover);
}

/* Homepage hero panels */
.hero-media,
.godspark-hero {
  margin: 1.2rem 0 2rem;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--gp-card-border);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.52), rgba(255,255,255,0.30)),
    var(--gp-aurora-iris);
  background-blend-mode: overlay;
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  box-shadow: var(--gp-card-shadow);
}
.hero-media img,
.godspark-hero img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: cover;
}
.hero-media figcaption,
.godspark-hero figcaption {
  padding: 0.8rem 1rem;
  color: var(--gp-text-muted);
  font-size: 0.92rem;
}

.intro-lead {
  font-size: 1.18rem;
  line-height: 1.65;
  color: var(--gp-text-muted);
}

/* Front-page lists */
.index main ul,
.index main ol {
  padding-left: 1.2rem;
  line-height: 1.75;
}
.index main ul li::marker,
.index main ol li::marker {
  color: var(--gp-primary);
}

/* CTA buttons (additive only) */
button.cta,
a.cta,
.zensical .cta,
button[class*="godspark"],
a[class*="godspark"] {
  background: linear-gradient(120deg, var(--gp-primary), var(--gp-accent));
  color: #fff;
  font-weight: 550;
  border: 1px solid rgba(122, 170, 150, 0.24);
  border-radius: 999px;
  padding: 0.55em 1.5em;
  cursor: pointer;
  transition: opacity 0.28s, box-shadow 0.28s, transform 0.28s var(--gp-ease);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  position: relative;
  overflow: hidden;
}
button.cta:hover,
a.cta:hover,
.zensical .cta:hover,
button[class*="godspark"]:hover,
a[class*="godspark"]:hover {
  opacity: 0.96;
  box-shadow: 0 12px 26px var(--gp-glow);
  transform: translateY(-1px);
}
button.cta::after,
a.cta::after,
.zensical .cta::after,
button[class*="godspark"]::after,
a[class*="godspark"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent, rgba(255,255,255,0.42), transparent);
  background-size: 220% 100%;
  background-repeat: no-repeat;
  background-position: -130% 0;
  pointer-events: none;
  border-radius: inherit;
}
.zensical .cta:hover::after,
button[class*="godspark"]:hover::after,
a[class*="godspark"]:hover::after {
  animation: gp-sheen 7s var(--gp-ease) infinite;
}
@keyframes gp-sheen {
  0%   { background-position: -140% 0; }
  55%  { background-position: 80% 0; }
  100% { background-position: 80% 0; }
}

/* Code (preserve toolbar button readability) */
pre {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--gp-card-border);
  border-radius: 14px;
  padding: 1.1rem 1.3rem;
}
code, kbd {
  background: rgba(122, 170, 150, 0.10);
  border: 1px solid rgba(122, 170, 150, 0.18);
  border-radius: 7px;
  color: var(--gp-text);
}

/* Blockquotes */
blockquote {
  border-left: 3px solid var(--gp-secondary);
  background: rgba(141, 184, 160, 0.08);
  border-radius: 0 12px 12px 0;
  padding: 0.9rem 1.2rem;
  margin: 1.4rem 0;
  color: var(--gp-text-muted);
  font-style: italic;
}

/* HR */
hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    var(--gp-primary),
    var(--gp-secondary),
    transparent);
  margin: 2.4rem 0;
}

/* Tables */
table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(122, 170, 150, 0.07);
}
th {
  background: linear-gradient(135deg, #3d6b52, #5a8a6e, #92ad9e);
  color: #fff;
  font-weight: 550;
  letter-spacing: 0.02em;
  padding: 0.7rem 1rem;
}
td {
  background: var(--gp-surface);
  border-bottom: 1px solid rgba(122, 170, 150, 0.12);
}

/* Scroll reveals */
.godspark-reveal {
  opacity: 0;
  transform: translateY(var(--gp-distance));
  transition:
    opacity var(--gp-duration) var(--gp-ease),
    transform var(--gp-duration) var(--gp-ease);
}
.godspark-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.godspark-reveal.is-visible > * {
  opacity: 0;
  transform: translateY(var(--gp-distance));
  transition:
    opacity var(--gp-duration) var(--gp-ease),
    transform var(--gp-duration) var(--gp-ease);
}
.godspark-reveal.is-visible > *:nth-child(1) { transition-delay: 0.00s; }
.godspark-reveal.is-visible > *:nth-child(2) { transition-delay: 0.08s; }
.godspark-reveal.is-visible > *:nth-child(3) { transition-delay: 0.16s; }
.godspark-reveal.is-visible > *:nth-child(4) { transition-delay: 0.24s; }
.godspark-reveal.is-visible > *:nth-child(5) { transition-delay: 0.32s; }
.godspark-reveal.is-visible > *:nth-child(6) { transition-delay: 0.40s; }
.godspark-reveal.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Cursor glow (opt-in attribute) */
[gp-glow]::after,
.gp-glow-active::after {
  content: "";
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999998;
  background: radial-gradient(
    circle,
    rgba(141, 184, 160, 0.30) 0%,
    rgba(160, 130, 210, 0.16) 32%,
    transparent 68%
  );
  transform: translate(-50%, -50%);
  opacity: 0;
  left: -400px;
  top: -400px;
  transition: opacity 0.45s ease;
  will-change: left, top, opacity;
}
[gp-glow]::after,
.gp-glow-active::after {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  [gp-glow]::after,
  .gp-glow-active::after {
    display: none !important;
  }
  .godspark-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .godspark-reveal.is-visible > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--gp-bg);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg,
    var(--gp-primary),
    var(--gp-accent),
    var(--gp-secondary));
  border-radius: 99px;
}

/* Neutralize default Zensical color cycling without breaking toolbar icons */
.md-header,
.md-header__inner,
.md-header__button,
.md-icon,
[data-md-color-component="header"] {
  animation: none !important;
}
h1, h2, h3, h4, h5, h6,
article h1, article h2, article h3 {
  animation: none !important;
  background: none !important;
  -webkit-text-fill-color: var(--gp-text);
  background-clip: unset !important;
  color: var(--gp-text);
}

/* Selection/focus */
::selection {
  background: var(--gp-primary);
  color: #fff;
}
:focus-visible {
  outline: 2px solid var(--gp-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

.beacon-icons a .md-icon,
.beacon-icons button .md-icon {
  color: inherit;
}

/* Larger logo in header */
.md-header__button.md-logo {
  padding: 0.4rem;
}
.md-header__button.md-logo img {
  height: 3.2rem;
  width: auto;
}

/* Hide the site name text in the header nav bar, keep layout intact */
.md-header__title .md-ellipsis {
  visibility: hidden;
}

/* Homepage refined */

.wp-divider {
  border: none;
  height: 1px;
  margin: 2.8rem auto 3.2rem;
  max-width: 86%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--gp-secondary),
    var(--gp-primary),
    var(--gp-accent),
    transparent
  );
  opacity: 0.42;
}

.wp-spacer {
  height: 0;
  opacity: 0;
}

/* Contribution section card */
.wp-section {
  background: var(--gp-card-bg);
  border: 1px solid var(--gp-card-border);
  border-radius: 26px;
  padding: 2rem 2.2rem;
  backdrop-filter: blur(14px) saturate(145%);
  -webkit-backdrop-filter: blur(14px) saturate(145%);
  box-shadow: var(--gp-card-shadow);
  position: relative;
  z-index: 1;
}

.wp-section h2,
.wp-section h3 {
  margin-top: 0;
  font-weight: 700;
  color: var(--gp-text);
}

.wp-section ul,
.wp-section ol {
  padding-left: 1.35rem;
  line-height: 1.8;
}

.wp-section li {
  margin: 0.28rem 0;
}

.wp-section li::marker {
  color: var(--gp-primary);
}

/* Tighter hero composition on index */
.index .godspark-hero {
  margin-bottom: 0.6rem;
  box-shadow: none;
  border: none;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.index .godspark-hero img {
  max-height: 420px;
}

/* ── Page hero images — full-width, caption overlay ── */
.page-hero,
.page-infographic {
  position: relative;
  margin: 0.6rem 0 1.2rem;
  border-radius: 12px;
  overflow: hidden;
  line-height: 0;
}
.page-hero img,
.page-infographic img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}
.page-hero figcaption,
.page-infographic figcaption {
  position: absolute;
  bottom: 0;
  right: 0;
  padding: 0.2rem 0.55rem;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 8px 0 0 0;
  color: var(--gp-text-muted);
  font-size: 0.68rem;
  font-style: italic;
  line-height: 1.35;
  max-width: 55%;
}
.page-hero figcaption a,
.page-infographic figcaption a {
  color: var(--gp-primary);
  font-style: normal;
}

/* ── AI-generated image credit — tiny, no emoji ── */
.ai-credit {
  font-size: 0.68rem;
  color: var(--gp-text-muted);
  font-style: italic;
}

/* ── Footer badges ── */
.md-copyright__badges {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.md-copyright__zensical {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}
.md-copyright__grebedoc {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
.md-copyright__grebedoc img {
  image-rendering: pixelated;
}

/* Print */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  h1, h2, h3, h4, h5, h6 {
    color: #000 !important;
  }
  .gp-glow-active::after,
  [gp-glow]::after {
    display: none !important;
  }
}
