/*
Theme Name: Beyond Haunted
Theme URI: https://beyondhaunted.com
Description: Atmospheric "haunted field guide" redesign for BeyondHaunted.com. A candlelit night identity — ink-blue ground, ember accent, bone type. Child theme of Twenty Twenty-Five. Phase 4: custom header nav with dropdowns, clean footer, homepage "near me" + geographic US map.
Author: Beyond Haunted
Template: twentytwentyfive
Version: 0.5.2
Requires at least: 6.7
Tested up to: 6.8
License: GNU General Public License v2 or later
Text Domain: beyondhaunted
*/

/* ==================================================================
   Base finishing touches (Phase 1)
================================================================== */
body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wp-block-navigation {
  font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.wp-block-site-tagline {
  font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.7rem;
  color: var(--wp--preset--color--ember, #e8ae5a);
}

.wp-block-image img,
.wp-block-post-featured-image img {
  border-radius: 12px;
}

.wp-block-quote {
  border-left: 2px solid var(--wp--preset--color--ember, #e8ae5a);
  font-style: italic;
}

/* ==================================================================
   PHASE 2 — Header
================================================================== */

/* Ghost mark before the site title (crisp SVG; swap for uploaded logo anytime) */
.wp-block-site-title a::before {
  content: "";
  display: inline-block;
  width: 26px;
  height: 26px;
  vertical-align: -6px;
  margin-right: 10px;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23ece4d3' d='M4 20V11a8 8 0 0 1 16 0v9l-2.7-1.8L15 20l-3-2-3 2-2.3-1.8L4 20z'/><circle cx='9.2' cy='10.5' r='1.3' fill='%230a0d12'/><circle cx='14.8' cy='10.5' r='1.3' fill='%230a0d12'/></svg>") no-repeat center / contain;
}

/* Hairline under the header */
.wp-site-blocks > header {
  border-bottom: 1px solid var(--wp--preset--color--line, #272f3b);
}

/* ==================================================================
   PHASE 2 — Archive / State (category) & Type (tag) pages: cards
   Paired with templates/archive.html + templates/category.html which
   switch the loop from full content to excerpts.
================================================================== */

/* Archive intro (term description) reads as a lead */
.wp-block-term-description {
  color: var(--wp--preset--color--dim, #a7acb6);
  font-size: 1.05rem;
  max-width: 68ch;
  margin-top: 0.6rem;
}

/* Grid spacing (the grid itself comes from the post-template block layout) */
.wp-block-post-template.is-layout-grid,
.wp-block-post-template.wp-block-post-template-is-layout-grid {
  gap: 24px;
}
/* Fallback if an older layout is in play */
.wp-block-post-template.is-layout-flow {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* The card */
.wp-block-query .wp-block-post {
  background: var(--wp--preset--color--panel, #141922);
  border: 1px solid var(--wp--preset--color--line, #272f3b);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.wp-block-query .wp-block-post:hover {
  transform: translateY(-3px);
  border-color: #39434f;
}

/* Card children render directly inside .wp-block-post (an <li>), so pad the
   text blocks and give the card bottom breathing room. The image stays flush. */
.wp-block-query .wp-block-post {
  padding-bottom: 22px;
}
.wp-block-query .wp-block-post > * {
  margin-top: 0;
  margin-bottom: 0;
}
.wp-block-query .wp-block-post .wp-block-post-title,
.wp-block-query .wp-block-post .wp-block-post-excerpt,
.wp-block-query .wp-block-post .wp-block-post-date {
  padding-left: 22px;
  padding-right: 22px;
}

/* Featured image flush to the top of the card */
.wp-block-query .wp-block-post .wp-block-post-featured-image {
  margin: 0 0 16px;
}
.wp-block-query .wp-block-post .wp-block-post-featured-image img {
  border-radius: 0;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

/* Title — clamped so long SEO titles stay tidy */
.wp-block-query .wp-block-post .wp-block-post-title {
  font-size: 1.2rem;
  line-height: 1.2;
  margin-bottom: 8px;
}
.wp-block-query .wp-block-post .wp-block-post-title a {
  color: var(--wp--preset--color--bone, #ece4d3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wp-block-query .wp-block-post .wp-block-post-title a:hover {
  color: var(--wp--preset--color--ember, #e8ae5a);
}

/* Excerpt */
.wp-block-query .wp-block-post .wp-block-post-excerpt {
  margin-top: 4px;
}
.wp-block-query .wp-block-post .wp-block-post-excerpt__excerpt,
.wp-block-query .wp-block-post .wp-block-post-excerpt p {
  color: var(--wp--preset--color--dim, #a7acb6);
  font-size: 0.92rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wp-block-query .wp-block-post .wp-block-post-excerpt__more-text a,
.wp-block-query .wp-block-post .wp-block-post-excerpt a {
  color: var(--wp--preset--color--ember, #e8ae5a);
  font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  -webkit-line-clamp: none;
  display: inline;
}

/* Date */
.wp-block-query .wp-block-post .wp-block-post-date {
  font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wp--preset--color--faint, #71767f);
  margin-top: 12px;
}

/* Pagination */
.wp-block-query-pagination {
  font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
  font-size: 0.8rem;
  margin-top: 8px;
}
.wp-block-query-pagination .wp-block-query-pagination-numbers .page-numbers.current {
  color: var(--wp--preset--color--ember, #e8ae5a);
  font-weight: 700;
}

/* ==================================================================
   PHASE 2 — Ads: frame the auto-placed units so they read as
   intentional on the dark ground (content stays untouched).
================================================================== */
/* Frame ONLY ads that actually filled, so unfilled slots never become empty boxes. */
.entry-content .google-auto-placed:has(ins.adsbygoogle[data-ad-status="filled"]),
.wp-block-post-content .google-auto-placed:has(ins.adsbygoogle[data-ad-status="filled"]) {
  background: var(--wp--preset--color--panel, #141922);
  border: 1px solid var(--wp--preset--color--line, #272f3b);
  border-radius: 14px;
  padding: 16px;
  margin: 28px auto;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.entry-content .google-auto-placed:has(ins.adsbygoogle[data-ad-status="filled"])::before,
.wp-block-post-content .google-auto-placed:has(ins.adsbygoogle[data-ad-status="filled"])::before {
  content: "Advertisement";
  display: block;
  text-align: center;
  font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--wp--preset--color--faint, #71767f);
  margin-bottom: 10px;
}
/* Keep every ad unit centred and contained on all screens */
.entry-content ins.adsbygoogle,
.wp-block-post-content ins.adsbygoogle {
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 100% !important;
}
.google-auto-placed ins,
.google-auto-placed iframe,
.entry-content ins.adsbygoogle iframe,
.wp-block-post-content ins.adsbygoogle iframe {
  max-width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* ==================================================================
   PHASE 2 — Single article: small polish (full layout in a later phase)
================================================================== */
/* Category link under the title reads as an ember eyebrow */
.wp-block-post-terms.taxonomy-category a {
  font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
}

/* ==================================================================
   PHASE 3 — Homepage: hero + interactive US map
================================================================== */
.bh-hero {
  position: relative;
  text-align: center;
  background: radial-gradient(760px 300px at 50% -12%, rgba(232, 174, 90, 0.07), transparent 70%);
}
.bh-eyebrow {
  font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.72rem;
  color: var(--wp--preset--color--ember, #e8ae5a);
  margin-bottom: 1.1rem;
}
.bh-hero__title {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.02;
  margin: 0 auto;
  max-width: 18ch;
  text-wrap: balance;
}
.bh-hero__sub {
  color: var(--wp--preset--color--dim, #a7acb6);
  font-size: 1.15rem;
  max-width: 54ch;
  margin: 1.3rem auto 0;
}

/* The map panel */
.bh-usmap {
  background: radial-gradient(120% 90% at 50% 0%, #141922 0%, #0a0d12 75%);
  border: 1px solid var(--wp--preset--color--line, #272f3b);
  border-radius: 18px;
  padding: 26px clamp(16px, 4vw, 40px);
  max-width: 860px;
  margin: 1rem auto 0;
}
.bh-usmap__svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

/* Geographic choropleth — real state outlines */
.bh-usmap--geo .bh-state {
  fill: var(--wp--preset--color--panel, #141922);
  stroke: #2f3a47;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: fill 0.15s ease, filter 0.15s ease;
}
.bh-usmap--geo .bh-state.is-active {
  fill: rgba(232, 174, 90, var(--o, 0.4));
  stroke: #6a5528;
}
.bh-usmap--geo a {
  cursor: pointer;
}
.bh-usmap--geo a:hover .bh-state,
.bh-usmap--geo a:focus-visible .bh-state {
  fill: var(--wp--preset--color--ember-soft, #f0c988);
  stroke: var(--wp--preset--color--ember, #e8ae5a);
  filter: drop-shadow(0 0 4px rgba(232, 174, 90, 0.7));
}
.bh-usmap a:focus-visible {
  outline: none;
}

/* Accessible state link list under the map */
.bh-state-list {
  list-style: none;
  padding: 0;
  margin: 24px auto 0;
  max-width: 860px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0 20px;
}
.bh-state-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 2px;
  border-bottom: 1px solid var(--wp--preset--color--panel-2, #1b222d);
  font-size: 0.95rem;
  color: var(--wp--preset--color--bone, #ece4d3);
}
.bh-state-list a:hover {
  color: var(--wp--preset--color--ember, #e8ae5a);
}
.bh-state-list .bh-count {
  font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
  font-size: 0.68rem;
  color: var(--wp--preset--color--faint, #71767f);
}

/* ==================================================================
   PHASE 4 — Homepage "near me" section
================================================================== */
.bh-nearme {
  border-top: 1px solid var(--wp--preset--color--line, #272f3b);
  background: radial-gradient(700px 260px at 50% 0%, rgba(232, 174, 90, 0.05), transparent 70%);
}
.bh-nearme > h2 { margin-bottom: 6px; }

/* ==================================================================
   PHASE 4 — Header + custom navigation (dropdowns + mobile menu)
================================================================== */
.bh-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 20px;
  padding: 12px max(20px, calc((100% - 1240px) / 2));
}

.bh-nav__toggle { display: none; }
.screen-reader-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px);
}

.bh-nav__menu {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.bh-nav__item { position: relative; }
.bh-nav__top {
  font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--wp--preset--color--dim, #a7acb6);
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 12px;
  text-decoration: none;
  display: inline-block;
  line-height: 1;
}
.bh-nav__top:hover,
.bh-nav__item--has:hover > .bh-nav__top { color: var(--wp--preset--color--ember, #e8ae5a); }

/* dropdown panels */
.bh-nav__panel {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 210px;
  background: var(--wp--preset--color--panel, #141922);
  border: 1px solid var(--wp--preset--color--line2, #333d4b);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 22px 44px -22px #000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
  z-index: 60;
}
.bh-nav__item--has:hover .bh-nav__panel,
.bh-nav__item--has:focus-within .bh-nav__panel { opacity: 1; visibility: visible; transform: none; }
.bh-nav__panel ul { list-style: none; margin: 0; padding: 0; }
.bh-nav__panel a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--wp--preset--color--bone, #ece4d3);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.bh-nav__panel a:hover {
  background: var(--wp--preset--color--panel-2, #1b222d);
  color: var(--wp--preset--color--ember, #e8ae5a);
}
/* Mega panel anchors to the right of its item (extends left) so it never
   overflows the right edge of the header. */
.bh-nav__panel--mega {
  left: auto;
  right: 0;
  min-width: 440px;
  max-width: min(620px, calc(100vw - 24px));
  max-height: 70vh;
  overflow: auto;
}
.bh-nav__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 6px; }

/* hamburger */
.bh-nav__bars, .bh-nav__bars::before, .bh-nav__bars::after {
  display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px;
  transition: transform 0.2s ease, background 0.2s ease;
}
.bh-nav__bars { position: relative; }
.bh-nav__bars::before { content: ""; position: absolute; top: -6px; left: 0; }
.bh-nav__bars::after  { content: ""; position: absolute; top: 6px;  left: 0; }
.bh-nav.is-open .bh-nav__bars { background: transparent; }
.bh-nav.is-open .bh-nav__bars::before { top: 0; transform: rotate(45deg); }
.bh-nav.is-open .bh-nav__bars::after  { top: 0; transform: rotate(-45deg); }

html.bh-nav-lock { overflow: hidden; }

/* ---- mobile ---- */
@media (max-width: 899px) {
  .bh-nav__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; border: 1px solid var(--wp--preset--color--line, #272f3b);
    border-radius: 11px; background: var(--wp--preset--color--panel, #141922);
    color: var(--wp--preset--color--bone, #ece4d3); cursor: pointer;
  }
  .bh-nav.is-open .bh-nav__toggle { position: fixed; top: 12px; right: 20px; z-index: 110; }

  .bh-nav__menu {
    display: none;
    position: fixed; inset: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--wp--preset--color--ink, #0a0d12);
    padding: 78px 22px 40px; overflow-y: auto; z-index: 100;
  }
  .bh-nav.is-open .bh-nav__menu { display: flex; }

  .bh-nav__item { border-bottom: 1px solid var(--wp--preset--color--line, #272f3b); }
  .bh-nav__top {
    display: block; width: 100%; text-align: left;
    font-size: 0.95rem; padding: 18px 4px;
  }
  .bh-nav__item--has > .bh-nav__top::after { content: " +"; color: var(--wp--preset--color--faint, #71767f); }
  .bh-nav__item.is-expanded > .bh-nav__top::after { content: " –"; }

  .bh-nav__panel {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: none; background: none; margin: 0;
    padding: 0 0 14px 12px; min-width: 0; max-height: none; display: none;
  }
  .bh-nav__item.is-expanded .bh-nav__panel { display: block; }
  .bh-nav__grid { grid-template-columns: 1fr 1fr; }
  .bh-nav__panel a { font-size: 0.95rem; padding: 9px 8px; }
}

/* ==================================================================
   PHASE 4 — Footer (clean; no old logo / generic links / WP credit)
================================================================== */
.bh-footer {
  border-top: 1px solid var(--wp--preset--color--line, #272f3b);
  text-align: center;
}
.bh-footer .wp-block-site-title { font-size: 0.95rem; }
.bh-footer__tag {
  color: var(--wp--preset--color--dim, #a7acb6);
  font-size: 0.98rem;
  margin: 0.7rem 0 0;
}
.bh-footer__copy {
  font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wp--preset--color--faint, #71767f);
  margin: 1.1rem 0 0;
}

/* ==================================================================
   PHASE 4 — Collapse UNFILLED auto-ad slots so they don't leave
   large empty black gaps (unfilled = no ad was served).
================================================================== */
ins.adsbygoogle[data-ad-status="unfilled"],
.google-auto-placed:empty,
.google-auto-placed:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
  display: none !important;
  min-height: 0 !important;
  height: 0 !important;
}
