/* HonestLivingGuide shared header. header.js writes the markup. Every class starts with hdr- so nothing
   meets the old .site-head / .nav rules in hlg.css. Colors come from the hlg.css tokens only, so the dark
   blocks and the print block there apply here too. The main button is the .cta from hlg.css, unchanged.

   One markup, two layouts. The base rules are the narrow layout (brand, a Menu button, the menu in the page
   flow). header.js measures the row and adds .hdr-wide when one row fits; those rules are in the second half.
   The brand is the stacked logo (symbol over the wordmark), which is about half as wide as the old side-by-side
   one. With that room every label in the row sits on one line at 17px.

   The last part is the shortlist tray (.hdr-tray), which header.js adds at the end of <body> once a community
   is chosen. */

/* The header stays at the top of the window on every page (owner 2026-11-24). header.js sets --hdr-top.
   On a phone with the menu open it goes back into the page, so a menu taller than the screen can be scrolled. */
#site-header { position: sticky; top: var(--hdr-top, 0px); z-index: 20; }
#site-header:has(.hdr:not(.hdr-wide) .hdr-menu[aria-expanded="true"]) { position: static; }
html { scroll-padding-top: calc(var(--stuck, 0px) + 0.75rem); }
@media print { #site-header { position: static; } }
.hdr { position: relative; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--rule); }
.hdr-in {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.5rem;
  max-width: 64rem; margin-inline: auto; padding: 0.5rem 1rem;
}

.hdr :focus-visible:not(.cta) { outline: 3px solid var(--ochre); outline-offset: 3px; box-shadow: 0 0 0 3px var(--forest); }

/* The wordmark is part of the logo, so it is smaller than body text: 13px on phones, 14px from 768px. */
.hdr-brand {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: var(--tap); margin-right: auto;
  font-family: var(--font-word); font-weight: 800; font-size: max(13px, 0.7rem); line-height: 1.15; letter-spacing: -0.01em;
  color: var(--forest); text-decoration: none; border-radius: var(--r-badge);
}
/* The symbol is the approved SVG (logo/hlg-symbol.svg), copied to img/. */
.hdr-brand img { width: 40px; height: 33px; object-fit: contain; flex: none; display: block; background: var(--logo-ground); border-radius: var(--r-badge); }

.hdr-ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.hdr-menu {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: var(--tap); padding: 0.25rem 0.9rem;
  border: 2px solid var(--forest); border-radius: var(--pill); background: var(--paper); color: var(--forest);
  font: 700 calc(1rem + 1px)/1.2 var(--font-body); cursor: pointer;
}
.hdr-menu[aria-expanded="true"] { background: var(--forest); color: var(--paper); }
/* On a phone the brand and the button share one line, so the three-bar mark gives way to the word. */
@media (max-width: 29.99em) { .hdr-menu .hdr-ic { display: none; } }

/* ---------- The menu, narrow layout ---------- */

.hdr-nav { flex: 1 0 100%; min-width: 0; }
.hdr:not(.hdr-wide) .hdr-menu[aria-expanded="false"] + .hdr-nav { display: none; }
.hdr-list { list-style: none; margin: 0; padding: 0.5rem 0 1rem; display: flex; flex-direction: column; }
.hdr-list li { max-width: none; }

.hdr-btn, .hdr-link {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%;
  min-height: 56px; padding: 0.5rem 0.25rem; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
  background: none; color: var(--forest); font: 700 calc(1rem + 1px)/1.3 var(--font-body); text-align: left;
  text-decoration: none; cursor: pointer;
}
.hdr-chev { color: var(--moss); }
.hdr-btn[aria-expanded="true"] .hdr-chev { transform: rotate(180deg); }
.hdr [aria-current="page"]:is(.hdr-btn, .hdr-link) > span,
.hdr-link[aria-current="page"] {
  text-decoration: underline; text-decoration-thickness: 4px; text-decoration-color: var(--ochre); text-underline-offset: 6px;
}

/* The header's main button is one step smaller than a page's .cta: 1px less type, 44px tall with a 32px chip
   (HF's header button is the same step down from its page buttons). */
.hdr-main .cta { width: 100%; max-width: 24rem; margin: 1.25rem 0 0.5rem; min-height: 44px; padding: 5px 5px 5px 20px; font-size: calc(1rem - 1px); }
.hdr-main .cta::after { width: 32px; height: 32px; background-size: 16px; }


