:root {
  --page-bg: #0a172e;
  --fg: #1a1a1a;
  --muted: #5a5a5a;
  --accent: #1f4d8a;
  --card-bg: #ffffff;
  --border: #e5e5e2;
  --max-width: 760px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, #15294a 0%, #0a172e 55%, #050d1d 100%) fixed;
  min-height: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Avenir", "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  background: transparent;
  isolation: isolate;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#bg-network {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 0;
  pointer-events: none;
  display: block;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

/* Page transition: header/main/footer fade out on link click,
   stay hidden during the new page's rotation, then fade in. */
header.site-header,
main.container,
footer.site-footer {
  transition: opacity 0.4s ease;
}

html.transitioning-out header.site-header,
html.transitioning-out main.container,
html.transitioning-out footer.site-footer,
html.transitioning-in header.site-header,
html.transitioning-in main.container,
html.transitioning-in footer.site-footer {
  opacity: 0;
}

header.site-header {
  background: transparent;
  position: relative;
  z-index: 10;
}

main.container {
  background: rgba(255, 255, 255, 0.80);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
  margin: 1.75rem auto;
  padding: 2rem 1.75rem 2.5rem;
  position: relative;
  z-index: 10;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

@media (min-width: 720px) {
  main.container { padding: 2.5rem 2.5rem 3rem; }
}

header.site-header .container {
  padding: 1.25rem 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

header.site-header a.brand {
  font-weight: 600;
  font-size: 1.1rem;
  color: #ffffff;
  text-decoration: none;
}

header.site-header .tagline {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
}

h1, h2, h3 { line-height: 1.25; margin-top: 2rem; }
h1 { font-size: 2rem; margin-top: 0.5rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; color: var(--muted); }

p { margin: 1rem 0; }

a { color: var(--accent); }
a:hover { text-decoration: underline; }

.intro {
  font-size: 1.1rem;
  color: var(--fg);
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--accent); text-decoration: underline; }

.product-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

@media (min-width: 640px) {
  .product-card { grid-template-columns: 220px 1fr; }
}

.product-card img.screenshot {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.product-card h2 { margin-top: 0; }

.product-card .links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.9rem;
  margin-top: 1rem;
}

.product-card .play-badge {
  display: block;
  /* Counter the transparent safe-area baked into the official Play badge so
     the visible black pill aligns flush with the text above. */
  margin-left: -10px;
}

.product-card .play-badge img {
  height: 76px;
  width: auto;
  display: block;
}

.product-card .doc-links a {
  margin-right: 1rem;
  font-size: 0.95rem;
}

footer.site-footer {
  margin-top: 0;
  padding: 1.25rem 1.25rem;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  text-align: center;
  background: transparent;
  position: relative;
  z-index: 10;
}

footer.site-footer a { color: rgba(255, 255, 255, 0.85); }

/* Article no longer needs its own card; main.container is the card. */
article { background: transparent; border: 0; padding: 0; }

/* === Table of contents === */
.toc {
  margin: 1.25rem 0 2rem;
  padding: 0.9rem 1.1rem;
  background: rgba(31, 77, 138, 0.05);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
}
.toc-title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 700;
}
.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.toc a {
  text-decoration: none;
  color: var(--accent);
  font-weight: 500;
  font-size: 0.96rem;
}
.toc a:hover { text-decoration: underline; }

/* === Collapsible Q&A (FAQ) === */
article details {
  border-top: 1px solid var(--border);
}
article details:last-of-type {
  border-bottom: 1px solid var(--border);
}
article summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  color: var(--fg);
  padding: 0.85rem 1.75rem 0.85rem 0;
  list-style: none;
  position: relative;
}
article summary::-webkit-details-marker { display: none; }
article summary::after {
  content: "";
  position: absolute;
  right: 0.5rem;
  top: 1.05rem;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
article details[open] summary::after {
  transform: rotate(225deg);
  top: 1.25rem;
}
article details summary:hover { color: var(--accent); }

/* Question text is itself a link, so right-click → "Copy link" works on it. */
.question-link {
  color: inherit;
  text-decoration: none;
}
.question-link:hover { color: var(--accent); }
.question-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
article details > p:first-of-type { margin-top: 0.25rem; }
article details > p:last-of-type,
article details > figure:last-of-type { margin-bottom: 1rem; }

article ul, article ol { padding-left: 1.5rem; }
article li { margin: 0.4rem 0; }

article h2 { margin-top: 2.5rem; }

article figure {
  margin: 1.25rem 0 1.5rem;
}

article figure.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

article figure img {
  display: block;
  max-width: 100%;
  max-height: 480px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

article figure.row img {
  flex: 0 1 auto;
  max-height: 360px;
  width: auto;
}

article figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}
