/* ============================================================
   VDI Technologies — Shared Stylesheet
   Brand manual 01/2025: primary #d50912, font Source Sans 3
   Supports dark (default) and light modes via data-theme attr
   ============================================================ */

/* GOOGLE FONTS are loaded per-page to keep this file cacheable */

/* ─── THEME TOKENS ─────────────────────────────────────────── */

:root,
[data-theme="dark"] {
  --bg:           #0c0c0c;
  --bg-2:         #161616;
  --bg-3:         #1e1e1e;
  --bg-nav:       rgba(12,12,12,0.94);
  --bg-menu:      rgba(12,12,12,0.98);
  --text:         #f2f2f2;
  --text-muted:   rgba(242,242,242,0.52);
  --accent:       #d50912;
  --accent-dark:  #a8070f;
  --accent-light: #f01828;
  --line:         rgba(255,255,255,0.08);
  --line-strong:  rgba(255,255,255,0.14);
  --shadow:       rgba(0,0,0,0.60);
  --shadow-hover: rgba(0,0,0,0.75);
  --logo-filter:  brightness(0) invert(1);
  --hero-grad:    rgba(12,12,12,0.92), rgba(12,12,12,0.55), rgba(12,12,12,0.14);
  --card-bg-a:    #161616;
  --card-bg-b:    #0c0c0c;
  --thumb-bg:     #1a1a1a;
  --btn-text:     #fff;
}

[data-theme="light"] {
  --bg:           #ffffff;
  --bg-2:         #f5f5f5;
  --bg-3:         #ebebeb;
  --bg-nav:       rgba(255,255,255,0.96);
  --bg-menu:      rgba(255,255,255,0.99);
  --text:         #0c0c0c;
  --text-muted:   rgba(12,12,12,0.52);
  --accent:       #d50912;
  --accent-dark:  #a8070f;
  --accent-light: #f01828;
  --line:         rgba(0,0,0,0.09);
  --line-strong:  rgba(0,0,0,0.15);
  --shadow:       rgba(0,0,0,0.12);
  --shadow-hover: rgba(0,0,0,0.20);
  --logo-filter:  brightness(0);
  --hero-grad:    rgba(12,12,12,0.88), rgba(12,12,12,0.48), rgba(12,12,12,0.10);
  --card-bg-a:    #f5f5f5;
  --card-bg-b:    #ffffff;
  --thumb-bg:     #e8e8e8;
  --btn-text:     #ffffff;
}

/* System preference — applied when no explicit data-theme set */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg:           #ffffff;
    --bg-2:         #f5f5f5;
    --bg-3:         #ebebeb;
    --bg-nav:       rgba(255,255,255,0.96);
    --bg-menu:      rgba(255,255,255,0.99);
    --text:         #0c0c0c;
    --text-muted:   rgba(12,12,12,0.52);
    --accent:       #d50912;
    --accent-dark:  #a8070f;
    --accent-light: #f01828;
    --line:         rgba(0,0,0,0.09);
    --line-strong:  rgba(0,0,0,0.15);
    --shadow:       rgba(0,0,0,0.12);
    --shadow-hover: rgba(0,0,0,0.20);
    --logo-filter:  brightness(0);
    --hero-grad:    rgba(12,12,12,0.88), rgba(12,12,12,0.48), rgba(12,12,12,0.10);
    --card-bg-a:    #f5f5f5;
    --card-bg-b:    #ffffff;
    --thumb-bg:     #e8e8e8;
    --btn-text:     #ffffff;
  }
}

/* ─── RESET ─────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-y: scroll; scrollbar-gutter: stable; }
body {
  font-family: 'Source Sans 3', 'Source Sans Pro', Calibri, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  transition: background .3s, color .3s;
}
a { text-decoration: none; color: inherit; }

/* ─── NAV ───────────────────────────────────────────────────── */

nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: 52px; min-height: 52px; max-height: 52px;
  display: grid;
  grid-template-columns: 230px minmax(0,1fr) auto;
  align-items: center;
  column-gap: 24px;
  padding: 0 48px;
  background: var(--bg-nav);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  transition: background .3s, border-color .3s;
  width: 100%; box-sizing: border-box;
}

.nav-logo {
  grid-column: 1;
  display: flex; align-items: center; justify-content: flex-start;
  width: 230px; height: 52px;
}
.nav-logo img {
  display: block; height: 26px; width: auto; max-width: 150px;
  object-fit: contain;
  filter: var(--logo-filter);
  transition: filter .3s;
}

.nav-links {
  grid-column: 2;
  display: flex; align-items: center; justify-content: center;
  height: 52px; gap: 28px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
}
.nav-links a {
  display: inline-flex; align-items: center; height: 52px;
  transition: color .2s; white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }

