/* Application Genie — global layout & Drupal chrome (depends on css/tokens.css) */

*,
*::before,
*::after {
  box-sizing: border-box;
}

.theme-appgenie {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  line-height: 1.55;
  color: var(--fg-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.theme-appgenie h1,
.theme-appgenie h2,
.theme-appgenie h3,
.theme-appgenie h4,
.theme-appgenie h5,
.theme-appgenie h6 {
  font-family: var(--font-display);
  color: var(--ink-900);
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin-block: 0;
  margin-inline: 0;
  text-wrap: balance;
}

.theme-appgenie h1 {
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 700;
}

.theme-appgenie h2 {
  font-size: clamp(1.75rem, 2.5vw, 2.5rem);
  font-weight: 700;
}

.theme-appgenie h3 {
  font-size: var(--fs-24);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.theme-appgenie h4 {
  font-size: var(--fs-20);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.theme-appgenie h5 {
  font-size: var(--fs-16);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
}

.theme-appgenie h6 {
  font-size: var(--fs-13);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
}

.theme-appgenie p {
  margin: 0;
  text-wrap: pretty;
}

.theme-appgenie small,
.theme-appgenie .text-sm {
  font-size: var(--fs-14);
}

.theme-appgenie .text-xs {
  font-size: var(--fs-12);
}

.theme-appgenie .eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-link);
}

.theme-appgenie code,
.theme-appgenie kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 1px 6px;
}

.theme-appgenie a {
  color: var(--accent-link);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color var(--t-fast) var(--ease-out), text-decoration var(--t-fast) var(--ease-out);
}

.theme-appgenie a:hover {
  color: var(--accent-link-hover);
  text-decoration: underline;
}

/* Site wordmark: not accent-colored like body links; no hover underline. */
.theme-appgenie a.appgenie-branding__title-link {
  color: var(--ink-900);
}

.theme-appgenie a.appgenie-branding__title-link:hover,
.theme-appgenie a.appgenie-branding__title-link:focus-visible {
  color: var(--genie-700);
  text-decoration: none;
}

.theme-appgenie ::selection {
  background: var(--lamp-200);
  color: var(--ink-900);
}

.theme-appgenie .visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/*
 * Skip-link reveal — never apply to Drupal contextual pencils (.trigger): same specificity as
 * .visually-hidden otherwise steals layout from contextual.theme.css after aggregation order.
 */
.theme-appgenie .visually-hidden.focusable:not(.trigger):active,
.theme-appgenie .visually-hidden.focusable:not(.trigger):focus {
  clip: auto;
  clip-path: none;
  height: auto;
  overflow: visible;
  position: absolute;
  left: var(--sp-4);
  top: var(--sp-4);
  width: auto;
  z-index: 1000;
}

/*
 * Contextual pencil is still marked .visually-hidden for SR text; undo sr-only geometry only so
 * core float / absolute .contextual wrapper positioning stays authoritative.
 */
.theme-appgenie .contextual > button.trigger.visually-hidden {
  clip: auto;
  clip-path: none;
  height: auto;
  width: auto;
  overflow: hidden;
  position: relative;
  white-space: nowrap;
  transition: opacity var(--t-fast) var(--ease-out);
}

.theme-appgenie .contextual > button.trigger.visually-hidden:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow);
}

/*
 * Fine pointers: hide pencils until hover/focus on the contextual region (or Tab onto trigger).
 * Touch/coarse: media query does not apply — pencils stay visible for tap targets.
 * Contextual links stay Drupal click-to-toggle (.open); do not CSS-hover-open them.
 */
@media (hover: hover) and (pointer: fine) {
  .theme-appgenie .contextual > button.trigger.visually-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .theme-appgenie .contextual-region:hover .contextual > button.trigger.visually-hidden,
  .theme-appgenie .contextual-region:focus-within .contextual > button.trigger.visually-hidden,
  .theme-appgenie .contextual.open > button.trigger.visually-hidden,
  .theme-appgenie .contextual > button.trigger.visually-hidden:focus-visible {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
  .theme-appgenie .contextual > button.trigger.visually-hidden {
    transition: none;
  }
}

.theme-appgenie .skip-link {
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-elev);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  color: var(--accent-link);
}

