/**
 * IceAway subsite (multisite blog_id 11). Loaded after saltsites.css.
 *
 * Structure:
 * 1. Tokens / Variables (:root)
 * 2. Global styles — layout, typography, cover blocks, buttons, nav, links (entire site)
 * 3. Specific page styles including blocks keyed by Additional CSS classes (ex: .homepage-intro, .homepage-callout)
 */

/* =============================================================================
   1. Tokens / Variables (:root)
   ============================================================================= */

:root {
  /*
   * WordPress layout vars (block editor + front-end):
   * - --wp--style--global--content-size = default / “content” width (inherits 800px from saltsites.css unless overridden here).
   * - --wp--style--global--wide-size    = “Wide width” alignment max width.
   * “Full width” (alignfull) is not a third variable — core breaks out to the viewport; use custom max-width if you need a 1600px cap.
   */
  --wp--style--global--wide-size: 1200px;
  /* Largest content band (intro, etc.) — wider than editor “Wide” when the design calls for ~1600px */
  --iceaway-section-max-width: 1600px;
  /* Horizontal breathing room so wide blocks don’t touch the viewport edge */
  --iceaway-gutter: clamp(1rem, 4vw, 2.5rem);
  /* Match iceawaymelter.com (yellow CTA, dark green callout band) */
  --iceaway-black: #000;
  --iceaway-white: #fff;
  /* Page / section headers on light backgrounds */
  --iceaway-header-gray: #767676;
  /* In-content text links (not buttons); Compass .cmps-global-footer keeps its own link styles */
  --iceaway-link-blue: #008cba;
  --iceaway-yellow: var(--color-yellow, #f2dd22);
  /* CTA “tab” shape: sharp corners except bottom-right (iceawaymelter.com) */
  --iceaway-cta-notch: 28px;
  /* Middle callout column — dark green field + top accent */
  --iceaway-dark-green: #1a472a;
  /*
   * Typography — match iceawaymelter.com (add @font-face / web fonts when files are ready).
   * Helvetica Neue is not a Google Font; it’s commercial / system-bundled. Stack falls back to Roboto, Arial.
   */
  --iceaway-font-body:
    "Univers-Roman-55", "UniversLTPro-Condensed", "Helvetica Neue", Helvetica,
    Roboto, Arial, sans-serif;
  /* Uppercase H2/H3, nav-adjacent display (condensed first — tune names when assets match the live site) */
  --iceaway-font-heading:
    "UniversLTPro-Condensed", "Univers-Roman-55", "Helvetica Neue", Helvetica,
    Roboto, Arial, sans-serif;
  /*
   * Type scale — same idea as theme.json "fluid": { "min", "max" }: one clamp() per step.
   * Edit the three numbers in each line (min, middle vw+px, max). Middle term ramps ~360–1200px wide.
   */
  --iceaway-fs-h1: clamp(38px, calc(0.95238vw + 34.571px), 46px);
  --iceaway-fs-h2: clamp(28px, calc(0.95238vw + 24.571px), 36px);
  --iceaway-fs-h3: clamp(18px, calc(0.95238vw + 14.571px), 26px);
  --iceaway-fs-h4: clamp(16px, calc(0.95238vw + 12.571px), 24px);
  --iceaway-fs-h5: clamp(14px, calc(0.95238vw + 10.571px), 22px);
  --iceaway-fs-h6: clamp(12px, calc(0.95238vw + 8.571px), 20px);
  --iceaway-fs-body: clamp(14px, calc(0.47619vw + 12.286px), 18px);
  /* font-weight is unitless (not px): regular / bold */
  --iceaway-font-weight-regular: 400;
  --iceaway-font-weight-bold: 700;
  /* Space below in-content headings — ~10–15px, scales with viewport (rem cap tracks user font size) */
  --iceaway-heading-spacing-after: clamp(0.625rem, 0.25rem + 2vw, 0.9375rem);
  /*
   * Homepage callout columns (.homepage-callout): max height 667px; scales down on narrow viewports.
   * Edit min / vw / max to taste (middle = 85vw links height to viewport width on phones/tablets).
   */
  --iceaway-callout-min-height: clamp(320px, 85vw, 667px);
  /*
   * “Mobile” band (781px) — matches WP Columns stack (wp-includes/blocks/columns/style.css).
   * Use in property values (padding, widths, etc.) via var(). Do NOT use inside @media (…):
   * var() there is invalid per spec and ignored in most browsers, so breakpoints stay literal 781px.
   * Theme SCSS uses Bootstrap widths separately (576 / 768 / 992 / 1200).
   */
  --iceaway-mobile-viewport-max: 781px;
}

/* =============================================================================
   2. Global — layout & alignment
   ============================================================================= */

/*
 * Block layout: `is-layout-constrained` on a Group (etc.) means WP lays out children with
 * content/wide widths using --wp--style--global--* (same vars as :root here). That class helps;
 * core CSS targets `.is-layout-constrained > .alignwide` — rules below reinforce when needed.
 * Page (Full width) templates use div.content, not #primary.
 */
/* Block pages only — flex homepage (.homepage-template) keeps full-bleed layout from main.scss */
.content.post,
.content.page {
  padding-left: var(--iceaway-gutter);
  padding-right: var(--iceaway-gutter);
  box-sizing: border-box;
  --font1: var(--iceaway-font-body);
  --font2: var(--iceaway-font-heading);
}

.alignwide,
.is-layout-constrained > .alignwide {
  width: 100%;
  max-width: var(--wp--style--global--wide-size) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box;
}

.alignfull .alignwide {
  max-width: var(--iceaway-section-max-width) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* =============================================================================
   2. Global — content typography
   ============================================================================= */

.content.page,
.content.post {
  font-family: var(--iceaway-font-body);
  font-size: var(--iceaway-fs-body);
  color: var(--iceaway-black);
}

.content.page p,
.content.post p,
.content .wp-block-paragraph {
  font-size: var(--iceaway-fs-body);
}

.content .wp-block-heading,
.content h1.wp-block-heading,
.content h2.wp-block-heading,
.content h3.wp-block-heading {
  color: var(--iceaway-black);
  font-weight: var(--iceaway-font-weight-regular);
}

.content h1.wp-block-heading,
.content h1:not(.entry-title) {
  font-size: var(--iceaway-fs-h1);
}

.content h2.wp-block-heading {
  font-size: var(--iceaway-fs-h2);
}

.content h3.wp-block-heading {
  font-size: var(--iceaway-fs-h3);
}

/* Breathing room below headings site-wide; Cover inner headings reset (padding/stack handles spacing there) */
.content :is(.wp-block-heading, h1, h2, h3, h4, h5, h6):not(.entry-title) {
  margin-block-end: var(--iceaway-heading-spacing-after);
}

.content .wp-block-cover :is(.wp-block-heading, h1, h2, h3, h4, h5, h6) {
  margin-block-end: 0;
}

/* =============================================================================
   2. Global — Cover block
   ============================================================================= */

/* Shell: no border/frame from theme */
.content .wp-block-cover,
.content .wp-block-cover .wp-block-cover__inner-container,
.content .wp-block-cover .wp-block-group {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

.content .wp-block-cover .wp-block-heading {
  color: var(--iceaway-white);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

/*
 * Editor “Full width” (alignfull): cap at layout max, centered (not viewport-wide).
 * Image heroes: height follows the image; inner container stays overlaid (core uses absolute img).
 */
.content.page .wp-block-cover.alignfull {
  margin-left: auto !important;
  margin-right: auto !important;
  width: 100% !important;
  max-width: var(--iceaway-section-max-width) !important;
  box-sizing: border-box;
}

.content.page .wp-block-cover:has(> .wp-block-cover__image-background) {
  min-height: 0 !important;
  aspect-ratio: unset !important;
  height: auto !important;
  padding: 0 !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.content.page
  .wp-block-cover:has(> .wp-block-cover__image-background)
  .wp-block-cover__image-background {
  position: relative !important;
  display: block;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center top;
  image-rendering: auto;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  flex-shrink: 0;
}

.content.page
  .wp-block-cover:has(> .wp-block-cover__image-background)
  .wp-block-cover__inner-container {
  position: absolute !important;
  inset: 0;
  display: flex;
  align-items: inherit;
  justify-content: inherit;
  width: 100% !important;
  box-sizing: border-box;
}

/*
 * Templates print <h1 class="entry-title"> before the_content(); saltsites hides it, but the next
 * sibling is still the first content block. Add space under the main nav unless the hero is a Cover
 * (overridden below). Uses --iceaway-gutter: clamp(1rem, 4vw, 2.5rem).
 */
.content.page > h1.entry-title + * {
  margin-top: var(--iceaway-gutter);
  margin-block-start: var(--iceaway-gutter);
}

/*
 * Flush hero: no top gap when the first block is a Cover, or a Group whose first child is a Cover.
 */
.content.page > h1.entry-title + .wp-block-cover,
.content.page > h1.entry-title + .wp-block-group > .wp-block-cover:first-child {
  margin-top: 0 !important;
  margin-block-start: 0 !important;
}

.content.page
  > h1.entry-title
  + .wp-block-group:has(> .wp-block-cover:first-child) {
  margin-top: 0 !important;
  margin-block-start: 0 !important;
  padding-top: 0 !important;
}

/*
 * Same gutter as non-hero pages (h1.entry-title + * margin-top): space below a flush Cover hero
 * before the rest of the page content.
 */
.content.page > h1.entry-title + .wp-block-cover,
.content.page
  > h1.entry-title
  + .wp-block-group:has(> .wp-block-cover:first-child) {
  margin-bottom: var(--iceaway-gutter);
  margin-block-end: var(--iceaway-gutter);
}

/* Video / gradient-only covers: no :has(img) rules above; core layout applies */

/* =============================================================================
   2. Global — buttons & CTAs
   ============================================================================= */

/* bottom-right corner rounded only */
.content .wp-block-button .wp-block-button__link {
  font-family: var(--iceaway-font-body);
  font-weight: var(--iceaway-font-weight-regular);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 0 0 var(--iceaway-cta-notch) 0;
  padding: 0.75em 1.9em;
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  text-decoration: none !important;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.content .wp-block-button:not(.is-style-outline) .wp-block-button__link {
  background-color: var(--iceaway-yellow) !important;
  color: var(--iceaway-black) !important;
  border: 2px solid var(--iceaway-yellow) !important;
}

.content .wp-block-button:not(.is-style-outline) .wp-block-button__link:hover,
.content .wp-block-button:not(.is-style-outline) .wp-block-button__link:focus {
  background-color: var(--iceaway-yellow) !important;
  border-color: var(--iceaway-yellow) !important;
  color: var(--iceaway-black) !important;
  text-decoration: underline !important;
  text-decoration-color: #000 !important;
  text-decoration-thickness: 3px !important;
  text-underline-offset: 0.2em;
}

.content .wp-block-button.is-style-outline .wp-block-button__link {
  background: transparent !important;
  color: var(--iceaway-black) !important;
  border: 2px solid var(--iceaway-black) !important;
}

.content .wp-block-button.is-style-outline .wp-block-button__link:hover {
  background: var(--iceaway-black) !important;
  color: var(--iceaway-white) !important;
}

/* =============================================================================
   2. Global — primary navigation
   ============================================================================= */

/* Primary nav links: black (overrides theme --nav-textcolor / navy). */
.navigation .primary-nav .nav-wrap nav ul.primary-list li.nav-level-1 a,
.navigation .primary-nav .nav-wrap nav ul.primary-list li.nav-level-1 button,
.navigation .primary-nav .nav-wrap nav ul.primary-list li.nav-level-2 a,
.navigation .primary-nav .nav-wrap nav ul.primary-list li.nav-level-2 button {
  color: #000 !important;
}

.navigation .primary-nav .nav-wrap nav ul.primary-list li.nav-level-1 a:hover,
.navigation
  .primary-nav
  .nav-wrap
  nav
  ul.primary-list
  li.nav-level-1
  button:hover,
.navigation .primary-nav .nav-wrap nav ul.primary-list li.nav-level-2 a:hover,
.navigation
  .primary-nav
  .nav-wrap
  nav
  ul.primary-list
  li.nav-level-2
  button:hover {
  text-decoration: underline !important;
  text-decoration-color: #000 !important;
  text-decoration-thickness: 3px !important;
  text-underline-offset: 0.2em;
}

/* Last primary item: theme zeros padding-right; dev keeps inset after “Contact”. */
@media (min-width: 992px) {
  .navigation .primary-nav .nav-wrap nav ul.primary-list li.nav-level-1:last-child > a,
  .navigation .primary-nav .nav-wrap nav ul.primary-list li.nav-level-1:last-child > button {
    padding-right: 15px !important;
  }
}

@media (min-width: 1200px) {
  .navigation .primary-nav .nav-wrap nav ul.primary-list li.nav-level-1:last-child > a,
  .navigation .primary-nav .nav-wrap nav ul.primary-list li.nav-level-1:last-child > button {
    padding-right: 20px !important;
  }
}

/* =============================================================================
   2. Global — in-content links (not buttons)
   ============================================================================= */

main#primary a:not(.wp-block-button__link):not(.btn-shape):not(.standalone),
.content a:not(.wp-block-button__link):not(.btn-shape):not(.standalone),
.entry-content a:not(.wp-block-button__link):not(.btn-shape):not(.standalone),
.wp-block-post-content a:not(.wp-block-button__link):not(.btn-shape):not(.standalone) {
  color: var(--iceaway-link-blue) !important;
}

main#primary a:hover:not(.wp-block-button__link):not(.btn-shape):not(.standalone),
.content a:hover:not(.wp-block-button__link):not(.btn-shape):not(.standalone),
.entry-content a:hover:not(.wp-block-button__link):not(.btn-shape):not(.standalone),
.wp-block-post-content a:hover:not(.wp-block-button__link):not(.btn-shape):not(.standalone) {
  color: var(--iceaway-link-blue) !important;
  text-decoration: underline !important;
  text-decoration-color: var(--iceaway-link-blue) !important;
  text-decoration-thickness: 3px !important;
  text-underline-offset: 0.2em;
}

/* =============================================================================
   3. Specific page styles
   (add these class names under “Additional CSS class(es)” in the block editor)
   ============================================================================= */

/*
 * Product template specs — dev parity with <th class="pt-spec-label"> markup.
 * Only override label chrome; keep add-on.css / main.scss forms-row flex + spacer.
 */
.product-template .pt-specs .pt-specs-table table tbody tr:nth-child(odd) th.pt-spec-label {
  background-color: transparent !important;
  text-transform: none !important;
  font-weight: 700 !important;
  text-align: left !important;
}

@media (min-width: 992px) {
  .product-template .pt-specs .pt-specs-table table tbody tr:nth-child(odd) th.pt-spec-label {
    vertical-align: middle !important;
    /* Same gutter as legacy td:first-child accent column */
    border-right: 10px solid #fff !important;
  }

  /*
   * Dev (no iceaway.css): add-on flex on td.pt-specs-forms-cell does not apply — cell
   * stays table-cell so min-height: 220px does not stretch the row. Local loads this
   * file after add-on, so flex wins unless reset here for parity.
   */
  .product-template
    .pt-specs
    .pt-specs-table
    table
    tbody
    tr.pt-specs-forms-row
    td.pt-specs-forms-cell {
    display: table-cell !important;
    min-height: 0 !important;
    vertical-align: bottom !important;
  }
}

@media (max-width: 991px) {
  .product-template .pt-specs .pt-specs-table table tbody tr:nth-child(odd) th.pt-spec-label {
    text-transform: none !important;
    font-weight: 700 !important;
  }
}

/* =============================================================================
   Homepage styles
============================================================================= */

/*
 * Intro strip — class: homepage-intro (Columns block)
 */
.content.page .wp-block-columns.homepage-intro {
  background-color: var(--iceaway-white) !important;
  background-image: none !important;
  color: #000 !important;
  box-sizing: border-box;
  width: 100%;
  max-width: var(--iceaway-section-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-bottom: clamp(2rem, 5vw, 3.25rem);
  padding-left: clamp(0.75rem, 4vw, 1rem);
  padding-right: clamp(0.75rem, 4vw, 1rem);
  text-align: center;
}

.content.page .wp-block-columns.homepage-intro .wp-block-heading,
.content.page .wp-block-columns.homepage-intro p {
  color: #000 !important;
  text-shadow: none !important;
  font-family: var(--iceaway-font-body);
  font-weight: var(--iceaway-font-weight-regular);
  font-size: clamp(18px, calc(0.95238vw + 14.571px), 23px);
  line-height: 1.45;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.content.page .wp-block-columns.homepage-intro .wp-block-buttons {
  justify-content: center;
  margin-top: clamp(1.25rem, 3vw, 2rem);
}

/*
 * Callout cards — classes: homepage-callout (Column), homepage-callout-text (Group inside column)
 * Column: top accent bar only. Image: full column width. Text band: odd = black, even = dark green.
 * Equal-height rows: core Columns may set .are-vertically-aligned-* / per-column align-self; force stretch.
 */
.content .wp-block-columns:has(.homepage-callout) {
  align-items: stretch !important;
}

.content .wp-block-columns:has(.homepage-callout).are-vertically-aligned-top,
.content .wp-block-columns:has(.homepage-callout).are-vertically-aligned-center,
.content
  .wp-block-columns:has(.homepage-callout).are-vertically-aligned-bottom {
  align-items: stretch !important;
}

.content
  .wp-block-columns:has(.homepage-callout)
  > .wp-block-column.homepage-callout {
  align-self: stretch !important;
  height: auto !important;
  flex: 1 1 0 !important;
  min-width: 0 !important;
}

/*
 * Below 781px (--iceaway-mobile-viewport-max): core sets flex-basis:100% so columns stack; our
 * flex:1 1 0 !important wins on specificity and kept all three callouts in one row, ultra-narrow.
 * Reset to full-width rows. (max-width is literal 781px — var() in @media is not portable.)
 * Respect “Stack on mobile” off: .is-not-stacked-on-mobile keeps editor / core behavior.
 */
@media (max-width: 781px) {
  .content
    .wp-block-columns:has(.homepage-callout):not(.is-not-stacked-on-mobile)
    > .wp-block-column.homepage-callout {
    flex: 0 0 100% !important;
    flex-basis: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

.content .wp-block-columns .wp-block-column.homepage-callout:nth-child(odd) {
  border: none;
  border-top: 10px solid var(--iceaway-black);
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-sizing: border-box;
}

.content .wp-block-columns .wp-block-column.homepage-callout:nth-child(even) {
  border: none;
  border-top: 10px solid var(--iceaway-dark-green);
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-sizing: border-box;
}

.content .wp-block-columns .wp-block-column.homepage-callout {
  gap: 0 !important;
  row-gap: 0 !important;
  display: flex;
  flex-direction: column;
  min-height: var(--iceaway-callout-min-height);
  height: 100%;
  align-self: stretch !important;
}

.content
  .wp-block-columns
  .wp-block-column.homepage-callout.is-vertically-aligned-top,
.content
  .wp-block-columns
  .wp-block-column.homepage-callout.is-vertically-aligned-center,
.content
  .wp-block-columns
  .wp-block-column.homepage-callout.is-vertically-aligned-bottom {
  align-self: stretch !important;
}

.content
  .wp-block-columns
  .wp-block-column.homepage-callout
  figure.wp-block-image,
.content .wp-block-columns .wp-block-column.homepage-callout .wp-block-image {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  margin-bottom: 0 !important;
  flex-shrink: 0;
}

.content
  .wp-block-columns
  .wp-block-column.homepage-callout
  .wp-block-image
  img,
.content
  .wp-block-columns
  .wp-block-column.homepage-callout
  figure.wp-block-image
  img {
  width: 100%;
  height: auto;
  display: block;
}

.content
  .wp-block-columns
  .wp-block-column.homepage-callout
  figure.wp-block-image
  + .wp-block-group.homepage-callout-text,
.content
  .wp-block-columns
  .wp-block-column.homepage-callout
  .wp-block-image
  + .wp-block-group.homepage-callout-text {
  margin-top: 0 !important;
  margin-block-start: 0 !important;
}

.content
  .wp-block-columns
  .wp-block-column.homepage-callout:nth-child(odd)
  .wp-block-group.homepage-callout-text,
.content
  .wp-block-columns
  .wp-block-column.homepage-callout:nth-child(even)
  .wp-block-group.homepage-callout-text {
  background-image: none !important;
  color: var(--iceaway-white);
  margin-top: 0 !important;
  margin-block-start: 0 !important;
  padding: 1.75rem 1.5rem 2rem;
  box-sizing: border-box;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.content
  .wp-block-columns
  .wp-block-column.homepage-callout:nth-child(odd)
  .wp-block-group.homepage-callout-text {
  background-color: var(--iceaway-black) !important;
}

.content
  .wp-block-columns
  .wp-block-column.homepage-callout:nth-child(even)
  .wp-block-group.homepage-callout-text {
  background-color: var(--iceaway-dark-green) !important;
}

/* All copy in the colored band (overrides global .content heading / link colors) */
.content
  .wp-block-columns
  .wp-block-column.homepage-callout
  .wp-block-group.homepage-callout-text
  :is(.wp-block-heading, h1, h2, h3, h4, h5, h6, p, li, a) {
  color: var(--iceaway-white) !important;
}

.content
  .wp-block-columns
  .wp-block-column.homepage-callout
  .wp-block-group.homepage-callout-text
  > h2,
.content
  .wp-block-columns
  .wp-block-column.homepage-callout
  .wp-block-group.homepage-callout-text
  h2.wp-block-heading {
  text-transform: none !important;
  font-family: var(--iceaway-font-body) !important;
  font-weight: var(--iceaway-font-weight-bold);
  font-size: var(--iceaway-fs-h3);
}

.content
  .wp-block-columns
  .wp-block-column.homepage-callout
  .wp-block-group.homepage-callout-text
  a:hover {
  text-decoration-color: var(--iceaway-white) !important;
}

/* =============================================================================
   Resources & Contact page styles
============================================================================= */

.gray-header {
  color: var(--iceaway-header-gray) !important;
  font-size: var(--iceaway-fs-h2) !important;
}

.contact-us-column h2 {
  font-size: var(--iceaway-fs-h4) !important;
}

.contact-us-column p {
  color: var(--iceaway-header-gray) !important;
}
