/* ============================================================
   Newton Engineering — shared stylesheet
   Keep header/footer markup identical across pages so styles
   here apply uniformly (see README for the find-and-replace note).
   ============================================================ */

/* ---- Webfonts (self-hosted, Latin subset only) ---- */
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/source-serif-4-600.woff2") format("woff2");
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/public-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/public-sans-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-500.woff2") format("woff2");
}

/* ---- Tokens ---- */
:root {
  --green-deep: #006551;
  --green-sage: #B0CEC6;
  --off-white: #FAFAF8;
  --ink: #1A1F1D;

  --font-head: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;

  --content-max: 1120px;
  --gap: 24px;
  --section-space: 72px;

  --focus-ring: 3px solid #0A8A6E;
}

@media (min-width: 900px) {
  :root {
    --section-space: 96px;
  }
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--off-white);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.65;
}
@media (min-width: 900px) {
  body { font-size: 18px; }
}
img { max-width: 100%; display: block; }
a { color: var(--green-deep); }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; margin: 0; color: var(--ink); }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }

/* Visible keyboard focus, everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--green-deep);
  color: var(--off-white);
  padding: 12px 20px;
  z-index: 100;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* ---- Layout helpers ---- */
.wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 20px;
}
@media (min-width: 900px) {
  .wrap { padding: 0 40px; }
}

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
}

.measure { max-width: 68ch; }

.section {
  padding-top: var(--section-space);
  padding-bottom: var(--section-space);
}

.bg-off-white  { background: var(--off-white); }
.bg-sage       { background: var(--green-sage); }
.bg-deep-green { background: var(--green-deep); color: var(--off-white); }
.bg-deep-green h2, .bg-deep-green h3 { color: var(--off-white); }

/* Hairline break when two same-coloured sections sit directly against
   each other (e.g. hero + first content section), so the seam still
   reads without relying on a colour change. */
.bg-off-white + .bg-off-white,
.bg-sage + .bg-sage {
  border-top: 1px solid rgba(26, 31, 29, 0.10);
}

/* ---- Type scale ---- */
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green-deep);
  margin-bottom: 16px;
}
.bg-deep-green .eyebrow { color: var(--green-sage); }

h1.hero-h1 {
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
@media (min-width: 900px) {
  h1.hero-h1 { font-size: 56px; }
}

h2.section-h2 {
  font-size: 26px;
  line-height: 1.2;
}
@media (min-width: 900px) {
  h2.section-h2 { font-size: 34px; }
}

h2.section-h2 + p,
h1.section-h2 + .grid-12,
h2.section-h2 + .grid-12:not(.services-grid):not(.steps-grid) {
  margin-top: 20px;
}

h3.sub-h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 20px;
}
@media (min-width: 900px) {
  h3.sub-h3 { font-size: 22px; }
}

.lead {
  font-size: 19px;
  font-weight: 400;
  line-height: 1.55;
}
@media (min-width: 900px) {
  .lead { font-size: 21px; }
}

.caption {
  font-size: 15px;
}

.mono-label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---- Buttons / links ---- */
.btn {
  display: inline-block;
  background: var(--green-deep);
  color: var(--off-white);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 17px;
  text-decoration: none;
  padding: 14px 28px;
  border-radius: 4px;
  border: 1px solid var(--green-deep);
}
.btn:hover { background: #004d3d; border-color: #004d3d; }
.btn:visited { color: var(--off-white); }

/* Inverted button for the deep-green closing band (a solid green button
   on a green section would disappear). */
.bg-deep-green .btn {
  background: var(--off-white);
  color: var(--green-deep);
  border-color: var(--off-white);
}
.bg-deep-green .btn:hover { background: #ffffff; border-color: #ffffff; }
.bg-deep-green .btn:visited { color: var(--green-deep); }

.text-link {
  color: var(--green-deep);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.bg-deep-green .text-link { color: var(--off-white); }

/* ---- Header ---- */
.site-header {
  background: var(--off-white);
  border-bottom: 1px solid rgba(26, 31, 29, 0.12);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
}
.brand img { height: 52px; width: 52px; border-radius: 6px; }
.brand span {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--ink);
}
@media (min-width: 900px) {
  .brand { gap: 18px; }
  .brand img { height: 68px; width: 68px; }
  .brand span { font-size: 28px; }
}

.main-nav ul {
  display: flex;
  gap: 32px;
}
.main-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
}
.main-nav a:hover { color: var(--green-deep); }
.main-nav a[aria-current="page"] { color: var(--green-deep); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 16px;
  cursor: pointer;
}

@media (max-width: 1059px) {
  .nav-toggle { display: block; }
  .main-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--off-white);
    border-bottom: 1px solid rgba(26, 31, 29, 0.12);
  }
  .main-nav.is-open { display: block; }
  .main-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 8px 20px 20px;
  }
  .main-nav li { border-top: 1px solid rgba(26, 31, 29, 0.08); }
  .main-nav a { display: block; padding: 14px 0; }
  .site-header .wrap { position: relative; }
}

