/* ==========================================================================
   Ad Optima - shared site chrome (nav search, login, multi-column footer).
   Loaded AFTER each page's inline <style>, so rules here override where needed.
   ========================================================================== */

/* ---- NAV: login link ---- */
.nav-login {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.35rem 0.2rem;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.2s ease;
}
.nav-login:hover {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}

/* ---- NAV: expanding search ---- */
.nav-search-item {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-search {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  border-radius: 100px;
  background: transparent;
  border: 1px solid transparent;
  transition:
    width 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
  z-index: 1;
}

.nav-search.open {
  width: 300px;
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  z-index: 102;
}

.nav-search-toggle {
  position: absolute;
  top: 0;
  left: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 100px;
  transition: color 0.15s ease, background 0.2s ease;
  padding: 0;
  font: inherit;
  z-index: 2;
}
.nav-search-toggle:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.04);
}
.nav-search-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.nav-search.open .nav-search-toggle {
  pointer-events: none;
  background: transparent;
  color: var(--text-tertiary);
}
.nav-search-toggle svg {
  display: block;
}

.nav-search-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 2.4rem 0 38px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease 0.12s;
}
.nav-search-input::placeholder { color: var(--text-tertiary); }
.nav-search-input:focus { outline: none; }
.nav-search.open .nav-search-input {
  opacity: 1;
  pointer-events: auto;
}

.nav-search-close {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: 100px;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-search-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}
.nav-search.open .nav-search-close { display: inline-flex; }
.nav-search-close svg { width: 13px; height: 13px; display: block; }

/* Hide the primary nav items when search is open so the pill has room to grow */
.nav-main {
  transition: opacity 0.25s ease, transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-links.search-open .nav-main {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
}

/* Results panel */
.nav-search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  padding: 0.4rem;
  list-style: none;
  margin: 0;
  max-height: 420px;
  overflow-y: auto;
  z-index: 103;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav-search.open .nav-search-results:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.nav-search-results[hidden] { display: none; }

.nav-search-results li { margin: 0; list-style: none; }

.nav-search-results a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.8rem;
  border-radius: 9px;
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.12s ease;
}
.nav-search-results a:hover,
.nav-search-results a.is-active {
  background: var(--primary-subtle);
}

.nav-search-result-title {
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-primary);
}
.nav-search-result-title mark {
  background: rgba(122, 158, 126, 0.22);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}
.nav-search-result-desc {
  font-size: 0.77rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.nav-search-group-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 0.6rem 0.8rem 0.35rem;
}

.nav-search-empty {
  padding: 1.1rem 0.8rem;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  text-align: center;
}

/* Hide the search button on mobile (nav-links are already hidden there) */
@media (max-width: 768px) {
  .nav-search-item { display: none; }
  .nav-login { display: none; }
}

/* ---- FOOTER: multi-column layout with rich internal links ---- */
/* Neutralise the page-level `nav { position: fixed }` rule inside the footer */
footer nav.footer-nav {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  z-index: auto;
  background: transparent;
  backdrop-filter: none;
 -webkit-backdrop-filter: none;
  border-bottom: none;
  height: auto;
}

footer {
  border-top: 1px solid var(--border);
  padding: 4rem 2rem 2.25rem;
  margin-top: 2rem;
  background: var(--bg);
}

/* Reset the old single-row flex layout so the grid layout below wins */
.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: grid !important;
  grid-template-columns: minmax(240px, 1.4fr) 3fr;
  gap: 4rem;
  align-items: start;
  justify-content: initial;
  flex-direction: initial;
  text-align: initial;
}

.footer-brand { max-width: 340px; }

.footer-brand .footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'EB Garamond', Garamond, 'Times New Roman', serif;
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-decoration: none;
  margin-bottom: 1rem;
}

.footer-tagline {
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0;
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2.25rem;
}

.footer-col-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin: 0 0 1rem;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-col a {
  font-size: 0.86rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}
.footer-col a:hover { color: var(--text-primary); }

.footer-bottom {
  max-width: 1320px;
  margin: 3.5rem auto 0;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.footer-bottom p { margin: 0; }
.footer-bottom-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-bottom-links a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.15s ease;
}
.footer-bottom-links a:hover { color: var(--text-secondary); }

@media (max-width: 900px) {
  footer { padding: 3rem 1.5rem 2rem; }
  .footer-inner { grid-template-columns: 1fr !important; gap: 2.5rem; }
  .footer-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1.5rem; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
@media (max-width: 520px) {
  .footer-nav { grid-template-columns: 1fr; }
}
