/* ==========================================================================
   EMEC — Site Stylesheet
   Plain, hand-written CSS. No build step, no Node.js, no npm, no Tailwind.
   Edit this file directly and refresh the browser — that's the whole
   workflow. See docs/DESIGN_SYSTEM.md for the palette/type rationale.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens (CSS custom properties)
   -------------------------------------------------------------------------- */
:root {
  --emec-ink: #0B1220;
  --emec-graphite: #151E2B;
  --emec-slate: #5B6B7C;
  --emec-steel: #3B6EA5;
  --emec-circuit: #35C7C0;
  --emec-porcelain: #F6F8FA;
  --emec-silver: #D7DCE2;
  --emec-white: #FFFFFF;
  --emec-signal: #E8B84B;

  --emec-bg: var(--emec-ink);
  --emec-surface: var(--emec-graphite);
  --emec-text: var(--emec-porcelain);
  --emec-text-muted: var(--emec-slate);
  --emec-border: rgba(215, 220, 226, 0.14);

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  --content-max: 1280px;
  --section-y: 6rem;
  --section-y-lg: 8rem;
  --radius: 3px;
}

html.light {
  --emec-bg: var(--emec-porcelain);
  --emec-surface: var(--emec-white);
  --emec-text: var(--emec-ink);
  --emec-text-muted: var(--emec-slate);
  --emec-border: var(--emec-silver);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--emec-bg);
  color: var(--emec-text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 600;
}
p { margin: 0; }
:focus-visible { outline: 2px solid var(--emec-circuit); outline-offset: 2px; }

main { flex: 1; }

/* --------------------------------------------------------------------------
   3. Layout helpers
   -------------------------------------------------------------------------- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.section { padding: var(--section-y) 0; }
.section-lg { padding: var(--section-y-lg) 0; }
.section--bordered { border-top: 1px solid var(--emec-border); }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.text-center { text-align: center; }
.max-width-sm { max-width: 42rem; }
.max-width-md { max-width: 56rem; }

/* Grids */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
.grid-gap-lg { gap: 2rem; }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* --------------------------------------------------------------------------
   4. Typography helpers
   -------------------------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--emec-circuit);
}
.text-muted { color: var(--emec-text-muted); }
.text-lg { font-size: 1.125rem; }
.mono { font-family: var(--font-mono); }

.page-title {
  font-size: 2rem;
  line-height: 1.15;
}
.hero-title {
  font-size: 2.25rem;
  line-height: 1.1;
  max-width: 48rem;
}
.section-title {
  font-size: 1.5rem;
}
@media (min-width: 768px) {
  .page-title { font-size: 2.5rem; }
  .hero-title { font-size: 3rem; }
  .section-title { font-size: 1.875rem; }
}

.prose-content {
  color: var(--emec-text-muted);
  line-height: 1.7;
  white-space: pre-line;
}

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: var(--emec-steel);
  color: #ffffff;
}
.btn-primary:hover { background: var(--emec-circuit); color: var(--emec-ink); }
.btn-secondary {
  background: transparent;
  border-color: var(--emec-border);
  color: var(--emec-text);
}
.btn-secondary:hover { border-color: var(--emec-circuit); color: var(--emec-circuit); }
.btn-block { width: 100%; justify-content: center; }

