/* =========================================================================
   Python Geospatial CI/CD & Wheel Building — theme
   Light, elegant, professional. Teal/green geospatial palette with
   indigo + orange accents. Wide on desktop, responsive on mobile.
   ========================================================================= */

:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --text: #1f2933;
  --text-muted: #55636c;
  --heading: #0f3d3a;

  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-darker: #115e59;
  --primary-light: #5eead4;
  --primary-tint: rgba(13, 148, 136, 0.10);

  --accent: #f97316;
  --accent-2: #6366f1;
  --ok: #10b981;

  --link: #0e7490;
  --link-hover: #155e63;

  --border: #dce5e2;
  --border-strong: #c3d2cd;

  --code-bg: #f3f6f9;
  --code-border: #e2e9ee;
  --inline-code-bg: rgba(13, 148, 136, 0.11);
  --inline-code-text: #0f5e58;

  --shadow-sm: 0 1px 2px rgba(15, 61, 58, 0.06), 0 1px 3px rgba(15, 61, 58, 0.08);
  --shadow-md: 0 6px 18px rgba(15, 61, 58, 0.10);
  --shadow-lg: 0 16px 40px rgba(15, 61, 58, 0.14);

  --header-h: 66px;
  --maxw: 1280px;
  --maxw-wide: 1440px;
  --radius: 14px;
  --radius-sm: 9px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}
a:hover { color: var(--link-hover); }

.icon { display: inline-block; vertical-align: middle; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary-dark);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; color: #fff; }

/* ----- Header ---------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--heading);
  font-weight: 700;
}
.brand-logo { transition: transform 0.25s ease; }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 1.02rem; letter-spacing: -0.01em; }
.brand-tag { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }

.primary-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
}
.nav-link .nav-icon { width: 20px; height: 20px; }
.nav-link:hover {
  background: var(--surface-2);
  color: var(--primary-darker);
}
.nav-link.is-active {
  background: var(--primary-tint);
  color: var(--primary-darker);
  border-color: var(--primary-light);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  cursor: pointer;
  color: var(--primary-dark);
}
.nav-toggle:hover { background: var(--surface-2); }

/* ----- Main ------------------------------------------------------------ */
.site-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.4rem, 3vw, 2.6rem) clamp(1rem, 3vw, 2.5rem) 3.5rem;
}

/* ----- Hero ------------------------------------------------------------ */
.hero {
  text-align: center;
  padding: clamp(1rem, 4vw, 2.6rem) 0 1.5rem;
}
.hero-logo { margin: 0 auto 1.2rem; }
.hero-logo img {
  width: clamp(110px, 16vw, 170px);
  height: auto;
  filter: drop-shadow(0 10px 24px rgba(13, 148, 136, 0.25));
  transition: transform 0.4s ease;
}
.hero-logo img:hover { transform: scale(1.05) rotate(3deg); }
.hero-title {
  font-size: clamp(1.8rem, 4.4vw, 3rem);
  line-height: 1.1;
  margin: 0.2rem auto 0.4rem;
  max-width: 18ch;
  background: linear-gradient(120deg, var(--primary-darker), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}
.hero-tagline {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 1.6rem;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 2rem;
}
.hero-intro {
  max-width: 70ch;
  margin: 0 auto;
  text-align: left;
}
.hero-intro p { margin: 0 0 1rem; color: var(--text); }

/* ----- Buttons --------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.72rem 1.25rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.98rem;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.btn .icon { width: 22px; height: 22px; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-primary {
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: #fff;
}
.btn-primary:hover { color: #fff; }
.btn-accent {
  background: linear-gradient(120deg, #fb923c, var(--accent));
  color: #fff;
}
.btn-accent:hover { color: #fff; }
.btn-ghost {
  background: var(--surface);
  color: var(--primary-darker);
  border-color: var(--border-strong);
}
.btn-ghost:hover { color: var(--primary-darker); background: var(--surface-2); }

/* ----- Section headings (homepage) ------------------------------------ */
.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--heading);
  margin: 2.5rem 0 0.3rem;
  text-align: center;
}
.section-lead {
  text-align: center;
  color: var(--text-muted);
  margin: 0 auto 2rem;
  max-width: 60ch;
}

