/* ===========================================================
   DWEENG LTD — Electrical Engineering & Control Systems
   Design tokens
   =========================================================== */

@font-face {
  font-family: 'Fraunces';
  src: local('Fraunces');
}

:root {
  /* Color */
  --ink:        #15171a;   /* near-black graphite, primary dark */
  --ink-soft:   #2a2d32;   /* panel/card dark */
  --steel:      #3c4a56;   /* switchgear blue-grey, secondary */
  --brass:      #a8884f;   /* bronze accent, matches existing brand mark */
  --brass-light:#c7a86c;
  --paper:      #f3f1ec;   /* warm off-white */
  --paper-dim:  #e8e4da;
  --signal:     #b3402f;   /* muted signal red, sparing emphasis only */
  --line:       rgba(21,23,26,0.12);
  --line-on-dark: rgba(243,241,236,0.14);

  /* Type */
  --f-display: 'Fraunces', 'Times New Roman', serif;
  --f-condensed: 'Oswald', 'Arial Narrow', sans-serif;
  --f-body: 'Source Sans 3', 'Segoe UI', Arial, sans-serif;
  --f-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --container: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--f-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  font-size: 16px;
}

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

a { color: inherit; text-decoration: none; }

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

/* ===========================================================
   Top utility bar
   =========================================================== */
.topbar {
  background: var(--ink);
  color: var(--paper-dim);
  font-size: 0.85rem;
}
.topbar .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 10px 28px;
  gap: 12px;
}
.topbar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--paper-dim);
}
.topbar-item svg { flex-shrink: 0; opacity: 0.85; }
.topbar-item .label-strong { color: #fff; font-weight: 600; }

/* ===========================================================
   Header / nav
   =========================================================== */
header.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}
.logo img { height: 40px; width: auto; }

nav.main-nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2px;
  flex-wrap: wrap;
}
nav.main-nav a {
  display: block;
  padding: 10px 16px;
  font-family: var(--f-condensed);
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  border-radius: 3px;
  transition: background 0.15s ease, color 0.15s ease;
}
nav.main-nav a:hover,
nav.main-nav a:focus-visible {
  background: var(--ink);
  color: var(--paper);
}
nav.main-nav a.active {
  background: var(--brass);
  color: var(--ink);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  font-family: var(--f-condensed);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
  cursor: pointer;
}

@media (max-width: 880px) {
  .header-inner { flex-wrap: wrap; }
  .nav-toggle { display: inline-block; }
  nav.main-nav { width: 100%; display: none; }
  nav.main-nav.open { display: block; }
  nav.main-nav ul { flex-direction: column; gap: 0; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
  nav.main-nav a { padding: 12px 4px; }
}

/* ===========================================================
   Hero (home)
   =========================================================== */
.hero {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  padding: 110px 0 90px;
}
.hero .wrap { position: relative; z-index: 2; }
.hero-eyebrow {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-light);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.hero-eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--brass-light);
}
.hero h1 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 5vw, 3.7rem);
  line-height: 1.08;
  margin: 0 0 26px;
  max-width: 14ch;
}
.hero p.lede {
  font-size: 1.15rem;
  max-width: 46ch;
  color: var(--paper-dim);
  margin: 0 0 34px;
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--brass);
  color: var(--ink);
  font-family: var(--f-condensed);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.88rem;
  padding: 14px 26px;
  border-radius: 2px;
  transition: background 0.15s ease;
}
.hero-cta:hover { background: var(--brass-light); }

