/* ============================================================
   NEW AI HEALTH
   SHARED INLINE DISCLOSURE FOOTER

   Depends on:
   /themes/css/system.css

   Markup:
   /footer.html

   Behavior:
   /themes/js/site-footer.js
   ============================================================ */


/* ============================================================
   ROOT

   Vertical separation belongs to the page composition. The footer
   does not impose a large corporate-style margin above itself.
   ============================================================ */

.site-footer {
  position: relative;
  z-index: 20;

  width: 100%;
  margin: 0;
  padding-bottom: 14px;

  color: var(--text);
  background: transparent;
}

.site-footer-shell {
  width: min(
    var(--shell-width),
    calc(100% - (var(--page-gutter-wide) * 2))
  );

  margin-inline: auto;
}


/* ============================================================
   INLINE DISCLOSURE

   The panel remains in normal document flow. Opening it expands
   the document rather than covering the preceding page content.
   ============================================================ */

.site-footer-panel {
  display: grid;
  grid-template-rows: 0fr;

  opacity: 0;
  pointer-events: none;

  transition:
    grid-template-rows var(--duration-slow) var(--ease-out),
    opacity var(--duration-standard) var(--ease-standard);
}

.site-footer-panel-clip {
  min-height: 0;
  overflow: hidden;
}

.site-footer-panel[data-open="true"] {
  grid-template-rows: 1fr;

  opacity: 1;
  pointer-events: auto;
}


/* ============================================================
   DISCLOSURE SURFACE

   The main field uses the same restrained peach language as the
   header menu hover surface. Neutral grey organizes the directory.
   ============================================================ */

.site-footer-panel-inner {
  display: grid;
  grid-template-columns:
    minmax(210px, 0.72fr)
    minmax(0, 2fr);

  align-items: stretch;
  gap: clamp(2rem, 4vw, 4.25rem);

  margin-bottom: 12px;
  padding: clamp(1.4rem, 2.5vw, 2.25rem);

  border: 1px solid var(--border);
  border-radius: var(--radius-panel);

  background: rgba(255, 255, 255, 0.58);

  box-shadow:
    0 1px 2px rgba(20, 27, 34, 0.018),
    0 8px 24px rgba(20, 27, 34, 0.028);

  scroll-margin-top: 20px;
}


/* ============================================================
   EDITORIAL INTRO
   ============================================================ */

.site-footer-panel-intro {
  display: flex;
  min-width: 0;
  flex-direction: column;

  padding: 3px 0;
}

.site-footer-panel-statement {
  max-width: 14ch;
  margin: 0;

  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.2vw, 2.15rem);
  font-weight: 660;
  letter-spacing: var(--tracking-display);
  line-height: 1.02;
  text-wrap: balance;
}

.site-footer-panel-description {
  max-width: 34ch;
  margin: var(--space-5) 0 0;

  color: var(--text-soft);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-regular);
  line-height: 1.6;
}


/* ============================================================
   INTRO META

   Copyright and observation belong to the editorial signature
   rather than occupying a separate full-width panel row.
   ============================================================ */

