/* HWLife - design system extracted from IDML */
/* Brand tokens reflect the publisher's named swatches:
 *   HW_Blue  = #193d4e (deep teal-navy)
 *   HW_Green = #45bb77 (fresh mid-green)
 *
 * Display font is Jubilat in print; we use Zilla Slab as the free
 * Google Fonts substitute. Body is Open Sans, UI labels are Noto Sans Bold
 * (per the IDML's "Content subheading" character style).
 */

:root {
  --hw-blue:       #193d4e;
  --hw-blue-dim:   #2a566c;
  --hw-green:      #45bb77;
  --hw-green-dark: #2f8a55;

  --ink:           #1a1d20;
  --ink-soft:      #4a4e54;
  --ink-deepblue:  #00031c;  /* "Content subheading" colour from IDML */
  --paper:         #fbf9f5;
  --paper-warm:    #f1ecde;
  --rule:          #d8d2c2;

  --font-display:  'Zilla Slab', 'Jubilat', Georgia, serif;
  --font-body:     'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-ui:       'Noto Sans', 'Open Sans', sans-serif;

  --content-max:   720px;
  --grid-max:      1200px;
  --pad:           1.25rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--hw-blue);
  color: var(--paper);
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Site header ---------- */

.site-header {
  background: var(--hw-blue);
  color: var(--paper);
  border-bottom: 4px solid var(--hw-green);
}
.site-header__inner {
  max-width: var(--grid-max);
  margin: 0 auto;
  padding: 1rem var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.site-header__brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--paper);
  letter-spacing: -0.01em;
}
.site-nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.site-nav a {
  color: var(--paper);
  text-decoration: none;
  opacity: 0.85;
}
.site-nav a:hover,
.site-nav a[aria-current] {
  opacity: 1;
  color: var(--hw-green);
}
.site-nav a[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

.site-search {
  display: flex;
  align-items: center;
  margin: 0;
  position: relative; /* anchor for the absolute-positioned results panel */
}

/* Pagefind default UI — map its CSS variables to HWLife design tokens */
#search {
  --pagefind-ui-scale: 0.85;
  --pagefind-ui-primary:        var(--hw-green);
  --pagefind-ui-text:           var(--ink);
  --pagefind-ui-background:     var(--paper);
  --pagefind-ui-border:         var(--rule);
  --pagefind-ui-border-radius:  999px;
  --pagefind-ui-font:           var(--font-body);
  --pagefind-ui-image-border-radius: 0;
}

/* Style the Pagefind-generated input to match the existing pill design */
.pagefind-ui__search-input {
  font-family: var(--font-body) !important;
  font-size: 0.85rem !important;
  padding: 0.4rem 0.75rem !important;
  border: 1px solid rgba(255,255,255,0.18) !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.08) !important;
  color: var(--paper) !important;
  width: 11rem !important;
  outline: none !important;
}
.pagefind-ui__search-input::placeholder { color: rgba(255,255,255,0.55) !important; }
.pagefind-ui__search-input:focus {
  background: rgba(255,255,255,0.16) !important;
  border-color: var(--hw-green) !important;
}

/* Hide the magnifying glass icon — label text "Search" is sufficient */
.pagefind-ui__search-icon { display: none !important; }
/* Hide the Pagefind clear button — the pill design has no room */
.pagefind-ui__search-clear { display: none !important; }

/* Results panel: drops below the search container, elevated, scrollable */
.pagefind-ui__results-container {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 22rem;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  box-shadow: 0 8px 32px rgba(25, 61, 78, 0.18);
  z-index: 200;
  padding: 0.5rem 0;
}
.pagefind-ui__results-container:empty { display: none; }

/* Result items */
.pagefind-ui__result {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rule);
}
.pagefind-ui__result:last-child { border-bottom: none; }
.pagefind-ui__result-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--hw-blue);
}
.pagefind-ui__result-title a { text-decoration: none; color: inherit; }
.pagefind-ui__result-title a:hover { color: var(--hw-green-dark); }
.pagefind-ui__result-excerpt {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
  line-height: 1.4;
}
.pagefind-ui__result-link { color: var(--hw-green-dark) !important; }
mark { background: transparent; color: var(--hw-green-dark); font-weight: 600; }

/* "No results" and loading messages */
.pagefind-ui__message {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

@media (max-width: 720px) {
  .site-search { width: 100%; order: 3; }
  .pagefind-ui__search-input { width: 100% !important; }
  .pagefind-ui__results-container {
    right: auto;
    left: calc(-1 * var(--pad));
    width: 100vw;
    border-radius: 0;
  }
}

/* ---------- Section hero ---------- */

.section-hero {
  background: var(--hw-blue);
  color: var(--paper);
  padding: 4rem var(--pad) 5rem;
}
.section-hero__inner {
  max-width: var(--grid-max);
  margin: 0 auto;
}
.section-hero__eyebrow {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--hw-green);
  margin: 0 0 0.75rem;
}
.section-hero__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1;
  margin: 0;
  letter-spacing: -0.02em;
}
.section-hero__strap {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1rem, 2vw, 1.4rem);
  color: var(--paper);
  margin: 1.5rem 0 0;
  opacity: 0.85;
}