/* Circuit trace signature animation */
.circuit-trace {
  position: absolute;
  top: 0; right: -5%;
  width: 62%;
  height: 100%;
  z-index: 1;
  opacity: 0.9;
  pointer-events: none;
}
.circuit-trace svg { width: 100%; height: 100%; }
.circuit-trace path {
  fill: none;
  stroke: var(--steel);
  stroke-width: 1.4;
  stroke-dasharray: 6 6000;
  animation: trace-draw 2.6s ease-out forwards;
}
.circuit-trace path.accent {
  stroke: var(--brass);
}
.circuit-trace circle {
  fill: var(--brass-light);
  opacity: 0;
  animation: node-pop 0.4s ease forwards;
}
@keyframes trace-draw {
  from { stroke-dashoffset: 1400; stroke-dasharray: 1400 1400; }
  to   { stroke-dashoffset: 0; stroke-dasharray: 1400 1400; }
}
@keyframes node-pop {
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .circuit-trace path { animation: none; stroke-dasharray: none; }
  .circuit-trace circle { animation: none; opacity: 1; }
}
@media (max-width: 880px) {
  .circuit-trace { display: none; }
  .hero { padding: 70px 0 60px; }
}

/* ===========================================================
   Inner page banner (non-home pages)
   =========================================================== */
.page-banner {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  padding: 64px 0 54px;
  background-size: cover;
  background-position: center;
}
.page-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(21,23,26,0.94) 30%, rgba(21,23,26,0.55));
}
.page-banner .wrap { position: relative; z-index: 1; }
.page-banner h1 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  margin: 0 0 10px;
}
.breadcrumb {
  font-family: var(--f-mono);
  font-size: 0.82rem;
  color: var(--brass-light);
  letter-spacing: 0.02em;
}
.breadcrumb a { color: var(--paper-dim); }
.breadcrumb a:hover { color: var(--paper); }

/* ===========================================================
   Section scaffolding
   =========================================================== */
section { padding: 76px 0; }
section.tight { padding: 52px 0; }
section.alt { background: var(--paper-dim); }
section.dark { background: var(--ink); color: var(--paper); }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.eyebrow::before { content: ''; width: 22px; height: 1px; background: var(--brass); }

h2.section-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  margin: 0 0 14px;
  max-width: 22ch;
}
.section-sub {
  max-width: 60ch;
  color: var(--steel);
  font-size: 1.04rem;
  margin: 0 0 36px;
}
section.dark .section-sub { color: var(--paper-dim); }

/* ===========================================================
   Services grid
   =========================================================== */
.service-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.service-cell {
  background: var(--paper);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.service-cell.filler {
  background: var(--paper-dim);
}
.service-cell .num {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--brass);
}
.service-cell h3 {
  font-family: var(--f-condensed);
  font-size: 1.02rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
  font-weight: 500;
}
@media (max-width: 760px) {
  .service-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .service-grid { grid-template-columns: 1fr; }
}

/* ===========================================================
   Feature split (image + text)
   =========================================================== */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}
.split img { border-radius: 2px; }
@media (max-width: 880px) {
  .split { grid-template-columns: 1fr; gap: 32px; }
}
.split.reverse { direction: rtl; }
.split.reverse > * { direction: ltr; }

/* ===========================================================
   Cards (work / projects)
   =========================================================== */
.card {
  background: #fff;
  border: 1px solid var(--line);
  padding: 30px 28px;
  border-left: 3px solid var(--brass);
}
.card h3 {
  font-family: var(--f-condensed);
  text-transform: uppercase;
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin: 0 0 12px;
}
.card ul { margin: 0; padding-left: 0; list-style: none; }
.card li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 9px;
  font-size: 0.97rem;
}
.card li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--brass);
  font-family: var(--f-mono);
}
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 880px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* ===========================================================
   Staff / people profiles
   =========================================================== */
