/*
Theme Name:  Santa Barbara Wine Country
Theme URI:   https://santabarbarawinecountry.com
Description: Child theme for santabarbarawinecountry.com. Sun-baked hills palette, Fraunces + Inter, mobile-first town board and town pages driven by the Town post type and ACF fields.
Author:      Santa Barbara County Vintners
Template:    generatepress
Version:     1.7.0
Text Domain: sbwc
*/

/* ---------------------------------------------------------------------
   Tokens
   --------------------------------------------------------------------- */
:root {
  --sbwc-cream:       #F4EDE1;
  --sbwc-cream-deep:  #EADFCB;
  --sbwc-cream-tile:  #FBF7EF;
  --sbwc-gold:        #D9A441;
  --sbwc-gold-deep:   #C4902F;
  --sbwc-gold-text:   #A8721A;
  --sbwc-olive:       #7C8B5E;
  --sbwc-olive-deep:  #5F6C46;
  --sbwc-brown:       #5C4433;
  --sbwc-ink:         #3F2E1E;
  --sbwc-line:        #D8CDB8;

  --sbwc-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sbwc-sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --sbwc-measure: 62ch;
  --sbwc-max: 1120px;
  --sbwc-gutter: 20px;
  --sbwc-radius: 14px;
}

/* ---------------------------------------------------------------------
   Reset the parts of GeneratePress we do not use
   --------------------------------------------------------------------- */
body {
  background: var(--sbwc-cream);
  color: var(--sbwc-brown);
  font-family: var(--sbwc-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.site.grid-container,
.grid-container,
.site-content,
.content-area,
.site-main,
.inside-article {
  max-width: none;
  width: auto;
  margin: 0;
  padding: 0;
  background: transparent;
}

.site-content { display: block; }
.site-footer { background: transparent; padding: 0; margin: 0; }
.sidebar,
.site-header,
.main-navigation,
.footer-widgets,
.entry-header,
.entry-meta,
.post-navigation,
.comments-area { display: none; }

a { color: var(--sbwc-brown); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--sbwc-ink); }
a:focus-visible,
button:focus-visible { outline: 3px solid var(--sbwc-gold); outline-offset: 3px; }

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

h1, h2, h3 {
  font-family: var(--sbwc-serif);
  font-weight: 600;
  color: var(--sbwc-ink);
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---------------------------------------------------------------------
   Layout helpers
   --------------------------------------------------------------------- */
.sbwc-wrap {
  max-width: var(--sbwc-max);
  margin: 0 auto;
  padding: 0 var(--sbwc-gutter);
}
.sbwc-measure { max-width: var(--sbwc-measure); }

/* ---------------------------------------------------------------------
   Top bar
   --------------------------------------------------------------------- */
.sbwc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--sbwc-gutter);
  max-width: var(--sbwc-max);
  margin: 0 auto;
}
.sbwc-wordmark {
  font-family: var(--sbwc-serif);
  font-weight: 600;
  font-size: 18px;
  color: var(--sbwc-ink);
  text-decoration: none;
}
.sbwc-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  color: var(--sbwc-olive-deep);
  text-decoration: none;
  font-size: 14px;
}
.sbwc-back:hover { color: var(--sbwc-ink); }
.sbwc-back-icon { display: block; }
.sbwc-back-text { display: none; }

@media (max-width: 759px) {
  .sbwc-wordmark { font-size: 16px; white-space: nowrap; }
}
@media (min-width: 760px) {
  .sbwc-back-icon { display: none; }
  .sbwc-back-text { display: inline; }
  .sbwc-back-text:hover { text-decoration: underline; }
}

/* ---------------------------------------------------------------------
   Homepage hero
   --------------------------------------------------------------------- */
