/* ------------------------------------------------------------------ *
 * Webperf Cloud — public marketing site.
 * A thin, minimalist SaaS layer on top of Pico CSS (pico.min.css).
 * Vanilla CSS only, no build step. WCAG-minded: visible focus, skip
 * link, sufficient contrast, respects reduced motion.
 * ------------------------------------------------------------------ */

:root {
  /* Teal "signal" accent, darkened from the terminal's #56d6c2 so that
     white text on the primary button clears WCAG AA contrast. */
  --pico-primary: #0a6e5e;
  --pico-primary-background: #0d7c6b;
  --pico-primary-hover-background: #0a6253;
  --pico-primary-hover: #084f43;
  --pico-primary-focus: rgba(13, 124, 107, 0.3);
  --pico-primary-underline: rgba(10, 110, 94, 0.5);

  --pico-border-radius: 0.5rem;
  --pico-typography-spacing-vertical: 1.4rem;

  /* Local tokens */
  --wp-accent: #0d7c6b;
  --wp-max-prose: 46rem;
  --wp-section-gap: clamp(2.5rem, 6vw, 4.5rem);
}

/* Slightly tighter, modern heading rhythm. */
:root {
  --pico-font-weight: 400;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

main#main {
  flex: 1 0 auto;
  padding-block: var(--wp-section-gap);
}

/* ---- Skip link ---------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 0.5rem 1rem;
  background: var(--wp-accent);
  color: #fff;
  border-radius: 0 0 var(--pico-border-radius) 0;
}
.skip-link:focus {
  left: 0;
}

/* ---- Header / nav ------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--pico-background-color) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--pico-muted-border-color);
  /* Capture the theme text colour here, outside any <button>. Pico
     re-declares --pico-color to white inside buttons, so the hamburger
     bars must reference this instead to stay visible in light & dark. */
  --wp-nav-ink: var(--pico-color);
}
.site-header nav {
  padding-block: 0.35rem;
}
.brand {
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--pico-color);
}
.brand strong { color: var(--wp-accent); }
.brand-sep { margin: 0 0.25rem; color: var(--pico-muted-color); }
.site-header nav a:not(.brand):not([role="button"]) {
  text-decoration: none;
  color: var(--pico-color);
}
.site-header nav a:not(.brand):not([role="button"]):hover,
.site-header nav a[aria-current="page"] {
  color: var(--wp-accent);
}
.nav-cta {
  --pico-color: #fff;
  padding-block: 0.4rem;
}

/* ---- Hamburger toggle (hidden on desktop) ------------------------- */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  cursor: pointer;
}
.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: var(--wp-nav-ink);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.nav-toggle-icon {
  position: relative;
}
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle-icon::before { top: -6px; }
.nav-toggle-icon::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after { transform: translateY(-6px) rotate(-45deg); }

/* ---- Prose / content --------------------------------------------- */
.prose {
  max-width: var(--wp-max-prose);
  margin-inline: auto;
}
.prose > h1:first-child {
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.prose h2 {
  margin-top: 2.6rem;
  letter-spacing: -0.01em;
}
.prose hr {
  margin-block: var(--wp-section-gap);
  border: none;
  border-top: 1px solid var(--pico-muted-border-color);
}
.prose p { color: var(--pico-color); }
.prose strong { font-weight: 600; }

/* Publication date — under a post's title and in the blog listing. */
.post-date {
  margin-block: 0 1.4rem;
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}
.prose h3 + .post-date {
  margin-block: -0.6rem 0.4rem;
}

/* The intro paragraph right after the hero reads as a lead. */
.prose > h1:first-child + p {
  font-size: 1.2rem;
  color: var(--pico-muted-color);
}

/* ---- Markdown buttons ({ .md-button }) ---------------------------- */
.md-button {
  display: inline-block;
  margin: 0.4rem 0.6rem 0.4rem 0;
  padding: 0.65rem 1.4rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--pico-border-radius);
  border: 1px solid var(--wp-accent);
  color: var(--wp-accent);
  background: transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.md-button:hover {
  background: color-mix(in srgb, var(--wp-accent) 10%, transparent);
}
.md-button--primary {
  background: var(--pico-primary-background);
  color: #fff;
}
.md-button--primary:hover {
  background: var(--pico-primary-hover-background);
  color: #fff;
}

/* ---- Admonitions (!!! note "...") -------------------------------- */
.admonition {
  margin-block: 1.6rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--pico-muted-border-color);
  border-left: 4px solid var(--wp-accent);
  border-radius: var(--pico-border-radius);
  background: var(--pico-card-background-color);
}
.admonition > :last-child { margin-bottom: 0; }
.admonition-title {
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--wp-accent);
}
.admonition.info, .admonition.note { border-left-color: var(--wp-accent); }
.admonition.warning { border-left-color: #c77700; }
.admonition.warning .admonition-title { color: #c77700; }

/* ---- Tables (plans comparison) ----------------------------------- */
.prose .table-wrap, .prose table { width: 100%; }
.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}
.prose th, .prose td {
  text-align: center;
  vertical-align: middle;
}
.prose th:first-child, .prose td:first-child {
  text-align: left;
}
.md-icon { font-weight: 700; }
.md-icon[aria-label="Included"] { color: var(--wp-accent); }
.md-icon[aria-label="Not included"] { color: var(--pico-muted-color); }

/* ---- Footer ------------------------------------------------------- */
.site-footer {
  flex-shrink: 0;
  margin-top: var(--wp-section-gap);
  padding-block: 2.5rem;
  border-top: 1px solid var(--pico-muted-border-color);
  background: var(--pico-card-background-color);
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
}
.footer-brand { margin-bottom: 0.5rem; }
.footer-brand strong { color: var(--wp-accent); }
.footer-note { color: var(--pico-muted-color); max-width: 32rem; }
.footer-heading {
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.3rem; }
.site-footer a { text-decoration: none; }
.footer-langs {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--pico-muted-border-color);
  color: var(--pico-muted-color);
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }

  .site-header nav { flex-wrap: wrap; row-gap: 0.5rem; }
  .nav-toggle { display: inline-flex; }
  .nav-menu {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    margin: 0;
    padding-block: 0.25rem;
  }
  .nav-menu.is-open { display: flex; }
  .nav-menu li { width: 100%; padding: 0; }
  .nav-menu a:not([role="button"]) {
    display: block;
    padding: 0.6rem 0.5rem;
  }
  .nav-menu .nav-cta { display: block; text-align: center; margin-top: 0.25rem; }
}

/* ---- Focus visibility & motion ------------------------------------ */
:where(a, button, [role="button"], input, summary):focus-visible {
  outline: 3px solid var(--wp-accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .site-header { backdrop-filter: none; }
}
