/*
Theme Name: MW Communities
Theme URI: https://martawalsh.com/communities/
Author: Loving Tree Technology
Description: Bridge theme for the /communities/ section. Wraps WordPress + Showcase IDX in the main martawalsh.com header/footer via shared PHP includes, so the section looks and behaves like part of the hand-built main site. Visual identity is inherited from the enqueued main-site stylesheet — this file only adds the layout scaffolding WordPress and Showcase need.
Version: 0.2.6
Requires PHP: 8.0
*/

/* ------------------------------------------------------------------
   NOTE ON STYLING
   Typography and color come from the MAIN SITE stylesheet, which is
   enqueued in functions.php (handle: mw-main). Do NOT redefine the
   palette or fonts here — keep this file to WordPress/Showcase layout
   plumbing only, so there is one source of truth for the look.
   The :root fallbacks below only apply if the main CSS fails to load.

   KNOWN DRIFT (2026-07-15): site.css uses --navy:#0B1F35 / --gold:#C8902A,
   while the --hub-* tokens below use #002349 / #b0893c. These are different
   colours, so hub headings do not match the main-site nav they sit under.
   #002349 is the Sotheby's blue standardised on elsewhere, so the theme may
   be the more correct of the two — this is a brand decision, left as-is
   deliberately. To unify, set: --hub-navy: var(--navy, #002349);
------------------------------------------------------------------- */

:root {
  /* Fallbacks only — real values live in the main-site stylesheet. */
  --mw-navy: #002349;      /* Sotheby's blue — sync to your token */
  --mw-gold: #a6892f;      /* sync to your token */
  --mw-cream: #f7f4ee;     /* sync to your token */
  --mw-ink: #1a1a1a;
  --mw-container: 1200px;
  --mw-gutter: clamp(1rem, 4vw, 3rem);

  /* Height of the fixed nav in site.css (`nav { position:fixed; height:62px }`).
     Constant across breakpoints — the mobile query only changes its padding. */
  --mw-nav-h: 62px;
}

/* Skip link — a11y/SEO quality floor */
.mw-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--mw-navy);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 1000;
}
.mw-skip:focus { left: 0; }

/* Content wrapper for WP + Showcase output */
.mw-container {
  max-width: var(--mw-container);
  margin: 0 auto;
  padding-left: var(--mw-gutter);
  padding-right: var(--mw-gutter);
}

/* Give WP page content room to breathe between the shared header/footer.
   The top pad must clear the FIXED nav (62px) as well as provide breathing
   room, or plain pages tuck their <h1> underneath it. This was invisible
   while logged in: the WP admin bar adds `html { margin-top:32px }`, which
   pushed content down just far enough to hide the bug. ALWAYS TEST INCOGNITO.
   Hero pages cancel this offset on purpose — see .hub-hero / .mw-community__hero. */
.mw-content {
  padding-top: calc(var(--mw-nav-h) + 2.5rem);
  padding-bottom: 4rem;
}

/* Showcase IDX renders inside .entry-content — ensure it can go full width */
.entry-content { width: 100%; }

