/* JRM Aluminum — credibility site
   Palette: charcoal/steel/white + one accent (oxide red, echoing the ACM portfolio).
   No frameworks, no webfonts — system stack. */

:root {
  --charcoal: #1c1f22;
  --charcoal-soft: #2a2e33;
  --steel: #5c6670;
  --paper: #f5f4f2;
  --white: #ffffff;
  --line: #d8d6d2;
  --accent: #a63b2a;
  --maxw: 1160px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.0625rem; /* 17px */
  line-height: 1.6;
  color: var(--charcoal);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header ---------- */
.site-header {
  background: var(--charcoal);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 3px solid var(--accent);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}
.wordmark {
  color: var(--white);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.wordmark span { color: #aab4bd; font-weight: 400; }
.wordmark:hover, .wordmark:focus-visible { text-decoration: none; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid #4a525a;
  border-radius: 4px;
  color: var(--white);
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  min-height: 44px;
}
.site-nav ul { display: flex; gap: 1.75rem; list-style: none; }
.site-nav a {
  color: #d4d9dd;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  padding: 0.5rem 0;
  display: inline-block;
}
.site-nav a:hover, .site-nav a:focus-visible { color: var(--white); text-decoration: none; }
.site-nav a[aria-current="page"] {
  color: var(--white);
  border-bottom: 2px solid var(--accent);
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; width: 100%; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; padding: 0.5rem 0 1rem; }
  .site-nav a { display: block; padding: 0.75rem 0; font-size: 1.05rem; }
  .site-header .container { flex-wrap: wrap; padding-top: 0.5rem; padding-bottom: 0.5rem; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 66vh;
  display: flex;
  align-items: flex-end;
  color: var(--white);
  isolation: isolate;
}
.hero img.hero-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(to bottom, rgba(20, 22, 24, 0.25) 0%, rgba(20, 22, 24, 0.72) 100%);
}
.hero .container { padding-top: 6rem; padding-bottom: 3.5rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e6c8c0;
  margin-bottom: 0.75rem;
}
.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  line-height: 1.12;
  font-weight: 750;
  max-width: 18ch;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.hero .lead {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  max-width: 56ch;
  color: #e8eaec;
}

/* ---------- Page hero (non-image) ---------- */
.page-head {
  background: var(--charcoal);
  color: var(--white);
  padding: 3.5rem 0 2.75rem;
}
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.15; margin-bottom: 0.75rem; }
.page-head p { color: #c8cdd2; max-width: 62ch; font-size: 1.1rem; }

/* ---------- Sections ---------- */
.section { padding: clamp(3rem, 7vh, 5rem) 0; }
.section h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.2;
  margin-bottom: 1rem;
}
.section .intro { max-width: 62ch; color: var(--steel); margin-bottom: 2rem; font-size: 1.1rem; }
.section--dark { background: var(--charcoal); color: var(--white); }
.section--dark .intro { color: #b8bec4; }

.rule-note {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--steel);
  font-size: 0.98rem;
  max-width: 60ch;
}

/* ---------- Gallery grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }

.grid figure { margin: 0; }
.grid .frame {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--charcoal-soft);
  border-radius: 4px;
}
.num-badge {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 1;
  background: rgba(28, 31, 34, 0.88);
  color: var(--white);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
}
.grid figcaption .file { font-weight: 600; color: var(--charcoal); }
.grid figcaption .meta { display: block; font-size: 0.82rem; }
.tag-onsite {
  display: inline-block;
  background: var(--accent);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 650;
  padding: 0.05rem 0.45rem;
  border-radius: 3px;
  vertical-align: 0.08rem;
}
.grid .frame img { width: 100%; height: 100%; object-fit: cover; }
.grid figcaption {
  font-size: 0.92rem;
  color: var(--steel);
  padding: 0.6rem 0.15rem 0;
  line-height: 1.45;
}
.section--dark .grid figcaption { color: #aab2b9; }

/* ---------- What we do ---------- */
.scope { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: center; padding: 2.5rem 0; border-top: 1px solid var(--line); }
.scope:first-of-type { border-top: none; }
.scope h3 { font-size: 1.35rem; margin-bottom: 0.6rem; }
.scope p { color: var(--charcoal); max-width: 52ch; }
.scope .frame { aspect-ratio: 4 / 3; overflow: hidden; border-radius: 4px; }
.scope .frame img { width: 100%; height: 100%; object-fit: cover; }
.scope--text { grid-template-columns: 1fr; }
.scope--text p { max-width: 62ch; }
@media (max-width: 720px) {
  .scope { grid-template-columns: 1fr; gap: 1.25rem; }
}

/* ---------- Finish table ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 0.98rem; }
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--charcoal); color: var(--white); font-weight: 600; white-space: nowrap; }
tbody tr:nth-child(even) { background: #edecea; }

/* ---------- Contact ---------- */
.contact-block { display: flex; flex-direction: column; gap: 1.5rem; max-width: 34rem; }
.contact-line { font-size: 1.15rem; }
.contact-line .label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--steel);
  margin-bottom: 0.2rem;
}
.contact-line a {
  font-size: clamp(1.3rem, 3.5vw, 1.75rem);
  font-weight: 650;
  color: var(--charcoal);
  display: inline-block;
  padding: 0.25rem 0;
  min-height: 44px;
}
.contact-line a:hover, .contact-line a:focus-visible { color: var(--accent); }

