/* ==========================================================================
   Appalachian Tool & Machine, Inc. — Modern Mechanical UI
   Brand palette preserved: deep blue, cream, graphite.
   ========================================================================== */

:root {
  --blue-900: #0c3d5d;
  --blue-800: #0f4d78;
  --blue-700: #1761b5;
  --blue-600: #1779ba;
  --blue-500: #2d8fd8;
  --blue-300: #6fb8e8;

  --cream: #faf3dd;
  --cream-2: #f4ecd8;
  --graphite: #383838;
  --graphite-2: #22262a;
  --graphite-3: #14181c;

  --steel: #cacaca;
  --steel-dark: #8a8a8a;
  --white: #fefefe;
  --accent: #d8a24a;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-soft: 0 4px 18px rgba(0,0,0,.18);
  --ease: cubic-bezier(.22,.8,.28,1);

  --font-display: "Barlow Condensed", "Raleway", system-ui, sans-serif;
  --font-body: "Inter", "Raleway", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--graphite);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-700); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--blue-500); }

h1,h2,h3,h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.15;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(1.9rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.6vw, 2.5rem); }
h3 { font-size: clamp(1.15rem, 2.4vw, 1.6rem); }
h4 { font-size: clamp(1rem, 2vw, 1.25rem); }
p { margin: 0 0 1em; }

hr {
  border: 0; height: 3px; width: 90px;
  background: var(--blue-600);
  margin: 18px auto; border-radius: 2px;
}
::selection { background: var(--blue-600); color: var(--cream); }

/* ------------------------------ Layout ------------------------------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 900px; }
section { padding: 64px 0; position: relative; }
section.tight { padding: 40px 0; }
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.text-center { text-align: center; }

/* ------------------------------ Header ------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(12,61,93,.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(111,184,232,.22);
  transition: background .3s var(--ease), box-shadow .3s var(--ease);
}
.site-header.scrolled { background: rgba(10,30,48,.98); box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 24px; max-width: 1200px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 42px; width: auto; }
.brand-name {
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 700;
  letter-spacing: .12em; color: var(--cream); text-transform: uppercase; white-space: nowrap;
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  font-family: var(--font-display); font-size: .95rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--cream-2);
  padding: 10px 14px; border-radius: var(--radius-sm); position: relative;
}
.nav a:hover { color: var(--white); background: rgba(111,184,232,.12); }
.nav a.active { color: var(--white); }
.nav a.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 5px;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.nav-toggle {
  display: none; background: transparent; border: 1px solid rgba(250,243,221,.35);
  color: var(--cream); border-radius: var(--radius-sm); padding: 9px 12px;
  font-size: 1.1rem; cursor: pointer;
}
.nav-toggle:hover { background: rgba(111,184,232,.15); }

/* ------------------------------- Hero -------------------------------- */
.hero {
  position: relative; min-height: 78vh; display: flex; align-items: center;
  overflow: hidden; background: var(--blue-900); isolation: isolate;
}
.hero-media {
  position: absolute; inset: 0;
  background: url("../img/home-hero-bg.jpg") center center / cover no-repeat;
  opacity: .55; z-index: -3;
}
.hero-scrim {
  position: absolute; inset: 0; z-index: -2;
  background: linear-gradient(160deg, rgba(12,61,93,.88) 0%, rgba(12,61,93,.55) 45%, rgba(20,24,28,.82) 100%);
}
.particle-field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; pointer-events: none; }
.hero-copy { position: relative; z-index: 1; width: 100%; padding: 40px 0; }
.eyebrow {
  font-family: var(--font-mono); font-size: .78rem; letter-spacing: .28em;
  text-transform: uppercase; color: var(--blue-300); margin-bottom: 14px;
}
.hero h1 { color: var(--cream); text-shadow: 0 2px 26px rgba(0,0,0,.55); margin-bottom: .35em; }
.hero .lede {
  color: var(--cream-2); font-size: clamp(1rem, 2.2vw, 1.28rem);
  max-width: 62ch; margin: 0 auto 26px;
}
.hero-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
  gap: 14px; margin-top: 30px;
}
.stat {
  background: rgba(8,28,44,.62); border: 1px solid rgba(111,184,232,.3);
  border-radius: var(--radius); padding: 16px 18px; text-align: center;
  backdrop-filter: blur(6px);
}
.stat .value {
  font-family: var(--font-display); font-size: clamp(1.5rem,3.4vw,2.1rem);
  font-weight: 700; color: var(--cream); display: block;
}
.stat .label {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--blue-300);
}

/* --------------------------- Page hero ------------------------------- */
.page-hero {
  position: relative; padding: 92px 0 72px; background: var(--blue-900);
  overflow: hidden; isolation: isolate;
}
.page-hero .hero-scrim { z-index: -2; }
.page-hero h1 { color: var(--cream); position: relative; z-index: 1; }
.page-hero p { color: var(--cream-2); position: relative; z-index: 1; }