.site-footer-panel-meta {
  display: grid;
  gap: 3px;

  margin-top: auto;
  padding-top: clamp(1.25rem, 2.5vw, 2rem);

  color: var(--text-faint);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.site-footer-panel-meta::before {
  width: 42px;
  height: 1px;
  margin-bottom: 8px;

  background: var(--border-strong);

  content: "";
}


/* ============================================================
   DIRECTORY
   ============================================================ */

.site-footer-directory {
  display: grid;
  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  align-items: start;
  align-content: start;
  gap: clamp(0.75rem, 1.2vw, 1rem);
}


/* ============================================================
   DIRECTORY GROUPS
   ============================================================ */

.site-footer-group {
  min-width: 0;
  margin: 0;
}

.site-footer-group-heading {
  min-height: 52px;
  margin-bottom: 5px;
  padding: 9px 12px;

  border: 1px solid rgba(29, 40, 51, 0.025);
  border-radius: var(--radius-sm);

  background: var(--surface-muted);
}

.site-footer-group-label {
  margin: 0;

  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.site-footer-group-description {
  margin: 4px 0 0;

  color: var(--text-faint);
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  line-height: 1.25;
}

.site-footer-group-list {
  display: grid;
  gap: 1px;

  margin: 0 0 0 8px;
  padding: 0 0 0 8px;

  border-left: 1px solid rgba(29, 40, 51, 0.055);

  list-style: none;
}

.site-footer-group-list li {
  min-width: 0;
  margin: 0;
  padding: 0;
}


/* ============================================================
   DIRECTORY LINKS
   ============================================================ */

.site-footer-menu-link {
  position: relative;

  display: flex;
  min-width: 0;
  min-height: 48px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;

  padding: 7px 30px 7px 9px;

  border: 1px solid transparent;
  border-radius: var(--radius-sm);

  color: var(--text);
  text-decoration: none;

  transition:
    color var(--duration-fast) var(--ease-standard),
    background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.site-footer-menu-link::after {
  position: absolute;
  top: 50%;
  right: 10px;

  color: var(--text-faint);
  font-size: 12px;
  line-height: 1;

  content: "\2192";
  opacity: 0.38;

  transform:
    translateY(-50%)
    translateX(0);

  transition:
    color var(--duration-fast) var(--ease-standard),
    opacity var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-out);
}

.site-footer-menu-link:hover,
.site-footer-menu-link:focus-visible {
  transform: translateX(2px);

  border-color: var(--border);
  background: var(--surface-hover);

  color: var(--text);
  text-decoration: none;

  box-shadow:
    0 1px 2px rgba(20, 27, 34, 0.025),
    0 5px 14px rgba(20, 27, 34, 0.025);
}

.site-footer-menu-link:hover::after,
.site-footer-menu-link:focus-visible::after {
  color: var(--red);
  opacity: 1;

  transform:
    translateY(-50%)
    translateX(2px);
}

.site-footer-menu-link:focus-visible {
  outline: none;

  box-shadow:
    0 1px 2px rgba(20, 27, 34, 0.025),
    0 5px 14px rgba(20, 27, 34, 0.025),
    var(--shadow-focus);
}

.site-footer-menu-link span:first-child {
  max-width: 100%;
  overflow: hidden;

  color: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.018em;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-footer-menu-link span:last-child {
  max-width: 100%;
  overflow: hidden;

  color: var(--text-faint);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ============================================================
   CURRENT PAGE
   ============================================================ */

.site-footer-menu-link[aria-current="page"] {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.88);

  box-shadow:
    0 1px 2px rgba(20, 27, 34, 0.025),
    0 5px 14px rgba(20, 27, 34, 0.025);
}

.site-footer-menu-link[aria-current="page"] span:first-child {
  color: var(--red);
}

.site-footer-menu-link[aria-current="page"]::after {
  color: var(--blue);
  opacity: 0.7;
}


/* ============================================================
   COLLAPSED BAR
   ============================================================ */

.site-footer-bar {
  position: relative;

  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);

  padding: 15px 2px 7px;

  border-top: 1px solid rgba(29, 40, 51, 0.045);
}

.site-footer-bar::before {
  position: absolute;
  top: -1px;
  left: 0;

  width: 64px;
  height: 1px;

  background: rgba(29, 40, 51, 0.075);

  content: "";

  transition:
    width var(--duration-slow) var(--ease-out),
    height var(--duration-standard) var(--ease-standard),
    background var(--duration-standard) var(--ease-standard);
}

.site-footer:has(.site-footer-panel[data-open="true"])
  .site-footer-bar::before {
  width: 104px;
  height: 2px;

  background: var(--peach);
}


/* ============================================================
   FOOTER BRAND
   ============================================================ */

.site-footer-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 11px;

  color: var(--text);
  text-decoration: none;
}

.site-footer-brand:hover,
.site-footer-brand:focus-visible {
  color: var(--text);
  text-decoration: none;
}

.site-footer-brand:focus-visible {
  outline: none;
}

.site-footer-brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;

  border: 1px solid var(--border);
  border-radius: 11px;

  background: var(--surface-gloss);
  box-shadow: var(--shadow-soft);

  transition:
    transform var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-standard),
    background var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-out);
}

.site-footer-brand:hover .site-footer-brand-mark {
  

  border-color: var(--border-hover);
  background: var(--surface-gloss-hover);

  box-shadow: var(--shadow-soft);
}

.site-footer-brand:focus-visible .site-footer-brand-mark {
  
  border-color: var(--border-hover);
  background: var(--surface-gloss-hover);

  box-shadow:
    var(--shadow-soft),
    var(--shadow-focus);
}

