/*
Theme Name: Spray Foam Wales
Description: The Spray Foam Wales site as a small classic theme with no page builder. Same layout as the previous site: red contact bar, white header, photo hero, service tiles, red product band, contact band and grey footer. Pages are edited in the normal WordPress editor.
Version: 1.0.2
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: sprayfoam-wales
*/

@font-face { font-family: "Oxygen"; src: url("assets/fonts/oxygen-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Oxygen"; src: url("assets/fonts/oxygen-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("assets/fonts/open-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 300 800; font-display: swap; }

:root {
  --red: #d4101a;        /* the logo's red, darkened a touch so white text on it passes contrast */
  --red-deep: #a80c14;
  --yellow: #eac221;     /* the old site's accent: buttons and heading rules */
  --yellow-deep: #d4ad10;
  --ink: #393939;
  --ink-strong: #1f1f1f;
  --grey: #f8f8f8;
  --line: #e2e2e2;
  --dark: #2b2b2b;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  --head: "Oxygen", "Segoe UI", Arial, sans-serif;
  --body: "Open Sans", "Segoe UI", Arial, sans-serif;
  --pad: max(var(--gutter), calc((100% - var(--wrap)) / 2));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 400 1rem/1.7 var(--body); color: var(--ink); background: #fff; }
::selection { background: var(--yellow); color: var(--ink-strong); }
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-underline-offset: 3px; }
a:hover { color: var(--red-deep); }
:focus-visible { outline: 3px solid var(--ink-strong); outline-offset: 2px; }
.topbar :focus-visible, .cta-copy :focus-visible, .hero :focus-visible, .sfw-products :focus-visible { outline-color: #fff; }
h1, h2, h3, h4 { font-family: var(--head); color: var(--ink); line-height: 1.2; margin: 0 0 .6em; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 700; }
h3 { font-size: 1.35rem; font-weight: 700; }
p, ul, ol { margin: 0 0 1em; }
.wrap { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink-strong); color: #fff; padding: 10px 14px; z-index: 100; }
.skip:focus { left: 8px; color: #fff; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- buttons: the yellow pill from the old site, with dark text so it can be read ---------- */
.btn, .wp-block-button__link, .wp-element-button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 26px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--yellow); color: var(--ink-strong); font: 700 1rem/1.2 var(--head); text-decoration: none; transition: background-color .15s ease, transform .1s ease; }
.btn:hover, .wp-block-button__link:hover, .wp-element-button:hover { background: var(--yellow-deep); color: var(--ink-strong); }
.btn:active, .wp-block-button__link:active { transform: scale(.97); }
.btn--ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px #fff; }
.btn--ghost:hover { background: #fff; color: var(--ink-strong); }
.btn[disabled] { opacity: .65; cursor: progress; }

/* ---------- red contact bar and header ---------- */
.topbar { background: var(--red); color: #fff; }
.topbar-in { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px 32px; padding-block: 7px; }
.topbar a { color: #fff; text-decoration: none; font: 700 1.0625rem/1.4 var(--head); display: inline-flex; align-items: center; gap: 9px; min-height: 30px; }
.topbar a:hover { color: #fff; text-decoration: underline; }
.topbar svg { width: 17px; height: 17px; color: var(--yellow); flex: none; }
.site-header { background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .1); position: relative; z-index: 20; }
.header-in { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 16px; }
.logo img { width: clamp(180px, 22vw, 290px); }
.nav .menu, .mobile-menu .menu { list-style: none; margin: 0; padding: 0; }
.nav .menu { display: flex; gap: clamp(18px, 3.4vw, 48px); align-items: center; }
.nav .menu > li { position: relative; }
.nav a { color: var(--ink); text-decoration: none; font: 300 1.2rem/1.2 var(--body); letter-spacing: .06em; padding: 12px 0; display: inline-block; }
.nav a:hover, .nav .current-menu-item > a, .nav .current-menu-ancestor > a { color: var(--red); }
.nav .menu-item-has-children > a::after { content: ""; display: inline-block; margin-left: 9px; border: 5px solid transparent; border-top-color: currentColor; border-bottom-width: 0; vertical-align: middle; }
.nav .sub-menu { list-style: none; margin: 0; padding: 8px 0; position: absolute; left: -18px; top: 100%; min-width: 250px; background: #fff; box-shadow: 0 10px 24px rgba(0, 0, 0, .16); border-top: 3px solid var(--red); opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .15s ease, transform .15s ease, visibility .15s; z-index: 30; }
.nav .menu > li:hover > .sub-menu, .nav .menu > li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.nav .sub-menu a { display: block; padding: 9px 18px; font-size: 1rem; font-weight: 400; letter-spacing: 0; }
.mobile-menu { display: none; position: relative; }
.mobile-menu summary { list-style: none; cursor: pointer; min-height: 44px; padding: 0 16px; display: flex; align-items: center; border: 2px solid var(--ink); font: 700 1rem/1 var(--head); }
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu[open] summary { background: var(--ink); color: #fff; }
.mobile-menu nav { position: absolute; right: 0; top: calc(100% + 8px); width: min(320px, calc(100vw - 2 * var(--gutter))); background: #fff; box-shadow: 0 10px 24px rgba(0, 0, 0, .2); border-top: 3px solid var(--red); z-index: 40; max-height: 75vh; overflow: auto; }
.mobile-menu .menu a { display: block; padding: 12px 16px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); font-weight: 600; }
.mobile-menu .sub-menu { list-style: none; margin: 0; padding: 0; }
.mobile-menu .sub-menu a { padding-left: 32px; font-weight: 400; }
@media (max-width: 860px) { .nav { display: none; } .mobile-menu { display: block; } }
@media (max-width: 560px) { .topbar-email { display: none !important; } .topbar-in { justify-content: center; } }

/* ---------- home hero ---------- */
.hero { position: relative; isolation: isolate; color: #fff; background: var(--dark); }
.hero-bg, .cta-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(20, 20, 20, .82) 0%, rgba(20, 20, 20, .62) 55%, rgba(20, 20, 20, .25) 100%); }
.hero-in { padding-block: clamp(48px, 8vw, 96px); max-width: calc(var(--wrap) + 2 * var(--gutter)); }
.hero h1 { color: #fff; font-size: clamp(2.1rem, 4.6vw, 3.2rem); max-width: 14em; }
.hero-lead { font-size: 1.125rem; max-width: 38em; }
.hero-sub { font-weight: 700; margin-bottom: .4em; }
.hero-points { padding-left: 1.3em; margin-bottom: 1.6em; }
.hero-points li { margin-bottom: .35em; }
.hero-acts { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }

/* ---------- inner pages: banner and title ---------- */
.banner { background: var(--dark); }
.banner img { width: 100%; height: clamp(180px, 30vw, 420px); object-fit: cover; }
.page-title { background: var(--grey); padding-block: clamp(28px, 4vw, 48px) 0; }
.page-title h1 { margin: 0; padding-bottom: 14px; position: relative; }
.page-title h1::after, .entry h2.sfw-rule::after { content: ""; position: absolute; left: 0; bottom: 0; width: 90px; height: 3px; background: var(--yellow); }

/* ---------- page content from the editor ---------- */
.entry > * { padding-inline: var(--pad); }
.entry > .page-title, .entry > .wp-block-group.sfw-intro, .entry > .wp-block-group.sfw-products { padding-inline: 0; }
.entry > .wp-block-group, .entry > .wp-block-media-text { padding-block: clamp(28px, 4.5vw, 56px); margin: 0; }
.entry > p, .entry > ul, .entry > ol, .entry > h2, .entry > h3, .entry > .wp-block-buttons, .entry > .wp-block-details, .entry > .wp-block-table { margin-block: 1.2em; }
.entry > .page-title + p, .entry > .page-title + h2 { margin-top: 2em; }
.entry .sfw-intro { background: var(--grey); padding-top: 18px !important; box-shadow: 0 6px 10px -8px rgba(0, 0, 0, .25); }
.entry .sfw-intro > *, .entry .sfw-products > * { padding-inline: var(--pad); }
.entry .sfw-intro p { max-width: 70em; }
.entry .wp-block-group > :last-child, .entry .wp-block-media-text__content > :last-child { margin-bottom: 0; }
.entry li { margin-bottom: .35em; }
.entry ul, .entry ol { padding-left: 1.3em; }
.entry li::marker { color: var(--red); }
.entry .wp-block-media-text { gap: clamp(20px, 4vw, 56px); align-items: center; grid-template-columns: 1fr 1fr; }
.entry .wp-block-media-text.has-media-on-the-right { grid-template-columns: 1fr 1fr; }
.entry .wp-block-media-text .wp-block-media-text__content { padding: 0; }
.entry .wp-block-media-text__media img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.entry .sfw-narrow > * { max-width: 62em; }
@media (max-width: 760px) { .entry .wp-block-media-text, .entry .wp-block-media-text.has-media-on-the-right { grid-template-columns: 1fr; } .entry .wp-block-media-text .wp-block-media-text__media { grid-column: 1; grid-row: 1; } .entry .wp-block-media-text .wp-block-media-text__content { grid-column: 1; grid-row: 2; } }

/* the red product band on the home page */
.entry .sfw-products { background: var(--red); color: #fff; }
.entry .sfw-products h2, .entry .sfw-products h3 { color: #fff; }
.entry .sfw-products a { color: #fff; }
.entry .sfw-products .wp-block-columns { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 4vw, 56px); margin: 0; }
@media (max-width: 760px) { .entry .sfw-products .wp-block-columns { grid-template-columns: 1fr; } }

/* FAQs: the old site's accordion, on the browser's own show and hide */
.entry .sfw-faqs h2 { color: #b8930a; }
.entry .wp-block-details { border: 1px solid var(--line); border-bottom-width: 0; margin: 0; }
.entry .wp-block-details:last-of-type { border-bottom-width: 1px; }
.entry .wp-block-details summary { cursor: pointer; list-style: none; padding: 14px 18px 14px 46px; position: relative; font: 700 1.0625rem/1.4 var(--head); color: var(--ink); }
.entry .wp-block-details summary::-webkit-details-marker { display: none; }
.entry .wp-block-details summary::before { content: "+"; position: absolute; left: 18px; top: 50%; translate: 0 -52%; font: 400 1.5rem/1 var(--head); color: #b8930a; }
.entry .wp-block-details[open] summary::before { content: "\2212"; }
.entry .wp-block-details summary:hover { color: var(--red); }
.entry .wp-block-details > :not(summary) { padding: 0 18px 4px; margin-top: 0; }
.entry .wp-block-details[open] { background: #fff; }
.entry .wp-block-details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.entry table { border-collapse: collapse; width: 100%; }
.entry th, .entry td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }

/* ---------- service tiles ---------- */
.tiles-section { padding-block: clamp(20px, 3vw, 36px) clamp(28px, 4.5vw, 56px); }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.tile { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--dark); color: #fff; text-decoration: none; isolation: isolate; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .4s ease; }
.tile::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, .78) 100%); }
.tile:hover img { transform: scale(1.05); }
.tile:hover { color: #fff; }
.tile-label { position: absolute; left: 18px; right: 18px; bottom: 16px; font: 700 1.3rem/1.2 var(--head); }
.tile-text { display: none; }

/* ---------- contact band with the quote form ---------- */
.cta { position: relative; isolation: isolate; color: #fff; background: var(--dark); }
.cta::after { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(25, 25, 25, .78); }
.cta-in { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(24px, 5vw, 64px); align-items: center; padding-block: clamp(40px, 6vw, 80px); }
.cta-copy h2 { color: var(--yellow); }
.cta-tel a { color: #fff; font: 700 1.9rem/1.2 var(--head); text-decoration: none; }
.cta-tel a:hover { color: var(--yellow); }
@media (max-width: 860px) { .cta-in { grid-template-columns: 1fr; } }

.quote { background: #fff; color: var(--ink); padding: clamp(18px, 3vw, 30px); border-top: 4px solid var(--yellow); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.contact-form { padding-block: clamp(24px, 4vw, 48px); }
.contact-form .quote { max-width: 760px; box-shadow: 0 4px 18px rgba(0, 0, 0, .12); border: 1px solid var(--line); border-top: 4px solid var(--yellow); }
.quote-title { font-size: 1.4rem; margin-bottom: .8em; }
.quote-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 520px) { .quote-row { grid-template-columns: 1fr; } }
.field { margin: 0 0 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .opt { font-weight: 400; color: #5f5f5f; }
.field input[type="text"], .field input[type="tel"], .field input[type="email"], .field select, .field textarea { width: 100%; min-height: 46px; padding: 9px 12px; border: 1px solid #9a9a9a; border-radius: 3px; background: #fff; color: var(--ink-strong); font: 400 1rem/1.4 var(--body); }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--ink-strong); outline-offset: 0; border-color: var(--ink-strong); }
.field input[type="file"] { width: 100%; font: 400 .95rem/1.4 var(--body); }
.field.is-bad input, .field.is-bad select { border-color: var(--red); background: #fff4f4; }
.field-err { display: block; margin-top: 4px; color: var(--red-deep); font-weight: 600; }
.quote-msg { background: #fff4f4; border: 1px solid var(--red); padding: 10px 12px; font-weight: 600; }
.quote-send { margin: 6px 0 10px; }
.quote-send .btn { min-width: 160px; }
.quote-note { font-size: .875rem; color: #5f5f5f; margin: 0; }
.quote-done-title { font: 700 1.5rem/1.2 var(--head); color: var(--ink-strong); }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- footer ---------- */
.site-footer { background: var(--grey); padding-block: clamp(32px, 5vw, 56px); font-size: .9375rem; border-top: 1px solid var(--line); }
.footer-in { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 32px; }
.site-footer h2 { font-size: 1.25rem; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--ink); display: inline-block; min-width: 60%; }
.site-footer a { color: var(--ink); text-decoration: none; }
.site-footer a:hover { color: var(--red); text-decoration: underline; }
.footer-logo { width: 220px; margin-bottom: 18px; }
.footer-menu { list-style: none; margin: 0; padding: 0; }
.footer-menu a { display: inline-block; padding-block: 3px; }
.social { display: flex; gap: 8px; }
.social a { width: 44px; height: 44px; display: grid; place-items: center; background: #3b5998; color: #fff; border-radius: 4px; }
.social a + a { background: #0a66c2; }
.social a:hover { color: #fff; opacity: .88; }
.social svg { width: 22px; height: 22px; }
@media (max-width: 760px) { .footer-in { grid-template-columns: 1fr; } }

/* ---------- phones: call and quote bar ---------- */
.callbar { display: none; }
@media (max-width: 760px) {
  .callbar { display: grid; grid-template-columns: 1fr 1fr; position: fixed; inset: auto 0 0 0; z-index: 50; padding-bottom: env(safe-area-inset-bottom); background: var(--red); box-shadow: 0 -2px 10px rgba(0, 0, 0, .2); }
  .callbar a { display: flex; align-items: center; justify-content: center; min-height: 54px; font: 700 1.0625rem/1 var(--head); text-decoration: none; color: #fff; background: var(--red); }
  .callbar a + a { background: var(--yellow); color: var(--ink-strong); }
  body { padding-bottom: calc(54px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .tile img, .btn { transition: none; } .tile:hover img { transform: none; } }