/* accent underline on active */
.nav-links a.active {
  position: relative;
}
.nav-links a.active::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: var(--accent); border-radius: 2px 2px 0 0;
}

.nav-right {
  grid-column: 3;
  display: flex; align-items: center; gap: 12px;
  justify-self: end;
}

/* theme toggle */
.theme-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: none; border: 1px solid var(--line-strong);
  cursor: pointer; color: var(--text-muted);
  transition: background .2s, color .2s, border-color .2s;
  flex-shrink: 0;
}
.theme-btn:hover {
  background: var(--accent); border-color: var(--accent);
  color: #fff;
}
.theme-btn svg { width: 15px; height: 15px; }
/* show correct icon */
.theme-btn .icon-sun  { display: none; }
.theme-btn .icon-moon { display: block; }
[data-theme="light"] .theme-btn .icon-sun  { display: block; }
[data-theme="light"] .theme-btn .icon-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-btn .icon-sun  { display: block; }
  :root:not([data-theme]) .theme-btn .icon-moon { display: none; }
}

.nav-badge {
  border: 1px solid var(--accent); color: var(--accent);
  font-size: 11px; font-weight: 700; padding: 5px 14px;
  border-radius: 20px; letter-spacing: .04em;
  transition: background .2s, color .2s; white-space: nowrap;
  display: inline-flex; align-items: center;
}
.nav-badge:hover { background: var(--accent); color: #fff; }

/* hamburger — desktop hidden */
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  width: 36px; height: 36px; min-width: 36px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.hamburger span {
  display: block; height: 2px; width: 24px;
  background: var(--text); border-radius: 2px;
  transition: transform .3s, opacity .3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── NAV RESPONSIVE ────────────────────────────────────────── */

@media (max-width: 1100px) and (min-width: 901px) {
  nav {
    padding: 0 32px;
    grid-template-columns: 190px minmax(0,1fr) auto;
    column-gap: 18px;
  }
  .nav-logo { width: 190px; }
  .nav-links { gap: 20px; }
}

@media (max-width: 900px) {
  nav {
    padding: 0 14px;
    grid-template-columns: auto 1fr auto;
    column-gap: 10px;
  }
  .nav-logo { width: auto; }
  .nav-logo img { height: 24px; max-width: 145px; }
  .nav-links {
    display: none !important;
    grid-column: 1 / -1;
  }
  .nav-links.open {
    display: flex !important;
    position: fixed;
    top: 52px; left: 0; right: 0;
    width: 100%; height: auto;
    z-index: 999;
    flex-direction: column;
    align-items: center; justify-content: flex-start;
    gap: 0; padding: 18px 0 20px;
    background: var(--bg-menu) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 70px var(--shadow);
    text-align: center;
    height: auto !important; min-height: 0 !important;
  }
  .nav-links.open a {
    width: 100%; height: auto; min-height: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 13px 20px; margin: 0;
    font-size: 15px; font-weight: 700; line-height: 1.2;
    color: var(--text-muted) !important;
  }
  .nav-links.open a:hover,
  .nav-links.open a.active {
    color: var(--text) !important;
  }
  .nav-links.open a.active::after { display: none; }
  .hamburger { display: flex; }
  .nav-right { gap: 8px; }
  .nav-badge { font-size: 10px; padding: 5px 12px; max-width: 160px; }
}

@media (max-width: 380px) {
  nav { padding: 0 8px; column-gap: 6px; }
  .nav-logo img { height: 23px; max-width: 135px; }
  .nav-badge { font-size: 9px; padding: 5px 9px; max-width: 144px; }
}

@media (max-width: 340px) {
  .nav-logo img { max-width: 118px; }
  .nav-badge { max-width: 128px; font-size: 8.5px; }
}

/* ─── HERO ──────────────────────────────────────────────────── */

.hero {
  position: relative; height: 100svh; min-height: 560px;
  display: flex; align-items: flex-end; justify-content: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  transform: scale(1.04);
  animation: heroZoom 12s ease-out forwards;
  filter: brightness(1.08) contrast(1.02);
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    to top,
    var(--bg) 0%,
    rgba(12,12,12,0.55) 45%,
    rgba(12,12,12,0.14) 100%
  );
}
@keyframes heroZoom { to { transform: scale(1); } }

.hero-content {
  position: relative; z-index: 2;
  width: 100%; padding: 0 24px 64px;
  text-align: center;
  animation: fadeUp .9s ease both;
}
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  color: var(--accent); text-transform: uppercase; margin-bottom: 18px;
}
.hero-tag span { width: 22px; height: 1px; background: var(--accent); display: inline-block; }
.hero h1 {
  font-size: clamp(28px, 5.6vw, 56px);
  line-height: 1.08; letter-spacing: -.02em; margin-bottom: 18px;
  color: #fff;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero-sub {
  font-size: clamp(14px, 3.5vw, 18px);
  color: rgba(242,242,242,0.65); font-weight: 300; line-height: 1.6;
  max-width: 520px; margin: 0 auto;
}
.nowrap { white-space: nowrap; }

