/* Base, header, column grid and footer. Breakpoints follow the reference (Bootstrap 3): 768 / 992 / 1200. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding-top: var(--body-top);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-page);
}

img,
svg {
  vertical-align: middle;
}

img {
  border: 0;
}

a {
  color: var(--c-link);
  text-decoration: none;
}

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

:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

button {
  font-family: inherit;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: inherit;
  color: inherit;
}

p {
  margin: 0 0 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 2000;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--c-link);
  color: var(--c-white);
}

.skip-link:focus {
  top: 8px;
}

/* Target of the "back to top" link: the very top of the document, not below the body offset. */
#top {
  position: absolute;
  top: 0;
  left: 0;
}

.icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex: none;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--c-navbar);
  border: 1px solid var(--c-navbar-border);
  border-radius: 4px;
  transition: top var(--t-header);
}

.site-header.is-hidden {
  top: var(--header-hide);
}

.hdr {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

.hdr-main {
  display: flex;
  align-items: flex-start;
}

.brand {
  display: block;
  height: 50px;
  padding: 6px 10px;
  flex: none;
}

.brand img {
  display: block;
}

.search {
  position: relative;
  display: flex;
  margin: 8px 10px 0;
  width: calc(12.5vw + 48px);
}

.search input {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  height: 34px;
  padding: 6px 12px;
  font: 14px/20px var(--font);
  color: var(--c-input-text);
  background: var(--c-white);
  border: 1px solid var(--c-input-border);
  border-right: 0;
  border-radius: 20px 0 0 20px;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  -webkit-appearance: none;
  appearance: none;
}

.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Focus ring in the shared focus colour (the reference light-blue glow was below 3:1); no size change. */
.search input:focus {
  outline: none;
  border-color: var(--c-focus);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0 1px var(--c-focus);
}

.search button {
  flex: none;
  width: 39px;
  height: 34px;
  padding: 0;
  border: 1px solid #2e6da4;
  border-radius: 0 20px 20px 0;
  background: var(--c-link);
  color: var(--c-white);
  cursor: pointer;
}

.search button:hover {
  background: #00557f;
}

.search button .icon {
  width: 15px;
  height: 15px;
}

.nav-toggle {
  display: none;
}

.main-nav {
  /* Children join the header flex row so the right links can wrap to their own row (as in the reference). */
  display: contents;
}

.cat-menu {
  position: relative;
}

.cat-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 53px;
  padding: 10px 8px 11px;
  border: 0;
  background: transparent;
  color: var(--c-link);
  font: 700 20px/20px var(--font);
  cursor: pointer;
}

.cat-toggle img {
  width: 32px;
  height: 32px;
  margin-right: 2px;
}

.caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  border-top: 4px solid var(--c-accent);
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  transition: transform var(--t-fast);
}

.cat-toggle[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}

.cat-panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1001;
  width: 500px;
  padding: 10px;
  line-height: 23px;
  background: var(--c-white);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 0 0 20px 20px;
  box-shadow: var(--shadow-menu);
  /* Phase 4: in short windows (landscape phones, zoom) the dropdown scrolls instead of running off-screen
     inside the fixed header, where its last links could not be reached. */
  max-height: calc(100vh - var(--body-top) - 70px);
  overflow-y: auto;
}

.cat-panel[hidden] {
  display: none;
}

.cat-panel .rule {
  margin: 8px 0;
}

.nav-right {
  display: flex;
  margin: 0 30px 0 auto;
  padding: 0;
  list-style: none;
}

.nav-right a,
.nav-right button {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 50px;
  padding: 15px;
  border: 0;
  background: transparent;
  font: 14px/20px var(--font);
  color: var(--c-muted);
  cursor: pointer;
  white-space: nowrap;
}

.nav-right .is-group {
  color: #4267b2;
}

.nav-right .is-video {
  color: var(--c-nav-video);
}

.nav-right .is-clip {
  color: var(--c-nav-clip);
}

.nav-right .is-write {
  color: var(--c-green);
}

.nav-right .icon-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.login-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 1px 8px;
  border: 1px solid var(--c-green-hover);
  border-radius: 10px;
  background: var(--c-green);
  color: var(--c-white);
  font: 700 12px/18px var(--font);
}

.login-pill .icon {
  width: 11px;
  height: 11px;
}

.nav-right button:hover .login-pill {
  background: var(--c-green-hover);
}

.nav-right a:hover,
.nav-right button:hover {
  text-decoration: none;
  color: var(--c-text);
}

/* Wrapped header (reference wraps the right links to a 2nd row at tablet widths). */
@media (min-width: 768px) and (max-width: 991.98px) {
  .search {
    width: 124px;
  }
}

