/* User guide layout and styling. Shared values live in the variables below. */
:root {
  --guide-font: 'Ubuntu', Arial, sans-serif;
  --guide-text: #222222;
  --guide-muted: #5f6368;
  --guide-accent: #1a73e8;
  --guide-accent-bg: #f0f7ff;
  --guide-surface: #f8f9fa;
  --guide-border: #e0e0e0;
  --guide-note-bg: #e8f0fe;
  --guide-warning-bg: #fff3cd;
  --guide-warning-border: #ffc107;
  --guide-warning-text: #856404;
  --guide-mark-bg: #fff1a8;
  --guide-nav-width: 260px;
  --guide-content-max: 760px;
  --guide-header-h: 50px;
  --guide-radius: 4px;
  --guide-space-xs: 4px;
  --guide-space-sm: 8px;
  --guide-space-md: 16px;
  --guide-space-lg: 24px;
  --guide-space-xl: 40px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--guide-font);
  color: var(--guide-text);
  background: #ffffff;
  line-height: 1.5;
}

/* Header */
.guide-header {
  position: sticky;
  top: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: var(--guide-space-lg);
  height: var(--guide-header-h);
  padding: 0 var(--guide-space-lg);
  background: var(--guide-surface);
  border-bottom: 1px solid var(--guide-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.guide-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.guide-home-link {
  color: var(--guide-accent);
  text-decoration: none;
  font-size: 14px;
}

.guide-home-link:hover {
  text-decoration: underline;
}

/* Links to related pages, shown in the header of the legal pages */
.guide-header-links {
  display: flex;
  gap: var(--guide-space-md);
}

.guide-header-link {
  color: var(--guide-accent);
  text-decoration: none;
  font-size: 14px;
}

.guide-header-link:hover {
  text-decoration: underline;
}

.guide-menu-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: #ffffff;
  border: 1px solid var(--guide-border);
  border-radius: var(--guide-radius);
  color: var(--guide-text);
  cursor: pointer;
}

/* Search box and results panel */
.guide-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 360px;
  margin-left: auto;
}

.guide-search:empty {
  display: none;
}

.guide-search-box {
  position: relative;
}

.guide-search-icon {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  color: var(--guide-muted);
  pointer-events: none;
}

.guide-search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--guide-border);
  border-radius: var(--guide-radius);
  background: #ffffff;
  color: var(--guide-text);
  font-family: inherit;
  font-size: 14px;
}

.guide-search-input:focus {
  outline: none;
  border-color: var(--guide-accent);
  box-shadow: 0 0 0 2px var(--guide-accent-bg);
}

.guide-search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1200;
  width: min(440px, calc(100vw - 16px));
  max-height: 70vh;
  overflow-y: auto;
  margin: 0;
  padding: var(--guide-space-xs);
  list-style: none;
  background: #ffffff;
  border: 1px solid var(--guide-border);
  border-radius: var(--guide-radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.guide-search-results[hidden] {
  display: none;
}

.guide-search-option {
  padding: var(--guide-space-sm) 10px;
  border-radius: var(--guide-radius);
  cursor: pointer;
}

.guide-search-option.is-active {
  background: var(--guide-accent-bg);
}

.guide-search-result-title {
  display: block;
  font-weight: 500;
}

.guide-search-crumb {
  display: block;
  color: var(--guide-muted);
  font-size: 12px;
}

.guide-search-snippet {
  display: block;
  margin-top: var(--guide-space-xs);
  color: var(--guide-muted);
  font-size: 14px;
}

.guide-search-option mark,
.guide-search-snippet mark {
  padding: 0 1px;
  border-radius: 2px;
  background: var(--guide-mark-bg);
  color: inherit;
}

.guide-search-empty {
  padding: var(--guide-space-sm) 10px;
  color: var(--guide-muted);
  list-style: none;
}

/* Short highlight on a section heading after a search result is chosen */
@keyframes guide-flash {
  from {
    background-color: var(--guide-accent-bg);
  }
  to {
    background-color: transparent;
  }
}

.guide-heading.is-flash {
  animation: guide-flash 1.5s ease-out;
}

/* Two-column layout */
.guide-layout {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--guide-header-h));
}

.guide-nav {
  position: sticky;
  top: var(--guide-header-h);
  flex: 0 0 var(--guide-nav-width);
  width: var(--guide-nav-width);
  height: calc(100vh - var(--guide-header-h));
  overflow-y: auto;
  padding: var(--guide-space-md);
  border-right: 1px solid var(--guide-border);
  background: var(--guide-surface);
}

.guide-content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: var(--guide-content-max);
  padding: var(--guide-space-xl) var(--guide-space-lg);
}

