/* ============================================================
   EP Engineered Clays — Corporate modern, blue/charcoal
   ============================================================ */
:root{
  /* palette */
  --ink:#0A0F19;
  --ink-2:#11192A;
  --navy:#0E2240;
  --blue:#1F4E8C;        /* EP brand blue (from logo) */
  --blue-2:#2E66B0;
  --blue-tint:#E8EEF6;
  --slate:#445268;
  --slate-2:#6B7787;
  --rule:#D7D2C7;
  --rule-2:#E6E2D9;
  --paper:#F5F3EE;       /* warm mineral white */
  --paper-2:#EDE9DF;
  --white:#FFFFFF;
  --amber:#C9824A;       /* mineral accent — adsorbent/oil cue */
  --amber-tint:#F2E7D9;
  --rust:#8E4A2B;
  --green-tag:#3E6E4A;

  /* type */
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;

  /* layout — overridden by density tweak */
  --max: 1320px;
  --gutter: 32px;
  --section-py: 96px;
  --section-py-tight: 56px;
  --header-h: 72px;
  --card-py: 24px;
  --grid-gap: 16px;
  --footer-py: 64px;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:var(--sans);
  background:var(--paper);
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  line-height:1.55;
}
img{display:block;max-width:100%;}
a{color:inherit;text-decoration:none;}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;}

/* ---------- typography ---------- */
.eyebrow{
  font-family:var(--mono);
  font-size:11px;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--slate);
  font-weight:500;
}
.eyebrow .num{color:var(--blue);}
h1,h2,h3,h4{font-weight:500; letter-spacing:-0.02em; margin:0;}
.display{
  font-size:clamp(48px,7.2vw,116px);
  line-height:0.96;
  letter-spacing:-0.035em;
  font-weight:400;
}
.display em{font-family:var(--serif); font-style:italic; font-weight:400;}
.h1{font-size:clamp(40px,4.6vw,68px); line-height:1.02; letter-spacing:-0.028em;}
.h2{font-size:clamp(28px,2.6vw,40px); line-height:1.08; letter-spacing:-0.022em;}
.h3{font-size:22px; line-height:1.2; letter-spacing:-0.012em;}
.lead{font-size:19px; line-height:1.6; color:var(--slate); max-width:62ch;}
.tiny{font-family:var(--mono); font-size:11px; letter-spacing:0.08em; color:var(--slate-2); text-transform:uppercase; white-space:nowrap;}

/* ---------- container + layout ---------- */
.container{max-width:var(--max); margin:0 auto; padding:0 var(--gutter);}
.section{padding:var(--section-py) 0;}
.section-tight{padding:var(--section-py-tight) 0;}
.divider{height:1px; background:var(--rule); border:0;}
.divider-2{height:1px; background:var(--rule-2); border:0;}

/* ---------- header ---------- */
.site-header{
  position:sticky; top:0; z-index:50;
  background:rgba(245,243,238,.86);
  backdrop-filter:saturate(140%) blur(10px);
  border-bottom:1px solid var(--rule);
}
.site-header .row{
  display:flex; align-items:center; justify-content:space-between;
  height:var(--header-h);
}
.brand{display:flex; align-items:center; gap:12px;}
.brand img{height:38px; width:auto;}
.nav{display:flex; gap:2px;}
.nav a{
  padding:10px 14px; font-size:14px; color:var(--ink); font-weight:500;
  border-radius:6px; position:relative;
}
.nav a:hover{background:var(--paper-2);}
.nav a.active{color:var(--blue);}
.nav a.active::after{
  content:""; position:absolute; left:14px; right:14px; bottom:4px; height:2px; background:var(--blue);
}
.header-cta{display:flex; gap:10px; align-items:center;}
.nav-toggle{
  display:none; width:42px; height:42px; align-items:center; justify-content:center;
  border-radius:8px; color:var(--ink); margin-left:4px;
  border:1px solid transparent;
}
.nav-toggle:hover{background:var(--paper-2);}
.nav-toggle:active{transform:scale(.96);}

