/* ==========================================================================
   Brass Noir — luxury noir theme for CMR Construction Group
   Near-black ground, brushed-brass hairlines, ivory type, Didone display.
   ========================================================================== */

:root {
  --ink: #0b0a09;
  --ink-2: #13110f;
  --ink-3: #1c1916;
  --ivory: #efe7d6;
  --ivory-dim: #c9bfab;
  --muted: #9d937f;
  --brass: #b8955a;
  --brass-hi: #d9bc82;
  --brass-lo: #7a6238;
  --hair: rgba(184, 149, 90, .45);
  --hair-soft: rgba(184, 149, 90, .22);
  --brass-grad: linear-gradient(90deg, var(--brass-lo), var(--brass-hi) 45%, var(--brass) 70%, var(--brass-lo));

  --display: Didot, "Bodoni MT", "Bodoni 72", "Libre Bodoni", "Playfair Display", "Book Antiqua", Georgia, serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --caps: "Gill Sans", "Gill Sans MT", "Century Gothic", Avenir, "Segoe UI", system-ui, sans-serif;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --wrap: 1200px;
  --measure: 66ch;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--ink); }

body {
  margin: 0;
  background:
    radial-gradient(120% 60% at 85% 0%, rgba(184, 149, 90, .07), transparent 60%),
    var(--ink);
  color: var(--ivory-dim);
  font-family: var(--serif);
  font-size: clamp(1.02rem, .97rem + .25vw, 1.14rem);
  line-height: 1.72;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--brass-hi);
  text-decoration: underline;
  text-decoration-color: var(--hair);
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
  transition: color .25s ease, text-decoration-color .25s ease;
}
a:hover { color: var(--ivory); text-decoration-color: var(--brass-hi); }

:focus-visible {
  outline: 1px solid var(--brass-hi);
  outline-offset: 4px;
}

strong { color: var(--ivory); font-weight: 600; }
em { color: var(--ivory); }

/* ---------- Masthead ---------- */
.masthead {
  position: relative;
  background: var(--ink);
  border-bottom: 1px solid var(--hair-soft);
}
.masthead::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--brass-grad);
  opacity: .8;
}
.masthead-inner {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 1.1rem var(--gutter) .9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .9rem 2rem;
}
.brand { display: inline-block; line-height: 0; text-decoration: none; }
.brand-logo { height: 34px; width: auto; }

.primary-nav { width: 100%; }
.primary-nav ul {
  list-style: none;
  margin: 0;
  padding: .7rem 0 0;
  border-top: 1px solid var(--hair-soft);
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.4rem;
}
.primary-nav a {
  display: inline-block;
  padding: .3rem 0;
  font-family: var(--caps);
  font-size: .72rem;
  font-variant: small-caps;
  text-transform: uppercase;
  letter-spacing: .26em;
  color: var(--ivory-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.primary-nav a:hover { color: var(--brass-hi); border-bottom-color: var(--hair); }
.primary-nav a[aria-current="page"] { color: var(--brass-hi); border-bottom-color: var(--brass); }

/* ---------- Hero: full-width image, dark panel overlaid bottom-left ---------- */
.hero {
  position: relative;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.25rem) var(--gutter) 0;
}
.hero-frame {
  position: relative;
  background: var(--ink-3);
}
.hero-frame::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(217, 188, 130, .55);
  pointer-events: none;
}
.hero-img {
  width: 100%;
  height: clamp(260px, 58vw, 640px);
  object-fit: cover;
  filter: saturate(.9) contrast(1.04);
}
.hero-panel {
  position: relative;
  margin: -3.5rem .75rem 0;
  padding: 1.75rem 1.4rem 1.6rem;
  background: rgba(11, 10, 9, .94);
  border: 1px solid var(--hair);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9);
}
.hero-ornament {
  display: block;
  width: 64px;
  height: 1px;
  margin-bottom: 1.2rem;
  background: var(--brass-grad);
  position: relative;
}
.hero-ornament::after {
  content: "\25C6";
  position: absolute;
  left: 70px;
  top: -.62em;
  font-size: .55rem;
  line-height: 1;
  color: var(--brass);
}
.hero-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 1.3rem + 3.2vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -.01em;
  color: var(--ivory);
  text-wrap: balance;
}
.hero-intro { padding: 2rem 0 0; }
.hero-intro p { margin: 0 0 1em; max-width: var(--measure); }
.hero-intro p:last-child { margin-bottom: 0; }
.hero-intro p:first-child::first-line {
  font-variant: small-caps;
  letter-spacing: .06em;
  color: var(--ivory);
}

/* ---------- Body flow ---------- */
.body-flow {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 6rem) var(--gutter) clamp(3rem, 6vw, 5rem);
  counter-reset: chapter;
}

.sec {
  counter-increment: chapter;
  position: relative;
  padding: clamp(2.5rem, 5vw, 4rem) 0;
  border-top: 1px solid var(--hair-soft);
}
.sec:first-child { border-top: 0; padding-top: 0; }

.sec-title {
  margin: 0 0 1.3rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.6rem, 1.15rem + 1.7vw, 2.45rem);
  line-height: 1.14;
  color: var(--ivory);
  text-wrap: balance;
  max-width: 24ch;
}
.sec-title::before {
  content: counter(chapter, upper-roman);
  display: block;
  margin-bottom: .9rem;
  font-family: var(--display);
  font-size: .95rem;
  letter-spacing: .3em;
  color: var(--brass);
  padding-bottom: .6rem;
  width: 3.2rem;
  border-bottom: 1px solid var(--brass);
}

