/* Senix Group — base styles
   Design direction: light theme, editorial/technical-report aesthetic,
   flat brass accent, no gradients, no shadows, minimal rounding. */

:root {
  --bg: #FFFFFF;
  --bg-muted: #FAFAF8;
  --text: #1A1A1A;
  --text-muted: #6B6B6B;
  --accent: #A9812C;
  --accent-dark: #8B6A22;
  --divider: #E4E2DD;

  --font-heading: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --container-width: 960px;
  --container-width-narrow: 680px;
  --nav-height: 64px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.6em;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); margin-top: 0; }
h3 { font-size: 1.15rem; margin-top: 1.5em; }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent); }

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container.narrow { max-width: var(--container-width-narrow); }
.container.center { text-align: center; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- Header / Nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
}

.nav-wrap {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
  min-height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Nav lockup: cropped icon mark + typeset wordmark. The raster wordmark
   inside the source logo is illegible below ~120px, so it is set in type. */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-mark { width: 38px; height: 38px; }
.brand-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}

.nav-toggle {
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: none;
  border: 1px solid var(--divider);
  padding: 8px 14px;
  min-height: 44px;
  color: var(--text);
  cursor: pointer;
}

.nav-links {
  display: none;
  flex-direction: column;
  gap: 4px;
  position: absolute;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
  padding: 8px 24px 16px;
}

.nav-links.is-open { display: flex; }

.nav-links a {
  color: var(--text);
  text-decoration: none;
  padding: 12px 4px;
  min-height: 44px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--divider);
}
.nav-links a:last-child { border-bottom: none; }
.nav-links a:hover { color: var(--accent-dark); }

/* 860px, not 640px: with five items (including two long labels) the row needs
   roughly 750px alongside the brand lockup, so it overflows below this. */
@media (min-width: 860px) {
  .nav-toggle { display: none; }
  .nav-links {
    display: flex;
    flex-direction: row;
    position: static;
    border-bottom: none;
    padding: 0;
    gap: 24px;
  }
  .nav-links a {
    border-bottom: none;
    padding: 0;
    min-height: auto;
    white-space: nowrap;
  }
}

.nav-links a[aria-current="page"] {
  color: var(--accent-dark);
  font-weight: 600;
}

/* ---------- Sections ---------- */

.section {
  padding: 56px 0;
  border-bottom: 1px solid var(--divider);
  scroll-margin-top: var(--nav-height);
}
.section:last-of-type { border-bottom: none; }
.section-muted { background: var(--bg-muted); }

@media (min-width: 1024px) {
  .section { padding: 88px 0; }
}

.hero .eyebrow {
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 0.5em;
}

.lede { max-width: 62ch; }

/* The hero is a centered column: eyebrow, headline and CTA row sit on one
   vertical axis. The lede paragraphs are the exception — they justify to flush
   both edges, while auto side margins keep the 62ch block itself centered.
   hyphens: auto lets the browser break words at line ends, which is what keeps
   justified text from opening up rivers of white space. */
.hero .container { text-align: center; }
.hero .cta-row { justify-content: center; }

.hero .lede {
  margin-left: auto;
  margin-right: auto;
  text-align: justify;
  hyphens: auto;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 3px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--accent-dark);
}
.btn-outline:hover { background: var(--bg-muted); }

/* ---------- About ---------- */
/* Editorial layout: photo floats at the top of the bio copy so text
   wraps around it, rather than a rigid two-column grid. */

.about-figure {
  margin: 0 0 24px;
  max-width: 320px;
}

/* height:auto is required — the img carries width/height attributes, which
   browsers apply as presentational CSS and would otherwise stretch it. */
.about-figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--divider);
}

.about-figure figcaption {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.about-details { clear: both; padding-top: 8px; }

/* Each About subsection (Education, Professional / Engineering Project /
   Functional Experience) opens with a full-width hairline carrying a short
   accent segment, so the four blocks read as separate sections rather than one
   continuous column of text. */
.about-details h3 {
  font-size: 1.25rem;
  margin-top: 2.6em;
  padding-top: 1.6em;
  border-top: 1px solid var(--divider);
  position: relative;
}

.about-details h3::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 52px;
  height: 2px;
  background: var(--accent);
}

.about-details h3:first-of-type { margin-top: 1.6em; }

@media (min-width: 640px) {
  .about-figure {
    float: left;
    width: 288px;
    margin: 6px 34px 20px 0;
  }
}

.plain-list {
  list-style: none;
  margin: 0 0 1.1em;
  padding: 0;
}
.plain-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--divider);
}
.plain-list li:last-child { border-bottom: none; }

/* Education: degree list with alma mater logos alongside it. */
.education {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 1.1em;
}

.education-list { margin-bottom: 0; }

.education-logos {
  display: flex;
  align-items: center;
  gap: 30px;
}

