/* ==========================================================================
   Home page — hero with animated R&D illustration, service directory
   ========================================================================== */

/* ---- Hero ---- */
.hero {
  padding-block: var(--cds-spacing-07) var(--cds-spacing-09);
  background: var(--cds-background);
  border-bottom: 1px solid var(--cds-border-subtle);
  overflow: hidden;
}

.hero__brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--cds-spacing-04) var(--cds-spacing-05);
  margin-bottom: var(--cds-spacing-08);
}

.hero__wordmark {
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--cds-text-primary);
}

.hero__wordmark:hover {
  color: var(--cds-text-primary);
  text-decoration: none;
}

/* Text column + illustration column; stacked on small screens */
.hero__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: var(--cds-spacing-08);
}

/* Carbon signature: short accent rule above the heading */
.hero__rule {
  width: var(--cds-spacing-09);
  height: 0.25rem;
  margin-bottom: var(--cds-spacing-06);
  background: var(--cds-interactive);
}

.hero__title {
  max-width: 20ch;
  margin-bottom: var(--cds-spacing-06);
  overflow-wrap: break-word;
}

.hero__lead {
  max-width: 44rem;
  font-size: 1.125rem;
  line-height: 1.625rem;
  color: var(--cds-text-secondary);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cds-spacing-03);
  margin-top: var(--cds-spacing-07);
}

.hero__figure {
  width: min(100%, 22rem);
  margin-inline: auto;
}

/* ---- Services ---- */
.services {
  padding-block: var(--cds-spacing-09);
}

.services__count {
  color: var(--cds-text-secondary);
}

.services__note {
  margin-top: var(--cds-spacing-05);
  color: var(--cds-text-helper);
}

/* ---- Breakpoints ---- */
@media (min-width: 42rem) {
  .hero {
    padding-block: var(--cds-spacing-09) var(--cds-spacing-10);
  }

  .hero__lead {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }

  .hero__figure {
    width: min(100%, 26rem);
  }
}

@media (min-width: 66rem) {
  .hero {
    padding-block: var(--cds-spacing-10) var(--cds-spacing-12);
  }

  .hero__brand {
    margin-bottom: var(--cds-spacing-10);
  }

  .hero__layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: var(--cds-spacing-10);
  }

  .hero__figure {
    width: 100%;
    max-width: 34rem;
    margin-inline: auto 0;
  }

  .services {
    padding-block: var(--cds-spacing-10);
  }
}

/* ==========================================================================
   Illustration — R&D pipeline (blueprint style)
   Pure CSS animation on inline SVG; colours come from theme tokens so it
   follows light and dark mode. Disabled under prefers-reduced-motion.
   ========================================================================== */

.fig {
  display: block;
  width: 100%;
  height: auto;
  animation: fig-enter 900ms var(--cds-ease-expressive) both;
}

/* ---- Paint roles ---- */
.fig__backdrop {
  fill: var(--cds-background-alt);
}

.fig__gridline {
  fill: none;
  stroke: var(--cds-border-subtle);
  stroke-width: 1;
}

.fig__card {
  fill: var(--cds-layer);
  stroke: var(--cds-border-strong);
  stroke-width: 1.5;
}

.fig__rule {
  fill: none;
  stroke: var(--cds-border-subtle);
  stroke-width: 1.5;
}