.site-footer-brand-mark img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.site-footer-wordmark {
  overflow: hidden;

  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-footer-ai {
  display: inline-block;
  margin-inline: 0.04em;

  color: var(--red);
  font-weight: 800;
  letter-spacing: 0.015em;
}

.site-footer-health {
  color: var(--blue);
}

.site-footer-domain {
  margin-left: 1px;

  color: var(--text-faint);
  font-size: 0.78em;
  font-weight: 500;
  letter-spacing: 0.015em;
}

/* ============================================================
   TOGGLE
   ============================================================ */

.site-footer-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;

  padding: 0;

  border: 0;
  background: transparent;

  color: var(--text);
  cursor: pointer;
}

.site-footer-toggle-label,
.site-menu-toggle-label {
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.035em;
  line-height: 1;
  text-transform: none;

  transition:
    color var(--duration-fast) var(--ease-standard);
}

.site-footer-toggle:hover .site-footer-toggle-label,
.site-footer-toggle:focus-visible .site-footer-toggle-label {
  color: var(--text);
}

.site-footer-toggle-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;

  border: 1px solid var(--border);
  border-radius: 13px;

  background: var(--surface-gloss);
  box-shadow: var(--shadow-card);

  transition:
    transform var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-standard),
    background var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-out);
}

.site-footer-toggle-mark img {
  width: 23px;
  height: 23px;
  object-fit: contain;

  transition:
    transform var(--duration-standard) var(--ease-out),
    opacity var(--duration-standard) var(--ease-standard);
}

.site-footer-toggle:hover .site-footer-toggle-label,
.site-footer-toggle:focus-visible .site-footer-toggle-label {
  color: var(--text);
}

.site-footer-toggle:hover .site-footer-toggle-mark,
.site-footer-toggle:focus-visible .site-footer-toggle-mark {
  transform: translateY(-1px);

  border-color: var(--border-hover);
  background: var(--surface-gloss-hover);
  box-shadow: var(--shadow-card-hover);
}

.site-footer-toggle:focus-visible {
  outline: none;
}

.site-footer-toggle:focus-visible .site-footer-toggle-mark {
  box-shadow:
    var(--shadow-card-hover),
    var(--shadow-focus);
}

.site-footer-toggle:active .site-footer-toggle-mark {
  transform: translateY(0);
}

.site-footer-toggle[aria-expanded="true"]
  .site-footer-toggle-label {
  color: var(--text);
}

.site-footer-toggle[aria-expanded="true"]
  .site-footer-toggle-mark {
  border-color: var(--border-hover);
  background: var(--surface-muted);
}

.site-footer-toggle[aria-expanded="true"]
  .site-footer-toggle-mark img {
  transform: scale(0.92);
  opacity: 0.86;
}


/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 980px) {
  .site-footer-panel-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-8);
  }

  .site-footer-directory {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
  }

  .site-footer-panel-intro {
    display: grid;
    grid-template-columns:
      minmax(180px, 0.9fr)
      minmax(0, 1.1fr);

    align-items: start;
    gap: var(--space-8);
  }

  .site-footer-panel-statement {
    max-width: 16ch;
  }

  .site-footer-panel-description {
    margin-top: 0;
  }

  .site-footer-panel-meta {
    grid-column: 1 / -1;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);

    margin-top: 0;
    padding-top: var(--space-4);

    border-top: 1px solid var(--border);
  }

  .site-footer-panel-meta::before {
    display: none;
  }
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 760px) {
  .site-footer {
    padding-bottom: 8px;
  }

  .site-footer-panel-inner {
    gap: var(--space-6);

    margin-bottom: 8px;
    padding: 17px 14px;

    border-radius: 18px;

    scroll-margin-top: 12px;
  }

  .site-footer-panel-intro {
    display: block;
  }

  .site-footer-panel-statement {
    max-width: 18ch;

    font-size: clamp(1.45rem, 7vw, 2rem);
    line-height: 1.02;
  }

  .site-footer-panel-description {
    max-width: 42ch;
    margin-top: var(--space-4);

    font-size: 12px;
  }

  .site-footer-panel-meta {
    display: grid;
    justify-content: start;
    gap: 2px;

    margin-top: var(--space-5);
    padding-top: var(--space-4);

    border-top: 1px solid var(--border);
  }

  .site-footer-directory {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
  }

  .site-footer-group-heading {
    min-height: auto;
    margin-bottom: 3px;
    padding: 9px 11px;
  }

  .site-footer-group-list {
    gap: 1px;

    margin-left: 6px;
    padding-left: 7px;
  }

  .site-footer-menu-link {
    min-height: 47px;
    padding-block: 7px;
  }

  .site-footer-bar {
    min-height: 62px;
    padding-top: 13px;
  }

  .site-footer-toggle-label {
    display: none;
  }
}