/* ----- Pillar grid / cards -------------------------------------------- */
.pillar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.4rem;
}
.pillar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.pillar-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}
.pillar-title { margin: 0 0 0.5rem; font-size: 1.25rem; }
.pillar-title a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--heading);
}
.pillar-title a:hover { color: var(--primary-dark); }
.pillar-title .icon { width: 28px; height: 28px; flex: none; }
.pillar-summary { color: var(--text-muted); margin: 0 0 1rem; font-size: 0.95rem; }

.cluster-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.cluster-list li { margin: 0 0 0.4rem; }
.cluster-list a {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text);
}
.cluster-list a:hover {
  background: var(--primary-tint);
  border-color: var(--primary-light);
}
.cluster-title { display: block; font-weight: 650; color: var(--primary-darker); }
.cluster-sum { display: block; font-size: 0.82rem; color: var(--text-muted); }

.pillar-more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  color: var(--primary-dark);
}
.pillar-more:hover { gap: 0.6rem; }

/* ----- Article --------------------------------------------------------- */
.article { width: 100%; }

.breadcrumbs { margin: 0 0 1.2rem; font-size: 0.85rem; }
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0;
  margin: 0;
  color: var(--text-muted);
}
.breadcrumbs li { display: flex; align-items: center; gap: 0.35rem; }
.breadcrumbs li + li::before { content: "›"; color: var(--border-strong); }
.breadcrumbs a { color: var(--link); }
.breadcrumbs [aria-current="page"] { color: var(--text-muted); }

.article-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.3rem, 3vw, 2.6rem) clamp(1.2rem, 3.4vw, 3rem);
  box-shadow: var(--shadow-sm);
}

.article-body > *:first-child { margin-top: 0; }

.article-body h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  line-height: 1.15;
  margin: 0 0 1.1rem;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--primary-darker), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.article-body h2 {
  font-size: 1.55rem;
  color: var(--heading);
  margin: 2.2rem 0 0.8rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--surface-2);
}
.article-body h3 {
  font-size: 1.22rem;
  color: var(--primary-darker);
  margin: 1.8rem 0 0.6rem;
}
.article-body h4 {
  font-size: 1.05rem;
  color: var(--heading);
  margin: 1.4rem 0 0.5rem;
}
.article-body p { margin: 0 0 1.1rem; }
.article-body ul, .article-body ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
.article-body li { margin: 0.3rem 0; }
.article-body strong { color: var(--heading); }
.article-body a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--primary-light);
  text-underline-offset: 2px;
}
.article-body a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--primary);
}
.article-body blockquote {
  margin: 1.2rem 0;
  padding: 0.6rem 1.2rem;
  border-left: 4px solid var(--primary-light);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}

/* Anchor offset so in-page links clear the sticky header */
[id] { scroll-margin-top: calc(var(--header-h) + 1rem); }
.heading-anchor {
  margin-left: 0.4rem;
  opacity: 0;
  color: var(--primary-light);
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.article-body :is(h2, h3, h4):hover .heading-anchor { opacity: 1; }

/* ----- Inline code ----------------------------------------------------- */
:not(pre) > code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
  padding: 0.12em 0.4em;
  border-radius: 5px;
  border: none;
  word-break: break-word;
}

