/* ============================================================
   Ruspolymet digital business card
   Dark industrial theme: steel charcoal, hairlines, brand red.
   Shape lock: all corners sharp. Accent lock: #C21F39 only.
   ============================================================ */

:root {
  --bg: #0C0F12;
  --surface: #14181C;
  --surface-2: #1A2026;
  --line: rgba(199, 205, 208, 0.14);
  --line-strong: rgba(199, 205, 208, 0.26);
  --text: #E9ECEE;
  --muted: #98A2A9;
  --faint: #6B767E;
  --red: #C21F39;
  --red-soft: rgba(194, 31, 57, 0.16);
  --red-text: #E8495F; /* lighter tint of brand red for small text on dark */
  --media-bg: #14181C; /* matches the baked video background */
  --footer-bg: #0A0D10;
  --header-bg: rgba(12, 15, 18, 0.72);
  --portrait-1: #1A2026;
  --portrait-2: #14181C;
  --portrait-3: #10151A;
  --initials: rgba(199, 205, 208, 0.28);

  --font-display: "Roboto Condensed", "Arial Narrow", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-body: "Roboto", -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, "PingFang SC", "Microsoft YaHei", monospace;

  --header-h: 60px;
  --container: 1120px;
  --pad: 20px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="dark"] { color-scheme: dark; }

html[data-theme="light"] {
  color-scheme: light;
  --bg: #F2F4F5;
  --surface: #FFFFFF;
  --surface-2: #E9EDF0;
  --line: rgba(18, 24, 30, 0.12);
  --line-strong: rgba(18, 24, 30, 0.24);
  --text: #15191D;
  --muted: #55606A;
  --faint: #7C868F;
  --red-soft: rgba(194, 31, 57, 0.1);
  --red-text: #C21F39; /* brand red has enough contrast on light */
  --media-bg: #DFE4E7; /* matches the baked light video background */
  --footer-bg: #E9EDF0;
  --header-bg: rgba(242, 244, 245, 0.78);
  --portrait-1: #FFFFFF;
  --portrait-2: #EDF1F3;
  --portrait-3: #DFE4E7;
  --initials: rgba(18, 24, 30, 0.2);
}

@media (min-width: 768px) {
  :root { --header-h: 64px; --pad: 32px; }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}
img, video { display: block; max-width: 100%; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.35s var(--ease);
}
.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header__logo { display: flex; align-items: center; height: 100%; padding-block: 4px; }
.site-header__logo img { height: 30px; width: auto; }
@media (min-width: 768px) { .site-header__logo img { height: 36px; } }

.site-header__controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  color: var(--muted);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.theme-toggle__icon--moon { display: none; }
html[data-theme="light"] .theme-toggle__icon--sun { display: none; }
html[data-theme="light"] .theme-toggle__icon--moon { display: block; }

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
}
.lang-switch__btn {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 8px 14px;
  color: var(--muted);
  transition: color 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.lang-switch__btn + .lang-switch__btn { border-left: 1px solid var(--line); }
.lang-switch__btn:hover { color: var(--text); }
.lang-switch__btn.is-active {
  color: var(--text);
  background: var(--red-soft);
  box-shadow: inset 0 -2px 0 var(--red);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hero__bg { position: absolute; inset: 0; z-index: -1; }
.hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 30%;
  filter: saturate(0.92);
}
.hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(12, 15, 18, 0.85) 0%, rgba(12, 15, 18, 0.38) 55%, rgba(12, 15, 18, 0.28) 100%),
    linear-gradient(180deg, rgba(12, 15, 18, 0.5) 0%, rgba(12, 15, 18, 0.66) 45%, rgba(12, 15, 18, 0.92) 78%, var(--bg) 100%);
}
html[data-theme="light"] .hero__bg::after {
  background:
    linear-gradient(90deg, rgba(242, 244, 245, 0.9) 0%, rgba(242, 244, 245, 0.52) 55%, rgba(242, 244, 245, 0.38) 100%),
    linear-gradient(180deg, rgba(242, 244, 245, 0.55) 0%, rgba(242, 244, 245, 0.68) 45%, rgba(242, 244, 245, 0.94) 80%, var(--bg) 100%);
}

.hero__inner {
  flex: 1;
  display: grid;
  grid-template-areas:
    "portrait"
    "text"
    "contacts";
  align-content: start;
  gap: 44px;
  padding-top: calc(var(--header-h) + 48px);
  padding-bottom: 64px;
  width: 100%;
}
.hero__text { grid-area: text; max-width: 620px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 22px;
}
.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--red);
  flex: none;
}

