/*!
Theme Name: The Gloaming — Botiga Child
Theme URI: https://thegloaming.uk/
Author: The Gloaming
Author URI: https://thegloaming.uk/
Description: Botiga child theme carrying The Gloaming brand — dusk/twilight palette, Cormorant Garamond headings and Source Sans 3 body, matching the Gloaming gallery showcase. Colours and type are taken from the gallery Space (the-gloaming).
Version: 1.0.10
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Template: botiga
Text Domain: botiga-child
*/

/* ------------------------------------------------------------------
   The Gloaming brand — palette taken from the gallery Space.
   Light theme is the default; dark follows the visitor's system
   preference, exactly like the gallery does.
   ------------------------------------------------------------------ */
:root {
  --gloam-bg: #faf6ef;          /* warm cream page */
  --gloam-surface: #ffffff;
  --gloam-surface2: #f1e9db;    /* soft parchment card */
  --gloam-ink: #211a2e;         /* deep plum-black text */
  --gloam-muted: #5f5670;       /* dusky mauve-grey */
  --gloam-line: #e2d8c6;        /* warm hairline */
  --gloam-accent: #9a5b12;      /* burnished amber — last light */
  --gloam-accent-hover: #7c4a0e;
  --gloam-accent-ink: #ffffff;
  --gloam-plum: #4a3566;
  --gloam-chip: #efe7d8;
  --gloam-twilight: #1d182c;    /* deep twilight violet */
  --gloam-twilight-deep: #13101d;
  --gloam-night-ink: #f0eaf8;
  --gloam-night-muted: #b9aed0;
  --gloam-night-line: #3a3052;
  --gloam-night-accent: #e8a33d;
  --gloam-shadow: 0 10px 30px rgba(33, 26, 46, .12);
}

/* ------------------------------------------------------------------
   Base — cream page, plum ink, gallery typefaces
   ------------------------------------------------------------------ */