.theme-appgenie .appgenie-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

@media (min-width: 60em) {
  .theme-appgenie .appgenie-shell.with-sidebar-first {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

.theme-appgenie .appgenie-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: calc(var(--sp-3) + 2px) var(--sp-3);
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
  min-height: 100vh;
  overflow-y: auto;
}

.theme-appgenie .appgenie-region-sidebar-first {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  flex: 1;
  min-height: 0;
}

@media (max-width: 59.9375em) {
  .theme-appgenie .appgenie-shell.with-sidebar-first > .appgenie-sidebar {
    min-height: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-block: var(--sp-4);
  }
}

.theme-appgenie .appgenie-navigation-collapsed {
  padding-block: var(--sp-3);
  padding-inline: clamp(var(--sp-4), 3vw, var(--sp-8));
}

@media (min-width: 60em) {
  .theme-appgenie .appgenie-navigation-collapsed {
    display: none;
  }
}

.theme-appgenie .appgenie-workspace {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.theme-appgenie .appgenie-topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-4);
  min-height: 64px;
  padding-inline: clamp(var(--sp-4), 3vw, var(--sp-8));
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}

/* Region wrapper is often a bare <div>; don't rely only on .region.region-header. */
.theme-appgenie .appgenie-topbar > div,
.theme-appgenie .appgenie-topbar .region.region-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: inherit;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.theme-appgenie .appgenie-topbar .search-block-form {
  margin-inline-start: auto;
}

.theme-appgenie .appgenie-region-highlighted-inner,
.theme-appgenie .region.region-breadcrumb,
.theme-appgenie .appgenie-region-breadcrumb {
  padding-inline: clamp(var(--sp-4), 3vw, var(--sp-8));
}

.theme-appgenie .region-highlighted > * + * {
  margin-block-start: var(--sp-2);
}

.theme-appgenie .appgenie-region-help {
  padding-inline: clamp(var(--sp-4), 3vw, var(--sp-8));
  margin-block-start: var(--sp-4);
}

.theme-appgenie .appgenie-region-content-above,
.theme-appgenie .region.region-content-above {
  padding-inline: clamp(var(--sp-4), 3vw, var(--sp-8));
}

.theme-appgenie main[role="main"] {
  padding-inline: clamp(var(--sp-4), 3vw, var(--sp-8));
  padding-block-end: var(--sp-12);
}

.theme-appgenie.appgenie-user-canonical-page #block-appgenie-page-title {
  text-align: center;
}

.theme-appgenie .appgenie-region-content-above {
  margin-block-end: var(--sp-6);
}

.theme-appgenie footer.appgenie-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
}

.theme-appgenie footer.appgenie-footer .region-footer {
  max-width: min(1440px, 100%);
  padding: var(--sp-8);
  padding-inline: clamp(var(--sp-4), 3vw, var(--sp-8));
}

.theme-appgenie footer.appgenie-footer .appgenie-footer__copyright {
  max-width: min(1440px, 100%);
  margin-inline: auto;
  padding: var(--sp-8);
  padding-inline: clamp(var(--sp-4), 3vw, var(--sp-8));
  padding-block-start: var(--sp-6);
  font-size: var(--fs-13);
  color: var(--fg-2);
  text-align: center;
}

.theme-appgenie footer.appgenie-footer .region-footer + .appgenie-footer__copyright {
  padding-block-start: var(--sp-6);
  border-top: 1px solid var(--border);
}

.theme-appgenie footer.appgenie-footer .appgenie-footer__copyright-text {
  margin: 0;
}

.theme-appgenie .region-floating > * {
  position: fixed;
  right: clamp(var(--sp-4), 3vw, var(--sp-8));
  bottom: clamp(var(--sp-4), 3vw, var(--sp-8));
  z-index: 200;
}

.theme-appgenie ul.tabs.primary,
.theme-appgenie ul.tabs.secondary {
  border-color: var(--border);
}

.theme-appgenie .pager__items a,
.theme-appgenie .js-pager__items a {
  border-radius: var(--r-md);
}

.theme-appgenie :focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow);
}