/* ---------- Mobile nav drawer (hidden by default; shown on small screens) ---------- */
.nav-drawer{
  position:absolute; left:0; right:0; top:100%;
  background:var(--paper);
  border-bottom:1px solid var(--rule);
  box-shadow:0 16px 32px -24px rgba(10,15,25,.25);
  overflow:hidden;
  max-height:0; opacity:0; pointer-events:none;
  transition:max-height .28s ease, opacity .2s ease;
}
.nav-drawer.open{max-height:560px; opacity:1; pointer-events:auto;}
.nav-drawer .container{padding-top:8px; padding-bottom:18px;}
.nav-drawer-list{display:flex; flex-direction:column; gap:0; padding:6px 0;}
.nav-drawer-list a{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 4px; font-size:17px; font-weight:500;
  color:var(--ink); border-bottom:1px solid var(--rule-2);
}
.nav-drawer-list a:last-child{border-bottom:0;}
.nav-drawer-list a.active{color:var(--blue);}
.nav-drawer-list a:hover{background:transparent;}
.nav-drawer-arrow{display:inline-flex; color:var(--slate-2); transition:transform .15s ease;}
.nav-drawer-list a:hover .nav-drawer-arrow{transform:translateX(3px); color:var(--blue);}
.nav-drawer-actions{display:flex; flex-direction:column; gap:10px; margin-top:14px;}
.nav-drawer-actions .btn{justify-content:center; width:100%;}