/* Visible keyboard focus everywhere (respect existing main-CSS styles if present) */
:focus-visible { outline: 2px solid var(--mw-gold); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==================================================================
   COMMUNITIES HUB (front-page.php)
   Matched to the main site: Cormorant Garamond display + Outfit body,
   eyebrow → italic-emphasis headline → body rhythm, navy/gold/cream.
   Tune the --hub-* tokens if they drift from site.css.
   ================================================================== */

:root {
  --hub-navy: #002349;
  --hub-gold: #b0893c;
  --hub-cream: #f7f4ee;
  --hub-ink: #1a1a1a;
  --hub-muted: #6f6f6f;
  --hub-line: #e4e0d7;
}

/* Full-bleed breakout: escape .mw-container to viewport width */
.hub-fullbleed {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.hub-eyebrow {
  font-family: "Outfit", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 500;
  color: var(--hub-gold);
  margin: 0 0 0.9rem;
}
.hub-eyebrow--light { color: rgba(255,255,255,0.85); }

.hub-h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  line-height: 1.08;
  color: var(--hub-navy);
  margin: 0 0 1.4rem;
}
.hub-h2 em { font-style: italic; color: var(--hub-navy); }
.hub-h2--light { color: #fff; }
.hub-h2--light em { color: #fff; }

.hub-prose {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--hub-ink);
  max-width: 60ch;
}
.hub-prose p { margin: 0 0 1.1rem; }

/* Buttons */
.hub-btn {
  display: inline-block;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.95rem 1.7rem;
  border-radius: 2px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.hub-btn--solid { background: var(--hub-navy); color: #fff; border-color: var(--hub-navy); }
.hub-btn--solid:hover { background: #001a37; }
.hub-btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.6); }
.hub-btn--ghost:hover { border-color: #fff; background: rgba(255,255,255,0.08); }
.hub-cta-row { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-top: 1.8rem; }

/* Hero — full-bleed, sits flush under the fixed nav.
   Cancels the whole .mw-content top pad (nav height + breathing room) so the
   image starts at y=0 and the translucent nav floats over it, as intended. */
.hub-hero {
  margin-top: calc(-1 * (var(--mw-nav-h) + 2.5rem));
  min-height: 58vh;
  display: flex;
  align-items: center;
  background: var(--hub-navy) center/cover no-repeat;
  position: relative;
  color: #fff;
}
.hub-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,18,38,0.35) 0%, rgba(0,18,38,0.55) 100%);
}
.hub-hero__inner {
  position: relative;
  max-width: var(--mw-container);
  margin: 0 auto;
  padding: 3.25rem var(--mw-gutter);
  width: 100%;
}
.hub-hero__title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 1.04;
  margin: 0 0 1.1rem;
  max-width: 16ch;
}
.hub-hero__title em { font-style: italic; }
.hub-hero__lede {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 1.12rem;
  line-height: 1.6;
  max-width: 46ch;
  color: rgba(255,255,255,0.92);
  margin: 0;
}

/* Section spacing for contained bands.
   The standalone .hub-intro band was removed from front-page.php (its thesis
   duplicated the hero and pushed the grid a full band below the fold). Its
   lead line now rides in the directory head as .hub-directory__lead. */
.hub-directory, .hub-listings { padding: 4.5rem 0; }
.hub-directory { padding-top: 3rem; }
.hub-directory__lead {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 1.08rem;
  line-height: 1.6;
  max-width: 60ch;
  color: var(--hub-ink);
  margin: 0.6rem 0 2.4rem;
}

/* Directory grid of community cards */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.6rem;
  margin-top: 2.2rem;
}
.hub-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--hub-line);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.hub-card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(0,20,40,0.12); }
.hub-card__media {
  height: 190px;
  background: var(--hub-cream) center/cover no-repeat;
  position: relative;
}
.hub-card__media::after { /* placeholder tint until an image is set */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #e9e5db 0%, #d8d3c6 100%);
  opacity: 1;
  z-index: -1; /* NOTE: renders behind the card's white bg, so effectively
                  invisible — the --hub-cream base shows instead. Moot once
                  every community has an image. */
}
.hub-card__body { padding: 1.3rem 1.4rem 1.5rem; }
.hub-card__name {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: 1.65rem;
  color: var(--hub-navy);
  margin: 0 0 0.5rem;
}
.hub-card__hook {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--hub-muted);
  margin: 0 0 1rem;
}
.hub-card__more {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hub-gold);
}

/* Listings band */
.hub-listings { border-top: 1px solid var(--hub-line); }

/* Wrapper for the Showcase hotsheet on the hub. */
.hub-listings__grid { margin-top: 2rem; }

/* Open-search exit: the grid above is curated, this is for someone with their
   own idea (a street, Biltmore). Matches the "Read the guide ↓" treatment on
   the community pages — same vocabulary for "there's more this way".
   :visited is set explicitly so the browser default purple never shows. */
.hub-listings__search { text-align: center; margin: 2.5rem 0 0; }
.hub-listings__search a,
.hub-listings__search a:visited {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--hub-navy);
  border-bottom: 1px solid var(--hub-gold);
  padding-bottom: 3px;
  transition: color 0.2s ease;
}
.hub-listings__search a:hover { color: var(--hub-gold); }

/* Retired: kept because the six community pages may want the same dashed
   "not built yet" band while their content is still being written. */
.hub-listings__placeholder {
  margin-top: 2rem;
  padding: 3.5rem 2rem;
  text-align: center;
  border: 1px dashed var(--hub-line);
  border-radius: 4px;
  background: var(--hub-cream);
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--hub-muted);
}