/* ------------------------- Buttons / cards --------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 14px 26px; border-radius: var(--radius-sm);
  background: var(--blue-700); color: var(--white);
  border: 1px solid transparent; cursor: pointer;
  transition: background .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { background: var(--blue-500); color: var(--white); transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.btn-ghost { background: transparent; border: 1px solid rgba(250,243,221,.5); color: var(--cream); }
.btn-ghost:hover { background: rgba(250,243,221,.12); color: var(--white); }
.btn-accent { background: var(--accent); color: var(--graphite-3); }
.btn-accent:hover { background: #e6b463; color: var(--graphite-3); }

.card {
  background: var(--white); border: 1px solid var(--steel);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--blue-300); }
.card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.card .card-body { padding: 20px 22px 24px; flex: 1; }
.card h4 { color: var(--blue-900); margin-bottom: .3em; }
.card p { font-size: .95rem; color: var(--steel-dark); margin: 0; }

.card-dark { background: rgba(20,24,28,.85); border: 1px solid rgba(111,184,232,.28); color: var(--cream-2); }
.card-dark h4 { color: var(--cream); }

.icon-card {
  background: var(--white); border: 1px solid var(--steel);
  border-top: 3px solid var(--blue-700); border-radius: var(--radius);
  padding: 26px 22px; text-align: center;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.icon-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-soft); }
.icon-card img { height: 58px; width: auto; margin: 0 auto 14px; }
.icon-card h4 { color: var(--blue-900); font-size: 1.05rem; }

/* --------------------------- Section bands --------------------------- */
.band-blue { background: var(--blue-900); color: var(--cream-2); }
.band-blue h2, .band-blue h3 { color: var(--cream); }
.band-graphite { background: var(--graphite-3); color: var(--cream-2); }
.band-graphite h2, .band-graphite h3 { color: var(--cream); }
.band-cream { background: var(--cream); }
.band-steel { background: #f4f6f8; }

/* ------------------------ Equipment tables --------------------------- */
.equip-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px;
  position: sticky; top: 70px; z-index: 20; padding: 10px;
  background: rgba(244,246,248,.95); border-radius: var(--radius); border: 1px solid var(--steel);
}
.equip-tabs button {
  font-family: var(--font-display); font-size: .9rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; padding: 9px 16px;
  border-radius: 999px; border: 1px solid var(--steel); background: var(--white);
  color: var(--graphite); cursor: pointer; transition: all .2s var(--ease); white-space: nowrap;
}
.equip-tabs button:hover { border-color: var(--blue-600); color: var(--blue-700); }
.equip-tabs button[aria-selected="true"] { background: var(--blue-700); border-color: var(--blue-700); color: var(--white); }

.equip-panel { display: none; animation: fadeUp .45s var(--ease) both; }
.equip-panel.is-active { display: block; }

table.machines { width: 100%; border-collapse: collapse; margin-bottom: 28px; font-size: .95rem; }
table.machines caption {
  caption-side: top; text-align: left; font-family: var(--font-display);
  font-size: 1.15rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--blue-900); padding-bottom: 10px; border-bottom: 2px solid var(--blue-700);
}
table.machines th, table.machines td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--steel); }
table.machines thead th {
  background: var(--graphite-3); color: var(--cream); font-family: var(--font-mono);
  font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; border-bottom: 0;
}
table.machines tbody tr { transition: background .18s var(--ease); }
table.machines tbody tr:hover { background: rgba(23,97,181,.06); }
table.machines td.model { font-weight: 600; color: var(--graphite); }
table.machines td.spec { font-family: var(--font-mono); font-size: .88rem; color: var(--blue-800); white-space: nowrap; }
table.machines td.note { color: var(--steel-dark); font-size: .9rem; }

.tag {
  display: inline-block; font-family: var(--font-mono); font-size: .7rem;
  letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px;
  border-radius: 4px; background: rgba(23,97,181,.12); color: var(--blue-800);
  border: 1px solid rgba(23,97,181,.3); margin-left: 6px; vertical-align: middle;
}
.tag.dual { background: rgba(216,162,74,.14); color: #805700; border-color: rgba(216,162,74,.45); }
.tag.swiss { background: rgba(130,209,115,.14); color: #157539; border-color: rgba(130,209,115,.45); }

/* ----------------------- Capability / feature blocks ----------------- */
.feature {
  background: var(--white); border: 1px solid var(--steel);
  border-left: 4px solid var(--blue-700); border-radius: var(--radius);
  padding: 22px 24px;
}
.feature h4 { color: var(--blue-900); margin-bottom: .35em; }
.feature p { color: var(--steel-dark); font-size: .95rem; margin: 0; }
.feature .num {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .2em;
  color: var(--blue-600); text-transform: uppercase; display: block; margin-bottom: 8px;
}

.envelope {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 18px;
}
.env-item {
  background: rgba(8,28,44,.5); border: 1px solid rgba(111,184,232,.28);
  border-radius: var(--radius); padding: 22px; text-align: center;
}
.env-item .big {
  font-family: var(--font-display); font-size: clamp(1.6rem,3.6vw,2.4rem);
  color: var(--cream); font-weight: 700; display: block; line-height: 1;
}
.env-item .desc {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--blue-300); margin-top: 8px;
}
.env-item .sub { color: var(--cream-2); font-size: .85rem; margin-top: 6px; opacity: .8; }

.industries { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.industry {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--cream);
  border: 2px solid rgba(111,184,232,.45); border-radius: var(--radius-sm);
  padding: 16px 30px; transition: all .25s var(--ease);
}
.industry:hover { background: rgba(111,184,232,.14); border-color: var(--blue-300); }

/* -------------------------- Contact / forms -------------------------- */
.contact-card {
  background: var(--white); border: 1px solid var(--steel);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-soft);
}
.contact-card h3 { color: var(--blue-900); margin-bottom: 1em; }
.contact-line { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.contact-line .k {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--blue-600); min-width: 90px; padding-top: 3px;
}
.contact-line .v { color: var(--graphite); }
.contact-line .v a { font-weight: 600; }