.sbwc-hero {
  max-width: var(--sbwc-max);
  margin: 0 auto;
  padding: 16px var(--sbwc-gutter) 0;
}
.sbwc-hero-photo {
  border-radius: var(--sbwc-radius);
  overflow: hidden;
  background: var(--sbwc-olive);
  aspect-ratio: 3 / 2;
}
.sbwc-hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.sbwc-hero-photo.is-empty {
  background: linear-gradient(160deg, var(--sbwc-olive) 0%, var(--sbwc-gold) 100%);
}
.sbwc-hero-copy { padding: 24px 0 8px; }
.sbwc-hero-title {
  font-size: clamp(34px, 7.5vw, 60px);
  max-width: 16ch;
}
.sbwc-hero-intro {
  margin: 16px 0 0;
  font-size: 18px;
  line-height: 1.55;
  max-width: 52ch;
}
.sbwc-hero-intro p { margin: 0 0 0.85em; }
.sbwc-hero-intro p:last-child { margin-bottom: 0; }
.sbwc-hero-lead { font-weight: 600; color: var(--sbwc-ink); }

/* Phones get one short line instead of the full intro (see Phone homepage below) */
.sbwc-hero-mobile-line { display: none; }
.sbwc-hero-photo picture { display: block; width: 100%; height: 100%; }

/* ---------------------------------------------------------------------
   Town board
   --------------------------------------------------------------------- */
.sbwc-board {
  max-width: var(--sbwc-max);
  margin: 0 auto;
  padding: 24px var(--sbwc-gutter) 48px;
}
.sbwc-board-title {
  font-size: 22px;
  margin-bottom: 14px;
  color: var(--sbwc-brown);
}
.sbwc-board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.sbwc-town-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--sbwc-cream-tile);
  border: 1px solid var(--sbwc-line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  min-height: 72px;
}
.sbwc-town-card:hover,
.sbwc-town-card:focus-visible { border-color: var(--sbwc-gold); }
.sbwc-town-logo {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--sbwc-line);
  display: grid;
  place-items: center;
  padding: 6px;
  overflow: hidden;
}
.sbwc-town-logo img { width: 100%; height: 100%; object-fit: contain; }
.sbwc-town-logo.is-empty { background: var(--sbwc-gold); border-color: var(--sbwc-gold); }
.sbwc-town-name {
  font-family: var(--sbwc-serif);
  font-weight: 500;
  font-size: 20px;
  color: var(--sbwc-ink);
  line-height: 1.15;
}
.sbwc-town-blurb {
  display: block;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--sbwc-brown);
  margin-top: 3px;
}
.sbwc-town-chevron {
  margin-left: auto;
  color: var(--sbwc-gold-deep);
  font-size: 22px;
  line-height: 1;
}