/* Matched by height, not width — the two lockups have different aspect
   ratios, so equal height is what reads as visually balanced. */
.education-logos img {
  height: 64px;
  width: auto;
  flex: none;
}

@media (min-width: 700px) {
  .education {
    grid-template-columns: 1fr auto;
    gap: 44px;
  }
}

/* Functional experience: six short items read as two per row, three rows deep.
   Held at two columns even on narrow screens — the items are short enough to
   wrap inside their cell rather than collapsing the intended shape. */
.func-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 32px;
}

@media (min-width: 700px) {
  .func-list { column-gap: 48px; }
}

/* In two columns the final row is the last *two* items, so :last-child alone
   would leave the left-hand cell with a stray rule under it. */
.func-list li:nth-last-child(-n+2) { border-bottom: none; }

.exp-list dt {
  font-weight: 600;
  margin-top: 1.1em;
}
.exp-list dd {
  margin: 4px 0 0;
  color: var(--text-muted);
}

/* ---------- Expertise / Services ---------- */

.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 24px;
}

.service {
  padding: 28px 0;
  border-top: 1px solid var(--divider);
}
/* image leads the card, so the heading must not carry its usual top margin */
.service h3 { margin-top: 0; }
.service .plain-list:last-child { margin-bottom: 0; }
.services-grid > .service:first-child { border-top: none; }

@media (min-width: 768px) {
  .services-grid {
    grid-template-columns: 1fr 1fr;
    column-gap: 48px;
  }
  .service {
    border-top: 1px solid var(--divider);
    padding: 32px 0;
  }
  /* 8 services in 2 columns: fills four even rows, no orphan card. */
}

/* Fixed 8:5 frame with object-fit so a replacement image of any native
   aspect ratio is cropped to fit instead of shifting the grid. */
.service-visual {
  margin-bottom: 20px;
  border: 1px solid var(--divider);
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  object-position: center;
  background: var(--bg-muted);
}

/* ---------- Expertise carousel ----------
   Progressive enhancement: script.js adds .is-carousel, so with JS disabled
   the services stay the plain stacked/two-column grid defined above. */

.carousel { position: relative; }

.is-carousel .services-grid {
  display: flex;
  grid-template-columns: none;
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  /* the dots below are the position indicator, so the native bar is redundant */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.is-carousel .services-grid::-webkit-scrollbar { display: none; }

/* One card per view on phones. Dividers are dropped because side-by-side
   cards no longer read as a stacked list. */
.is-carousel .service {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  border-top: none;
  padding: 8px 0 0;
}

@media (min-width: 768px) {
  /* Two per view, matching the gap used by the no-JS grid. */
  .is-carousel .service { flex-basis: calc((100% - 48px) / 2); }
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.carousel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: 2px;
  cursor: pointer;
}

.carousel-btn:hover { background: var(--bg-muted); border-color: var(--accent); color: var(--accent-dark); }
.carousel-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.carousel-dots {
  display: flex;
  align-items: center;
  gap: 10px;
}

.carousel-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  flex: none;
  background: transparent;
  border: 1px solid var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
}

.carousel-dot[aria-current="true"] { background: var(--accent); border-color: var(--accent); }
.carousel-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .is-carousel .services-grid { scroll-behavior: auto; }
}

/* ---------- Independent Specialists ---------- */

/* Heading centers over the column; the body justifies to flush edges, matching
   the hero treatment. hyphens: auto is what stops justified text from opening
   up rivers of white space between words. */
.specialists h2 { text-align: center; }

.specialists p {
  text-align: justify;
  hyphens: auto;
}

/* ---------- Contact form ---------- */

.contact-form { margin-top: 24px; }

.field { margin-bottom: 18px; display: flex; flex-direction: column; gap: 6px; }

.field label { font-weight: 600; font-size: 0.95rem; }
.req { color: var(--accent-dark); }
.optional { font-weight: 400; color: var(--text-muted); }

.field input,
.field select,
.field textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--divider);
  border-radius: 3px;
  background: #fff;
  color: var(--text);
}

.field textarea { min-height: 140px; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field-hidden {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.fallback {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--divider);
  color: var(--text-muted);
}

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

.site-footer {
  padding: 40px 0;
}

.footer-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.footer-mark { width: 96px; height: auto; }

.footer-social { display: flex; gap: 10px; }

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--text-muted);
  border: 1px solid var(--divider);
  border-radius: 3px;
}
.footer-social a:hover { color: var(--accent); border-color: var(--accent); }

.footer-social svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.footer-meta { display: flex; flex-direction: column; align-items: center; gap: 6px; }

.footer-links a { color: var(--text-muted); }

.copyright {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

@media (min-width: 640px) {
  .footer-grid { flex-direction: row; justify-content: space-between; align-items: center; text-align: left; }
  .footer-brand { flex-direction: row; }
  .footer-meta { align-items: flex-end; }
}
