/*
 * AH Digital — Homepage SaaS / Product Studio
 * Fix: architecture flow fit + independent column heights
 */

.ah-studio {
  position: relative;
  overflow: hidden;
  padding-block: clamp(104px, 12vw, 184px);
  background:
    radial-gradient(circle at 13% 22%, rgba(86, 87, 230, 0.16), transparent 26%),
    radial-gradient(circle at 82% 76%, rgba(32, 199, 214, 0.08), transparent 24%),
    var(--ah-color-bg);
}

.ah-studio::before {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 76px 76px;
  content: "";
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
}

.ah-studio > .ah-container {
  position: relative;
  z-index: 1;
}

.ah-studio__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: clamp(36px, 6vw, 82px);
}

.ah-studio .ah-section-heading__title {
  max-width: 17ch;
}

.ah-studio__system {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(330px, 0.72fr);
  align-items: start;
  gap: 18px;
  margin-block-start: clamp(64px, 8vw, 108px);
}

.ah-studio__architecture,
.ah-studio__possibilities {
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--ah-color-border);
  border-radius: var(--ah-radius-xl);
  background: color-mix(in srgb, var(--ah-color-surface) 96%, transparent);
}

.ah-studio__architecture {
  align-self: start;
}

.ah-studio__possibilities {
  align-self: start;
}

.ah-studio__architecture-top {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-block-end: 1px solid var(--ah-color-border);
  color: var(--ah-color-text-muted);
  font-family: var(--ah-font-mono);
  font-size: 0.55rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  padding-inline: 20px;
}

.ah-studio__flow {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr) 18px
    minmax(0, 1fr) 18px
    minmax(0, 1fr) 18px
    minmax(0, 1fr) 18px
    minmax(0, 1fr);
  align-items: stretch;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: clamp(24px, 3vw, 36px);
}

.ah-studio-node {
  display: grid;
  min-width: 0;
  min-height: 130px;
  align-content: center;
  gap: 7px;
  border: 1px solid var(--ah-color-border);
  border-radius: 16px;
  background: var(--ah-color-surface-soft);
  padding: 14px 12px;
}

.ah-studio-node > span {
  color: var(--ah-color-brand);
  font-family: var(--ah-font-mono);
  font-size: 0.52rem;
  font-weight: 700;
}

.ah-studio-node small {
  color: var(--ah-color-text-muted);
  font-family: var(--ah-font-mono);
  font-size: 0.46rem;
  font-weight: 650;
  letter-spacing: 0.055em;
}

.ah-studio-node strong {
  overflow-wrap: anywhere;
  color: var(--ah-color-text);
  font-size: clamp(0.7rem, 0.75vw, 0.78rem);
  line-height: 1.4;
}

.ah-studio-node--result {
  border-color: color-mix(in srgb, var(--ah-color-signal) 48%, var(--ah-color-border));
  background:
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--ah-color-signal) 8%, var(--ah-color-surface-soft)),
      var(--ah-color-surface-soft)
    );
}

.ah-studio-node--result > span {
  color: var(--ah-color-signal);
}

.ah-studio-connector {
  display: flex;
  min-width: 0;
  align-items: center;
  color: var(--ah-color-text-muted);
}

.ah-studio-connector i {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--ah-color-border), var(--ah-color-brand));
}

.ah-studio-connector span {
  margin-inline-start: -1px;
  font-size: 0.68rem;
}

.ah-studio__principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-block-start: 1px solid var(--ah-color-border);
}

.ah-studio__principles > div {
  min-height: 156px;
  border-inline-end: 1px solid var(--ah-color-border);
  padding: 22px;
}

.ah-studio__principles > div:last-child {
  border-inline-end: 0;
}

.ah-studio__principles span {
  color: var(--ah-color-brand);
  font-family: var(--ah-font-mono);
  font-size: 0.52rem;
  font-weight: 700;
}

.ah-studio__principles strong {
  display: block;
  margin-block-start: 20px;
  color: var(--ah-color-text);
  font-size: 0.86rem;
}

.ah-studio__principles p {
  margin-block-start: 8px;
  color: var(--ah-color-text-secondary);
  font-size: 0.76rem;
  line-height: 1.6;
}

.ah-studio__possibilities {
  display: grid;
  grid-template-rows: auto 1fr;
}

.ah-studio__possibilities-heading {
  display: grid;
  gap: 5px;
  min-height: 82px;
  align-content: center;
  border-block-end: 1px solid var(--ah-color-border);
  padding-inline: 22px;
}

