/* Alan Industrial Services — 2026 rebuild
   Palette derives from the original site: slate #576776, deep navy #213344,
   pale panel #ebf4fa, and the slogan red #7f221f as the accent. */

:root {
  --navy: #182838;
  --navy-2: #213344;
  --slate: #576776;
  --slate-light: #8496a5;
  --panel: #eef3f7;
  --panel-2: #f8fafc;
  --white: #ffffff;
  --accent: #9c2b26;
  --accent-hover: #7f221f;
  --ink: #1a2531;
  --ink-soft: #4a5866;
  --line: #dbe3ea;

  --wrap: 1140px;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(24, 40, 56, .08), 0 8px 24px rgba(24, 40, 56, .06);
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { line-height: 1.25; color: var(--navy); margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); letter-spacing: -.01em; }
h3 { font-size: 1.1rem; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.lede { font-size: 1.1rem; color: var(--ink-soft); max-width: 65ch; }
.muted { color: var(--ink-soft); }

/* Skip link — keyboard users */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px;
}
.skip:focus { left: 8px; top: 8px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Header ---------- */

.site-header {
  background: var(--navy);
  position: sticky; top: 0; z-index: 50;
  border-bottom: 3px solid var(--accent);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; min-height: 72px;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
/* Square badge, so height and width match */
.brand img { height: 44px; width: 44px; flex: none; }
@media (max-width: 480px) { .brand img { height: 38px; width: 38px; } }
.brand-text { color: #fff; font-weight: 600; letter-spacing: .01em; line-height: 1.2; }
.brand-text small {
  display: block; font-weight: 400; font-size: .72rem;
  color: var(--slate-light); letter-spacing: .06em; text-transform: uppercase;
}

.nav-toggle {
  display: none; background: none; border: 1px solid #3a4b5d;
  color: #fff; border-radius: var(--radius); padding: 8px 12px;
  font-size: .9rem; cursor: pointer;
}

.nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: block; padding: 10px 14px; border-radius: var(--radius);
  color: #cdd8e2; text-decoration: none; font-size: .95rem; font-weight: 500;
}
.nav a:hover { background: #24374a; color: #fff; }
.nav a[aria-current="page"] { background: var(--accent); color: #fff; }

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--navy-2); border-bottom: 3px solid var(--accent);
  }
  .nav.open { display: block; }
  .nav ul { flex-direction: column; padding: 8px; }
  .nav a { padding: 12px 14px; }
}

/* ---------- Hero ---------- */

.hero {
  background: linear-gradient(rgba(24, 40, 56, .82), rgba(24, 40, 56, .88)),
              url("../img/refinery.jpg") center/cover no-repeat;
  color: #fff; padding: clamp(56px, 9vw, 104px) 0;
}
.hero h1 { color: #fff; max-width: 18ch; }
.hero p { font-size: 1.15rem; color: #cbd6e0; max-width: 58ch; margin: 0 0 28px; }
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: #e8b4b1; margin-bottom: 14px;
}

.page-head { background: var(--panel); border-bottom: 1px solid var(--line); padding: 44px 0; }
.page-head h1 { margin-bottom: .3em; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block; padding: 12px 24px; border-radius: var(--radius);
  font-weight: 600; text-decoration: none; font-size: .98rem;
  border: 2px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { border-color: #5c6f81; color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Prose sections ----------
   Long-form copy: capped to a readable measure, with subheadings that sit
   under their heading rather than competing with it. */

.prose { max-width: 72ch; }
.prose > p { margin: 0 0 1.1em; color: var(--ink-soft); }
.prose > h2 { margin-bottom: .3em; }
.prose > h3 {
  font-size: 1.05rem; font-weight: 600; color: var(--slate);
  margin: 0 0 1em;
}
/* a subheading introducing a later block needs air above it… */
.prose > * + h3 { margin-top: 1.9em; }
/* …but one sitting directly under its own heading does not */
.prose > h2 + h3 { margin-top: 0; }
.prose > ul { margin: 0 0 1.3em; }

/* ---------- Sections & grids ---------- */

section { padding: clamp(44px, 6vw, 72px) 0; }
.section-tint { background: var(--panel-2); border-block: 1px solid var(--line); }
.section-head { max-width: 65ch; margin-bottom: 36px; }

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
}
.card h3 { margin-bottom: .4em; }
.card p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.card-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--panel); color: var(--navy);
  font-weight: 700; font-size: .95rem; margin-bottom: 14px;
}

.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: 44px; align-items: center; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; gap: 28px; } }
.split img { border-radius: var(--radius); box-shadow: var(--shadow); }
/* Two images stacked in the split's image column, side by side. Equal width
   and both being landscape keeps their heights near-matched with no cropping. */
.img-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.img-pair img { width: 100%; height: auto; }
@media (max-width: 480px) { .img-pair { grid-template-columns: 1fr; } }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; }
.stat { text-align: center; padding: 22px 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.stat b { display: block; font-size: 2rem; color: var(--navy); line-height: 1.1; }
.stat span { font-size: .85rem; color: var(--ink-soft); }

/* Checklist */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { position: relative; padding: 0 0 12px 30px; color: var(--ink-soft); }
.checklist li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  color: var(--accent); font-weight: 700;
}

/* Industry tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.tile {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 18px 20px; font-weight: 600; color: var(--navy);
}

/* Tiles that link through to the product list */
a.tile { display: block; text-decoration: none; }
a.tile:hover,
a.tile:focus-visible {
  background: var(--panel); color: var(--accent);
  border-left-color: var(--accent-hover); box-shadow: var(--shadow);
}

