/* =========================================================================
   Rockville Engine Works — shared stylesheet
   Single stylesheet for every page. No build step, no preprocessor.

   Contents
     01  Fonts
     02  Design tokens
     03  Reset & base
     04  Typography
     05  Layout primitives
     06  Blueprint texture
     07  Header & navigation
     08  Hero
     09  Cards & grids
     10  Contact
     11  Footer
     12  Buttons & links
     13  Utilities
     14  Motion preferences
   ========================================================================= */


/* -- 01  Fonts ------------------------------------------------------------
   Self-hosted Space Grotesk (SIL OFL 1.1, see assets/fonts/OFL.txt).
   Latin subset only; body and mono use the system stack for zero payload. */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/space-grotesk-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/space-grotesk-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}


/* -- 02  Design tokens ----------------------------------------------------
   Colour ramp generated with helmlab 1.0.0 — see /tools/build_palette.py.
   Every text pairing is verified against WCAG 2.1 AA by that script; the
   oklch value beside each hex is the source of truth it was derived from.
   Re-run the tool rather than hand-editing these values. */

:root {
  /* Surfaces */
  --rew-bg:          #0d0f12;  /* oklch(16.8% 0.0071 258.4)  page background   */
  --rew-surface:     #15171b;  /* oklch(20.4% 0.0086 264.4)  cards, panels     */
  --rew-elevated:    #1b1d21;  /* oklch(23.0% 0.0083 264.4)  hover / raised    */
  --rew-hairline:    #1f2226;  /* oklch(25.1% 0.0088 255.6)  rules, grid       */
  --rew-line:        #2b2e32;  /* oklch(30.0% 0.0084 255.6)  borders           */

  /* Text — all ≥ 4.5:1 on both --rew-bg and --rew-surface. The top step is
     held below a true off-white, which glared on a page this dark. */
  --rew-text-dim:    #7d8084;  /* oklch(59.9% 0.0071 255.6)  4.52:1 on surface */
  --rew-text-muted:  #909396;  /* oklch(66.2% 0.0057 248.1)  5.81:1 on surface */
  --rew-text:        #c0c2c4;  /* oklch(81.3% 0.0036 248.2) 10.04:1 on surface */

  /* Accent — signal orange, used sparingly. Nothing on the site takes a solid
     accent fill except the skip link, which is invisible until focused: a
     full-chroma orange block overwhelms everything else on a page this dark.
     Buttons get an accent border over --rew-accent-wash instead. */
  --rew-accent:      #e96929;  /* oklch(66.8% 0.1749 43.7)   5.96:1 on bg      */
  --rew-accent-dim:  #783c21;  /* oklch(42.8% 0.0926 43.7)   quiet hairlines   */
  --rew-accent-hi:   #fe7c3e;  /* oklch(72.7% 0.1753 44.0)   border, hover     */
  --rew-accent-wash: #231e1f;  /* oklch(24.1% 0.0079 3.9)    button ground     */
  --rew-wash-hi:     #312422;  /* oklch(27.5% 0.0203 28.4)   button hover      */
  --rew-accent-ink:  #0d0f12;  /* oklch(16.8% 0.0071 258.4)  text on accent    */

  /* Type */
  --rew-font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --rew-font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --rew-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  /* Spacing — 4px base */
  --rew-space-1: 0.25rem;
  --rew-space-2: 0.5rem;
  --rew-space-3: 0.75rem;
  --rew-space-4: 1rem;
  --rew-space-6: 1.5rem;
  --rew-space-8: 2rem;
  --rew-space-12: 3rem;
  --rew-space-16: 4rem;
  --rew-space-24: 6rem;

  /* Structure */
  --rew-shell: 74rem;      /* 1184px drawing frame */
  --rew-gutter: 1.25rem;
  --rew-measure: 62ch;     /* comfortable reading width */
  --rew-hairline-w: 1px;
  /* Mono index gutter, shared by section heads and spec rows so their labels
     line up. Wide enough for the longest label in use ("01 / PHILOSOPHY");
     widen it before adding a longer one. */
  --rew-index-col: 10.5rem;
}