/* --------------------------------------------------------------------------
   6. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--emec-surface);
  border: 1px solid var(--emec-border);
  border-radius: var(--radius);
  padding: 2rem;
}
.card-link { display: block; transition: border-color 0.2s ease; }
.card-link:hover .card { border-color: var(--emec-circuit); }
.card-link:hover .card-title { color: var(--emec-circuit); }

.card-title { font-family: var(--font-display); font-size: 1.125rem; transition: color 0.2s ease; }
.group-company-logo { height: 2.5rem; width: auto; margin-bottom: 1rem; }
.card-media {
  aspect-ratio: 4 / 3;
  background: var(--emec-surface);
  border: 1px solid var(--emec-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-media--wide { aspect-ratio: 16 / 10; }
.card-media--square { aspect-ratio: 1 / 1; }
.card-media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s ease;
}
.card-link:hover .card-media img { transform: scale(1.05); }

.card-center { text-align: center; }

/* --------------------------------------------------------------------------
   7. Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--emec-bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--emec-border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}
.brand img { height: 2rem; width: auto; }
.brand-logo--light { display: none; }
html.light .brand-logo--dark { display: none; }
html.light .brand-logo--light { display: block; }

.primary-nav { display: none; align-items: center; gap: 2rem; font-size: 0.9375rem; }
.primary-nav a:hover { color: var(--emec-circuit); }
.nav-item { position: relative; }
.nav-dropdown {
  position: absolute;
  left: 0;
  top: 100%;
  padding-top: 0.75rem;
  display: none;
  min-width: 220px;
}
.nav-item:hover .nav-dropdown { display: block; }
.nav-dropdown-inner {
  background: var(--emec-surface);
  border: 1px solid var(--emec-border);
  border-radius: var(--radius);
  padding: 0.5rem 0;
}
.nav-dropdown-inner a { display: block; padding: 0.5rem 1.5rem; font-size: 0.875rem; }
.nav-dropdown-inner a:hover { color: var(--emec-circuit); }

.header-actions { display: flex; align-items: center; gap: 1rem; }
.theme-toggle {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--emec-border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--emec-text);
  padding: 0.375rem 0.75rem;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--emec-circuit); color: var(--emec-circuit); }
.header-cta { display: none; }

@media (min-width: 768px) {
  .primary-nav { display: flex; }
}
@media (min-width: 640px) {
  .header-cta { display: inline-flex; font-size: 0.875rem; padding: 0.5rem 1rem; }
}

/* --------------------------------------------------------------------------
   8. Announcement bar
   -------------------------------------------------------------------------- */
.announcement-bar {
  background: var(--emec-steel);
  color: #ffffff;
  font-size: 0.875rem;
}
.announcement-bar .container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  text-align: center;
}
.announcement-bar a { text-decoration: underline; text-underline-offset: 2px; font-weight: 500; }
.announcement-bar a:hover { color: var(--emec-ink); }

/* --------------------------------------------------------------------------
   9. Footer
   -------------------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--emec-border); margin-top: 6rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  padding: 4rem 0;
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: repeat(4, 1fr); }
}
.footer-brand { font-family: var(--font-display); font-weight: 600; font-size: 1.125rem; margin-bottom: 0.75rem; }
.footer-about { color: var(--emec-text-muted); font-size: 0.9375rem; max-width: 20rem; }
.footer-col-title { margin-bottom: 1rem; }
.footer-col ul { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.9375rem; }
.footer-col a:hover { color: var(--emec-circuit); }
.footer-contact { color: var(--emec-text-muted); font-size: 0.9375rem; }
.footer-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--emec-text-muted);
}
.footer-bottom-links { display: flex; gap: 1rem; }
.footer-bottom-links a:hover { color: var(--emec-circuit); }
@media (min-width: 640px) {
  .footer-bottom { flex-direction: row; }
}

/* --------------------------------------------------------------------------
   10. Signature trace divider + scroll reveal
   -------------------------------------------------------------------------- */
.trace-divider { width: 100%; height: 1.5rem; overflow: visible; stroke: var(--emec-circuit); opacity: 0.55; }
[data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 400ms ease, transform 400ms ease;
}
[data-reveal].is-revealed { opacity: 1; transform: translateY(0); }
[data-trace] path {
  stroke-dasharray: 1300;
  stroke-dashoffset: 1300;
  transition: stroke-dashoffset 900ms ease;
}
[data-trace].is-revealed path { stroke-dashoffset: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   11. Homepage hero
   -------------------------------------------------------------------------- */
.hero { padding: 5rem 0 6rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2.5rem; }
.hero-media {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--emec-border);
  margin-top: 3rem;
}
.hero-divider { margin-top: 4rem; }
@media (min-width: 768px) {
  .hero { padding: 8rem 0; }
}

/* --------------------------------------------------------------------------
   12. Statistics
   -------------------------------------------------------------------------- */
.stat-value { font-family: var(--font-mono); font-size: 1.875rem; color: var(--emec-circuit); }
.stat-label { font-size: 0.875rem; color: var(--emec-text-muted); margin-top: 0.25rem; }
@media (min-width: 768px) {
  .stat-value { font-size: 2.25rem; }
}

/* --------------------------------------------------------------------------
   13. Process steps (numbered)
   -------------------------------------------------------------------------- */