/* Reveal animations */
.reveal { opacity: 0; transform: translateY(8px); animation: reveal 0.7s cubic-bezier(0.2, 0.6, 0.2, 1) forwards; }
.reveal-d1 { animation-delay: 0.1s; }
.reveal-d2 { animation-delay: 0.2s; }
.reveal-d3 { animation-delay: 0.3s; }
@keyframes reveal { to { opacity: 1; transform: none; } }

/* ---------- Tile grid (section landing) ---------- */

.tile-grid {
  max-width: var(--grid-max);
  margin: -3rem auto 4rem;
  padding: 0 var(--pad);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  position: relative;
  z-index: 1;
}

.tile {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  display: block;
  transition: transform 0.2s, box-shadow 0.2s;
}
.tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(25, 61, 78, 0.15);
}
.tile__media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--paper-warm);
  position: relative;
}
.tile__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.tile:hover .tile__media img { transform: scale(1.03); }
.tile__eyebrow {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-deepblue);
  margin: 1.5rem 1.5rem 0.5rem;
}
.tile__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 1.5rem 0.75rem;
  color: var(--hw-blue);
}
.tile__subtitle {
  margin: -0.5rem 1.5rem 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-style: italic;
}
.tile__dek {
  margin: 0 1.5rem 1.75rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------- Past issues carousel ---------- */

.past-issues {
  padding: 2.5rem var(--pad) 1.5rem;
}
.past-issues__eyebrow {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-deepblue);
  margin: 0 0 0.4rem;
}
.past-issues__heading {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--hw-blue);
  margin: 0 0 1.5rem;
}
.past-issues__track {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  align-items: flex-start;
  padding-bottom: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.past-issues__item {
  flex: 0 0 160px;
  scroll-snap-align: start;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.past-issues__item:hover .past-issues__media {
  border-color: var(--hw-green);
}
.past-issues__media {
  width: 160px;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: 0.35rem;
  overflow: hidden;
  transition: border-color 0.2s;
}
.past-issues__media img {
  display: block;
  width: 100%;
  height: auto;
}
.past-issues__label {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--hw-blue);
  line-height: 1.3;
}

/* ---------- Article page ---------- */

.article {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 3rem var(--pad) 5rem;
}
.article__eyebrow {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-deepblue);
  margin: 0 0 1rem;
}
.article__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--hw-blue);
  margin: 0 0 1.25rem;
}
.article__subtitle {
  font-size: 0.95rem;
  color: var(--ink-soft);
  font-style: italic;
  margin: -0.75rem 0 1.25rem;
}
.article__byline {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--hw-green-dark);
  margin: 0 0 2rem;
}
.article__hero {
  margin: 2rem 0 2.5rem;
  border-radius: 0.5rem;
  overflow: hidden;
}
.article__photo-credit {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 1.5rem 0 0;
}
.article__sponsor-strip {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  background: var(--hw-blue);
  padding: 0.6rem 1rem;
  border-radius: 0.35rem;
  margin: 1.5rem 0 0;
}
.article__body p { margin: 0 0 1.1rem; font-size: 1.0625rem; }
.article__body a {
  color: var(--hw-blue);
  text-decoration: none;
  word-break: break-word;
}
.article__body a:hover { text-decoration: underline; }
.article__body p.has-dropcap::first-letter,
.article__body .dropcap-first::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--hw-green);
  font-size: 4.5rem;
  line-height: 0.85;
  float: left;
  padding: 0.4rem 0.5rem 0 0;
}
.article__body h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--hw-blue);
  margin: 2.5rem 0 0.5rem;
  letter-spacing: -0.005em;
}
.article__body h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-deepblue);
  margin: 1.5rem 0 0.5rem;
}

/* Secondary editorial images placed inline within the article body.
   On wide screens float right to let text wrap; on narrow screens stack. */
.article__inline-image {
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
}
.article__inline-image img {
  width: 100%;
  height: auto;
  display: block;
}
@media (min-width: 800px) {
  .article__inline-image {
    float: right;
    width: 45%;
    margin: 0.5rem 0 1rem 1.75rem;
    clear: both;
  }
}

/* Gallery strip below the body, used when inline placement isn't confident
   (typically listing pages and directory spreads). */
.article__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 2.5rem 0 1rem;
}
.article__gallery-item {
  margin: 0;
  border-radius: 0.5rem;
  overflow: hidden;
}
.article__gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4 / 3;
  display: block;
}