@media (min-width: 48em) {
  :root {
    --rew-gutter: 2.5rem;
  }
}


/* -- 03  Reset & base ----------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--rew-bg);
  color: var(--rew-text);
  font-family: var(--rew-font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Anchor the footer to the bottom on short pages (404, stubs). */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* A single, consistent focus treatment for every interactive element. */
:focus-visible {
  outline: 2px solid var(--rew-accent);
  outline-offset: 3px;
  border-radius: 1px;
}


/* -- 04  Typography ------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--rew-font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.125rem, 1.55rem + 2.9vw, 4rem);
}

h2 {
  font-size: clamp(1.5rem, 1.25rem + 1.25vw, 2.25rem);
}

h3 {
  font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  max-width: var(--rew-measure);
}

/* Micro-labels: "EST. 2026 / MARYLAND", section numbers, status stamps. */
.label {
  font-family: var(--rew-font-mono);
  font-size: 0.6875rem;
  line-height: 1.4;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rew-text-dim);
  margin: 0;
}

.label--accent {
  color: var(--rew-accent);
}

.lead {
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  line-height: 1.6;
  color: var(--rew-text-muted);
}

.prose > * + * {
  margin-top: var(--rew-space-4);
}


/* -- 05  Layout primitives ------------------------------------------------
   .shell is the drawing frame: a fixed-width column with hairline rules down
   both edges, the way a plotted sheet has a border. */

.shell {
  width: 100%;
  max-width: var(--rew-shell);
  margin-inline: auto;
  padding-inline: var(--rew-gutter);
  position: relative;
}

@media (min-width: 64em) {
  .shell::before,
  .shell::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: var(--rew-hairline-w);
    background-color: var(--rew-hairline);
  }

  .shell::before {
    left: 0;
  }

  .shell::after {
    right: 0;
  }
}

.section {
  padding-block: var(--rew-space-16);
  border-top: var(--rew-hairline-w) solid var(--rew-hairline);
}

@media (min-width: 48em) {
  .section {
    padding-block: var(--rew-space-24);
  }
}

/* Section header: mono index on the left, heading beside it. */
.section-head {
  display: grid;
  gap: var(--rew-space-3);
  margin-bottom: var(--rew-space-8);
}

@media (min-width: 48em) {
  .section-head {
    grid-template-columns: var(--rew-index-col) minmax(0, 1fr);
    gap: var(--rew-space-6);
    align-items: baseline;
  }
}

.section-index {
  font-family: var(--rew-font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rew-text-dim);
  display: flex;
  align-items: center;
  gap: var(--rew-space-2);
  white-space: nowrap;
}

/* The one place the accent appears by default: a short registration tick. */
.section-index::before {
  content: "";
  width: 1.25rem;
  height: var(--rew-hairline-w);
  background-color: var(--rew-accent);
  flex: none;
}

main {
  flex: 1 0 auto;
}


/* -- 06  Blueprint texture ------------------------------------------------
   A quiet plotted grid behind the page. Fixed so it reads as the sheet the
   site is drawn on rather than as page content. Decorative only. */

.grid-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(
      to right,
      rgba(255, 255, 255, 0.022) 0 1px,
      transparent 1px 5.5rem
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.022) 0 1px,
      transparent 1px 5.5rem
    );
}


/* -- 07  Header & navigation ---------------------------------------------
   Stacks to two rows under 40em so three links always fit at 380px without
   a toggle — which is why this site ships no JavaScript. */

