/* ==========================================================================
   Site header (2026 v2, desktop) — template-parts/header-desktop.php

   Ported from the approved home-redesign-preview (artifacts/
   home-redesign-preview-2026-09-24/index.html, <header class="hd">).
   Self-contained tokens/reset, like footer-2026.css -- this loads sitewide,
   so it can't lean on the .rh2026-scoped redesign.css. CSS-only open/close
   (:hover + :focus-within), matching the previous header's zero-JS
   approach. Hidden at <=820px; the phone header in header.php is unchanged.
   ========================================================================== */

.hdv2 {
  --hdv2-paper: #f2eee6;
  --hdv2-ink: #121110;
  --hdv2-ink-2: #2b2825;
  --hdv2-mute: #716b64;
  --hdv2-line: rgba(18, 17, 16, 0.16);
  --hdv2-line-2: rgba(18, 17, 16, 0.45);
  --hdv2-rust: #b5451b;
  --hdv2-gutter: clamp(24px, 4.3vw, 62px);
  --hdv2-max: 1440px;
  --hdv2-h: 80px;
  --hdv2-sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --hdv2-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  position: sticky;
  top: 0;
  z-index: 120;
  background: var(--hdv2-paper);
  color: var(--hdv2-ink);
  border-bottom: 1px solid var(--hdv2-line);
  font-family: var(--hdv2-sans);
  -webkit-font-smoothing: antialiased;
}

.hdv2 *, .hdv2 *::before, .hdv2 *::after { box-sizing: border-box; }
/* :where() keeps this reset's specificity at zero, so any single-class
   rule below (e.g. .hdv2__cta) can safely override its color. */
:where(.hdv2) a { color: inherit; text-decoration: none; }
.hdv2 img { display: block; max-width: 100%; }
.hdv2 b { font-weight: 600; }

.hdv2__bar {
  max-width: var(--hdv2-max);
  height: var(--hdv2-h);
  margin: 0 auto;
  padding: 0 var(--hdv2-gutter);
  display: flex;
  align-items: center;
  gap: 36px;
}

.hdv2__logo {
  font: 500 20px/1 var(--hdv2-sans);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  margin-right: 8px;
  white-space: nowrap;
}

/* --- Primary nav ---------------------------------------------------------- */

.hdv2__nav { margin-left: auto; display: flex; align-items: center; gap: 4px; height: 100%; }

.hdv2__item { position: relative; display: flex; align-items: center; height: 100%; }

.hdv2__link {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 8px 14px;
  font-size: 16px;
  font-weight: 500;
  opacity: 0.82;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.hdv2__link--solo { padding: 8px 14px; }

.hdv2__item:hover > .hdv2__link,
.hdv2__item:focus-within > .hdv2__link,
.hdv2__link:hover { opacity: 1; }

.hdv2__item:hover::after,
.hdv2__item:focus-within::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  background: var(--hdv2-rust);
}

.hdv2__eyebrow {
  display: block;
  font-family: var(--hdv2-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hdv2-mute);
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--hdv2-line);
}

.hdv2__tlink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  transition: gap 0.25s ease;
}
.hdv2__tlink span[aria-hidden] { transition: transform 0.3s ease; }
.hdv2__tlink:hover span[aria-hidden] { transform: translateX(4px); }

/* --- Mega / popover panels -------------------------------------------------- */

.hdv2-mega, .hdv2-pop {
  background: var(--hdv2-paper);
  color: var(--hdv2-ink);
  border-top: 1px solid var(--hdv2-line);
  border-bottom: 1px solid var(--hdv2-line-2);
  box-shadow: 0 40px 60px -40px rgba(18, 17, 16, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.3s ease, visibility 0s 0.3s;
}

.hdv2-pop { position: absolute; top: 100%; }

/* .hdv2-mega must span the full header width, not just its trigger item's
   narrow box -- position:fixed skips .hdv2__item's positioned ancestor and
   uses the viewport, so left/right:0 stretch it correctly edge-to-edge. */
.hdv2-mega { position: fixed; top: var(--hdv2-h); }

.hdv2__item:hover > .hdv2-mega,
.hdv2__item:focus-within > .hdv2-mega,
.hdv2__item:hover > .hdv2-pop,
.hdv2__item:focus-within > .hdv2-pop {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.22s ease, transform 0.3s ease, visibility 0s;
}

.hdv2-mega { left: 0; right: 0; }

/* Anchored from the right edge of the trigger item, not the left: with a
   CSS-only (no JS) open/close system there's no scroll-time check for
   viewport overflow, and the last couple of nav items sit close enough to
   the right edge that a left-anchored panel would run off-screen. */
.hdv2-pop { right: 0; width: 380px; padding: 30px 34px 34px; }
.hdv2-pop--wide { width: 720px; }

.hdv2-mega__in {
  max-width: var(--hdv2-max);
  margin: 0 auto;
  padding: 52px var(--hdv2-gutter) 58px;
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr 1.1fr;
  gap: 56px;
  align-items: start;
}

.hdv2-mega__in--fur { grid-template-columns: 1.5fr 1fr 1fr 1fr 0.9fr; }

/* Navigation labels, not document headings: an h3 here sat before every page's h1. */
.hdv2-mega__title { font-size: clamp(28px, 2.4vw, 36px); line-height: 1.1; margin: 0 0 14px; letter-spacing: -0.02em; font-weight: 600; }
.hdv2-mega__head p { font-size: 15.5px; line-height: 1.5; color: var(--hdv2-ink-2); max-width: 32ch; margin: 0 0 20px; }
.hdv2-mega__head .hdv2__tlink { display: flex; margin-top: 6px; }
/* whole-home entry: a quieter text link under the two main actions */
.hdv2-mega__head .hdv2__tlink--scope { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--hdv2-line); max-width: 32ch; font-weight: 400; color: var(--hdv2-ink-2); }
.hdv2-mega__head .hdv2__tlink--scope:hover { color: var(--hdv2-rust); }
/* room headings open that room on /furniture/ */
.hdv2__eyebrow--room { transition: color 0.2s ease, border-color 0.2s ease; }
.hdv2__eyebrow--room:hover, .hdv2__eyebrow--room:focus-visible { color: var(--hdv2-ink); border-bottom-color: var(--hdv2-ink); }