.ah-studio__possibilities-heading span {
  color: var(--ah-color-text);
  font-size: 0.9rem;
  font-weight: 700;
}

.ah-studio__possibilities-heading small {
  color: var(--ah-color-text-muted);
  font-size: 0.7rem;
}

.ah-studio__product-list {
  display: grid;
}

.ah-studio-product {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  border-block-end: 1px solid var(--ah-color-border);
  padding: 20px 22px;
  transition:
    background-color var(--ah-duration-fast) var(--ah-ease-standard),
    padding-inline var(--ah-duration-fast) var(--ah-ease-standard);
}

.ah-studio-product:last-child {
  border-block-end: 0;
}

.ah-studio-product:hover {
  background: var(--ah-color-surface-soft);
  padding-inline-start: 26px;
}

.ah-studio-product__number {
  color: var(--ah-color-brand);
  font-family: var(--ah-font-mono);
  font-size: 0.54rem;
  font-weight: 700;
}

.ah-studio-product h3 {
  color: var(--ah-color-text);
  font-size: 0.88rem;
  letter-spacing: -0.015em;
}

.ah-studio-product p {
  max-width: 48ch;
  margin-block-start: 7px;
  color: var(--ah-color-text-secondary);
  font-size: 0.74rem;
  line-height: 1.58;
}

.ah-studio-product__arrow {
  color: var(--ah-color-text-muted);
  font-size: 0.75rem;
}

.ah-studio__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  margin-block-start: 34px;
  border-block-start: 1px solid var(--ah-color-border);
  padding-block-start: 26px;
}

.ah-studio__footer > div:first-child {
  display: grid;
  gap: 7px;
}

.ah-studio__footer-label {
  color: var(--ah-color-brand);
  font-family: var(--ah-font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ah-studio__footer p {
  max-width: 66ch;
  color: var(--ah-color-text-secondary);
  font-size: 0.9rem;
}

.ah-studio__footer-flow {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  color: var(--ah-color-text-muted);
  font-family: var(--ah-font-mono);
  font-size: 0.54rem;
  font-weight: 650;
}

.ah-studio__footer-flow i {
  width: 26px;
  height: 1px;
  background: var(--ah-color-border-strong);
}

.ah-studio__footer-flow strong {
  color: var(--ah-color-signal);
}

@media (max-width: 1180px) {
  .ah-studio__system {
    grid-template-columns: minmax(0, 1fr);
  }

  .ah-studio__flow {
    grid-template-columns:
      minmax(0, 1fr) 18px
      minmax(0, 1fr) 18px
      minmax(0, 1fr) 18px
      minmax(0, 1fr) 18px
      minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .ah-studio__header {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .ah-studio__header .ah-button {
    justify-self: start;
  }

  .ah-studio__flow {
    grid-template-columns: minmax(0, 1fr);
  }

  .ah-studio-connector {
    min-width: 0;
    min-height: 28px;
    justify-content: center;
    flex-direction: column;
  }

  .ah-studio-connector i {
    width: 1px;
    height: 22px;
    background: linear-gradient(180deg, var(--ah-color-border), var(--ah-color-brand));
  }

  .ah-studio-connector span {
    margin-block-start: -6px;
    margin-inline-start: 0;
    transform: rotate(90deg);
  }

  .ah-studio-node {
    min-height: 100px;
  }
}

@media (max-width: 767px) {
  .ah-studio {
    padding-block: 80px;
  }

  .ah-studio__system {
    margin-block-start: 54px;
  }

  .ah-studio__architecture,
  .ah-studio__possibilities {
    border-radius: var(--ah-radius-lg);
  }

  .ah-studio__architecture-top {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding-block: 14px;
  }

  .ah-studio__flow {
    padding: 22px;
  }

  .ah-studio__principles {
    grid-template-columns: minmax(0, 1fr);
  }

  .ah-studio__principles > div {
    min-height: 0;
    border-inline-end: 0;
    border-block-end: 1px solid var(--ah-color-border);
  }

  .ah-studio__principles > div:last-child {
    border-block-end: 0;
  }

  .ah-studio__footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .ah-studio__footer-flow {
    display: none;
  }
}

@supports not (color: color-mix(in srgb, black, white)) {
  .ah-studio__architecture,
  .ah-studio__possibilities {
    background: var(--ah-color-surface);
  }

  .ah-studio-node--result {
    background: var(--ah-color-surface-soft);
  }
}

@media (hover: none) {
  .ah-studio-product:hover {
    padding-inline-start: 22px;
  }
}