.profile {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 36px;
  padding: 40px 0;
  border-bottom: 1px solid var(--line);
}
.profile:last-child { border-bottom: none; }
.profile img {
  border-radius: 2px;
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.profile h3 {
  font-family: var(--f-display);
  font-size: 1.5rem;
  margin: 0 0 4px;
}
.profile .since {
  font-family: var(--f-mono);
  font-size: 0.84rem;
  color: var(--steel);
  margin-bottom: 18px;
}
.profile h4 {
  font-family: var(--f-condensed);
  text-transform: uppercase;
  font-size: 0.84rem;
  letter-spacing: 0.05em;
  color: var(--brass);
  margin: 18px 0 10px;
}
.profile ul { margin: 0; padding-left: 0; list-style: none; }
.profile li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 7px;
  font-size: 0.95rem;
}
.profile li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--brass);
  font-family: var(--f-mono);
  font-size: 0.85rem;
}
@media (max-width: 700px) {
  .profile { grid-template-columns: 1fr; }
  .profile img { max-width: 220px; }
}

/* ===========================================================
   Gallery
   =========================================================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.gallery-grid figure {
  margin: 0;
  overflow: hidden;
  border-radius: 2px;
  background: var(--ink-soft);
}
.gallery-grid img {
  width: 100%;
  height: 230px;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.gallery-grid a:hover img { transform: scale(1.05); }
@media (max-width: 880px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .gallery-grid { grid-template-columns: 1fr; }
}

/* ===========================================================
   Contact
   =========================================================== */
.contact-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line-on-dark);
}
.contact-strip > div {
  padding: 28px 26px;
  border-right: 1px solid var(--line-on-dark);
}
.contact-strip > div:last-child { border-right: none; }
.contact-strip .label {
  font-family: var(--f-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brass-light);
  margin-bottom: 8px;
  display: block;
}
@media (max-width: 800px) {
  .contact-strip { grid-template-columns: 1fr; }
  .contact-strip > div { border-right: none; border-bottom: 1px solid var(--line-on-dark); }
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 36px;
}
.form-grid .full { grid-column: 1 / -1; }
.field label {
  display: block;
  font-family: var(--f-condensed);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  color: var(--steel);
}
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px 14px;
  font-family: var(--f-body);
  font-size: 0.96rem;
  border-radius: 2px;
}
.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}
.field textarea { resize: vertical; min-height: 130px; }
.submit-btn {
  background: var(--ink);
  color: var(--paper);
  border: none;
  font-family: var(--f-condensed);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.88rem;
  padding: 14px 30px;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s ease;
}
.submit-btn:hover { background: var(--steel); }
.form-note {
  font-size: 0.85rem;
  color: var(--steel);
  margin-top: 14px;
}
.form-success {
  background: #eef5ee;
  border: 1px solid #8cb88c;
  color: #2e5c2e;
  padding: 16px 20px;
  border-radius: 3px;
  margin-bottom: 24px;
  font-size: 0.95rem;
}
.form-error {
  background: #fbeceb;
  border: 1px solid #d99a92;
  color: #8a2e23;
  padding: 16px 20px;
  border-radius: 3px;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* ===========================================================
   Footer
   =========================================================== */
footer.site-footer {
  background: var(--ink);
  color: var(--paper-dim);
  padding: 60px 0 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 44px;
  border-bottom: 1px solid var(--line-on-dark);
}
.footer-grid h4 {
  font-family: var(--f-condensed);
  text-transform: uppercase;
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  color: var(--brass-light);
  margin: 0 0 18px;
}
.footer-grid img { height: 32px; margin-bottom: 16px; }
.footer-grid p { font-size: 0.92rem; max-width: 32ch; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { font-size: 0.92rem; color: var(--paper-dim); transition: color 0.15s; }
.footer-links a:hover { color: var(--brass-light); }
.social-row { display: flex; gap: 10px; }
.social-row a {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink-soft);
  border-radius: 2px;
  transition: background 0.15s;
}
.social-row a:hover { background: var(--brass); }
.footer-bottom {
  padding: 22px 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--steel);
}
@media (max-width: 800px) {
  .footer-grid { grid-template-columns: 1fr; gap: 30px; }
}

/* ===========================================================
   Misc utility
   =========================================================== */
.visually-hidden {
  position: absolute;
  left: -9999px;
}
:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