/* ─── CARD SECTIONS ─────────────────────────────────────────── */

.card-section {
  display: grid; grid-template-columns: 1fr 1.2fr;
  min-height: clamp(390px, 42vw, 560px);
  border-top: 1px solid var(--line);
}
.card-section.flip { grid-template-columns: 1.2fr 1fr; }
.card-section.flip .card-text { order: 2; }
.card-section.flip .card-img  { order: 1; }

.col-a { background: var(--card-bg-a); }
.col-b { background: var(--card-bg-b); }

.card-text {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 64px 56px; min-height: inherit;
}
.card-text > * { max-width: 420px; width: 100%; }
.card-text p   { max-width: 420px; }

.section-num {
  font-size: 10px; font-weight: 700; letter-spacing: .15em;
  color: var(--accent); text-transform: uppercase;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.section-num::before { content:''; width: 20px; height: 1px; background: var(--accent); }
.card-text h2 {
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.12; margin-bottom: 16px; letter-spacing: -.01em;
  color: var(--text);
}
.card-text p {
  font-size: clamp(14px, 1.4vw, 17px);
  color: var(--text-muted); font-weight: 300; line-height: 1.8;
}

.card-img {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; min-height: inherit;
}
.img-wrap {
  width: 100%; border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 56px var(--shadow);
  transition: transform .5s ease, box-shadow .5s ease;
  line-height: 0;
}
.card-section:hover .img-wrap {
  transform: translateY(-4px);
  box-shadow: 0 32px 72px var(--shadow-hover);
}
.img-wrap img { width: 100%; height: 300px; object-fit: cover; display: block; }

.img-wrap.software-full {
  background: var(--bg);
  border-radius: 14px; overflow: hidden; padding: 0;
}
.img-wrap.software-full img {
  display: block; width: 100%; height: auto;
  max-height: 420px; object-fit: contain; object-position: center;
  background: var(--bg); border-radius: 14px;
}
.img-wrap.product-full { background: var(--bg-2); }
.img-wrap.product-full img {
  height: auto; max-height: 420px;
  object-fit: contain; object-position: center;
  background: var(--bg-2);
}
.img-wrap.diagram-full { background: var(--bg-2); padding: 12px 0; }
.img-wrap.diagram-full img {
  height: auto; max-height: 420px;
  object-fit: contain; object-position: center;
  background: var(--bg-2);
}

/* ─── REVEAL ANIMATIONS ─────────────────────────────────────── */

.reveal { opacity:0; transform: translateY(24px); transition: opacity .65s ease, transform .65s ease; }
.reveal.visible { opacity:1; transform: none; }
@keyframes fadeUp { from{opacity:0;transform:translateY(24px)} to{opacity:1;transform:none} }

/* ─── FOOTER ────────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--line);
  padding: 28px 0; text-align: center;
  font-size: 13px; color: var(--text-muted);
  background: var(--bg);
  transition: background .3s, color .3s, border-color .3s;
}
footer img { height: 20px; filter: var(--logo-filter); opacity: .35; }

/* ─── SECTION HEADER (standalone hero-style banners) ────────── */

.page-hero {
  position: relative; height: 50svh; min-height: 340px;
  display: flex; align-items: flex-end; justify-content: center;
  overflow: hidden;
}
.page-hero .hero-bg { filter: brightness(0.9) contrast(1.0); }

/* ─── CTA / BUTTON ──────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .04em;
  padding: 10px 24px; border-radius: 24px;
  border: none; cursor: pointer;
  transition: background .2s, transform .2s;
}
.btn:hover { background: var(--accent-light); transform: translateY(-1px); }
.btn-outline {
  background: none; color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover { background: var(--accent); color: #fff; }

/* ─── NEWS CARDS ─────────────────────────────────────────────── */

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px,1fr));
  gap: 1px; background: var(--line);
  border-top: 1px solid var(--line);
}
.news-card {
  background: var(--bg); padding: 40px 36px;
  display: flex; flex-direction: column; gap: 12px;
  transition: background .2s;
}
.news-card:hover { background: var(--bg-2); }
.news-card-link { cursor: pointer; }
.news-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  color: var(--accent); text-transform: uppercase;
}
.news-meta span + span { color: var(--text-muted); font-weight: 400; letter-spacing: 0; }
.news-card h2 {
  font-size: clamp(18px, 2.2vw, 26px);
  line-height: 1.2; letter-spacing: -.01em; color: var(--text);
}
.news-card p {
  font-size: 15px; color: var(--text-muted);
  font-weight: 300; line-height: 1.7; flex: 1;
}
.news-read {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  color: var(--accent); text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px;
}
.news-read::after { content: '→'; }