.hero__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(42px, 9vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.hero__name-line { display: block; }
.hero__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(19px, 3vw, 24px);
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 6px;
}
.hero__dept {
  display: block;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 8px;
}
.hero__bio {
  color: var(--muted);
  font-size: 15.5px;
  max-width: 46ch;
  margin-top: 20px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 15px 26px;
  border: 1px solid transparent;
  transition: transform 0.15s var(--ease), background 0.25s var(--ease),
              border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn--primary { background: var(--red); color: #fff; }
.btn--primary:hover { background: #A91830; }
.btn--ghost { border-color: var(--line-strong); color: var(--text); }
.btn--ghost:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* Portrait placeholder */
.portrait {
  grid-area: portrait;
  position: relative;
  width: min(300px, 78vw);
  aspect-ratio: 4 / 5;
  background:
    linear-gradient(160deg, var(--portrait-1) 0%, var(--portrait-2) 55%, var(--portrait-3) 100%);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; }
.portrait__initials {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 84px;
  letter-spacing: 0.02em;
  color: var(--initials);
  user-select: none;
}
.portrait__corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--red);
  border-style: solid;
  border-width: 0;
}
.portrait__corner--tl { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; }
.portrait__corner--tr { top: 10px; right: 10px; border-top-width: 2px; border-right-width: 2px; }
.portrait__corner--bl { bottom: 10px; left: 10px; border-bottom-width: 2px; border-left-width: 2px; }
.portrait__corner--br { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; }

/* Contact rows */
.contacts {
  grid-area: contacts;
  display: grid;
  grid-template-columns: 1fr;
}

/* Keep the identity, portrait and primary actions inside a typical phone viewport. */
@media (max-width: 639px) {
  .hero__inner {
    gap: 32px;
    padding-top: calc(var(--header-h) + 32px);
  }
  .portrait { width: min(210px, 56vw); }
  .hero__bio { margin-top: 16px; }
  .hero__actions { margin-top: 24px; }
}
@media (min-width: 640px) { .contacts { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .contacts { grid-template-columns: 1fr 1fr 1fr; } }

/* No border on the last grid row, so nothing underlines the block */
.contacts li:last-child .contact-row { border-bottom: 0; }
@media (min-width: 640px) { .contacts li:nth-last-child(-n+2) .contact-row { border-bottom: 0; } }
@media (min-width: 1024px) { .contacts li:nth-last-child(-n+3) .contact-row { border-bottom: 0; } }

.contact-row {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  height: 100%;
  padding: 18px 20px 18px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition: padding-left 0.3s var(--ease);
}
.contact-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: var(--red);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s var(--ease);
}
.contact-row:hover::before,
.contact-row:focus-visible::before { transform: scaleY(1); }
.contact-row:hover, .contact-row:focus-visible { padding-left: 14px; }

.contact-row__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.contact-row__value {
  font-size: 16px;
  color: var(--text);
  word-break: break-all;
}
.contact-row__hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--faint);
}

/* ---------- Sections ---------- */
.section {
  padding-block: 88px;
  border-top: 1px solid var(--line);
}
@media (min-width: 1024px) { .section { padding-block: 120px; } }

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 4.6vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-bottom: 28px;
}

/* ---------- About ---------- */
.about {
  display: grid;
  gap: 56px;
}
@media (min-width: 1024px) {
  .about { grid-template-columns: 1.15fr 0.85fr; gap: 72px; align-items: start; }
}
.about__body { color: var(--muted); max-width: 58ch; }
.about__motto {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 22px;
  padding-left: 14px;
  border-left: 2px solid var(--red);
}

.text-link {
  display: inline-block;
  margin-top: 26px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--text);
  border-bottom: 1px solid var(--red);
  padding-bottom: 3px;
  transition: color 0.25s var(--ease);
}
.text-link:hover { color: var(--red-text); }

/* Stats */
.stats {
  border-top: 1px solid var(--line);
}
.stats__item {
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.stats__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.stats__label::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--red);
  flex: none;
}
.stats__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 44px;
  line-height: 1.1;
  margin-top: 6px;
}
.stats__caption {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 2px;
}

/* Industries */
.industries { margin-top: 44px; }
.industries__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 16px;
}
.industries__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.industries__list li {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 7px 12px;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.industries__list li:hover { border-color: var(--red); color: var(--text); }

/* ---------- Products ---------- */
.products__grid {
  display: grid;
  gap: 28px;
}
@media (min-width: 1024px) {
  .products__grid { grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
}

.product-card__media {
  position: relative;
  aspect-ratio: 5 / 3;
  background: var(--media-bg);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: border-color 0.3s var(--ease), background-color 0.35s var(--ease);
}
.product-card:hover .product-card__media { border-color: rgba(194, 31, 57, 0.55); }
.product-card__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.12);
}
.product-card__body { padding-top: 16px; }
.product-card__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.product-card__spec {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
}
.product-card__link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  transition: color 0.25s var(--ease);
}
.product-card__link .arrow {
  color: var(--red-text);
  transition: transform 0.25s var(--ease);
}
.product-card__link:hover { color: var(--red-text); }
.product-card__link:hover .arrow { transform: translate(2px, -2px); }