.fig__ink {
  fill: none;
  stroke: var(--cds-text-primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fig__solid {
  fill: var(--cds-text-primary);
}

.fig__accent {
  fill: var(--cds-interactive);
}

.fig__lens {
  fill: var(--cds-interactive);
  fill-opacity: 0.12;
  stroke: var(--cds-text-primary);
  stroke-width: 3;
}

.fig__code {
  fill: var(--cds-border-strong);
}

.fig__code--accent {
  fill: var(--cds-interactive);
}

.fig__cursor {
  fill: var(--cds-text-primary);
}

.fig__field {
  fill: none;
  stroke: var(--cds-support-success);
  stroke-width: 3;
  stroke-dasharray: 6 5;
  opacity: 0.7;
}

.fig__rotor {
  fill: none;
  stroke: var(--cds-text-primary);
  stroke-width: 2.5;
  stroke-dasharray: 10 5;
}

.fig__wire {
  fill: none;
  stroke: var(--cds-border-strong);
  stroke-width: 2;
  stroke-dasharray: 4 5;
}

.fig__pulse {
  fill: none;
  stroke: var(--cds-interactive);
  stroke-width: 4;
  stroke-linecap: square;
  stroke-dasharray: 18 100;
  stroke-dashoffset: 18;
  animation: fig-pulse 2.4s linear infinite;
}

.fig__pulse:nth-of-type(5) {
  animation-delay: 0.8s;
}

.fig__pulse:nth-of-type(6) {
  animation-delay: 1.6s;
}

/* Sizes are in SVG units (viewBox 480), so labels scale with the figure */
.fig__label,
.fig__index {
  font-family: var(--cds-font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.fig__label {
  fill: var(--cds-text-primary);
}

.fig__index {
  fill: var(--cds-interactive);
}

html[lang="km"] .fig__label {
  font-family: var(--cds-font-khmer);
  font-size: 15px;
  letter-spacing: 0;
}

/* Phones: the figure is small, so enlarge labels relative to the artwork */
@media (max-width: 41.99rem) {
  .fig__label,
  .fig__index {
    font-size: 15px;
    letter-spacing: 0.02em;
  }

  html[lang="km"] .fig__label {
    font-size: 17px;
  }
}

/* ---- Motion ---- */
.fig__scan {
  animation: fig-scan 4s ease-in-out infinite alternate;
}

.fig__code {
  transform-box: fill-box;
  transform-origin: 0 50%;
  animation: fig-type 4s steps(12, end) infinite;
}

.fig__code:nth-child(2) {
  animation-delay: 0.3s;
}

.fig__code:nth-child(3) {
  animation-delay: 0.6s;
}

.fig__code:nth-child(4) {
  animation-delay: 0.9s;
}

.fig__code:nth-child(5) {
  animation-delay: 1.2s;
}

.fig__cursor {
  animation: fig-blink 1s steps(1, end) infinite;
}

.fig__gear {
  animation: fig-spin 8s linear infinite;
}

.fig__drone {
  animation: fig-hover 2.6s ease-in-out infinite alternate;
}

.fig__rotor {
  transform-box: fill-box;
  transform-origin: center;
  animation: fig-spin 0.6s linear infinite;
}

.fig__drop {
  animation: fig-drop 1.6s ease-in infinite;
}

.fig__drop:nth-child(2) {
  animation-delay: 0.4s;
}

.fig__drop:nth-child(3) {
  animation-delay: 0.8s;
}

.fig__bar {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: fig-grow 2.4s ease-in-out infinite alternate;
}

.fig__bar:nth-child(2) {
  animation-delay: 0.2s;
}

.fig__bar:nth-child(3) {
  animation-delay: 0.4s;
}

.fig__bar:nth-child(4) {
  animation-delay: 0.6s;
}

.fig__bar:nth-child(5) {
  animation-delay: 0.8s;
}

@keyframes fig-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fig-pulse {
  to {
    stroke-dashoffset: -100;
  }
}

@keyframes fig-scan {
  to {
    transform: translateX(110px);
  }
}

@keyframes fig-type {
  0% {
    transform: scaleX(0);
  }
  40%,
  100% {
    transform: scaleX(1);
  }
}

@keyframes fig-blink {
  50% {
    opacity: 0;
  }
}

@keyframes fig-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fig-hover {
  to {
    transform: translateY(-6px);
  }
}

@keyframes fig-drop {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(20px);
  }
}

@keyframes fig-grow {
  from {
    transform: scaleY(0.4);
  }
  to {
    transform: scaleY(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fig,
  .fig * {
    animation: none !important;
  }
}
