/* The site's top bar and footer for pages that are not the landing page (the
 * manual first). Same look as the landing page's own bar and footer in
 * about.html, which keeps its copy inline; if one changes, change the other.
 *
 * Self-contained: every colour is a custom property declared here, so a page
 * only has to load this file and site-chrome.js. Both bars span every column of
 * a page that lays itself out as a grid (the manual does), and are plain
 * full-width blocks on one that does not.
 */

:root {
  --sc-brand: #1667d8;
  --sc-brand-strong: #1256b8;
  --sc-ink: #0f1420;
  --sc-text-sub: #5f6876;
  --sc-text-soft: #677181;
  --sc-stroke: #e1e4ea;
  --sc-white: #ffffff;
  --sc-container: 100%; /* the bar and footer run the full width, 24px in from each edge */
  --sc-gutter: 24px;
  --sc-nav-height: 64px;
}

@media (max-width: 480px) {
  :root {
    --sc-gutter: 16px;
    --sc-nav-height: 56px;
  }
}

/* Reserve the bar's height before the script has drawn it, so the page does not
   jump when it arrives. */
[data-site-nav] {
  min-height: var(--sc-nav-height);
  border-bottom: 1px solid #e6e8ec;
}
/* The link inside the placeholder is there for a crawler and for a reader whose
   script never ran; once the bar is drawn it is replaced, and until then it
   stays out of sight so the bar's slot does not flash a bare text link. */
[data-site-nav] > a {
  position: absolute;
  left: -9999px;
}

.sc-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(251, 251, 252, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid #e6e8ec;
  font-family: "Noto Sans Thai", -apple-system, "Segoe UI", sans-serif;
}
.sc-nav-inner {
  max-width: var(--sc-container);
  margin: 0 auto;
  padding: 0 var(--sc-gutter);
  height: var(--sc-nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.sc-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--sc-ink);
  text-decoration: none;
}
.sc-brand-logo {
  display: block;
  flex: none;
  width: 156px;
  height: 54px;
  object-fit: contain;
}
.sc-brand-word {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}
@media (max-width: 480px) {
  .sc-nav-inner { gap: 8px; }
  .sc-nav .sc-brand-logo { width: 112px; height: auto; }
  .sc-nav.is-signed-in .sc-brand-logo { width: 96px; }
  .sc-brand-word {
    font-size: 22px;
  }
}

.sc-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sc-acct-host { display: flex; }
/* "Go to the planner", for a signed-in reader: the bar's one filled control,
   the same shape as the landing page's. */
.sc-go {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--sc-brand);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.sc-go:hover { background: var(--sc-brand-strong); }
.sc-go:focus-visible { outline: 2px solid var(--sc-brand); outline-offset: 2px; }
/* On a phone the way back keeps only its arrow, so account, planner and home fit. */
@media (max-width: 560px) {
  .sc-nav.is-signed-in .sc-back span { display: none; }
  .sc-nav.is-signed-in .sc-back { padding: 0 10px; }
}

/* One quiet control: the way back to the page this bar belongs to. Same shape as
   the landing page's sign-in button (34px, 6px corners, hairline border). */
.sc-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid #e6e8ec;
  border-radius: 6px;
  background: var(--sc-white);
  color: var(--sc-ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.sc-back:hover {
  border-color: #c9cdd4;
}
.sc-back:focus-visible,
.sc-brand:focus-visible,
.sc-footer a:focus-visible {
  outline: 2px solid var(--sc-brand);
  outline-offset: 2px;
}

.sc-footer {
  border-top: 1px solid var(--sc-stroke);
  background: var(--sc-white);
  font-family: "Noto Sans Thai", -apple-system, "Segoe UI", sans-serif;
  color: var(--sc-text-sub);
}
.sc-footer-inner {
  max-width: var(--sc-container);
  margin: 0 auto;
  padding: 48px var(--sc-gutter);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
}
/* Four columns need room: below 1000px the brand takes its own row and the
   three link columns share the one under it. */
@media (max-width: 999px) {
  .sc-footer-inner {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .sc-footer-inner > div:first-child {
    grid-column: 1 / -1;
  }
}
@media (max-width: 640px) {
  .sc-footer-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}
.sc-footer-blurb {
  margin: 16px 0 0;
  max-width: 34ch;
  font-size: 14px;
  line-height: 1.6;
}
.sc-footer-head {
  margin: 0 0 14px;
  color: var(--sc-text-soft);
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.sc-footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.sc-footer-links li {
  margin: 0;
  max-width: none;
}
.sc-footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--sc-text-sub);
  font-size: 14px;
  text-decoration: none;
}
.sc-footer-links a:hover {
  color: var(--sc-brand);
}
.sc-footer-legal {
  max-width: var(--sc-container);
  margin: 0 auto;
  padding: 18px var(--sc-gutter) 32px;
  border-top: 1px solid var(--sc-stroke);
  color: var(--sc-text-soft);
  font-size: 12px;
}

/* On a page laid out as a grid (the manual's body), both bars take the whole
   width and sit in the first and last rows. */
body > .sc-nav,
body > [data-site-nav],
body > .sc-footer {
  grid-column: 1 / -1;
}
body > .sc-nav,
body > [data-site-nav] {
  grid-row: 1;
}
body > .sc-footer {
  grid-row: 3;
}