/* ---------- Gallery ---------- */
.gallery { overflow: hidden; }
.gallery__strip {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-inline: var(--pad);
  padding-bottom: 12px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.gallery__strip::-webkit-scrollbar { display: none; }
@media (min-width: 1120px) {
  .gallery__strip {
    padding-inline: calc((100vw - var(--container)) / 2 + var(--pad));
  }
}
.gallery__item {
  flex: 0 0 min(74vw, 430px);
  scroll-snap-align: start;
}
.gallery__item img {
  width: 100%;
  height: auto; /* override the height attribute so aspect-ratio governs */
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 1px solid var(--line);
  filter: saturate(0.95);
}
.gallery__caption {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 10px;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding-top: 56px;
  background: var(--footer-bg);
  transition: background-color 0.35s var(--ease);
}
.footer__grid {
  display: grid;
  gap: 36px;
  padding-bottom: 48px;
}
@media (min-width: 900px) {
  .footer__grid { grid-template-columns: 1.3fr 1fr 1fr 0.9fr; gap: 40px; }
}
.footer__logo { height: 32px; width: auto; opacity: 0.9; }
.footer__motto {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 14px;
  max-width: 30ch;
}
.footer__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
}
.footer__text { font-size: 13.5px; color: var(--muted); line-height: 1.9; }
.footer__link { color: var(--text); transition: color 0.25s var(--ease); }
.footer__link:hover { color: var(--red-text); }
.footer__bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 22px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--faint);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  z-index: 200;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--red);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  padding: 12px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal on scroll ---------- */
.reveal .section-title,
.reveal .about__body,
.reveal .about__motto,
.reveal .text-link,
.reveal .stats__item,
.reveal .industries,
.reveal .product-card,
.reveal .gallery__item {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in .section-title,
.reveal.in .about__body,
.reveal.in .about__motto,
.reveal.in .text-link,
.reveal.in .stats__item,
.reveal.in .industries,
.reveal.in .product-card,
.reveal.in .gallery__item {
  opacity: 1;
  transform: none;
}
.reveal.in .stats__item:nth-child(2) { transition-delay: 0.08s; }
.reveal.in .stats__item:nth-child(3) { transition-delay: 0.16s; }
.reveal.in .product-card:nth-child(2) { transition-delay: 0.08s; }
.reveal.in .product-card:nth-child(3) { transition-delay: 0.16s; }

/* Hero entrance */
.hero__text > *, .portrait, .contacts li {
  animation: rise 0.9s var(--ease) both;
}
.hero__text > *:nth-child(1) { animation-delay: 0.05s; }
.hero__text > *:nth-child(2) { animation-delay: 0.12s; }
.hero__text > *:nth-child(3) { animation-delay: 0.19s; }
.hero__text > *:nth-child(4) { animation-delay: 0.26s; }
.hero__text > *:nth-child(5) { animation-delay: 0.33s; }
.portrait { animation-delay: 0.05s; }
.contacts li { animation-delay: calc(0.4s + var(--i, 0) * 0.06s); }
.contacts li:nth-child(1) { --i: 1; } .contacts li:nth-child(2) { --i: 2; }
.contacts li:nth-child(3) { --i: 3; } .contacts li:nth-child(4) { --i: 4; }
.contacts li:nth-child(5) { --i: 5; } .contacts li:nth-child(6) { --i: 6; }

@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Desktop hero layout ---------- */
@media (min-width: 1024px) {
  .hero__inner {
    grid-template-areas:
      "text portrait"
      "contacts contacts";
    grid-template-columns: 1.25fr 0.75fr;
    gap: 56px 72px;
    align-items: start;
    padding-top: calc(var(--header-h) + 72px);
  }
  .portrait { justify-self: end; width: 100%; max-width: 340px; margin-top: 8px; animation-delay: 0.25s; }
}

/* ---------- Chinese locale adjustments ---------- */
html[lang^="zh"] .eyebrow,
html[lang^="zh"] .section-title,
html[lang^="zh"] .hero__name,
html[lang^="zh"] .hero__dept,
html[lang^="zh"] .product-card__title,
html[lang^="zh"] .industries__title,
html[lang^="zh"] .about__motto,
html[lang^="zh"] .footer__label,
html[lang^="zh"] .footer__motto,
html[lang^="zh"] .gallery__caption,
html[lang^="zh"] .contact-row__label,
html[lang^="zh"] .stats__label,
html[lang^="zh"] .btn,
html[lang^="zh"] .product-card__link {
  text-transform: none;
  letter-spacing: 0.06em;
}
html[lang^="zh"] .hero__name {
  font-weight: 700;
  line-height: 1.12;
  word-break: keep-all;
  font-size: clamp(34px, 7.5vw, 64px);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-delay: 0s !important;
    transition-duration: 0.001s !important;
  }
  .reveal .section-title, .reveal .about__body, .reveal .about__motto,
  .reveal .text-link, .reveal .stats__item, .reveal .industries,
  .reveal .product-card, .reveal .gallery__item {
    opacity: 1;
    transform: none;
  }
}