/* Navigator */
.guide-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-nav-sublist {
  padding-left: var(--guide-space-md);
}

.guide-nav-link {
  display: block;
  padding: var(--guide-space-xs) var(--guide-space-sm);
  border-left: 3px solid transparent;
  border-radius: var(--guide-radius);
  color: var(--guide-text);
  text-decoration: none;
  font-size: 15px;
}

.guide-nav-link.is-sub {
  font-size: 14px;
  color: var(--guide-muted);
}

.guide-nav-link:hover {
  background: #ffffff;
}

.guide-nav-link.is-active {
  border-left-color: var(--guide-accent);
  background: var(--guide-accent-bg);
  color: var(--guide-accent);
  font-weight: 500;
}

.guide-nav-link:focus-visible,
.guide-menu-button:focus-visible,
.guide-home-link:focus-visible,
.guide-content a:focus-visible {
  outline: 2px solid var(--guide-accent);
  outline-offset: 2px;
}

/* Sections and headings */
.guide-content section,
.guide-heading {
  scroll-margin-top: calc(var(--guide-header-h) + 12px);
}

.guide-heading {
  margin: var(--guide-space-xl) 0 var(--guide-space-md);
  line-height: 1.3;
}

h2.guide-heading {
  font-size: 26px;
  font-weight: 500;
}

h3.guide-heading {
  font-size: 20px;
  font-weight: 500;
}

/* Blocks */
.guide-p {
  margin: 0 0 var(--guide-space-md);
}

.guide-steps {
  margin: 0 0 var(--guide-space-md);
  padding-left: 1.5em;
}

.guide-steps li {
  margin-bottom: var(--guide-space-sm);
}

.guide-list {
  margin: 0 0 var(--guide-space-md);
  padding-left: 1.5em;
}

.guide-list li {
  margin-bottom: var(--guide-space-sm);
}

.guide-callout {
  margin: 0 0 var(--guide-space-md);
  padding: var(--guide-space-sm) var(--guide-space-md);
  border-left: 4px solid var(--guide-accent);
  border-radius: var(--guide-radius);
  background: var(--guide-note-bg);
}

.guide-callout p {
  margin: 0;
}

.guide-callout-label {
  display: block;
  margin-bottom: var(--guide-space-xs);
  font-weight: 500;
}

.guide-callout--warning {
  border-left-color: var(--guide-warning-border);
  background: var(--guide-warning-bg);
  color: var(--guide-warning-text);
}

.guide-see-also {
  margin: var(--guide-space-lg) 0 var(--guide-space-md);
  padding-top: var(--guide-space-md);
  border-top: 1px solid var(--guide-border);
  font-size: 14px;
}

.guide-see-also-label {
  display: block;
  margin-bottom: var(--guide-space-xs);
  color: var(--guide-muted);
  font-weight: 500;
}

.guide-see-also ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-see-also li {
  margin-bottom: var(--guide-space-xs);
}

.guide-see-also a {
  color: var(--guide-accent);
  text-decoration: none;
}

.guide-see-also a:hover {
  text-decoration: underline;
}

.guide-figure {
  margin: var(--guide-space-lg) 0;
}

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

.guide-figure figcaption {
  margin-top: var(--guide-space-sm);
  color: var(--guide-muted);
  font-size: 13px;
}

/* Error message when guide.json cannot be loaded */
.guide-error {
  color: var(--guide-warning-text);
}

/* Drawer backdrop (mobile only; shown by JS) */
.guide-backdrop {
  position: fixed;
  top: var(--guide-header-h);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.4);
}

.guide-backdrop[hidden] {
  display: none;
}

/* Phones and small tablets: nav becomes an off-canvas drawer */
@media (max-width: 768px) {
  .guide-header {
    gap: var(--guide-space-md);
    padding: 0 var(--guide-space-md);
  }

  .guide-title,
  .guide-header-links {
    display: none;
  }

  .guide-search {
    max-width: none;
  }

  .guide-menu-button {
    display: inline-flex;
  }

  .guide-layout {
    display: block;
  }

  .guide-nav {
    position: fixed;
    top: var(--guide-header-h);
    bottom: 0;
    left: 0;
    z-index: 1000;
    width: min(280px, 85vw);
    height: auto;
    flex: none;
    border-right: 1px solid var(--guide-border);
    background: #ffffff;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s ease;
  }

  .guide-nav.is-open {
    transform: none;
    visibility: visible;
  }

  .guide-content {
    max-width: none;
    padding: var(--guide-space-lg) var(--guide-space-md);
  }

  .guide-heading {
    margin-top: var(--guide-space-lg);
  }
}