/* Closing CTA band */
.hub-closer {
  background: var(--hub-navy);
  color: #fff;
  text-align: center;
}
.hub-closer__inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 5rem var(--mw-gutter);
}
.hub-closer__lede {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 1.1rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.88);
  margin: 0 0 2rem;
}

/* Responsive */
@media (max-width: 900px) {
  .hub-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .hub-grid { grid-template-columns: 1fr; }
  .hub-hero { min-height: 52vh; }
}

/* ==================================================================
   STICKY FOOTER
   Short pages (a community page with little content, or a listings
   grid showing "No Results") were letting the shared footer ride up
   under the content instead of anchoring to the bottom of the screen.
   Make <body> a full-height flex column so #main absorbs the slack and
   the footer stays pinned to the bottom on short pages, while tall pages
   behave normally. Scoped to this theme's stylesheet only — the main
   martawalsh.com site never loads this file.
   ================================================================== */
html { height: 100%; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* Main content grows to fill leftover space, pushing the footer down. */
#main { flex: 1 0 auto; }
/* Nav and the shared footer are siblings of #main and keep natural size. */

/* ==================================================================
   COMMUNITY LANDING (template-community.php)
   Full-bleed hero (from mw_hero_image URL field) + image gallery grid.
   Hero mirrors the hub hero; gallery is FTP-image-driven (no Media Library).
   ================================================================== */

/* Hero — full-bleed, flush under the fixed nav (cancels .mw-content top pad) */
.mw-community__hero {
  margin-top: calc(-1 * (var(--mw-nav-h) + 2.5rem));
  min-height: 58vh;
  display: flex;
  align-items: flex-end;
  background: var(--hub-navy, #002349) center/cover no-repeat;
  position: relative;
  color: #fff;
}
.mw-community__hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,18,38,0.15) 0%, rgba(0,18,38,0.62) 100%);
}
.mw-community__hero-inner {
  position: relative;
  max-width: var(--mw-container, 1200px);
  width: 100%;
  margin: 0 auto;
  padding: 3.5rem var(--mw-gutter, 2rem);
}
.mw-community__title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 1.04;
  margin: 0;
}
.mw-community__standfirst {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 46ch;
  color: rgba(255,255,255,0.92);
  margin: 0.9rem 0 0;
}

/* Body spacing */
.mw-community__body { padding: 3.5rem 0 1rem; }

/* Image gallery — FTP images referenced by URL in the Custom HTML block */
.mw-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 2.5rem 0 1rem;
}
.mw-gallery figure { margin: 0; }
.mw-gallery img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}

/* Feature the first image across two columns. Uses the CHILD combinator (>):
   the old descendant version also matched every <img> (each being the first
   child of its <figure>), which was harmless only because grid-column is
   ignored on non-grid-items. */
.mw-gallery--wide > :first-child { grid-column: span 2; }

/* Bookend the last image too. Silverleaf has 7 figures: 2 + 5 = 8 cells in a
   3-col grid leaves a hole bottom-right. Spanning the last as well = 9 cells,
   a clean 3x3 — wide/narrow, three, narrow/wide. Reads as a frame, not a bug. */
.mw-gallery--wide > :last-child { grid-column: span 2; }

@media (max-width: 900px) {
  .mw-gallery { grid-template-columns: repeat(2, 1fr); }
  .mw-gallery--wide > :first-child { grid-column: span 2; }
  /* At 2 cols, 7 figures + first spanning 2 = 8 cells = exactly 4 rows.
     Bookending here would CREATE a hole, so cancel it. */
  .mw-gallery--wide > :last-child { grid-column: auto; }
}
@media (max-width: 560px) {
  .mw-gallery { grid-template-columns: 1fr; }
  .mw-gallery--wide > :first-child { grid-column: auto; }
  .mw-gallery img { height: 220px; }
}

/* ---- v0.2.4 — "See All" link (community landing pages) ------------
   Sits at the end of the Custom HTML block, under the 20-listing grid.
   Same vocabulary as the "Read the guide ↓" link: uppercase Outfit,
   gold hairline rule. :visited set explicitly so the browser default
   purple never shows. */

.mw-seeall { text-align: center; margin: 2.5rem 0 3.5rem; }