/* ---------- A care type's panel ---------- */

.hdr-btn[aria-expanded="false"] + .hdr-panel { display: none; }
.hdr-panel {
  display: grid; margin: 0.75rem 0 1rem; overflow: hidden;
  border: 2px solid var(--forest); border-radius: var(--radius); background: var(--sand); color: var(--ink);
}
.hdr-panel p { max-width: none; }
.hdr-cities { padding: 1.25rem 1rem 0.75rem; min-width: 0; }
.hdr-h, .hdr-about-h {
  margin: 0 0 0.25rem; font-family: var(--font-head); font-weight: 600; font-variation-settings: "SOFT" 100;
  font-size: var(--fs-3); line-height: 1.2; color: var(--forest);
}
.hdr-sub { margin: 0 0 0.75rem; font-size: var(--fs-small); line-height: 1.45; color: var(--moss); }

/* Two columns, read down each column: the first four cities, then the next four. */
.hdr-city-list {
  list-style: none; margin: 0 0 0.25rem; padding: 0; display: grid; gap: 0 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(4, auto); grid-auto-flow: column;
  border-top: 2px solid var(--forest);
}
.hdr-city {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 56px;
  padding: 0.4rem 0.25rem; border-bottom: 1px solid var(--rule);
  color: var(--forest); font-weight: 700; line-height: 1.25; text-decoration: none;
}
.hdr-go { color: var(--sage); }
@media (max-width: 29.99em) { .hdr-go { display: none; } }  /* phone: the room goes to the city name */

.hdr-text {
  display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 700;
  color: var(--forest); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
}

.hdr-about { padding: 1.25rem 1rem 0.75rem; min-width: 0; background: var(--sage-tint); border-top: 1px solid var(--rule); }
.hdr-about-h { font-size: var(--fs-2); margin-bottom: 0.4rem; }
.hdr-about p { margin: 0 0 0.5rem; line-height: 1.5; }
.hdr-about .hdr-note { margin-top: 0.75rem; padding-left: 0.75rem; border-left: 4px solid var(--ochre); font-size: var(--fs-small); }

