/*
 * The site header every page starts with (site-nav.js), in the brand navy in both themes,
 * and the section toolbar under it: the section's name, then the page's own controls.
 */

/* ---------- Site header ---------- */
.at-site {
  --at-site-bg: var(--at-header-bg);
  --at-site-ink: var(--at-header-ink);
  --at-site-dim: var(--at-header-dim);
  position: relative;
  z-index: 1000;
  flex: none;
  box-sizing: border-box;
  height: 52px;
  background: var(--at-site-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--at-site-ink);
  font: 500 14px/1.2 var(--at-font, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
}
:root[data-theme="dark"] .at-site {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.at-site-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
  padding: 0 16px;
}

.at-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--at-on-color);
  text-decoration: none;
  white-space: nowrap;
}
.at-logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  position: relative;
  background: var(--at-logo-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  flex: none;
}
.at-logo-mark::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: var(--at-cyan);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M3.5 12.5l3.2-4 2.6 2.2 4.7-5.7' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 22px 22px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M3.5 12.5l3.2-4 2.6 2.2 4.7-5.7' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 22px 22px no-repeat;
}
.at-logo-word {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.015em;
}
.at-logo-apna {
  color: var(--at-cyan);
}
.at-logo:focus-visible {
  outline: 2px solid var(--at-cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

.at-site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.at-tab-wrap {
  position: relative;
}
.at-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--at-site-dim);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.at-tab:hover,
.at-tab[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.07);
  color: var(--at-on-color);
}
.at-tab.is-active {
  color: var(--at-on-color);
  box-shadow: inset 0 -2px 0 var(--at-cyan);
  border-radius: 8px 8px 0 0;
}
.at-tab:focus-visible,
.at-theme-toggle:focus-visible {
  outline: 2px solid var(--at-cyan);
  outline-offset: 1px;
}
.at-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
}
.at-yt-icon {
  display: none;
}
.at-yt-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}
.at-ext svg {
  display: block;
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.75;
}

.at-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: 6px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: transparent;
  color: var(--at-site-ink);
  cursor: pointer;
}
.at-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--at-on-color);
}
.at-theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The menus under Learn and Tools follow the page's theme */
.at-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1001;
  width: min(300px, calc(100vw - 24px));
  padding: 6px;
  border: 1px solid var(--at-border);
  border-radius: 10px;
  background: var(--at-surface);
  color: var(--at-text);
  box-shadow: var(--at-shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.2));
  text-align: left;
}
.at-menu[hidden] {
  display: none;
}
.at-menu-item {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}
.at-menu-item:hover,
.at-menu-item:focus-visible {
  background: var(--at-accent-softer, rgba(0, 120, 160, 0.06));
  outline: none;
}
.at-menu-item.is-current {
  background: var(--at-accent-soft, rgba(0, 120, 160, 0.1));
  box-shadow: inset 2px 0 0 var(--at-accent);
}
.at-menu-name {
  display: block;
  font-weight: 600;
}
.at-menu-tag {
  display: block;
  margin-top: 2px;
  color: var(--at-text-3);
  font-size: 12px;
  font-weight: 400;
}
.at-menu-small {
  padding: 7px 10px;
  color: var(--at-text-2);
  font-weight: 500;
}
.at-menu-rule {
  height: 1px;
  margin: 5px 4px;
  border: 0;
  background: var(--at-border);
}

/* Phones: YouTube as an icon, a smaller logo */
@media (max-width: 560px) {
  .at-site-inner {
    gap: 8px;
    padding: 0 10px 0 12px;
  }
  .at-logo-word {
    font-size: 17px;
  }
  .at-logo-mark {
    display: none;
  }
  .at-tab {
    padding: 0 8px;
  }
  .at-yt-icon {
    display: block;
  }
  .at-yt-text,
  .at-ext {
    display: none;
  }
  .at-theme-toggle {
    margin-left: 2px;
  }
}

/* ---------- Section toolbar (under the header) ---------- */
header.at-bar {
  box-sizing: border-box;
  min-height: 52px;
  padding: 6px 16px;
  background: var(--at-surface);
  border-bottom: 1px solid var(--at-border);
  color: var(--at-text);
}
.at-bar-title {
  margin: 0;
  color: var(--at-text);
  font: 650 15px/30px var(--at-font, system-ui, sans-serif);
  letter-spacing: -0.005em;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .at-bar-title {
    display: none; /* the Tools menu shows where you are; the room goes to the controls */
  }
}
@media (max-width: 520px) {
  header.at-bar {
    padding: 6px 12px;
  }
}