body {
  background-color: var(--gloam-bg);
  color: var(--gloam-ink);
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1, h2, h3, h4, h5, h6,
.site-title,
.entry-title,
.page-title,
.woocommerce-loop-product__title,
.woocommerce div.product .product_title {
  font-family: "Cormorant Garamond", Georgia, serif;
  line-height: 1.08;
  color: var(--gloam-ink);
}

h1, .entry-title, .page-title { font-weight: 700; }
h2, h3 { font-weight: 600; }

a { color: var(--gloam-accent); }
a:hover, a:focus { color: var(--gloam-accent-hover); }

/* Muted text follows the brand's dusky mauve */
.entry-content p,
.woocommerce-loop-product__title + .price,
.site-content {
  color: var(--gloam-ink);
}

/* ------------------------------------------------------------------
   Header — deep twilight band, sticky, like the gallery's nav.
   Wordmark in large Cormorant Garamond; nav links pale lavender,
   amber on hover.
   ------------------------------------------------------------------ */
.bhfb-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--gloam-twilight);
  border-bottom: 1px solid var(--gloam-night-line);
}
.bhfb-header .site-title,
.bhfb-header .site-title a {
  color: var(--gloam-night-ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: 1.9rem;
  letter-spacing: .02em;
  text-decoration: none;
}
.bhfb-header .site-title a:hover { color: var(--gloam-night-accent); }
.bhfb-header .main-navigation a,
.bhfb-header .header-item a,
.bhfb-header .site-header-cart a {
  color: #e9e2f5;
}
.bhfb-header .main-navigation a:hover,
.bhfb-header .main-navigation .current-menu-item > a,
.bhfb-header .header-item a:hover {
  color: var(--gloam-night-accent);
}
.bhfb-header .main-navigation .sub-menu {
  background: var(--gloam-twilight);
  border: 1px solid var(--gloam-night-line);
}
.bhfb-header .main-navigation .sub-menu a { color: #e9e2f5; }
.bhfb-header .main-navigation .sub-menu a:hover { color: var(--gloam-night-accent); }

/* The visible header background lives on the BHFB row wrappers, not
   on the <header> element — Botiga's generated CSS paints the main
   row white (#FFF). Paint the rows twilight instead. */
.bhfb-header .bhfb-row-wrapper,
.bhfb-header .bhfb-main_header_row,
.bhfb-header .bhfb-above_header_row,
.bhfb-header .bhfb-below_header_row {
  background-color: var(--gloam-twilight);
}

/* Mobile header + off-canvas menu share the twilight treatment */
.bhfb-mobile-header,
.botiga-offcanvas-menu {
  background: var(--gloam-twilight);
  color: var(--gloam-night-ink);
}
.botiga-offcanvas-menu a { color: #e9e2f5; }
.botiga-offcanvas-menu a:hover { color: var(--gloam-night-accent); }
.botiga-offcanvas-menu .site-title a { color: var(--gloam-night-ink); }

/* Header icons use currentColor / inherited fill, so the pale ink
   must sit on the header links and buttons themselves. The
   account/cart links ARE .header-item; the search icon is not, so
   cover both. Filled icons take fill; outline icons take stroke. */
.bhfb-header .header-item,
.bhfb-header a,
.bhfb-header button {
  color: #e9e2f5;
}
.bhfb-header .ws-svg-icon svg:not(.stroke-based),
.bhfb-header .ws-svg-icon svg:not(.stroke-based) path {
  fill: #e9e2f5;
}
.bhfb-header .ws-svg-icon svg.stroke-based,
.bhfb-header .ws-svg-icon svg.stroke-based path {
  fill: none;
  stroke: #e9e2f5;
}

/* Mobile header — the wordmark must never wrap, and no icon may
   ever sit on top of it. Measured cause at 375px: Botiga lays the
   mobile header row out as a GRID of three equal columns (115px
   each). The right column's icons (account + cart + hamburger)
   need ~126px, so they spill ~11px left out of their column and
   land on the title, which itself nearly fills the centre column —
   on Graeme's phone the title renders a little wider, so the
   account icon ends up on top of the end of "theGloaming". The
   v1.0.6 flex rules were inert because the row is a grid, not a
   flex container. Give the side columns only the room their icons
   need and the centre column the rest. */
.bhfb-header.bhfb-mobile .bhfb-main_header_row .bhfb-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.bhfb-header.bhfb-mobile .bhfb-main_header_row .bhfb-column {
  min-width: 0;
}
@media (max-width: 575px) {
  .bhfb-header .site-title,
  .bhfb-header .site-title a {
    font-size: 1.15rem;
    white-space: nowrap;
  }
}
@media (max-width: 400px) {
  .bhfb-header .site-title,
  .bhfb-header .site-title a { font-size: 1.05rem; }
}

/* ------------------------------------------------------------------
   Page title — big serif, echoing the gallery hero title
   ------------------------------------------------------------------ */
.entry-header .entry-title,
.page-header .page-title {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
}

/* Lead-in paragraphs on the gallery front page, serif and generous */
.home .entry-content > p:first-of-type {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.45rem;
  line-height: 1.35;
  color: var(--gloam-plum);
}

/* ------------------------------------------------------------------
   Gallery — rounded cards with soft dusk shadows, serif captions,
   as in the gallery Space (20px radius on its hero card)
   ------------------------------------------------------------------ */
.wp-block-gallery .wp-block-image img,
.wp-block-gallery .wp-block-image figure img {
  border-radius: 14px;
  box-shadow: var(--gloam-shadow);
}
/* Gallery captions — WordPress core overlays captions on the image
   (white text on a dark gradient, clipped by the cropped figure),
   which looks cheap and cuts long captions off mid-line. Captions
   belong BELOW the image, in the brand serif, like a real gallery
   wall. This neutralises core's absolute overlay and its blurred
   :before fade, and keeps the cropped images square with the
   caption underneath. */
.wp-block-gallery.has-nested-images figure.wp-block-image {
  justify-content: flex-start;
}
.wp-block-gallery.has-nested-images figure.wp-block-image:has(figcaption):before {
  content: none !important;
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption,
.wp-block-gallery .wp-block-image figcaption {
  position: static !important;
  inset: auto !important;
  max-height: none !important;
  overflow: visible !important;
  background: none !important;
  color: var(--gloam-muted) !important;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.05rem !important;
  line-height: 1.35;
  text-align: left !important;
  text-shadow: none !important;
  margin: 0;
  padding: 0.55rem 0.15rem 0;
}
.wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image img {
  flex: none !important;
  height: auto !important;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: cover !important;
}
.wp-block-image img { border-radius: 14px; }

/* ------------------------------------------------------------------
   Buttons — burnished amber, cream text (matches theme mods too)
   ------------------------------------------------------------------ */
.wp-block-button__link,
.button,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
input[type="submit"],
button[type="submit"] {
  background-color: var(--gloam-accent);
  color: var(--gloam-accent-ink);
  border: 1px solid var(--gloam-accent);
  border-radius: 6px;
}
.wp-block-button__link:hover,
.button:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce #respond input#submit:hover,
input[type="submit"]:hover,
button[type="submit"]:hover {
  background-color: var(--gloam-accent-hover);
  border-color: var(--gloam-accent-hover);
  color: var(--gloam-accent-ink);
}

/* WooCommerce prices and sale badges */
.woocommerce ul.products li.product .price,
.woocommerce div.product p.price,
.woocommerce div.product span.price {
  color: var(--gloam-plum);
}
.woocommerce span.onsale {
  background-color: var(--gloam-accent);
  color: var(--gloam-accent-ink);
}

/* Content cards on the parchment tone */
.content-cards-background,
.woocommerce ul.products li.product {
  background-color: transparent;
}

/* Shop / archive title band sits on the cream page, not white */
.woocommerce-page-header,
.page-header {
  background-color: var(--gloam-bg);
}

/* ------------------------------------------------------------------
   Footer — twilight, with a thin amber "last light" rule on top
   ------------------------------------------------------------------ */
.bhfb-footer {
  background: var(--gloam-twilight);
  color: var(--gloam-night-muted);
  border-top: 2px solid var(--gloam-accent);
}
/* Footer rows carry their own backgrounds in Botiga's generated CSS */
.bhfb-footer .bhfb-row-wrapper,
.bhfb-footer .bhfb-main_footer_row,
.bhfb-footer .bhfb-above_footer_row,
.bhfb-footer .bhfb-below_footer_row {
  background-color: var(--gloam-twilight);
}
.bhfb-footer a { color: var(--gloam-night-accent); }
.bhfb-footer a:hover { color: #f3c26b; }
.bhfb-footer .widget-title,
.bhfb-footer h1, .bhfb-footer h2, .bhfb-footer h3,
.bhfb-footer .footer-credits {
  color: var(--gloam-night-ink);
}
.bhfb-footer .footer-copyright,
.bhfb-footer .site-info { color: var(--gloam-night-muted); }

/* Back-to-top button */
.botiga-scroll-top,
a.botiga-scroll-top {
  background-color: var(--gloam-accent);
  color: var(--gloam-accent-ink);
}

/* ------------------------------------------------------------------
   Dark mode — mirrors the gallery Space's dark theme exactly,
   following the visitor's system preference.
   ------------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
  :root {
    --gloam-bg: #13101d;
    --gloam-surface: #1d182c;
    --gloam-surface2: #272038;
    --gloam-ink: #f0eaf8;
    --gloam-muted: #b9aed0;
    --gloam-line: #3a3052;
    --gloam-accent: #e8a33d;
    --gloam-accent-hover: #f3c26b;
    --gloam-accent-ink: #1d1405;
    --gloam-plum: #c9b6ec;
    --gloam-chip: #2a2242;
    --gloam-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  }

  /* Botiga paints headings, body text, links and buttons from its own
     --bt-color-* variables (e.g. h1:not(.has-text-color) uses
     var(--bt-color-heading-1)). Redefine those variables for dark
     mode so every Botiga rule follows the twilight palette. */
  :root,
  body {
    --bt-color-bg: #13101d;
    --bt-color-body-text: #f0eaf8;
    --bt-color-heading-1: #f0eaf8;
    --bt-color-heading-2: #f0eaf8;
    --bt-color-heading-3: #f0eaf8;
    --bt-color-heading-4: #f0eaf8;
    --bt-color-heading-5: #f0eaf8;
    --bt-color-heading-6: #f0eaf8;
    --bt-color-link-default: #e8a33d;
    --bt-color-link-hover: #f3c26b;
    --bt-color-button: #1d1405;
    --bt-color-button-bg: #e8a33d;
    --bt-color-button-bg-hover: #f3c26b;
    --bt-color-button-border: #e8a33d;
    --bt-color-button-border-hover: #f3c26b;
    --bt-color-button-hover: #1d1405;
    --bt-color-content-cards-bg: #1d182c;
    --bt-color-forms-background: #272038;
    --bt-color-forms-borders: #3a3052;
    --bt-color-forms-dividers: #3a3052;
    --bt-color-forms-placeholder: #b9aed0;
    --bt-color-forms-text: #f0eaf8;
    --bt-color-loop-post-meta: #b9aed0;
    --bt-color-loop-post-text: #f0eaf8;
    --bt-color-loop-post-title: #f0eaf8;
    --bt-color-onsale: #1d1405;
    --bt-color-onsale-bg: #e8a33d;
    --bt-color-post-meta: #b9aed0;
    --bt-color-post-title: #f0eaf8;
  }

  /* Botiga's generated CSS also re-declares a few colour variables
     scoped to body classes (.single, .blog). A class selector beats
     the plain `body` selector above regardless of load order, so on
     single posts the title stayed at its light-mode #212121 and on
     the Journal page the loop colours did too — dark-on-dark again.
     Re-declare them with higher-specificity body-class selectors. */
  body.single {
    --bt-color-post-title: #f0eaf8;
    --bt-color-post-meta: #b9aed0;
  }
  body.blog {
    --bt-color-loop-post-text: #f0eaf8;
    --bt-color-loop-post-title: #f0eaf8;
    --bt-color-loop-post-meta: #b9aed0;
  }

  /* Botiga's own stylesheet also hard-codes the post meta colour
     (.entry-meta { color:#666 }) with no variable at all; in dark
     mode that mid-grey all but vanishes against the near-black page.
     The child stylesheet loads last, so this equal-specificity rule
     wins in dark mode only. */
  .entry-meta {
    color: var(--gloam-muted);
  }

  body,
  .site-content,
  .content-area,
  .site-main,
  .woocommerce ul.products li.product,
  .woocommerce .woocommerce-ordering select,
  .woocommerce div.product {
    background-color: var(--gloam-bg) !important;
    color: var(--gloam-ink);
  }

  h1, h2, h3, h4, h5, h6,
  .site-title, .entry-title, .page-title,
  .woocommerce-loop-product__title,
  .woocommerce div.product .product_title {
    color: var(--gloam-ink);
  }

  a { color: var(--gloam-accent); }
  a:hover, a:focus { color: var(--gloam-accent-hover); }

  .home .entry-content > p:first-of-type { color: var(--gloam-plum); }
  .wp-block-gallery .wp-element-caption { color: var(--gloam-muted); }

  /* Header stays twilight; it simply blends with the dark page */
  .bhfb-header {
    background: var(--gloam-twilight);
    border-bottom-color: var(--gloam-night-line);
  }

  .bhfb-footer { background: var(--gloam-twilight-deep); }
  .bhfb-footer .bhfb-row-wrapper,
  .bhfb-footer .bhfb-main_footer_row,
  .bhfb-footer .bhfb-above_footer_row,
  .bhfb-footer .bhfb-below_footer_row {
    background-color: var(--gloam-twilight-deep);
  }
  .woocommerce-page-header,
  .page-header {
    background-color: var(--gloam-bg) !important;
  }

  /* Botiga's generated customizer stylesheet (botiga-custom-styles)
     paints the shop archive header text with a literal #212121 — its
     archive-header text colour — which no --bt-color-* variable
     reaches. That explicit colour beats the light body colour the
     description would otherwise inherit, so in dark mode the category
     description sat dark-on-dark and unreadable. The child stylesheet
     is enqueued after the generated one, so these equal-or-higher
     specificity rules win the cascade — in dark mode only. */
  .woocommerce-page-header h1,
  .woocommerce-page-header .page-title {
    color: var(--gloam-ink);
  }
  .woocommerce-page-header .term-description,
  .woocommerce-page-header .page-description {
    color: var(--gloam-ink);
  }

  .wp-block-button__link,
  .button,
  .woocommerce a.button,
  .woocommerce button.button,
  .woocommerce input.button,
  .woocommerce #respond input#submit,
  input[type="submit"],
  button[type="submit"] {
    background-color: var(--gloam-accent);
    border-color: var(--gloam-accent);
    color: var(--gloam-accent-ink);
  }

  .woocommerce ul.products li.product .price,
  .woocommerce div.product p.price,
  .woocommerce div.product span.price { color: var(--gloam-plum); }

  input[type="text"], input[type="email"], input[type="tel"],
  input[type="password"], input[type="search"], input[type="url"],
  input[type="number"], textarea, select,
  .woocommerce form .form-row input.input-text,
  .woocommerce form .form-row textarea {
    background-color: var(--gloam-surface2);
    color: var(--gloam-ink);
    border-color: var(--gloam-night-line);
  }
  ::placeholder { color: var(--gloam-muted); opacity: 1; }

  .woocommerce table.shop_table,
  .woocommerce table.shop_table td,
  .woocommerce table.shop_table th {
    border-color: var(--gloam-night-line);
  }
  .woocommerce .woocommerce-message,
  .woocommerce .woocommerce-info,
  .woocommerce .woocommerce-error {
    background-color: var(--gloam-surface2);
    color: var(--gloam-ink);
    border-top-color: var(--gloam-accent);
  }
}