/* Sponsor logo block at the foot of sponsored articles */
.article__sponsor {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0,0,0,.08);
}
.article__sponsor-label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-deepblue);
  opacity: 0.65;
  margin: 0 0 0.75rem;
}
.article__sponsor-logo-link {
  display: inline-block;
}
.article__sponsor-logo {
  max-width: 220px;
  max-height: 90px;
  width: auto;
  height: auto;
  display: block;
}

/* ---------- Directory cards (Live Music style) ---------- */

.directory-controls {
  margin: 2rem 0 1.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.directory-controls__label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-right: 0.5rem;
}
.filter-chip {
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-chip:hover { border-color: var(--hw-blue); }
.filter-chip.active {
  background: var(--hw-blue);
  color: var(--paper);
  border-color: var(--hw-blue);
}

.directory-section {
  margin: 2.5rem 0 1rem;
}
.directory-section__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--hw-blue);
  margin: 0 0 0.75rem;
  border-bottom: 2px solid var(--hw-green);
  padding-bottom: 0.4rem;
  display: inline-block;
}
.directory-section__sub {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-deepblue);
  margin: 1.25rem 0 0.5rem;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin: 0.5rem 0;
}

.dir-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0.4rem;
  padding: 1rem 1.1rem;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dir-card:hover {
  border-color: var(--hw-blue);
  box-shadow: 0 4px 12px rgba(25, 61, 78, 0.08);
}
.dir-card.hidden { display: none; }
.dir-card__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--hw-blue);
  line-height: 1.2;
}
.dir-card__when {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hw-green-dark);
}
.dir-card__where {
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.dir-card__desc {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.dir-card__contact {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
}
.dir-card__contact a {
  color: var(--hw-blue);
  text-decoration: none;
  word-break: break-all;
}
.dir-card__contact a:hover { text-decoration: underline; }
.dir-card__needs-llm {
  font-size: 0.7rem;
  color: var(--ink-soft);
  font-style: italic;
  border-top: 1px dashed var(--rule);
  padding-top: 0.4rem;
  margin-top: 0.4rem;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--hw-blue);
  color: var(--paper);
  padding: 3rem var(--pad);
  margin-top: 4rem;
}
.site-footer__inner {
  max-width: var(--grid-max);
  margin: 0 auto;
}
.site-footer__brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}
.site-footer__brand .dot { color: var(--hw-green); }
.site-footer p { margin: 0.4rem 0; font-size: 0.9rem; opacity: 0.85; }

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
  .section-hero { padding: 2.5rem var(--pad) 4rem; }
  .tile-grid { margin-top: -2rem; gap: 1.25rem; }
  .article { padding-top: 2rem; padding-bottom: 3rem; }
}

/* ── Issue masthead ────────────────────────────────────────────────────── */
.issue-masthead {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  padding: 2.5rem var(--pad) 2rem;
  max-width: var(--grid-max);
  margin: 0 auto;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.issue-masthead__cover {
  width: clamp(180px, 18vw, 260px);
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,.22);
  flex-shrink: 0;
}
.issue-masthead__brand {
  font-size: .8rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .55;
  margin: 0 0 .3rem;
}
.issue-masthead__label {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  margin: 0 0 .5rem;
}
.issue-masthead__sub {
  font-size: .95rem;
  opacity: .65;
  margin: 0;
}
@media (max-width: 480px) {
  .issue-masthead { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .issue-masthead__cover { width: 130px; }
}

/* ── Advertiser blocks ──────────────────────────────────────────────────── */
/* Class names avoid common content-blocker filter patterns (.ad, .ad-figure,
   aside[role="complementary"] are in most major filter lists). */

.sponsor {
  display: flex;
  justify-content: center;
  margin: 2rem auto;
}

/* max-width on the link encodes the 25vh height cap via the 1.6:1 aspect
   ratio (1280÷800), which avoids the Safari iOS bug where aspect-ratio +
   max-height on the same element produces zero height. */
.sponsor > a {
  display: block;
  width: 100%;
  max-width: min(600px, 100%, calc(25vh * 1.6));
}

.sponsor-figure {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1280 / 800;
  overflow: hidden;
}

.sponsor-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Typographic fallback: shown when Playwright capture fails */
.sponsor-figure--fallback {
  background: var(--hw-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sponsor-fallback__text {
  color: white;
  font-family: var(--font-display);
  font-size: clamp(1rem, 3vw, 1.6rem);
  text-align: center;
  padding: 1rem;
}

/* Overlay strap — glued to the image's bottom edge */
.sponsor-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--hw-blue);
  color: white;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  text-align: center;
}

/* Footer advertisers link */
.site-footer a {
  color: var(--hw-green);
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}