/* ============================================================
   SMALL MOBILE
   ============================================================ */

@media (max-width: 520px) {
  .site-footer-panel-inner {
    padding-inline: 12px;
  }

  .site-footer-menu-link {
    padding-right: 29px;
    padding-left: 9px;
  }

  .site-footer-menu-link::after {
    right: 9px;
  }
}


/* ============================================================
   NARROW MOBILE
   ============================================================ */

@media (max-width: 390px) {
  .site-footer-brand {
    gap: 9px;
  }

  .site-footer-brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .site-footer-brand-mark img {
    width: 20px;
    height: 20px;
  }

  .site-footer-wordmark {
    font-size: 15px;
  }

  .site-footer-toggle-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }
}


/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .site-footer-panel,
  .site-footer-brand-mark,
  .site-footer-toggle-label,
  .site-footer-toggle-mark,
  .site-footer-toggle-mark img,
  .site-footer-menu-link,
  .site-footer-menu-link::after,
  .site-footer-bar::before {
    transition: none;
  }
}

/* ============================================================
   PANEL UTILITY NAVIGATION

   Desktop:
   Bottom-right institutional navigation inside the disclosure.

   Mobile:
   Utility navigation follows the editorial description and
   precedes the copyright/meta boundary.
   ============================================================ */

.site-footer-panel-inner {
  position: relative;
}

.site-footer-panel-utility {
  position: absolute;
  right: clamp(1.4rem, 2.5vw, 2.25rem);
  bottom: clamp(1.4rem, 2.5vw, 2.25rem);

  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;

  color: rgba(29, 40, 51, 0.42);

  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.012em;
  white-space: nowrap;
}

.site-footer-panel-utility a {
  color: rgba(29, 40, 51, 0.58);
  text-decoration: none;
  text-underline-offset: 3px;

  transition:
    color var(--duration-standard) var(--ease-standard),
    text-decoration-color var(--duration-standard) var(--ease-standard);
}

.site-footer-panel-utility a:hover,
.site-footer-panel-utility a:focus-visible,
.site-footer-panel-utility a[aria-current="page"] {
  color: var(--blue);
  text-decoration: underline;
}

.site-footer-panel-utility a:focus-visible {
  border-radius: 3px;
  outline: 2px solid rgba(35, 112, 161, 0.28);
  outline-offset: 4px;
}

.site-footer-panel-utility-separator {
  color: rgba(29, 40, 51, 0.2);
  user-select: none;
}


/* ============================================================
   MOBILE TOGGLE CHEVRON
   ============================================================ */

.site-footer-toggle-chevron {
  display: none;
  flex: 0 0 auto;

  color: var(--text-faint);

  transition:
    color var(--duration-fast) var(--ease-standard),
    transform var(--duration-standard) var(--ease-out);
}

.site-footer-toggle-chevron svg {
  display: block;
  width: 12px;
  height: 8px;
  overflow: visible;
}

.site-footer-toggle-chevron path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* ============================================================
   TABLET UTILITY PLACEMENT
   ============================================================ */

@media (max-width: 980px) {
  .site-footer-panel-utility {
    position: static;

    grid-column: 2;
    justify-self: start;

    margin-top: var(--space-4);
  }
}


/* ============================================================
   MOBILE UTILITY AND CHEVRON
   ============================================================ */

@media (max-width: 760px) {
  .site-footer-panel-utility {
    position: static;

    display: inline-flex;
    grid-column: auto;

    align-items: center;
    justify-content: flex-start;
    justify-self: auto;
    gap: 6px;

    margin-top: var(--space-4);

    font-size: 10.5px;
  }

  .site-footer-panel-meta {
    margin-top: var(--space-4);
  }

  .site-footer-toggle {
    gap: 6px;
  }

  .site-footer-toggle-chevron {
    display: inline-flex;
    width: 14px;
    height: 14px;
    align-items: center;
    justify-content: center;
  }
  .site-footer-toggle-chevron svg {
    width: 10px;
    height: 6px;
  }

  .site-footer-toggle:hover
    .site-footer-toggle-chevron,
  .site-footer-toggle:focus-visible
    .site-footer-toggle-chevron {
    color: var(--text);
  }

  .site-footer-toggle[aria-expanded="true"]
    .site-footer-toggle-chevron {
    color: var(--text);

    transform: rotate(180deg);
  }
}


/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .site-footer-panel-utility a,
  .site-footer-toggle-chevron {
    transition: none;
  }
}