/* ---- Hero ---- */
.hero .grid-12 { align-items: start; }
.hero-content { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .hero-content { grid-column: 1 / span 8; }
}
.hero-h1 { grid-column: 1 / -1; }
.hero .lead {
  grid-column: 1 / -1;
  margin-top: 24px;
  margin-bottom: 32px;
}
@media (min-width: 900px) {
  .hero .lead { grid-column: 1 / span 7; max-width: none; }
}

/* ---- What I do (services grid) ---- */
.services-grid {
  margin-top: 48px;
}
.service-item {
  grid-column: span 12;
}
@media (min-width: 700px) {
  .service-item { grid-column: span 6; }
}
@media (min-width: 900px) {
  .service-item { grid-column: span 4; }
}
.service-rule {
  width: 40px;
  height: 3px;
  background: var(--green-deep);
  margin-bottom: 20px;
}
.service-item h3 { margin-bottom: 10px; }
.services-footer {
  margin-top: 40px;
  text-align: right;
}

/* Two-card variant (homepage audience split) — overrides the span-4
   three-up default so two items sit at half width instead of a third
   with an empty gap. Only added because the 3-up grid didn't fit a
   2-item layout; flagged for review. */
@media (min-width: 700px) {
  .two-up .service-item { grid-column: span 6; }
}

/* ---- How it works ---- */
.steps-grid {
  margin-top: 48px;
}
.step-item {
  grid-column: 1 / -1;
  padding-bottom: 32px;
}
@media (min-width: 700px) {
  .step-item { grid-column: span 6; }
}
.step-number {
  display: block;
  margin-bottom: 12px;
}
.step-item h3 { margin-bottom: 8px; }

/* ---- Capability ---- */
.capability-standards {
  margin-top: 24px;
}
.capability-standards li {
  display: inline;
}
.capability-standards li:not(:last-child)::after {
  content: " · ";
}

/* ---- Crosslink (used on for-engineers.html and direct-clients.html) ---- */
.crosslink p {
  margin: 0;
  font-size: 15px;
}

/* ---- Contact section (shared across pages) ---- */
.contact-section .wrap > * + * { margin-top: 12px; }
.contact-section .btn { margin-top: 20px; }

/* ---- Project cards + lightbox (experience-capability.html) ---- */
.project-card {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.project-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 16px;
  background: var(--green-sage);
}
.project-title { margin: 0; }
/* Full description text: hidden once JS is driving the lightbox, but
   left in the DOM (and revealed by the <noscript> rule in the page)
   so the content still exists with JS disabled. */
.project-desc { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 31, 29, 0.75);
}
.lightbox-panel {
  position: relative;
  background: var(--off-white);
  color: var(--ink);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  border-radius: 6px;
}
.lightbox-img {
  width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: contain;
  border-radius: 4px;
  margin-bottom: 20px;
  background: var(--green-sage);
}
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: var(--off-white);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

/* ---- Contact form (contact.html only) ---- */
.contact-form {
  margin-top: 32px;
  max-width: 560px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}
.form-field label {
  font-weight: 600;
  font-size: 15px;
}
.form-field input,
.form-field textarea {
  font-family: var(--font-body);
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(26, 31, 29, 0.3);
  border-radius: 4px;
  background: var(--off-white);
  color: var(--ink);
}
.form-field textarea {
  resize: vertical;
  min-height: 140px;
}
/* Honeypot: hidden from sighted users and kept out of tab order,
   but still present for bots that fill in every field. */
.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Footer ---- */
.site-footer {
  background: var(--off-white);
  border-top: 1px solid rgba(26, 31, 29, 0.12);
  padding: 40px 0;
}
.site-footer .wrap {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.site-footer a { color: var(--ink); }


/* ---- Phones: tighter hero, two-up project thumbnails, easier tapping ---- */
@media (max-width: 699px) {
  .hero .lead { margin-top: 0; margin-bottom: 8px; }
  .services-grid { margin-top: 32px; }
  .text-link { display: inline-block; padding: 10px 0; }

  /* Experience page: two thumbnails per row instead of one, so the
     page is about half as long. Targets only cards that contain a
     .project-card so the other service grids stay single-column. */
  .services-grid { row-gap: 20px; column-gap: 14px; }
  .service-item:has(> .project-card) { grid-column: span 6; }
  .project-card .project-title { font-size: 15px; line-height: 1.3; }
  .project-thumb { margin-bottom: 10px; }

  .lightbox { padding: 16px; }
  .lightbox-panel { padding: 24px 20px; }
}

#lightbox-title { margin-bottom: 8px; }


/* ---- Utility classes (replace inline style="" attributes, which the
   site's Content-Security-Policy in _headers blocks) ---- */
.span-all { grid-column: 1 / -1; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.section-tight-top { padding-top: 48px; }
.section.crosslink { padding-top: 48px; padding-bottom: 48px; }
.headshot-wrap { grid-column: 1 / -1; max-width: 220px; margin-bottom: 32px; }
.headshot { width: 220px; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 4px; }