.masthead {
  border-bottom: var(--rew-hairline-w) solid var(--rew-hairline);
  background-color: rgba(13, 15, 18, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.masthead__inner {
  display: flex;
  flex-direction: column;
  gap: var(--rew-space-3);
  padding-block: var(--rew-space-4);
}

@media (min-width: 40em) {
  .masthead__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--rew-space-6);
  }
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--rew-space-3);
  font-family: var(--rew-font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  color: var(--rew-text);
  text-decoration: none;
  line-height: 1.2;
}

.wordmark:hover {
  color: var(--rew-text);
}

.wordmark__mark {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  color: var(--rew-accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--rew-space-6);
  border-top: var(--rew-hairline-w) solid var(--rew-hairline);
  padding-top: var(--rew-space-3);
}

@media (min-width: 40em) {
  .nav {
    border-top: 0;
    padding-top: 0;
  }
}

.nav a {
  font-family: var(--rew-font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rew-text-muted);
  text-decoration: none;
  padding-block: var(--rew-space-1);
  border-bottom: var(--rew-hairline-w) solid transparent;
  transition: color 120ms linear, border-color 120ms linear;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--rew-text);
  border-bottom-color: var(--rew-accent);
}


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

.hero {
  padding-block: var(--rew-space-16) var(--rew-space-16);
}

@media (min-width: 48em) {
  .hero {
    padding-block: var(--rew-space-24);
  }
}

/* minmax(0, …) on every track: without it an auto track takes the schematic's
   max-width as a floor and pushes the page wider than a 380px viewport. */
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--rew-space-12);
  align-items: center;
}

@media (min-width: 64em) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: var(--rew-space-16);
  }
}

.hero__stamp {
  display: flex;
  align-items: center;
  gap: var(--rew-space-3);
  margin-bottom: var(--rew-space-6);
}

.hero__stamp::after {
  content: "";
  height: var(--rew-hairline-w);
  flex: 1 1 auto;
  background-color: var(--rew-hairline);
}

.hero h1 {
  margin-bottom: var(--rew-space-6);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rew-space-3);
  margin-top: var(--rew-space-8);
}

/* Line-art schematic beside the hero copy. Decorative. */
.schematic {
  width: 100%;
  max-width: min(24rem, 100%);
  margin-inline: auto;
  color: var(--rew-line);
}

.schematic .schematic__accent {
  color: var(--rew-accent);
}


/* -- 09  Cards & grids ---------------------------------------------------- */

.card-grid {
  display: grid;
  gap: var(--rew-space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 40em) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 64em) {
  .card-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  position: relative;
  background-color: var(--rew-surface);
  border: var(--rew-hairline-w) solid var(--rew-hairline);
  padding: var(--rew-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--rew-space-3);
  transition: border-color 140ms linear, background-color 140ms linear;
}

@media (min-width: 48em) {
  .card {
    padding: var(--rew-space-8);
  }
}

.card:hover {
  background-color: var(--rew-elevated);
  border-color: var(--rew-line);
}

/* Registration tick in the top-left corner, like a drawing datum mark. */
.card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 0.75rem;
  height: 0.75rem;
  border-top: var(--rew-hairline-w) solid var(--rew-accent-dim);
  border-left: var(--rew-hairline-w) solid var(--rew-accent-dim);
}

.card p {
  color: var(--rew-text-muted);
  max-width: none;
}

.card__icon {
  width: 2rem;
  height: 2rem;
  color: var(--rew-text-dim);
  margin-bottom: var(--rew-space-1);
}

/* Two-column definition rows used by "what we do". */
.spec-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: var(--rew-hairline-w) solid var(--rew-hairline);
}

.spec {
  display: grid;
  gap: var(--rew-space-2);
  padding-block: var(--rew-space-6);
  border-bottom: var(--rew-hairline-w) solid var(--rew-hairline);
}

@media (min-width: 48em) {
  .spec {
    grid-template-columns: var(--rew-index-col) minmax(0, 14rem) minmax(0, 1fr);
    gap: var(--rew-space-6);
    align-items: start;
  }
}

.spec p {
  color: var(--rew-text-muted);
}


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