.sec-body { max-width: var(--measure); }
.sec-body p { margin: 0 0 1.15em; }
.sec-body p:last-child { margin-bottom: 0; }
.sec-body ul {
  list-style: none;
  margin: 1.4em 0;
  padding: 0;
  border-top: 1px solid var(--hair-soft);
}
.sec-body li {
  position: relative;
  padding: .7em 0 .7em 1.8em;
  border-bottom: 1px solid var(--hair-soft);
}
.sec-body li::before {
  content: "\25C7";
  position: absolute;
  left: 0;
  top: .78em;
  font-size: .7em;
  color: var(--brass);
}

/* Sidebar rail: text column + framed image aside */
.sec--rail { display: grid; gap: 2rem; }
.sec-media {
  position: relative;
  margin: 0;
  max-width: 560px;
  background: var(--ink-3);
}
.sec-media::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(217, 188, 130, .6);
  pointer-events: none;
}
.sec-img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  filter: saturate(.88);
}

/* Plain sections: a centred ruled "card" of ink */
.sec--plain .sec-body { max-width: var(--measure); }

/* Support pages: plain sections get a narrow index rail */
.page-support .sec--plain { border-top-color: var(--hair-soft); }

/* ---------- Colophon / footer ---------- */
.colophon {
  position: relative;
  background: var(--ink-2);
  border-top: 1px solid var(--hair-soft);
  color: var(--ivory-dim);
  font-size: .98rem;
}
.colophon::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -1px;
  height: 1px;
  background: var(--brass-grad);
}
.colophon-inner {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 4.5rem) var(--gutter) 2.5rem;
  display: grid;
  gap: 2.25rem;
}
.colophon-name {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-size: 1.6rem;
  line-height: 1.15;
  color: var(--ivory);
}
.colophon address { font-style: normal; line-height: 1.7; }
.colophon-contact { margin: 0; }
.colophon-contact dt,
.colophon-oneline {
  font-family: var(--caps);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .28em;
  color: var(--brass);
  margin: 0 0 .35rem;
}
.colophon-contact dd { margin: 0 0 1.4rem; font-size: 1.08rem; overflow-wrap: anywhere; }
.colophon-contact dd:last-child { margin-bottom: 0; }
.colophon-oneline { letter-spacing: .18em; margin-bottom: .8rem; }
.colophon-map {
  position: relative;
}
.colophon-map iframe {
  display: block;
  border: 1px solid var(--hair) !important;
  padding: 6px;
  background: var(--ink);
  filter: grayscale(.85) contrast(1.05) brightness(.9);
}
.colophon-copy {
  margin: 0;
  padding: 1.25rem var(--gutter) 1.6rem;
  border-top: 1px solid var(--hair-soft);
  text-align: center;
  font-family: var(--caps);
  font-size: .7rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Tablet ---------- */
@media (min-width: 720px) {
  .brand-logo { height: 38px; }

  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-frame { grid-column: 1 / -1; grid-row: 1; }
  .hero-panel {
    grid-column: 1; grid-row: 1;
    align-self: end;
    justify-self: start;
    width: min(580px, 82%);
    margin: 0 0 -4rem 2.25rem;
    padding: 2.25rem 2.25rem 2.1rem;
    z-index: 1;
  }
  .hero-img { height: clamp(460px, 62vw, 660px); }
  .hero-intro { grid-column: 1 / -1; grid-row: 2; padding: 6.5rem 0 0 2.25rem; }
  .hero-intro p { max-width: 58ch; }

  .sec--rail { grid-template-columns: minmax(0, 1fr) minmax(0, .72fr); gap: 3rem; align-items: start; }
  .sec--rail .sec-media { position: sticky; top: 2rem; }
  .sec--rail .sec-img { aspect-ratio: 4 / 5; }

  .colophon-inner { grid-template-columns: 1fr 1fr; }
  .colophon-map { grid-column: 1 / -1; }
}

/* ---------- Desktop ---------- */
@media (min-width: 1100px) {
  .brand-logo { height: 42px; }
  .primary-nav a { font-size: .76rem; }
  .masthead-inner { flex-wrap: nowrap; padding-block: 1.25rem; }
  .primary-nav { width: auto; }
  .primary-nav ul { border-top: 0; padding: 0; gap: .3rem 2rem; justify-content: flex-end; }
  .hero { grid-template-columns: 620px minmax(0, 1fr); column-gap: 3.5rem; }
  .hero-panel { width: auto; justify-self: stretch; }
  .hero-img { height: 660px; }
  .hero-panel { margin-left: 3rem; padding: 2.75rem 3rem 2.6rem; }
  .hero-intro { grid-column: 2; padding: 2.75rem 0 0; font-size: .98rem; }

  .sec--rail {
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 5rem;
    background: linear-gradient(var(--hair-soft), var(--hair-soft)) no-repeat calc(100% - 400px - 2.5rem) 4rem / 1px calc(100% - 8rem);
  }
  .sec--rail:first-child { background-position: calc(100% - 400px - 2.5rem) 0; background-size: 1px calc(100% - 4rem); }
  .sec--rail:nth-of-type(even) .sec-media { margin-top: 4rem; }

  .sec--plain {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 4rem;
  }
  .sec--plain .sec-title { font-size: clamp(1.6rem, 1rem + 1.2vw, 2.1rem); }

  .colophon-inner { grid-template-columns: 1fr .9fr 1.5fr; gap: 3.5rem; }
  .colophon-map { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .sec--rail .sec-media { position: relative; top: auto; }
}