.process-list { list-style: none; }
.process-step__number { font-family: var(--font-mono); color: var(--emec-circuit); font-size: 1.5rem; }
.process-step__title { font-family: var(--font-display); font-size: 1rem; margin-top: 0.75rem; }
.process-step__desc { margin-top: 0.5rem; font-size: 0.875rem; color: var(--emec-text-muted); }

.step-list { display: flex; flex-direction: column; gap: 1.5rem; }
.step-row { display: flex; gap: 1rem; }
.step-row__number { font-family: var(--font-mono); color: var(--emec-circuit); flex-shrink: 0; }
.step-row__title { font-family: var(--font-display); }
.step-row__desc { margin-top: 0.25rem; font-size: 0.875rem; color: var(--emec-text-muted); }

/* --------------------------------------------------------------------------
   14. Timeline (About page)
   -------------------------------------------------------------------------- */
.timeline { border-left: 1px solid var(--emec-border); padding-left: 2rem; display: flex; flex-direction: column; gap: 2.5rem; }
.timeline-year { font-family: var(--font-mono); color: var(--emec-circuit); font-size: 0.875rem; }
.timeline-title { font-family: var(--font-display); font-size: 1.125rem; margin-top: 0.25rem; }
.timeline-desc { margin-top: 0.5rem; font-size: 0.875rem; color: var(--emec-text-muted); max-width: 40rem; }
.timeline-image { margin-top: 1rem; max-width: 24rem; border-radius: var(--radius); border: 1px solid var(--emec-border); }

/* --------------------------------------------------------------------------
   15. Testimonial
   -------------------------------------------------------------------------- */
.client-logos { display: flex; flex-wrap: wrap; align-items: center; gap: 2.5rem 1.5rem; opacity: 0.8; }
.client-logos img { height: 2rem; width: auto; filter: grayscale(100%); }
.testimonial-quote { max-width: 42rem; margin-top: 3rem; }
.testimonial-quote p { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.5; }
.testimonial-quote footer { margin-top: 1rem; font-size: 0.875rem; color: var(--emec-text-muted); display: flex; align-items: center; gap: 0.75rem; }
.testimonial-photo { width: 2.5rem; height: 2.5rem; border-radius: 50%; object-fit: cover; }

/* --------------------------------------------------------------------------
   16. Team
   -------------------------------------------------------------------------- */
.team-role { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--emec-text-muted); margin-top: 0.25rem; }
.team-role--accent { color: var(--emec-circuit); }
.team-detail-photo { width: 10rem; height: 10rem; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--emec-border); }
.team-detail-layout { display: flex; flex-direction: column; gap: 2.5rem; align-items: flex-start; }
@media (min-width: 768px) {
  .team-detail-layout { flex-direction: row; }
}
.team-links { display: flex; gap: 1rem; font-size: 0.9375rem; margin-top: 1.5rem; }
.team-links a { color: var(--emec-circuit); }
.team-links a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   17. Detail pages (service/project/research/blog) two-column layout
   -------------------------------------------------------------------------- */
.detail-layout { display: grid; gap: 3rem; grid-template-columns: 1fr; margin-top: 3rem; }
@media (min-width: 768px) {
  .detail-layout { grid-template-columns: 2fr 1fr; }
}
.detail-hero-image { width: 100%; border-radius: var(--radius); border: 1px solid var(--emec-border); margin-top: 3rem; }
.sidebar-list { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.9375rem; margin-top: 1rem; }
.sidebar-list a:hover { color: var(--emec-circuit); }

/* --------------------------------------------------------------------------
   18. Utility spacing (small, deliberately limited set)
   -------------------------------------------------------------------------- */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-6 { margin-top: 3rem; }
.mt-8 { margin-top: 4rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* --------------------------------------------------------------------------
   19. Simple pages (coming soon / maintenance)
   -------------------------------------------------------------------------- */
.simple-page { padding: 8rem 0; text-align: center; }
.simple-page p { max-width: 32rem; margin: 1rem auto 0; }

/* --------------------------------------------------------------------------
   20. Placeholder note (used on thin Phase-3/4/5 detail pages)
   -------------------------------------------------------------------------- */
.phase-note {
  margin-top: 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--emec-text-muted);
}
.empty-note {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--emec-text-muted);
}