/* ---------- Mobile header ---------- */
@media (max-width: 767.98px) {
  .hdr {
    display: block;
  }

  .hdr-main {
    align-items: center;
  }

  .search {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    margin: 8px 9px 8px 0;
  }

  .nav-toggle {
    display: block;
    flex: none;
    width: 32px;
    height: 32px;
    margin: 0 15px 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
  }

  .nav-toggle img {
    display: block;
    width: 32px;
    height: 32px;
  }

  .main-nav {
    display: none;
    max-height: calc(100vh - 51px);
    overflow-y: auto;
    border-top: 1px solid var(--c-navbar-border);
    padding: 0 0 7px 10px;
  }

  .main-nav.is-open {
    display: block;
  }

  .cat-panel {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
    margin-right: 10px;
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 0 0 10px;
  }

  .nav-right {
    display: block;
    margin: 0;
  }

  .nav-right a,
  .nav-right button {
    height: 40px;
    padding: 10px 5px;
  }
}

/* ---------- Columns ---------- */
.page {
  display: flex;
  align-items: flex-start;
}

.layout-home {
  margin-top: 10px;
  margin-bottom: 20px;
}

.col-left,
.col-right {
  position: sticky;
  top: 0;
  width: 25%;
  max-height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
}

.col-left::-webkit-scrollbar,
.col-right::-webkit-scrollbar {
  display: none;
}

.col-left {
  padding: 10px 1px 30px 10px;
}

.col-center {
  position: relative;
  width: 50%;
  padding: 0 1px;
}

.layout-home .col-right {
  padding: 0 10px 0 1px;
}

.layout-article .col-right {
  padding: 0 10px;
}

.content {
  max-width: var(--content-max);
  margin: 0 auto;
}

@media (max-width: 1199.98px) {
  .col-left {
    display: none;
  }

  .layout-article {
    display: block;
  }

  .layout-article .col-center,
  .layout-article .col-right {
    position: relative;
    width: auto;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 991.98px) {
  .layout-home {
    display: block;
  }

  .layout-home .col-center,
  .layout-home .col-right {
    position: relative;
    width: auto;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 767.98px) {
  .content {
    max-width: none;
  }
}

/* ---------- Footer ---------- */
.footer-info {
  position: relative;
  max-width: var(--footer-max);
  margin: 0 auto -30px;
  padding: 10px 10px 20px;
  text-align: center;
}

.footer-info h2 {
  margin: 20px 0 10px;
  font-size: 26px;
  line-height: 45px;
  font-weight: 600;
}

.footer-info .label {
  font-size: 19.5px;
  padding: 0.2em 0.6em 0.3em;
}

.footer-info p {
  margin: 0 0 20px;
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  font-weight: 300;
}

.footer-info p a {
  font-weight: 700;
}

.site-footer {
  position: relative;
}

.footer-nav {
  position: relative;
  min-height: 51px;
  padding-left: 10px;
  background: var(--c-navbar);
  border: 1px solid var(--c-navbar-border);
  border-radius: 4px;
}

.container {
  width: var(--container);
  margin: 0 auto;
  padding: 0 15px;
}

.footer-nav .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  max-width: 100%;
}

.footer-nav ul + ul {
  margin-left: auto;
}

.footer-nav ul {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-nav a {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 50px;
  padding: 15px;
  color: var(--c-muted);
  white-space: nowrap;
}

.footer-nav .is-info {
  color: #31708f;
}

.footer-nav ul:first-child li:first-child a {
  padding-left: 0;
}

.footer-nav ul:first-child li:last-child a {
  padding-right: 0;
}

.footer-legal {
  margin-top: 10px;
  margin-bottom: 60px;
}

.footer-legal p {
  margin: 0;
}

/* Phase 4: the footer-legal lines are mostly lists of links (“A | B”), where WCAG 2.2’s inline exception does
   not apply, so each link is a 24 px tall target. The text is unchanged; each line grows a few pixels. */
.footer-legal a {
  display: inline-block;
  padding: 5px 0;
}

/* Links inside running text are underlined, so they are identifiable without relying on hue. */
.footer-legal a,
.footer-info p a {
  text-decoration: underline;
}

@media (max-width: 1199.98px) {
  .container {
    width: 970px;
  }
}

@media (max-width: 991.98px) {
  .container {
    width: 750px;
  }
}

@media (max-width: 767.98px) {
  .container {
    width: auto;
  }

  .footer-nav .container {
    display: block;
    padding: 7px 0 0;
  }

  .footer-nav ul {
    display: block;
    margin-bottom: 8px;
  }

  .footer-nav a,
  .footer-nav ul:first-child li a {
    height: 40px;
    padding: 10px 15px;
  }

  .footer-nav ul:first-child li:first-child a {
    padding-left: 0;
  }

  .footer-legal {
    padding: 0 15px;
  }
}