/* ----- Code blocks + copy button -------------------------------------- */
.code-block {
  position: relative;
  margin: 1.3rem 0;
}
.code-block pre {
  margin: 0;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
}
.code-block code {
  font-family: var(--mono);
  background: none;
  color: #243b53;
  padding: 0;
}
.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.code-block:hover .copy-btn,
.copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.copy-btn.copied { background: var(--ok); color: #fff; border-color: var(--ok); }

/* Prism light syntax theme (matches palette) */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #7b8a94; font-style: italic; }
.token.punctuation { color: #5c6b73; }
.token.property, .token.tag, .token.boolean, .token.number,
.token.constant, .token.symbol, .token.deleted { color: #b45309; }
.token.selector, .token.attr-name, .token.string, .token.char,
.token.builtin, .token.inserted { color: #0f766e; }
.token.operator, .token.entity, .token.url { color: #6d28d9; }
.token.atrule, .token.attr-value, .token.keyword { color: #4f46e5; font-weight: 600; }
.token.function, .token.class-name { color: #be185d; }
.token.regex, .token.important, .token.variable { color: #c2410c; }

/* ----- Tables ---------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  margin: 1.4rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.table-wrap table {
  border-collapse: collapse;
  width: 100%;
  min-width: 540px;
  font-size: 0.9rem;
}
.table-wrap th, .table-wrap td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table-wrap thead th {
  background: linear-gradient(120deg, var(--primary-darker), var(--primary));
  color: #fff;
  font-weight: 650;
  white-space: nowrap;
}
.table-wrap tbody tr:nth-child(even) { background: var(--surface-2); }
.table-wrap tbody tr:hover { background: var(--primary-tint); }

/* ----- Task list checkboxes ------------------------------------------- */
.article-body ul.contains-task-list { list-style: none; padding-left: 0.25rem; }
.task-list-item { list-style: none; display: flex; align-items: flex-start; gap: 0.6rem; }
.task-list-item::marker { content: ""; }
.task-list-item input.task-list-item-checkbox {
  margin-top: 0.35rem;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--primary);
  cursor: pointer;
  flex: none;
}
.task-list-item.is-checked {
  color: var(--text-muted);
  text-decoration: line-through;
}
.task-list-item.is-checked input.task-list-item-checkbox { text-decoration: none; }

/* ----- Mermaid + math -------------------------------------------------- */
.mermaid {
  margin: 1.4rem 0;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  overflow-x: auto;
}
.math-block {
  margin: 1.3rem 0;
  overflow-x: auto;
  padding: 0.4rem 0;
}

/* ----- FAQ accordion --------------------------------------------------- */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0.7rem 0;
  background: var(--surface);
  overflow: hidden;
}
.faq-item > summary {
  cursor: pointer;
  padding: 0.9rem 1.1rem;
  font-weight: 650;
  color: var(--heading);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: "+";
  color: var(--primary);
  font-size: 1.3rem;
  transition: transform 0.2s ease;
}
.faq-item[open] > summary::after { transform: rotate(45deg); }
.faq-item > summary:hover { background: var(--surface-2); }
.faq-body { padding: 0 1.1rem 1rem; }

/* ----- Related content ------------------------------------------------- */
.related { margin-top: 2.2rem; }
.related-section { margin-top: 1.4rem; }
.related-heading {
  font-size: 1.15rem;
  color: var(--heading);
  margin: 0 0 0.8rem;
}
.related-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.8rem;
}
.related-cards a {
  display: block;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.related-cards a:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}
.related-title { display: block; font-weight: 650; color: var(--primary-darker); }
.related-sum { display: block; font-size: 0.82rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ----- Footer ---------------------------------------------------------- */
.site-footer {
  flex-shrink: 0;
  background: var(--heading);
  color: #d7e4e1;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 2.2rem clamp(1rem, 3vw, 2.5rem) 1rem;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}
.footer-brand { display: flex; gap: 0.9rem; align-items: flex-start; }
.footer-name { font-weight: 700; color: #fff; margin: 0 0 0.3rem; }
.footer-desc { margin: 0; font-size: 0.88rem; color: #b6c9c4; max-width: 52ch; }
.footer-heading {
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}
.footer-nav ul { list-style: none; padding: 0; margin: 0; }
.footer-nav li { margin: 0.3rem 0; }
.footer-nav a { color: #cfe0dc; }
.footer-nav a:hover { color: #fff; }
.footer-copy {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 0.8rem clamp(1rem, 3vw, 2.5rem) 1.6rem;
  font-size: 0.8rem;
  color: #9fb6b1;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ----- Responsive ------------------------------------------------------ */
@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem clamp(1rem, 3vw, 2.5rem) 1rem;
    box-shadow: var(--shadow-md);
  }
  .site-header.nav-open .primary-nav { display: flex; }
  .nav-link { font-size: 1rem; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .footer-inner { grid-template-columns: 1fr; }
  .hero-cta .btn { width: 100%; justify-content: center; }
}

/* Large widescreen: use more of the viewport */
@media (min-width: 1600px) {
  :root { --maxw: 1440px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