/* ---------- buttons ---------- */
.btn{
  display:inline-flex; align-items:center; gap:10px;
  padding:13px 22px; border-radius:999px;
  font-size:14px; font-weight:500; letter-spacing:-0.005em;
  transition:transform .15s ease, background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
  white-space:nowrap;
}
.btn-primary{background:var(--blue); color:#fff;}
.btn-primary:hover{background:var(--navy); transform:translateY(-1px);}
.btn-dark{background:var(--ink); color:#fff;}
.btn-dark:hover{background:#000; transform:translateY(-1px);}
.btn-ghost{border:1px solid var(--rule); color:var(--ink); background:transparent;}
.btn-ghost:hover{border-color:var(--ink); background:var(--white);}
.btn-light{background:#fff; color:var(--ink);}
.btn-light:hover{transform:translateY(-1px); box-shadow:0 8px 24px -12px rgba(10,15,25,.4);}
.btn-sm{padding:8px 14px; font-size:13px;}
.btn .arr{display:inline-block; transition:transform .2s ease;}
.btn:hover .arr{transform:translateX(3px);}
.link-arrow{
  display:inline-flex; align-items:center; gap:8px; font-weight:500; font-size:14px;
  color:var(--blue); border-bottom:1px solid transparent; padding-bottom:2px;
}
.link-arrow:hover{border-color:var(--blue);}
.link-arrow .arr{transition:transform .2s ease;}
.link-arrow:hover .arr{transform:translateX(3px);}

/* ---------- chips / pills ---------- */
.chip{
  display:inline-flex; align-items:center; gap:8px;
  padding:6px 12px; border-radius:999px;
  background:var(--paper-2); border:1px solid var(--rule);
  font-size:12px; font-weight:500; color:var(--ink);
  font-family:var(--mono); letter-spacing:0.02em;
  white-space:nowrap;            /* don't break mid-label — wrap as a unit */
}
.chip.solid{background:var(--ink); color:#fff; border-color:var(--ink);}
.chip.blue{background:var(--blue-tint); color:var(--blue); border-color:#C8D5E7;}
.chip.amber{background:var(--amber-tint); color:var(--rust); border-color:#E8D0B0;}
.chip.dot::before{content:""; width:6px; height:6px; border-radius:50%; background:currentColor;}

/* ---------- cards ---------- */
.card{
  background:#fff; border:1px solid var(--rule); border-radius:14px;
  overflow:hidden; transition:box-shadow .25s ease, transform .25s ease, border-color .2s ease;
}
.card:hover{box-shadow:0 18px 42px -28px rgba(14,34,64,.35); transform:translateY(-2px); border-color:#C8C2B4;}
.card-body{padding:var(--card-py);}
.card-img{aspect-ratio:4/3; background:var(--paper-2); position:relative; overflow:hidden;}
.card-img img{width:100%; height:100%; object-fit:cover;}

/* ---------- placeholder image (striped) ---------- */
.ph{
  position:relative; overflow:hidden;
  background:
    repeating-linear-gradient(135deg,
      #ECE7DB 0 12px,
      #E2DDD0 12px 24px);
  display:flex; align-items:center; justify-content:center;
  color:var(--slate);
}
.ph .ph-label{
  font-family:var(--mono); font-size:11px; letter-spacing:0.14em; text-transform:uppercase;
  background:rgba(245,243,238,.92); padding:6px 12px; border:1px solid var(--rule);
  color:var(--slate);
}

/* ---------- footer ---------- */
.footer{
  background:var(--ink); color:#D7DCE4; padding:var(--footer-py) 0 28px;
}
.footer h4{color:#fff; font-size:13px; text-transform:uppercase; letter-spacing:0.12em; font-family:var(--mono); font-weight:500; margin:0 0 16px;}
.footer a{color:#A4B0C2; font-size:14px; display:block; padding:5px 0;}
.footer a:hover{color:#fff;}
.footer-grid{display:grid; grid-template-columns:2.4fr 1fr 1fr 1fr 1fr; gap:48px;}
.footer-bottom{
  display:flex; justify-content:space-between; align-items:center;
  margin-top:48px; padding-top:24px; border-top:1px solid #1F2735;
  font-family:var(--mono); font-size:11px; letter-spacing:0.1em; color:#5D6A7E; text-transform:uppercase;
}

/* ---------- form ---------- */
.field{display:flex; flex-direction:column; gap:6px;}
.field label{font-size:12px; font-family:var(--mono); letter-spacing:0.06em; text-transform:uppercase; color:var(--slate);}
.input, .select, .textarea{
  width:100%; padding:13px 14px; border:1px solid var(--rule); border-radius:8px;
  font:inherit; font-size:14px; background:#fff; color:var(--ink); outline:none;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus{
  border-color:var(--blue); box-shadow:0 0 0 3px rgba(31,78,140,.12);
}
.textarea{min-height:120px; resize:vertical; font-family:inherit;}

/* ---------- spec list / data grid ---------- */
.spec{display:grid; grid-template-columns:1fr auto; gap:12px; padding:14px 0; border-bottom:1px dashed var(--rule);}
.spec:last-child{border-bottom:0;}
.spec dt{font-size:13px; color:var(--slate);}
.spec dd{font-family:var(--mono); font-size:13px; color:var(--ink); margin:0; font-weight:500;}

/* ---------- animations ---------- */
@keyframes fadeUp{
  from{opacity:0; transform:translateY(12px);}
  to{opacity:1; transform:translateY(0);}
}
.fade-up{animation:fadeUp .5s ease both;}
@keyframes blink{ 0%,49%{opacity:1} 50%,100%{opacity:0} }
.blink{animation:blink 1.1s steps(2) infinite;}

/* ---------- utility ---------- */
.row-flex{display:flex; align-items:center;}
.gap-8{gap:8px;} .gap-12{gap:12px;} .gap-16{gap:16px;} .gap-24{gap:24px;} .gap-32{gap:32px;}
.muted{color:var(--slate);}
.mono{font-family:var(--mono);}

/* ============================================================
   Responsive
   ============================================================
   Note on the attribute selectors below ([style*="..."]) — the site
   uses React inline styles for almost every layout grid, so we
   intercept them by string-matching the rendered style attribute
   and overriding with !important. Brittle if the inline values
   change, but it lets us mobile-ify without touching every JSX.
   ============================================================ */

/* ---------- Tablet (≤1024px) ---------- */
@media (max-width: 1024px){
  :root{
    --section-py:72px;
    --section-py-tight:40px;
    --gutter:24px;
  }
  /* 4-col → 2-col (plants, footer) */
  [style*="grid-template-columns: repeat(4, 1fr)"]{
    grid-template-columns:repeat(2, 1fr) !important;
  }
  /* 5-col footer → 3-col */
  .footer-grid{grid-template-columns:2fr 1fr 1fr; gap:32px;}
  .footer-grid > div:first-child{grid-column:1 / -1;}
}

/* ---------- Header reflow zone (≤960px): hide desktop nav, show hamburger ---------- */
@media (max-width: 960px){
  .nav{display:none;}
  .nav-toggle{display:inline-flex;}
  /* Drop datasheet CTA at this width to make room — drawer carries it */
  .header-datasheets{display:none;}
  .header-cta .btn-sm{padding:9px 13px; font-size:13px;}
}

/* ---------- Phone (≤640px): hide the Quote button too — drawer has both ---------- */
@media (max-width: 640px){
  .header-quote{display:none;}
}

/* ---------- Phone / small tablet (≤780px) ---------- */
@media (max-width: 780px){
  :root{
    --max:100%;
    --gutter:18px;
    --section-py:56px;
    --section-py-tight:32px;
    --header-h:60px;
    --card-py:18px;
    --grid-gap:12px;
    --footer-py:48px;
  }

  html, body{overflow-x:hidden;}

  /* --- typography: bump floors so the display type stays readable --- */
  .display{font-size:clamp(38px, 10vw, 116px) !important; line-height:1.02; letter-spacing:-0.025em;}
  .h1{font-size:clamp(28px, 7vw, 68px) !important; line-height:1.08;}
  .h2{font-size:clamp(22px, 5.6vw, 40px) !important; line-height:1.15;}
  .h3{font-size:18px !important;}
  .lead{font-size:16px !important; line-height:1.55;}

  /* --- header --- */
  .site-header .row{gap:10px;}
  .nav{display:none;}
  .nav-toggle{display:inline-flex;}          /* show hamburger */
  .header-cta .btn{padding:10px 14px; font-size:13px;}
  .brand img{height:30px;}

  /* --- container --- */
  .container{padding-left:18px !important; padding-right:18px !important;}
  .section{padding:56px 0 !important;}
  .section-tight{padding:32px 0 !important;}

  /* --- buttons: enforce 44px touch target --- */
  .btn{min-height:44px; padding:12px 18px;}
  .btn-sm{min-height:40px; padding:10px 14px;}

  /* --- collapse every 2-col / 3-col / 4-col / 5-col inline grid --- */
  [style*="grid-template-columns: 1.1fr 1fr"],
  [style*="grid-template-columns:1.1fr 1fr"],
  [style*="grid-template-columns: 1.4fr 1fr"],
  [style*="grid-template-columns:1.4fr 1fr"],
  [style*="grid-template-columns: 1fr 1.4fr"],
  [style*="grid-template-columns:1fr 1.4fr"],
  [style*="grid-template-columns: 1fr 1.2fr"],
  [style*="grid-template-columns:1fr 1.2fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns:repeat(3, 1fr)"],
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns:repeat(4, 1fr)"],
  [style*="grid-template-columns: repeat(2, 1fr)"],
  [style*="grid-template-columns:repeat(2, 1fr)"],
  [style*="grid-template-columns: auto 1fr auto auto auto"],
  [style*="grid-template-columns: auto 1fr auto auto"]{
    grid-template-columns:1fr !important;
    gap:24px !important;
  }

  /* Hero grid wants a smaller stack gap so the Solution Finder sits closer */
  section [style*="grid-template-columns: 1.1fr 1fr"]:not(.container){
    gap:40px !important;
  }
  /* the hero IS a .container — handle it too */
  .container[style*="grid-template-columns: 1.1fr 1fr"],
  .container[style*="grid-template-columns: 1fr 1fr"]{
    gap:40px !important;
  }

  /* Right-aligned "Find your grade in 3 steps" caption — go left */
  .mono[style*="justify-content: flex-end"]{
    justify-content:flex-start !important;
  }

  /* --- stacked items lose their right divider, gain a bottom one --- */
  [style*="border-right: 1px solid var(--rule)"],
  [style*="border-right:1px solid var(--rule)"],
  [style*="border-right: 1px solid var(--rule-2)"],
  [style*="border-right:1px solid var(--rule-2)"]{
    border-right:none !important;
    border-bottom:1px solid var(--rule-2);
    padding-bottom:20px;
    padding-left:0 !important;
  }
  [style*="border-right: 1px solid #1F2735"],
  [style*="border-right:1px solid #1F2735"]{
    border-right:none !important;
    border-bottom:1px solid #1F2735;
    padding-bottom:24px;
  }

  /* Editorial 3-pillar cards — tighten padding when stacked */
  [style*="padding: 40px 32px 40px"]{
    padding:28px 4px !important;
  }

  /* StatRow cells */
  [style*="padding: 28px 24px"]{
    padding:22px 16px !important;
  }

  /* --- footer collapses fully --- */
  .footer-grid{grid-template-columns:1fr !important; gap:32px !important;}
  .footer-grid > div:first-child{grid-column:auto !important;}
  .footer-bottom{flex-direction:column; align-items:flex-start; gap:10px; text-align:left;}

  /* --- forms span full width, double-col field rows stack --- */
  .field{width:100%;}

  /* --- product detail drawer: full-width, smaller padding --- */
  /* the drawer wrapper is min(720px, 100%) — already responsive,
     but the inner 32px padding is too wide for narrow phones */
  [style*="padding: 32px;"]{padding:22px !important;}
  [style*="padding: 22px 32px"]{padding:18px 20px !important;}

  /* --- marquee text: smaller --- */

  /* --- tweaks panel button: don't cover content --- */
  /* (TweaksPanel renders its own positioning — leave its FAB alone,
     just make sure CTA-strip buttons can be full-width) */
  section[style*="background: var(--blue)"] .btn-light,
  section[style*="background: var(--blue)"] .btn-ghost{
    flex:1; justify-content:center; min-width:0;
  }
  section[style*="background: var(--blue)"] .row-flex{
    width:100%;
  }

  /* --- chips inside hero meta strip --- */
  .chip{font-size:11px; padding:5px 10px;}

  /* --- spec dl spacing --- */
  .spec{padding:11px 0;}
}

/* ---------- Small phones (≤420px) ---------- */
@media (max-width: 420px){
  :root{
    --gutter:14px;
    --section-py:44px;
  }
  .display{font-size:34px !important; line-height:1.04;}
  .h1{font-size:26px !important;}
  .h2{font-size:20px !important;}
  .lead{font-size:15px !important;}

  .container{padding-left:14px !important; padding-right:14px !important;}

  .header-cta .btn{padding:8px 12px; font-size:12px;}
  .brand img{height:26px;}

  .btn{font-size:13px; padding:11px 14px;}
  .btn-sm{font-size:12px; padding:9px 12px;}

  /* CTA strip stacks its buttons */
  section[style*="background: var(--blue)"] .row-flex{flex-direction:column;}
  section[style*="background: var(--blue)"] .btn{width:100%;}

  /* Distributor row: 5-col grid was already collapsed to 1fr above;
     make the inner buttons full-width when stacked */
  [style*="grid-template-columns: auto 1fr auto auto auto"] .btn{
    width:100%; justify-content:flex-start;
  }
}

/* ---------- Reduce motion respect ---------- */
@media (prefers-reduced-motion: reduce){
  *{animation-duration:0.01ms !important; animation-iteration-count:1 !important; transition-duration:0.01ms !important;}
}