form.contact-form { display: grid; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--blue-800);
}
.field input, .field textarea, .field select {
  font-family: var(--font-body); font-size: 1rem; padding: 12px 14px;
  border: 1px solid var(--steel); border-radius: var(--radius-sm);
  background: #fff; color: var(--graphite); width: 100%;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(23,121,186,.18);
}
.field textarea { min-height: 130px; resize: vertical; }
.form-note { font-size: .82rem; color: var(--steel-dark); }
.form-status {
  font-size: .95rem; padding: 12px 14px; border-radius: var(--radius-sm);
  display: none; border: 1px solid transparent;
}
.form-status.ok { display: block; background: rgba(130,209,115,.15); border-color: #157539; color: #157539; }
.form-status.err { display: block; background: rgba(204,75,55,.12); border-color: #a53b2a; color: #a53b2a; }

/* ------------------------------- Footer ------------------------------ */
.site-footer { background: var(--graphite-3); color: var(--cream-2); padding: 56px 0 34px; }
.site-footer a { color: var(--cream-2); }
.site-footer a:hover { color: var(--white); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); gap: 30px; }
.footer-col h4 {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--blue-300); margin-bottom: 12px;
}
.footer-col p, .footer-col li { font-size: .9rem; line-height: 1.75; color: var(--cream-2); }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-bottom {
  margin-top: 34px; padding-top: 22px; border-top: 1px solid rgba(111,184,232,.2);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  font-size: .82rem; color: var(--steel-dark);
}
.footer-map { width: 100%; max-width: 380px; border-radius: var(--radius-sm); border: 1px solid rgba(111,184,232,.25); }
.footer-map iframe { width: 100%; height: 220px; border: 0; display: block; }

/* --------------------------- Reveal animation ------------------------ */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: translateY(0); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spinSlow { to { transform: rotate(360deg); } }

/* machined gear divider */
.gear-divider {
  height: 3px; background: repeating-linear-gradient(90deg,
    var(--blue-600) 0 18px, rgba(111,184,232,.25) 18px 34px);
  opacity: .55;
}

/* ----------------------------- Responsive ---------------------------- */
@media (max-width: 900px) {
  .nav { display: none; }
  .nav-toggle { display: block; }
  .nav.open {
    display: flex; flex-direction: column; position: absolute;
    top: 100%; left: 0; right: 0; background: rgba(10,30,48,.99);
    padding: 10px; border-bottom: 1px solid rgba(111,184,232,.25);
  }
  .nav.open a { padding: 12px 16px; border-radius: var(--radius-sm); }
  .header-inner { position: relative; }
  .brand-name { font-size: .95rem; letter-spacing: .08em; }
  .brand img { height: 34px; }
  .brand { flex: 1 1 auto; min-width: 0; overflow: hidden; }
  .brand-name { overflow: hidden; text-overflow: ellipsis; }
  section { padding: 46px 0; }
  .hero { min-height: 62vh; }
  .equip-tabs { position: static; }
  .footer-map { max-width: 100%; }
}

@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .header-inner { padding: 10px 16px; }
  .brand-name { display: none; }
  .brand img { height: 30px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  table.machines { font-size: .86rem; }
  table.machines th, table.machines td { padding: 9px 8px; }
  table.machines td.spec { white-space: normal; }
  .contact-line { flex-direction: column; gap: 4px; }
  .contact-line .k { min-width: 0; }
  .grid { gap: 14px; }
}

/* mobile card-stacked tables */
@media (max-width: 640px) {
  table.machines thead { display: none; }
  table.machines tbody tr {
    display: grid; grid-template-columns: 1fr; gap: 2px;
    padding: 12px 0; border-bottom: 1px solid var(--steel);
  }
  table.machines tbody td { border: 0; padding: 4px 0; }
  table.machines tbody td::before {
    content: attr(data-label);
    font-family: var(--font-mono); font-size: .66rem; letter-spacing: .12em;
    text-transform: uppercase; color: var(--steel-dark);
    display: block; margin-bottom: 2px;
  }
  table.machines tbody td.empty { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .particle-field { display: none; }
  html { scroll-behavior: auto; }
}