/* ---------- Sub-navigation ----------
   Mirrors the original site's Products | Brands sub-nav. */

.sub-nav {
  display: flex; gap: 2px; flex-wrap: wrap;
  margin: 0 0 26px; border-bottom: 1px solid var(--line);
}
.sub-nav a {
  padding: 10px 20px; text-decoration: none; font-weight: 600; font-size: .96rem;
  color: var(--ink-soft); border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.sub-nav a:hover { color: var(--accent); }
.sub-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Products ---------- */

.filter-bar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  margin-bottom: 24px; padding: 18px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.filter-bar input {
  flex: 1 1 260px; padding: 11px 14px; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--slate-light); border-radius: var(--radius); background: #fff;
}
.count { font-size: .9rem; color: var(--ink-soft); white-space: nowrap; }

.product-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px;
}
.product-list li {
  padding: 10px 14px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); font-size: .93rem; color: var(--ink-soft);
}
.product-list li mark { background: #ffe9a8; color: var(--ink); padding: 0 1px; }
.empty-state { padding: 30px; text-align: center; color: var(--ink-soft); }
[hidden] { display: none !important; }

/* ---------- Contact ---------- */

.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; align-items: start; }
/* The form is first in the source (see contact.html) so the single-column phone
   layout leads with it. Side by side there is no "first", so put the address
   back on the left where it has always been. */
@media (min-width: 821px) {
  .contact-grid > .address-card { grid-column: 1; grid-row: 1; }
  .contact-grid > [data-contact-form] { grid-column: 2; grid-row: 1; }
}
@media (max-width: 820px) { .contact-grid { grid-template-columns: 1fr; gap: 32px; } }

/* Links land on #enquiry; without this the sticky header sits over the heading. */
[data-contact-form] { scroll-margin-top: 88px; }

.address-card {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 28px;
}
.address-card address { font-style: normal; line-height: 1.9; color: var(--ink-soft); }
.address-card .label {
  font-size: .75rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--slate); margin-bottom: 10px;
}

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--navy); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--slate-light); border-radius: var(--radius); background: #fff;
}
.field textarea { min-height: 130px; resize: vertical; }
.field .hint { font-size: .82rem; color: var(--ink-soft); margin-top: 4px; }
.form-note {
  background: #fff8e6; border: 1px solid #f0dca8; border-radius: var(--radius);
  padding: 14px 16px; font-size: .88rem; color: #6b5518; margin-bottom: 22px;
}

/* Contact form is hidden when config.js sets contactForm.enabled = false */
.no-contact-form [data-contact-form] { display: none; }
.no-contact-form .contact-grid { grid-template-columns: 1fr; max-width: 640px; }

/* ---------- Enquiry dialog ----------
   Opened by the call-to-action buttons instead of sending people to the
   contact page. The nav and footer links still navigate normally. */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(24, 40, 56, .62);
  display: grid; place-items: center; padding: 20px;
  overflow-y: auto;
  /* If the dialog is taller than the space available, align to the top so the
     heading stays reachable instead of being clipped off the top edge. */
  align-items: start;
}
@media (min-height: 760px) {
  .modal-backdrop { align-items: center; }
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: #fff; border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(15, 26, 38, .35);
  width: 100%; max-width: 560px;
  max-height: calc(100vh - 40px);
  /* dvh tracks the genuinely visible area on mobile, where 100vh is taller
     than the screen and would push the buttons out of reach */
  max-height: calc(100dvh - 40px);
  overflow-y: auto; padding: 28px 28px 30px;
  overscroll-behavior: contain;
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 6px;
}
.modal-head h2 { margin: 0; font-size: 1.35rem; }
.modal-intro { color: var(--ink-soft); font-size: .95rem; margin: 0 0 20px; }

.modal-close {
  flex: none; background: none; border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink-soft);
  width: 34px; height: 34px; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: var(--panel); color: var(--accent); border-color: var(--slate-light); }

.modal .field:last-of-type { margin-bottom: 22px; }
.modal-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.modal-actions .btn { cursor: pointer; }

.modal-status {
  margin: 18px 0 0; padding: 14px 16px; border-radius: var(--radius);
  font-size: .92rem; line-height: 1.5;
}
.modal-status[hidden] { display: none; }
.modal-status.is-working { background: var(--panel); color: var(--ink-soft); }
.modal-status.is-ok { background: #e8f4ec; border: 1px solid #b8dcc6; color: #1f5133; }
.modal-status.is-problem { background: #fdecea; border: 1px solid #f2c2bc; color: #8a2318; }
.modal-status a { color: inherit; }

@media (max-width: 560px) {
  .modal { padding: 22px 20px 24px; }
}

/* ---------- CTA band ---------- */

.cta {
  background: var(--navy); color: #fff; text-align: center;
  padding: clamp(44px, 6vw, 72px) 0;
}
.cta h2 { color: #fff; }
.cta p { color: #cbd6e0; max-width: 55ch; margin: 0 auto 26px; }

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

.site-footer { background: var(--navy-2); color: #a9bacb; padding: 48px 0 24px; font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1.4fr; gap: 36px; }
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr; gap: 26px; } }
.site-footer h4 {
  color: #fff; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
  margin: 0 0 14px;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { color: #a9bacb; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer address { font-style: normal; line-height: 1.8; }
.footer-bottom {
  margin-top: 36px; padding-top: 20px; border-top: 1px solid #35485c;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: .85rem; color: #7e93a7;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