@media (min-width: 760px) {
  .sbwc-board-list { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
@media (min-width: 1000px) {
  .sbwc-board-list { grid-template-columns: repeat(4, 1fr); }
  .sbwc-board-list > li { display: flex; }
  .sbwc-town-card { flex: 1 1 auto; }
  .sbwc-town-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
    min-height: 0;
  }
  .sbwc-town-logo {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    flex-basis: auto;
    padding: 18px;
  }
  .sbwc-town-chevron { display: none; }
}

/* ---------------------------------------------------------------------
   Town page
   --------------------------------------------------------------------- */
.sbwc-town-hero {
  max-width: var(--sbwc-max);
  margin: 0 auto;
  padding: 0 var(--sbwc-gutter);
}
.sbwc-town-hero .sbwc-hero-photo { aspect-ratio: 3 / 2; }

.sbwc-town-body {
  max-width: var(--sbwc-max);
  margin: 0 auto;
  padding: 24px var(--sbwc-gutter) 40px;
}
.sbwc-region-tag {
  font-size: 14px;
  color: var(--sbwc-olive-deep);
  margin-bottom: 8px;
}
.sbwc-town-title {
  font-size: clamp(32px, 6.5vw, 52px);
  margin-bottom: 18px;
}
.sbwc-town-accent { color: var(--sbwc-gold-text); }
.sbwc-town-text { max-width: var(--sbwc-measure); }
.sbwc-town-text p { margin: 0 0 1.1em; line-height: 1.7; }
.sbwc-town-text p:last-child { margin-bottom: 0; }

.sbwc-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.sbwc-btn {
  flex: 1 1 180px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 18px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  line-height: 1.2;
  border: 1.5px solid transparent;
}
.sbwc-btn-primary { background: var(--sbwc-gold); color: var(--sbwc-ink); }
.sbwc-btn-primary:hover { background: var(--sbwc-gold-deep); color: var(--sbwc-ink); }
.sbwc-btn-secondary { border-color: var(--sbwc-olive); color: var(--sbwc-brown); background: transparent; }
.sbwc-btn-secondary:hover { background: rgba(124, 139, 94, 0.12); }

/* Mobile: pin the actions to the bottom of the screen */
@media (max-width: 759px) {
  body.single-town { padding-bottom: 92px; }
  .sbwc-actions {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    margin: 0;
    padding: 12px var(--sbwc-gutter) calc(12px + env(safe-area-inset-bottom));
    background: rgba(244, 237, 225, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--sbwc-line);
    flex-wrap: nowrap;
  }
  .sbwc-btn { flex: 1 1 0; padding: 13px 8px; font-size: 14px; }
}

/* Phase 2 sections (render only when populated) */
.sbwc-sections {
  max-width: var(--sbwc-max);
  margin: 0 auto;
  padding: 0 var(--sbwc-gutter) 40px;
  display: grid;
  gap: 28px;
}
.sbwc-section h2 { font-size: 24px; margin-bottom: 10px; }
.sbwc-section .sbwc-rich { max-width: var(--sbwc-measure); }
.sbwc-rich p { margin: 0 0 1em; }
.sbwc-rich p:last-child { margin-bottom: 0; }

.sbwc-rooms {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.sbwc-room {
  background: var(--sbwc-cream-tile);
  border: 1px solid var(--sbwc-line);
  border-radius: 12px;
  padding: 14px 16px;
}
.sbwc-room-name {
  font-family: var(--sbwc-serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--sbwc-ink);
  text-decoration: none;
}
.sbwc-room-name:hover { text-decoration: underline; }
.sbwc-room-desc { margin: 6px 0 0; font-size: 15px; }

@media (min-width: 760px) {
  .sbwc-rooms { grid-template-columns: repeat(3, 1fr); }
  .sbwc-sections { padding-top: 8px; }
}

/* Other towns */
.sbwc-more {
  max-width: var(--sbwc-max);
  margin: 0 auto;
  padding: 8px var(--sbwc-gutter) 56px;
  border-top: 1px solid var(--sbwc-line);
}
.sbwc-more h2 { font-size: 20px; margin: 24px 0 12px; color: var(--sbwc-brown); }
.sbwc-more-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sbwc-more-list a {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--sbwc-line);
  border-radius: 999px;
  background: var(--sbwc-cream-tile);
  text-decoration: none;
  font-size: 15px;
}
.sbwc-more-list a:hover { border-color: var(--sbwc-gold); }

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.sbwc-footer {
  border-top: 1px solid var(--sbwc-line);
  background: var(--sbwc-cream-deep);
}
.sbwc-footer-inner {
  max-width: var(--sbwc-max);
  margin: 0 auto;
  padding: 28px var(--sbwc-gutter) 32px;
  display: grid;
  gap: 20px;
  font-size: 14px;
  color: var(--sbwc-brown);
}
.sbwc-footer-row {
  display: grid;
  gap: 14px;
}
.sbwc-footer-family { font-family: var(--sbwc-serif); font-size: 17px; color: var(--sbwc-ink); }
.sbwc-footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.sbwc-footer-links a { text-decoration: none; }
.sbwc-footer-links a:hover { text-decoration: underline; }

.sbwc-footer-bottom {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 14px;
  align-items: center;
}
.sbwc-vintners { display: inline-flex; text-decoration: none; }
.sbwc-vintners .sbwc-social-icon { width: 46px; height: 46px; }
.sbwc-vintners .sbwc-social-text { font-size: 13px; color: var(--sbwc-brown); }
.sbwc-footer-bottom .sbwc-social { grid-column: 1 / -1; }
.sbwc-footer-fine {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #9A8F80;
}
.sbwc-social {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 10px;
}
.sbwc-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--sbwc-line);
  border-radius: 999px;
  background: var(--sbwc-cream-tile);
  color: var(--sbwc-brown);
  text-decoration: none;
  font-size: 13px;
}
.sbwc-social a:hover { border-color: var(--sbwc-gold); }
.sbwc-social-icon { display: inline-flex; width: 20px; height: 20px; }
.sbwc-social-icon svg { width: 100%; height: 100%; }
.sbwc-social a:has(.sbwc-social-icon) { width: 36px; padding: 0; }
.sbwc-footer-legal {
  border-top: 1px solid var(--sbwc-line);
  padding-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 12.5px;
  color: #9A8F80;
}
.sbwc-footer-legal .sbwc-footer-links { gap: 6px 16px; font-size: 12.5px; }
.sbwc-footer-legal a { color: #9A8F80; }
.sbwc-footer-legal a:hover { color: var(--sbwc-brown); }

@media (min-width: 760px) {
  .sbwc-footer-bottom { grid-template-columns: auto 1fr auto; }
  .sbwc-footer-bottom .sbwc-social { grid-column: auto; }
  .sbwc-vintners .sbwc-social-icon { width: 54px; height: 54px; }
}

/* Screen reader only */
.sbwc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------------
   Desktop: image left, text right
   --------------------------------------------------------------------- */
@media (min-width: 900px) {
  /* Homepage hero */
  .sbwc-hero {
    display: grid;
    grid-template-columns: 6fr 5fr;
    gap: 40px;
    align-items: center;
    padding-top: 28px;
  }
  .sbwc-hero-copy { padding: 0; }
  .sbwc-hero-title { font-size: clamp(38px, 4.2vw, 56px); }

  /* Town page: photo stays put while the text scrolls */
  .sbwc-town-top {
    max-width: var(--sbwc-max);
    margin: 0 auto;
    padding: 20px var(--sbwc-gutter) 0;
    display: grid;
    grid-template-columns: 5fr 6fr;
    gap: 40px;
    align-items: start;
  }
  .sbwc-town-hero,
  .sbwc-town-body {
    max-width: none;
    margin: 0;
    padding: 0;
  }
  .sbwc-town-hero {
    position: sticky;
    top: 20px;
  }
  .sbwc-town-hero .sbwc-hero-photo { aspect-ratio: 4 / 5; }
  .sbwc-town-body { padding-bottom: 40px; }
  .sbwc-town-title { font-size: clamp(34px, 3.6vw, 48px); }

  /* "This is how you do" on one line, the name on the next (period stays with the name) */
  .sbwc-town-title .sbwc-town-accent::before,
  .sbwc-hero-title .sbwc-town-accent::before { content: "\A"; white-space: pre; }
}

/* ---------------------------------------------------------------------
   Four-up action buttons on town pages (Get here / Taste / Eat / Stay)
   --------------------------------------------------------------------- */
.sbwc-actions-4 { flex-wrap: nowrap; gap: 8px; }
.sbwc-actions-4 .sbwc-btn {
  flex: 1 1 0;
  padding: 12px 8px;
  font-size: 14px;
  white-space: nowrap;
}
@media (max-width: 759px) {
  .sbwc-actions-4 .sbwc-btn { padding: 12px 4px; font-size: 13px; border-radius: 8px; }
}

/* ---------------------------------------------------------------------
   Phone homepage (under 760px): short photo band, headline, one line,
   then the towns, so the town list starts on the first screen.
   Tablet and desktop layouts are untouched.
   --------------------------------------------------------------------- */
@media (max-width: 759px) {
  .sbwc-hero { padding-top: 12px; }
  .sbwc-hero .sbwc-hero-photo { aspect-ratio: 2 / 1; }
  .sbwc-hero-copy { padding: 16px 0 0; }
  .sbwc-hero-title { font-size: 30px; line-height: 1.1; }
  .sbwc-hero-intro { display: none; }
  .sbwc-hero-mobile-line {
    display: block;
    margin: 8px 0 0;
    font-size: 16px;
    line-height: 1.45;
    font-weight: 600;
    color: var(--sbwc-ink);
  }

  .sbwc-board { padding-top: 16px; }
  /* The line above already says "Pick a town"; keep the heading for screen readers only */
  .sbwc-board-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    margin: 0;
  }
}
