/* GGX help site. Colors follow the app's theme (app/lib/theme/theme.dart). */

:root {
  color-scheme: light dark;
  --background: #fdf8f8;
  --surface: #f4eeee;
  --text: #1c1b1b;
  --muted: #5d5f5f;
  --border: #ddd6d6;
  --accent: #924b00;
  --link: #006782;
  --brand: #f68511;
  /* Status colors: the theme's tertiary, buyGreen, error and onSurfaceVariant. */
  --status-tertiary: #006782;
  --status-green: #1e6333;
  --status-error: #ba1a1a;
  --status-neutral: #444748;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
}

/* Dark follows the device unless the header's toggle chose an appearance
   (help.js), which page.html records as data-theme on the root element. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #121212;
    --surface: #1e1e1e;
    --text: #ececec;
    --muted: #a9a9a9;
    --border: #333333;
    --accent: #ffb781;
    --link: #5ed4ff;
    --status-tertiary: #9de2ff;
    --status-green: #90d79b;
    --status-error: #ffb4ab;
    --status-neutral: #c4c7c7;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #121212;
  --surface: #1e1e1e;
  --text: #ececec;
  --muted: #a9a9a9;
  --border: #333333;
  --accent: #ffb781;
  --link: #5ed4ff;
  --status-tertiary: #9de2ff;
  --status-green: #90d79b;
  --status-error: #ffb4ab;
  --status-neutral: #c4c7c7;
}

:root[data-theme="light"] {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
}

a {
  color: var(--link);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

/* Shows the appearance a press switches to: a moon while light, a sun while
   dark. */
.theme-toggle {
  display: inline-flex;
  padding: 0.4rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--border);
  color: var(--text);
}

.theme-toggle svg {
  fill: currentColor;
}

.theme-toggle .icon-light,
.theme-toggle[aria-pressed="true"] .icon-dark {
  display: none;
}

.theme-toggle[aria-pressed="true"] .icon-light {
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 2.5rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.site-nav > ul {
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a,
.site-nav summary {
  display: block;
  padding: 0.4rem 0.75rem;
  border-left: 3px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"],
.site-nav summary {
  border-left-color: var(--brand);
  color: var(--text);
  font-weight: 600;
}

/* The current page's entry opens to list its sections. */
.site-nav summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}

.site-nav summary::-webkit-details-marker {
  display: none;
}

.site-nav summary::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.page-sections[open] > summary::after {
  transform: rotate(45deg);
}

.page-sections ul {
  margin: 0 0 0.25rem;
  padding: 0;
  list-style: none;
}

.page-sections a {
  padding: 0.3rem 0.75rem 0.3rem 1.5rem;
  font-size: 0.9rem;
}

/* The section the reader has scrolled to (help.js). */
.page-sections a[aria-current="location"] {
  color: var(--accent);
  font-weight: 600;
}

main {
  min-width: 0;
  max-width: 52rem;
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 2rem;
  line-height: 1.25;
}

h2 {
  margin-top: 2.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 1.4rem;
}

h3 {
  margin-top: 1.75rem;
  font-size: 1.1rem;
}

h4 {
  margin-top: 1.5rem;
  font-size: 1rem;
}

h2,
h3,
h4 {
  /* A section opened from a link stays clear of the sticky header. */
  scroll-margin-top: 5rem;
}

.section-link {
  display: inline-flex;
  margin-left: 0.4rem;
  padding: 0.2rem;
  border-radius: 0.375rem;
  color: var(--muted);
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.15s;
}

.section-link svg {
  fill: currentColor;
}

h2:hover .section-link,
h3:hover .section-link,
h4:hover .section-link,
.section-link:focus-visible,
.section-link.copied {
  opacity: 1;
}

.section-link:hover,
.section-link.copied {
  background: var(--surface);
  color: var(--link);
}

/* A touch screen cannot hover, so its section links stay visible. */
@media (hover: none) {
  .section-link {
    opacity: 1;
  }
}

.summary {
  margin-top: 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.status {
  font-size: 0.9em;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-tertiary {
  color: var(--status-tertiary);
}

.status-green {
  color: var(--status-green);
}

.status-error {
  color: var(--status-error);
}

.status-neutral {
  color: var(--status-neutral);
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 4px solid var(--brand);
  border-radius: 0.5rem;
  background: var(--surface);
}

blockquote > :first-child {
  margin-top: 0;
}

blockquote > :last-child {
  margin-bottom: 0;
}

code {
  padding: 0.1rem 0.3rem;
  border-radius: 0.25rem;
  background: var(--surface);
  font-size: 0.9em;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface);
}

.screenshot {
  display: block;
  margin: 1rem 0;
}

.screenshot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.topics a {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.topics a:hover {
  border-color: var(--brand);
}

.topics span {
  color: var(--muted);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pager a {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  font-weight: 600;
}

.pager .next {
  margin-left: auto;
  text-align: right;
}

.pager span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  margin: 0;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--background);
  font-size: 0.9rem;
  box-shadow: 0 4px 16px rgb(0 0 0 / 20%);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 0.2s;
}

.toast.visible {
  opacity: 1;
}

@media (max-width: 48rem) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding: 1rem;
  }

  .site-nav > ul {
    position: static;
    display: flex;
    gap: 0.25rem;
    max-height: none;
    overflow-x: auto;
  }

  .site-nav a,
  .site-nav summary {
    border-left: 0;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }

  .site-nav a[aria-current="page"],
  .site-nav summary {
    border-bottom-color: var(--brand);
  }

  /* The phone layout's topic strip has no room for a page's sections. */
  .site-nav summary {
    pointer-events: none;
  }

  .site-nav summary::after,
  .page-sections ul {
    display: none;
  }
}