/* Sized so a 29-character address stays on one line from 320px up; the
   overflow-wrap below is a safety net, not the expected behaviour. */
.contact__email {
  font-family: var(--rew-font-display);
  font-weight: 700;
  font-size: clamp(1rem, 0.68rem + 1.45vw, 1.875rem);
  letter-spacing: -0.02em;
  color: var(--rew-text);
  text-decoration: none;
  border-bottom: 2px solid var(--rew-accent-dim);
  padding-bottom: var(--rew-space-1);
  display: inline-block;
  overflow-wrap: anywhere;
  transition: border-color 140ms linear;
}

.contact__email:hover {
  border-bottom-color: var(--rew-accent);
}


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

.footer {
  border-top: var(--rew-hairline-w) solid var(--rew-hairline);
  padding-block: var(--rew-space-8);
  margin-top: auto;
}

.footer__inner {
  display: flex;
  flex-direction: column;
  gap: var(--rew-space-4);
}

@media (min-width: 48em) {
  .footer__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rew-space-6);
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer__links a {
  font-family: var(--rew-font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rew-text-muted);
  text-decoration: none;
  border-bottom: var(--rew-hairline-w) solid transparent;
}

.footer__links a:hover {
  color: var(--rew-text);
  border-bottom-color: var(--rew-accent);
}


/* -- 12  Buttons & links -------------------------------------------------- */

a {
  color: var(--rew-accent);
}

.prose a {
  color: var(--rew-text);
  text-decoration: underline;
  text-decoration-color: var(--rew-accent-dim);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

.prose a:hover {
  text-decoration-color: var(--rew-accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--rew-space-2);
  font-family: var(--rew-font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: var(--rew-space-3) var(--rew-space-6);
  border: var(--rew-hairline-w) solid transparent;
  transition: background-color 140ms linear, border-color 140ms linear,
    color 140ms linear;
}

/* Bordered rather than filled — see the accent note in the tokens block. */
.btn--primary {
  background-color: var(--rew-accent-wash);
  border-color: var(--rew-accent);
  color: var(--rew-text);         /* 9.21:1 on the wash */
}

.btn--primary:hover {
  background-color: var(--rew-wash-hi);
  border-color: var(--rew-accent-hi);
}

.btn--ghost {
  border-color: var(--rew-line);
  color: var(--rew-text);
}

.btn--ghost:hover {
  border-color: var(--rew-text-dim);
  background-color: var(--rew-surface);
}


/* -- 13  Utilities -------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip link — visible only once focused. */
.skip-link {
  position: absolute;
  left: var(--rew-space-4);
  top: var(--rew-space-4);
  z-index: 20;
  transform: translateY(-200%);
  background-color: var(--rew-accent);
  color: var(--rew-accent-ink);
  font-family: var(--rew-font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: var(--rew-space-3) var(--rew-space-4);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* Status stamp, e.g. "IN DEVELOPMENT". */
.stamp {
  display: inline-flex;
  align-items: center;
  gap: var(--rew-space-2);
  font-family: var(--rew-font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rew-text-dim);
  border: var(--rew-hairline-w) solid var(--rew-line);
  padding: var(--rew-space-1) var(--rew-space-3);
  align-self: flex-start;
}

.stamp::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  background-color: var(--rew-accent-dim);
  flex: none;
}

.rule {
  border: 0;
  border-top: var(--rew-hairline-w) solid var(--rew-hairline);
  margin: 0;
}

/* Footnote under a section's main content. */
.section-note {
  margin-top: var(--rew-space-8);
}

.stack-6 > * + * {
  margin-top: var(--rew-space-6);
}

.stack-8 > * + * {
  margin-top: var(--rew-space-8);
}

/* Centred narrow column for stub pages and 404. */
.pillar {
  max-width: 44rem;
  padding-block: var(--rew-space-24);
}


/* -- 14  Motion preferences ----------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