.hdv2-mega__col { display: flex; flex-direction: column; }
.hdv2-mega__link { display: block; font-size: 17px; font-weight: 500; line-height: 1.3; padding: 11px 0; transition: color 0.2s ease, transform 0.3s ease; }
.hdv2-mega__link:hover { color: var(--hdv2-rust); transform: translateX(4px); }
.hdv2-mega__link--sub { font-weight: 400; color: var(--hdv2-ink-2); font-size: 16px; }
.hdv2-mega__gap { display: block; height: 1px; background: var(--hdv2-line); margin: 12px 0; }

.hdv2-mega__feature { display: flex; flex-direction: column; gap: 14px; }
.hdv2-mega__img { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #e8e2d8; }
.hdv2-mega__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s ease; }
.hdv2-mega__feature:hover .hdv2-mega__img img { transform: scale(1.06); }
.hdv2-mega__feature b { font-size: 17px; letter-spacing: -0.01em; line-height: 1.3; }

.hdv2-pop__link { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; min-height: 44px; justify-content: center; }
.hdv2-pop__link b { font-size: 17px; font-weight: 500; line-height: 1.3; transition: color 0.2s ease; }
.hdv2-pop__link small { font-size: 13.5px; line-height: 1.35; color: var(--hdv2-mute); }
.hdv2-pop__link:hover b { color: var(--hdv2-rust); }
.hdv2-pop__div { height: 1px; background: var(--hdv2-line); margin: 12px 0; }
.hdv2-pop__q { display: block; font-weight: 600; font-size: 16px; margin: 2px 0 4px; }
.hdv2-pop__note { font-size: 14px; color: var(--hdv2-mute); margin: 2px 0 0; }
.hdv2-pop__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }

/* --- CTA -------------------------------------------------------------------- */

/* type selector needed: ".hdv2 a{color:inherit}" above outranks a bare
   class selector, which left this text the same color as its background. */
a.hdv2__cta {
  margin-left: 8px;
  flex: none;
  height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--hdv2-ink);
  color: var(--hdv2-paper);
  border-radius: 2px;
  font: 500 14px/1 var(--hdv2-sans);
  transition: background 0.25s ease;
}
.hdv2__cta:hover { background: var(--hdv2-rust); color: #fff; }
.hdv2__cta svg { width: 14px; height: 14px; }

/* --- Widths ------------------------------------------------------------------- */

@media (max-width: 820px) {
  .hdv2 { display: none !important; }
}

/* Between the phone header (<=820px) and full desktop the bar ran ~50px wider
   than the window (the CTA hung past the edge at 1024). Tighten it there. */
@media (min-width: 821px) and (max-width: 1180px) {
  .hdv2__bar { gap: 16px; padding: 0 24px; }
  .hdv2__logo { font-size: 18px; letter-spacing: 0.26em; margin-right: 0; }
  .hdv2__nav { gap: 0; }
  .hdv2__link, .hdv2__link--solo { padding: 8px 9px; font-size: 15px; }
  a.hdv2__cta { margin-left: 0; padding: 0 14px; font-size: 13.5px; }
  .hdv2__cta svg { display: none; }
}
@media (min-width: 821px) and (max-width: 940px) {
  .hdv2__link, .hdv2__link--solo { padding: 8px 7px; font-size: 14px; }
  .hdv2__logo { font-size: 16px; letter-spacing: 0.22em; }
}

/* --- Phone menu (header.php): whole-home entry and one-line descriptions ---- */
@media (max-width: 820px) {
  .ratahome-mobile-collections-list .ratahome-mobile-scope { border-top: 0; margin-top: -14px; color: #2b2825 !important; font-weight: 600 !important; }
  .ratahome-mobile-solutions-list a { flex-direction: column; align-items: flex-start !important; justify-content: center; gap: 2px; min-height: 48px !important; padding-top: 6px !important; padding-bottom: 6px !important; }
  .ratahome-mobile-solutions-list a small { display: block; font-size: 12px; line-height: 1.3; letter-spacing: 0; text-transform: none; color: #8a847d; }
}