.mw-seeall-link,
.mw-seeall-link:visited {
  display: inline-block;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--hub-navy);
  padding: 0.9rem 2.25rem;
  border: 1px solid var(--hub-gold);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.mw-seeall-link:hover { background: var(--hub-gold); color: #fff; }


/* ---- v0.2.4 — All Homes page (template-community-all.php) ---------
   Intro band + grid wrapper + closer. Utility page, not editorial:
   the type is quieter than a community hero on purpose. */

.mw-search-intro {
  max-width: var(--mw-container);
  margin: 0 auto;
  padding: 1rem 0 1.75rem;
  text-align: center;
}
.mw-search-eyebrow {
  font-family: "Outfit", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 500;
  color: var(--hub-gold);
  margin: 0 0 0.75rem;
}
.mw-search-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  line-height: 1.1;
  color: var(--hub-navy);
  margin: 0;
}
.mw-rule {
  display: block;
  width: 56px;
  height: 1px;
  background: var(--hub-gold);
  margin: 1.25rem auto;
}
.mw-search-sub {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 15px;   /* web font rule: body >= 14px */
  line-height: 1.6;
  color: var(--hub-muted);
  max-width: 46ch;
  margin: 0 auto;
}

.mw-search-app { margin-top: 1.5rem; }

/* Closer — thin by design. See the note in template-community-all.php. */
.mw-search-closer {
  border-top: 1px solid var(--hub-line);
  margin-top: 3rem;
  padding: 2.5rem 0 1rem;
  text-align: center;
}
.mw-search-closer__lede {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--hub-ink);
  max-width: 46ch;
  margin: 0 auto 1.6rem;
}
.mw-search-closer__actions {
  display: flex;
  gap: 1.4rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.mw-search-closer__back,
.mw-search-closer__back:visited {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 13px;   /* web font rule: secondary >= 13px */
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--hub-muted);
  transition: color 0.2s ease;
}
.mw-search-closer__back:hover { color: var(--hub-gold); }

/* Button primitive — the hub has .hub-btn, but that lives in the hub
   block and reads as hub-specific. Same treatment, section-neutral name,
   so the all-homes pages and anything later can share it. */
.mw-btn,
.mw-btn:visited {
  display: inline-block;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.95rem 1.7rem;
  border-radius: 2px;
  border: 1px solid transparent;
  transition: background-color 0.2s ease;
}
.mw-btn--solid,
.mw-btn--solid:visited {
  background: var(--hub-navy);
  color: #fff;
  border-color: var(--hub-navy);
}
.mw-btn--solid:hover { background: var(--hub-gold); border-color: var(--hub-gold); }

/* ===== Hub index — long-tail communities below the featured tiles =====
   Uses the --hub-* tokens defined in this file's directory scope, so it
   matches the tile grid it sits under. (Note the known site.css drift:
   --hub-* is #002349/#b0893c, main site is #0B1F35/#C8902A. This band
   deliberately follows the directory it belongs to, not the nav.) */
.hub-index {
  max-width: var(--mw-container, 1200px);
  margin: 56px auto 0;
  padding: 40px var(--mw-gutter, 1.5rem) 0;
  border-top: 1px solid var(--hub-line, #e4e0d7);
}

.hub-index__label {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hub-gold, #b0893c);
  margin: 0 0 26px;
}

.hub-index__group { margin-bottom: 30px; }

.hub-index__region {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--hub-navy, #002349);
  margin: 0 0 12px;
}

.hub-index__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
}

.hub-index__list a {
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 15px;
  color: var(--hub-navy, #002349);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 160ms ease, color 160ms ease;
}

.hub-index__list a:hover {
  color: var(--hub-gold, #b0893c);
  border-bottom-color: var(--hub-gold, #b0893c);
}

@media (max-width: 640px) {
  .hub-index { margin-top: 40px; padding-top: 30px; }
  .hub-index__list { gap: 10px 20px; }
  .hub-index__list a { font-size: 14px; }
}

/* Empty state — shown when the plugin has no featured tiles yet. */
.hub-empty {
  max-width: var(--mw-container, 1200px);
  margin: 0 auto;
  padding: 32px var(--mw-gutter, 1.5rem);
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 15px;
  color: var(--hub-muted, #6f6f6f);
  text-align: center;
  border: 1px dashed var(--hub-line, #e4e0d7);
  border-radius: 4px;
}