/* ---------- Editorial elements ---------- */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.kicker::before { content: ""; width: 2rem; height: 2px; background: var(--accent); }
.section--dark .kicker, .page-head .kicker { color: #d9a297; }
.section--dark .kicker::before, .page-head .kicker::before { background: #d9a297; }

.fig-label {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 1rem;
}

/* Gallery hover */
.grid .frame img { transition: transform 0.45s ease; }
.grid figure:hover .frame img, .grid figure:focus-within .frame img { transform: scale(1.035); }
.grid figure { transition: transform 0.3s ease; }
.grid figure:hover { transform: translateY(-3px); }

/* Scroll reveal — scoped to html.js so content never hides without JS;
   motion collapses under reduced-motion */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; } }

/* ---------- Process timeline ---------- */
.timeline { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; counter-reset: step; }
.timeline li { position: relative; padding-top: 1.6rem; }
.timeline li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  background: var(--charcoal);
  color: var(--white);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}
.timeline li::after {
  content: "";
  position: absolute;
  top: 0.95rem;
  left: 2.6rem;
  right: -0.4rem;
  height: 2px;
  background: var(--line);
}
.timeline li:last-child::after { display: none; }
.timeline li:last-child::before { background: var(--accent); }
.timeline h3 { font-size: 1.02rem; margin: 0.9rem 0 0.25rem; }
.timeline p { font-size: 0.9rem; color: var(--steel); line-height: 1.45; }
@media (max-width: 900px) {
  .timeline { grid-template-columns: 1fr; gap: 0; }
  .timeline li { padding: 0 0 1.75rem 3rem; }
  .timeline li::before { top: 0; }
  .timeline li::after { top: 2.3rem; left: 0.95rem; right: auto; bottom: 0.3rem; width: 2px; height: auto; }
  .timeline h3 { margin-top: 0.2rem; }
}

/* ---------- Anatomy diagram ---------- */
.anatomy-scroll { overflow-x: auto; }
.anatomy-scroll svg { display: block; width: 100%; min-width: 640px; height: auto; }
.anatomy-legend { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.8rem 2rem; margin-top: 1.25rem; }
.anatomy-legend li { display: flex; gap: 0.7rem; align-items: baseline; font-size: 0.95rem; }
.anatomy-legend .n {
  flex: none;
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  font-size: 0.8rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  transform: translateY(0.25rem);
}
.anatomy-legend b { display: block; }
.anatomy-legend span.d { color: var(--steel); font-size: 0.88rem; }

/* ---------- Warranty range chart ---------- */
.chart { max-width: 46rem; }
.chart-row { display: grid; grid-template-columns: 11.5rem 1fr; gap: 1rem; align-items: center; padding: 0.55rem 0; }
.chart-row .c-label { font-size: 0.95rem; line-height: 1.3; }
.chart-row .c-label small { display: block; color: var(--steel); }
.c-track { position: relative; height: 14px; background: #e7e5e2; border-radius: 4px; }
.c-bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--accent); }
.c-bar.range { background: #d5a49a; }
.c-bar.plus { background: linear-gradient(to right, var(--accent) 55%, rgba(166, 59, 42, 0)); border-radius: 4px 0 0 4px; }
.c-val { position: absolute; left: calc(100% + 0.6rem); top: 50%; transform: translateY(-50%); font-size: 0.88rem; color: var(--charcoal); white-space: nowrap; }
.chart-axis { display: grid; grid-template-columns: 11.5rem 1fr; gap: 1rem; margin-top: 0.35rem; }
.chart-axis .ticks { position: relative; height: 1.3rem; font-size: 0.78rem; color: var(--steel); }
.chart-axis .ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.chart-note { font-size: 0.85rem; color: var(--steel); margin-top: 0.9rem; }
.chart-note .sw { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 3px; vertical-align: -0.1rem; margin-right: 0.3rem; }
@media (max-width: 640px) {
  .chart-row, .chart-axis { grid-template-columns: 1fr; gap: 0.3rem; }
  .chart-row { padding-bottom: 1rem; }
  .c-track { margin-right: 4.5rem; }
  .chart-axis .ticks { margin-right: 4.5rem; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--charcoal);
  color: #aab2b9;
  padding: 2.5rem 0;
  font-size: 0.95rem;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.5rem;
  justify-content: space-between;
  align-items: baseline;
}
.site-footer a { color: #d4d9dd; }
.site-footer .brand { color: var(--white); font-weight: 700; }
