/* Keep native activation, text selection and focus; suppress only tap decoration. */
:is(a, button) {
  -webkit-tap-highlight-color: transparent;
}

:is(a, button):focus-visible,
html[data-input-mode="keyboard"] :is(a, button):focus {
  outline: 2px solid var(--foreground);
  outline-offset: 4px;
  border-radius: 4px;
}

html[data-input-mode="pointer"] :is(a, button):focus {
  outline: none;
}

html[data-input-mode="keyboard"] .guides-index .guide-index-link:focus {
  outline-offset: -2px;
}

body.site-page {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 100vh;
  min-height: 100svh;
}

.site-page > .site-footer {
  flex-shrink: 0;
  margin-top: auto;
}

/* Let the content own the opening screen; the footer follows it in normal flow. */
.site-page > main {
  box-sizing: border-box;
  flex-shrink: 0;
  min-height: max(0px, calc(100vh - var(--header-height, 4.5625rem)));
  min-height: max(0px, calc(100svh - var(--header-height, 4.5625rem)));
  padding-bottom: calc(2 * var(--site-space-section));
}

/* The homepage closing section already supplies its closing breathing room. */
.site-page.site-home > main { padding-bottom: 0; }

@media print {
  body.site-page { display: block; min-height: 0; }
  .site-page > main { min-height: 0; padding-bottom: 0; }
  .site-footer { display: none; }
}

/* One keyboard-only bypass link, supplied by the shared header template. */
.skip-link {
  position: fixed;
  top: 12px;
  left: max(16px, env(safe-area-inset-left));
  z-index: 40;
  max-width: calc(100% - 32px);
  min-height: 44px;
  padding: 14px 18px;
  background: var(--background);
  color: var(--foreground);
  font: 600 1rem/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transform: translateY(calc(-100% - 24px));
  overflow-wrap: anywhere;
}

.skip-link:focus-visible,
html[data-input-mode="keyboard"] .skip-link:focus { transform: none; }

/* The menu owns keyboard focus while open; its bypass target is inert. */
body.menu-open .skip-link { display: none; }

.site-page main {
  scroll-margin-top: calc(var(--header-height, 4.5625rem) + var(--site-space-meta));
}

@media print { .skip-link { display: none; } }
