/* ---------------------------------------------------------
   Self-hosted fonts
--------------------------------------------------------- */
@font-face{
  font-family: 'Space Grotesk';
  src: url('fonts/SpaceGrotesk.woff2') format('woff2-variations'), url('fonts/SpaceGrotesk.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face{
  font-family: 'IBM Plex Sans';
  src: url('fonts/IBMPlexSansVF.woff2') format('woff2-variations'), url('fonts/IBMPlexSansVF.woff2') format('woff2');
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face{
  font-family: 'IBM Plex Sans';
  src: url('fonts/IBMPlexSansItalicVF.woff2') format('woff2-variations'), url('fonts/IBMPlexSansItalicVF.woff2') format('woff2');
  font-weight: 100 700;
  font-style: italic;
  font-display: swap;
}
@font-face{
  font-family: 'IBM Plex Mono';
  src: url('fonts/IBMPlexMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face{
  font-family: 'IBM Plex Mono';
  src: url('fonts/IBMPlexMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------
   MBD Systems — tokens
--------------------------------------------------------- */
:root{
  --bg: #FBFBF8;
  --surface: #F0F1EB;
  --ink: #15181A;
  --ink-soft: #52585B;
  --line: #DBDCD4;
  --accent: #D2321C;
  --trace: #2E6E68;
  --trace-soft: #BFD8D4;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --max: 1160px;
  --gutter: clamp(24px, 6vw, 64px);
}

*{ box-sizing: border-box; }
body{
  margin:0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

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

h1,h2,h3{
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  margin: 0;
  letter-spacing: -0.01em;
}

p{ margin: 0 0 1em; color: var(--ink-soft); max-width: 62ch; }

:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* subtle paper grain, one quiet texture over the whole page */
.grain{
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  opacity: 0.035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------
   Header
--------------------------------------------------------- */
.site-header{
  position: sticky; top: 0; z-index: 100;
  display:flex; align-items:center; justify-content: space-between;
  padding: 22px var(--gutter);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 2px solid #E3A29B;
}
.wordmark{ display: inline-flex; align-items: center; text-decoration: none; }
.logo-img{ height: 36px; width: auto; opacity: 0.62; transition: opacity .15s ease; }
.wordmark:hover .logo-img{ opacity: 0.85; }

.site-nav{ display:flex; align-items:center; gap: 32px; }
.site-nav a{
  text-decoration:none;
  font-size: 15px;
  color: var(--ink-soft);
  transition: color .15s ease;
  position: relative;
}
.site-nav a:hover{ color: var(--ink); }
.site-nav a.active{ color: var(--ink); }
.site-nav a.active::after{
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.nav-cta{
  color: var(--ink) !important;
  border: 1px solid var(--ink);
  padding: 7px 14px;
  border-radius: 3px;
}
.nav-cta:hover{ background: var(--ink); color: var(--bg) !important; }

.nav-toggle{ display:none; }

@media (max-width: 760px){
  .site-nav{
    position: fixed; inset: 68px 0 0 0; height: calc(100vh - 68px);
    background: var(--bg);
    flex-direction: column; align-items: flex-start; justify-content: flex-start;
    gap: 22px; padding: 32px var(--gutter);
    transform: translateX(100%);
    transition: transform .28s ease;
  }
  .site-nav.open{ transform: translateX(0); }
  .site-nav a{ font-size: 20px; }
  .nav-toggle{
    display:flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 32px; height: 32px; background: none; border: none; cursor: pointer;
  }
  .nav-toggle span{ display:block; width: 100%; height: 2px; background: var(--ink); }
}

/* ---------------------------------------------------------
   Home hero — centered, logo-led
--------------------------------------------------------- */
.hero-centered{
  position: relative;
  overflow: hidden;
  min-height: 560px;
  min-height: clamp(480px, 66vh, 640px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(56px, 8vw, 88px) var(--gutter);
  text-align: center;
}
.hero-bg{ position:absolute; inset:0; z-index:0; }
.hero-bg svg{ width:100%; height:100%; display:block; }
.hero-bg-fade{
  position:absolute; inset:0;
  background: linear-gradient(to bottom, rgba(251,251,248,0) 0%, rgba(251,251,248,0.25) 60%, var(--bg) 95%);
}
.hero-centered-inner{
  position: relative; z-index: 1;
  max-width: 620px; margin: 24px auto 0;
  display:flex; flex-direction: column; align-items: center;
}
.hero-logo-big{ width: 100%; max-width: 400px; height: auto; margin-bottom: 72px; }
.hero-centered h1{
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 500;
  margin-bottom: 18px;
  max-width: none;
  white-space: nowrap;
}
.hero-lede{ font-size: 16.5px; max-width: 46ch; margin-left:auto; margin-right:auto; }
.hero-actions{ display:flex; gap: 16px; margin-top: 28px; flex-wrap: wrap; justify-content: center; }

.btn{
  display:inline-flex; align-items:center;
  padding: 12px 22px;
  border-radius: 3px;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn-primary{ background: var(--ink); color: var(--bg); }
.btn-primary:hover{ background: var(--accent); }
.btn-ghost{ border-color: var(--line); color: var(--ink); }
.btn-ghost:hover{ border-color: var(--ink); }

/* ---------------------------------------------------------
   Home — compact capabilities strip
--------------------------------------------------------- */
.capabilities-compact{
  background: var(--bg);
  border-top: 2px solid #E3A29B;
  padding: clamp(40px, 6vw, 64px) var(--gutter);
}
.cap-grid-compact{
  max-width: var(--max); margin: 0 auto;
  display:grid; grid-template-columns: repeat(4, 1fr); gap: clamp(20px, 3vw, 32px);
}
.cap-item h3{ font-size: 16px; margin-bottom: 8px; padding-left: 14px; border-left: 2px solid #B81F2E; }
.cap-item p{ font-size: 14px; margin: 0; }

.protocol-tags{
  max-width: var(--max); margin: 32px auto 0;
  display:flex; flex-wrap: wrap; gap: 10px;
  list-style: none; padding: 24px 0 0;
  border-top: 1px solid var(--line);
}
.protocol-tags li{
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--line);
  padding: 5px 11px;
  border-radius: 3px;
  color: var(--ink-soft);
}

@media (max-width: 700px){
  .hero-centered{ min-height: 420px; }
  .hero-centered h1{ white-space: normal; }
  .hero-logo-big{ max-width: 260px; }
  .page-head{ min-height: 420px; }
  .project-list, .about{ margin-top: -160px; }
}

/* Preview label used only on background-option-b/c.html, not the main site */
.option-tag{
  text-align:center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #fff;
  background: var(--accent);
  padding: 6px 0;
  margin: 0;
  position: relative;
  z-index: 2;
}

@media (max-width: 900px){
  .cap-grid-compact{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px){
  .cap-grid-compact{ grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------
   Page head (Projects, About)
--------------------------------------------------------- */
.page-head{
  position: relative;
  overflow: hidden;
  min-height: 560px;
  min-height: clamp(480px, 66vh, 640px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 130px var(--gutter) 32px;
  padding-top: clamp(110px, 15vw, 170px);
}
.page-head-inner{ max-width: var(--max); margin: 0 auto; width: 100%; }
.page-head h1{ position: relative; z-index: 1; font-size: clamp(24px, 2.6vw, 30px); font-weight: 500; max-width: 22ch; }
.page-head .eyebrow{ position: relative; z-index: 1; }

.page-bg{ position:absolute; inset:0; z-index:0; }
.page-bg svg{ width:100%; height:100%; display:block; }
.page-bg-fade{
  position:absolute; inset:0;
  background: linear-gradient(to bottom, rgba(251,251,248,0) 0%, rgba(251,251,248,0.25) 60%, var(--bg) 95%);
}

/* ---------------------------------------------------------
   Projects — listing
--------------------------------------------------------- */
.project-list{
  max-width: var(--max); margin: -320px auto 0;
  position: relative; z-index: 2;
  padding: 0 var(--gutter) clamp(56px, 8vw, 96px);
}
.project-list-inner{
  border: 1px solid var(--line);
  background: var(--bg);
}
.project-card{
  display:grid; grid-template-columns: 260px 1fr;
  gap: clamp(24px, 4vw, 48px);
  padding: 32px;
  text-decoration: none;
  color: inherit;
  transition: background .15s ease;
  border-bottom: 1px solid var(--line);
}
.project-card:last-child{ border-bottom: none; }
.project-card:hover{ background: var(--surface); }

.project-card--twingtec, .project-card--dac, .project-card--eltronic{ border-left: none; }

.project-detail--twingtec .client-logo{ border-bottom: 2px solid #B81F2E; padding-bottom: 10px; height: 46px; }
.project-detail--dac .client-logo{ border-bottom: 2px solid #DC5F52; padding-bottom: 10px; }
.project-detail--eltronic .client-logo{ border-bottom: 2px solid #E8938C; padding-bottom: 10px; }
.project-card-media img{
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  width: 100%;
  height: 160px;
  object-fit: cover;
}
.project-card-body h2{ font-size: 21px; margin: 4px 0 10px; max-width: 26ch; }
.project-card-body p{ font-size: 15px; margin: 0; }

@media (max-width: 700px){
  .project-card{ grid-template-columns: 1fr; }
  .project-card-media img{ height: 200px; }
}

/* ---------------------------------------------------------
   Shared: client logo / label used on cards + detail pages
--------------------------------------------------------- */
.client-logo{ height: 40px; width: auto; margin-bottom: 12px; }
.client-logo-link{ display: inline-block; text-decoration: none; }
.project-card--dac .client-logo, .project-card--eltronic .client-logo{ height: 35px; }
.project-client{
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--trace);
  margin-bottom: 8px;
}

/* ---------------------------------------------------------
   Project — detail page
--------------------------------------------------------- */
.project-detail{
  max-width: 760px; margin: 0 auto;
  padding: clamp(40px, 6vw, 64px) var(--gutter) clamp(32px, 5vw, 48px);
}
.back-link{
  display:inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: 28px;
}
.back-link:hover{ color: var(--ink); }

.project-detail-media img{
  width: 100%;
  max-width: 380px;
  margin: 0 auto 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}
.project-detail-media-pair{
  display:grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 32px;
}
.project-detail-media-pair img{ margin-bottom: 0; height: 100%; object-fit: cover; }

.project-detail-body h1{ font-size: clamp(26px, 3.4vw, 34px); margin-bottom: 18px; max-width: 22ch; }
.project-detail-body p{ font-size: 16px; }

.spec-list{ list-style:none; padding:0; margin: 20px 0 0; border-top: 1px solid var(--line); }
.spec-list li{
  display:flex; gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink);
}
.spec-list li span{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--trace);
  flex: 0 0 110px;
}

.project-pager{
  max-width: 760px; margin: 0 auto;
  padding: 0 var(--gutter) clamp(56px, 8vw, 88px);
  display:flex; justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.project-pager-link{
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
  color: var(--ink-soft);
}
.project-pager-link:hover{ color: var(--ink); }

@media (max-width: 480px){
  .project-detail-media-pair{ grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------
   About
--------------------------------------------------------- */
.about{
  max-width: var(--max); margin: -320px auto 0;
  position: relative; z-index: 2;
  padding: 0 var(--gutter) clamp(56px, 8vw, 96px);
  display:grid; grid-template-columns: 240px 1fr; gap: clamp(32px, 6vw, 72px);
  align-items: start;
}
.about-photo img{
  border-radius: 4px;
  border: 1px solid var(--line);
}
.about-copy p{ font-size: 16px; }
.definition{
  margin-top: 20px;
  padding: 18px 22px;
  border-left: 2px solid var(--trace);
  background: var(--surface);
}
.definition p{ margin:0; font-size: 14.5px; font-style: italic; color: var(--ink-soft); max-width: 54ch; }

@media (max-width: 640px){
  .about{ grid-template-columns: 1fr; }
  .about-photo{ width: 160px; }
}

/* ---------------------------------------------------------
   404 page
--------------------------------------------------------- */
.error-page{
  max-width: 680px; margin: 0 auto;
  padding: clamp(96px, 16vw, 180px) var(--gutter) clamp(96px, 14vw, 160px);
  text-align: center;
}
.error-page .eyebrow{ text-align: center; font-size: 15px; }
.error-page h1{
  font-size: clamp(26px, 3.6vw, 36px);
  margin-bottom: 18px;
}
.error-lede{ font-size: 16.5px; max-width: 46ch; margin: 0 auto; }
.error-page .hero-actions{ justify-content: center; margin-top: 30px; }

/* ---------------------------------------------------------
   Contact page
--------------------------------------------------------- */
.contact-page{
  max-width: var(--max); margin: -320px auto 0;
  position: relative; z-index: 2;
  padding: 0 var(--gutter) clamp(72px, 10vw, 120px);
}
.contact-card{ max-width: 480px; }
.contact-company{
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--trace);
  margin: 0 0 18px;
}
.contact-email-big{
  display:block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(24px, 3.2vw, 34px);
  text-decoration: none;
  color: var(--ink);
  border-bottom: 2px solid #B81F2E;
  padding-bottom: 10px;
  margin-bottom: 24px;
  width: fit-content;
}
.contact-email-big:hover{ color: #B81F2E; }
.contact-addr{ font-size: 16px; color: var(--ink-soft); margin: 0; }

@media (max-width: 700px){
  .contact-page{ margin-top: -160px; }
}

/* ---------------------------------------------------------
   Footer
--------------------------------------------------------- */
.site-footer{
  border-top: 2px solid #E3A29B;
}
.footer-inner{
  display:flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px;
  padding: 32px var(--gutter) 40px;
  max-width: var(--max);
  margin: 0 auto;
}
.footer-address p{
  font-size: 13.5px;
  margin: 0 0 3px;
  color: var(--ink-soft);
}
.footer-address a{ color: var(--trace); text-decoration: underline; text-underline-offset: 2px; }
.footer-address a:hover{ color: var(--accent); }
.footer-copy{
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
}