/* ─── PRODUCT CARDS ─────────────────────────────────────────── */

.product-card {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0; border-top: 1px solid var(--line);
  min-height: 460px;
}
.product-card-reverse { direction: rtl; }
.product-card-reverse > * { direction: ltr; }
.product-copy {
  background: var(--bg-2);
  display: flex; flex-direction: column; justify-content: center;
  padding: 56px 52px; gap: 18px;
}
.product-copy h3 {
  font-size: clamp(22px, 2.8vw, 38px);
  line-height: 1.1; letter-spacing: -.015em; color: var(--text);
}
.product-copy h4 {
  font-size: clamp(13px, 1.4vw, 16px);
  color: var(--accent); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  margin-top: -8px;
}
.product-copy p {
  font-size: clamp(14px, 1.4vw, 16px);
  color: var(--text-muted); font-weight: 300; line-height: 1.8;
}
.product-components {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.product-components span {
  font-size: 11px; font-weight: 700; letter-spacing: .07em;
  color: var(--text-muted); text-transform: uppercase;
  background: var(--bg-3); padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--line);
}
.product-visual {
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.product-visual img {
  max-width: 100%; max-height: 380px; object-fit: contain;
  filter: drop-shadow(0 16px 40px var(--shadow));
  transition: transform .4s, filter .4s;
}
.product-card:hover .product-visual img {
  transform: translateY(-4px) scale(1.015);
  filter: drop-shadow(0 24px 56px var(--shadow-hover));
}

/* ─── ARTICLE / RICH TEXT ────────────────────────────────────── */

.article-body {
  max-width: 740px; margin: 0 auto;
  padding: 64px 24px 80px;
  font-size: clamp(15px, 1.5vw, 17px);
  line-height: 1.82; color: var(--text-muted);
}
.article-body h2 {
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.2; color: var(--text); margin: 48px 0 16px;
}
.article-body h3 {
  font-size: clamp(16px, 1.8vw, 22px);
  color: var(--text); margin: 32px 0 12px;
}
.article-body p { margin-bottom: 20px; }
.article-body ul, .article-body ol {
  padding-left: 24px; margin-bottom: 20px;
}
.article-body li { margin-bottom: 8px; }
.article-body strong { color: var(--text); font-weight: 700; }
.article-body a { color: var(--accent); text-decoration: underline; }
.article-body a:hover { color: var(--accent-light); }
.article-body img {
  width: 100%; border-radius: 10px; margin: 32px 0;
  box-shadow: 0 12px 40px var(--shadow);
}

/* ─── UTILITY ────────────────────────────────────────────────── */

.section-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.spacer-top { height: 52px; } /* compensate fixed nav */

/* ─── TABLET ─────────────────────────────────────────────────── */

@media (max-width: 1024px) and (min-width: 701px) {
  .card-text { padding: 48px 36px; }
  .card-img  { padding: 32px; }
  .img-wrap img { height: 260px; }
  .product-copy { padding: 40px 36px; }
  .product-visual { padding: 28px; }
}

/* ─── MOBILE ─────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .hero-content { padding: 0 20px 52px; }

  .card-section,
  .card-section.flip { grid-template-columns: 1fr; min-height: auto; }
  .card-text,
  .card-section.flip .card-text { order: 1; padding: 40px 22px 26px; }
  .card-img,
  .card-section.flip .card-img  { order: 2; padding: 0 20px 36px; min-height: auto; }
  .card-text > *, .card-text p { max-width: 100%; }
  .img-wrap img { height: 220px; }
  .img-wrap.diagram-full img,
  .img-wrap.product-full img,
  .img-wrap.software-full img { height: auto; max-height: none; }

  .news-grid { grid-template-columns: 1fr; }
  .news-card { padding: 28px 22px; }

  .product-card,
  .product-card-reverse { grid-template-columns: 1fr; direction: ltr; }
  .product-copy { padding: 36px 22px; order: 2; }
  .product-visual { padding: 28px 22px; order: 1; }
}

@media (max-width: 480px) {
  .article-body { padding: 40px 18px 56px; }
}

/* Article hero slideshow wrapper — injected by article-loader.js.
   The carousel itself (.vdi-ss) provides its own rounding/shadow. */
.article-hero-figure { margin: 36px 0 0; }
@media (max-width: 640px) {
  .article-hero-figure { margin-top: 26px; }
}