@media (min-width: 48em) {
  .hdr-panel { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
  .hdr-cities { padding: 1.75rem 2rem 1.25rem; }
  .hdr-city-list { gap: 0 2.5rem; }
  .hdr-about { padding: 1.75rem 1.75rem 1.25rem; border-top: 0; border-left: 1px solid var(--rule); }
}

/* ---------- Wide layout: one row, the panel lies over the page ---------- */

.hdr-wide .hdr-in { flex-wrap: nowrap; }
.hdr-wide .hdr-nav { flex: none; }
.hdr-wide .hdr-list { flex-direction: row; align-items: stretch; padding: 0; }
.hdr-wide .hdr-list > li { flex: none; display: flex; align-items: center; }
.hdr-wide .hdr-menu { display: none; }
.hdr-wide :is(.hdr-btn, .hdr-link) {
  width: auto; min-height: var(--tap); padding: 0.25rem 0.4rem; gap: 0.2rem; border: 0; border-radius: var(--pill);
  font-size: calc(0.8rem + 1px); white-space: nowrap;
}
.hdr-wide .hdr-btn[aria-expanded="true"] { background: var(--sage-tint); }
.hdr-wide .hdr-main { margin-inline: 0.5rem 0.15rem; }
.hdr-wide .hdr-main .cta { width: auto; margin: 0; }
.hdr-wide .hdr-panel { position: absolute; left: 1rem; right: 1rem; top: 100%; margin: 0.4rem 0 0; box-shadow: 0 28px 44px -28px var(--cta-shadow); }
.hdr-wide .hdr-btn { padding-inline: 0.45rem 0.3rem; }
.hdr-wide .hdr-chev { width: 1em; height: 1em; }

/* ---------- Pointer, motion, print ---------- */

@media (hover: hover) and (pointer: fine) {
  .hdr-wide :is(.hdr-btn, .hdr-link):hover, .hdr-city:hover { background: var(--sage-tint); }
  .hdr-city:hover .hdr-go { color: var(--forest); transform: translateX(3px); }
  .hdr-menu:hover { background: var(--paper); }
  .hdr-menu[aria-expanded="true"]:hover { background: var(--forest); }
  .hdr-text:hover { text-decoration-thickness: 3px; }
}
/* Touch: no hover styles apply (they sit in the query above), and the rows get a little more room. */
@media (pointer: coarse) {
  .hdr-city { min-height: 60px; }
}
@media (prefers-reduced-motion: no-preference) {
  .hdr-panel { animation: hdr-open 0.18s ease-out; }
  .hdr-chev, .hdr-go { transition: transform 0.18s ease; }
  @keyframes hdr-open { from { opacity: 0; transform: translateY(-6px); } }
}
@media print {
  .hdr-nav, .hdr-menu, .hdr-tray { display: none !important; }
}

/* ---------- Shortlist tray: HF's compare tray in HLG colors ----------
   A fixed bar at the bottom (full width with side margins up to 56.25em). HF's sits at the right;
   this one sits at the left, because city.html and profile.html keep a sticky column (the map, the contact
   card) at the right and the tray would cover its foot. It sits over the page's sticky parts (z-index 5 to 7)
   and under the phone filter sheet (10) and the "i" popups (60). */

.hdr-tray {
  position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 9;
  display: flex; align-items: center; gap: 0.6rem; padding: 10px 10px 10px 12px;
  border-radius: var(--radius); background: var(--forest); color: var(--paper);
  box-shadow: 0 18px 44px -14px var(--cta-shadow);
  font-size: var(--fs-small); line-height: 1.2;
}
.hdr-tray-ico {
  display: grid; place-items: center; flex: none; width: 48px; height: 48px;
  border-radius: var(--r-badge); background: var(--ochre); color: var(--on-ochre); font-size: 1.2rem;
}
.hdr-tray-txt { display: grid; gap: 7px; min-width: 0; }
.hdr-tray-kind { font-weight: 700; }
.hdr-tray-dots { display: flex; gap: 5px; }
.hdr-tray-dots i { width: 26px; height: 7px; border-radius: var(--pill); background: color-mix(in srgb, var(--paper) 28%, transparent); }
.hdr-tray-dots i.on { background: var(--paper); }
.hdr-tray-go {
  display: inline-flex; align-items: center; flex: none; min-height: var(--tap); margin-left: 0.4rem; padding: 0.25rem 1.2rem;
  border-radius: var(--pill); background: var(--paper); color: var(--forest);
  font-weight: 700; text-decoration: none; white-space: nowrap;
}
.hdr-tray-clear {
  flex: none; min-width: 44px; min-height: 44px; padding: 0 0.35rem; border: 0; border-radius: var(--pill); background: none;
  color: var(--paper); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
/* The ochre ring gets a dark edge on both sides, so it shows on the bar in both themes. */
.hdr-tray :focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; box-shadow: 0 0 0 7px var(--on-ochre); }

/* The footer grows by the tray's height, so the tray never covers the last lines of the page. */
.site-foot:has(~ .hdr-tray) { padding-bottom: calc(2rem + 96px + env(safe-area-inset-bottom, 0px)); }

@media (max-width: 56.25em) {
  .hdr-tray { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); gap: 0.45rem; padding: 6px 6px 6px 10px; }
  .hdr-tray-ico { width: 40px; height: 40px; }
  .hdr-tray-txt { flex: 1; }
  .hdr-tray-go { margin-left: 0; padding-inline: 0.9rem; }
  .site-foot:has(~ .hdr-tray) { padding-bottom: calc(2rem + 76px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 26em) { .hdr-tray-ico { display: none; } }  /* phone: the room goes to the words */

@media (hover: hover) and (pointer: fine) {
  .hdr-tray-go:hover { background: var(--sage-tint); }
  .hdr-tray-clear:hover { text-decoration-thickness: 3px; }
}
@media (prefers-reduced-motion: no-preference) {
  .hdr-tray { animation: hdr-tray-in 0.35s ease-out both; }
  .hdr-tray.is-bump { animation: hdr-tray-bump 0.9s ease-out; }
  .hdr-tray.is-bump .hdr-tray-ico { animation: hdr-tray-pop 0.6s ease-out; }
  @keyframes hdr-tray-in { from { opacity: 0; transform: translateY(14px); } }
  @keyframes hdr-tray-bump { 30% { transform: scale(1.05); } 60% { transform: scale(0.99); } }
  @keyframes hdr-tray-pop { 40% { transform: scale(1.2) rotate(-8deg); } }
}
