/*
 * AH Digital — Homepage Selected Projects / Project Explorer
 */

.ah-projects {
  position: relative;
  padding-block: clamp(104px, 12vw, 184px);
  background: var(--ah-color-bg);
}

.ah-projects__intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 40px;
}

.ah-projects .ah-section-heading__title {
  max-width: 16ch;
}

.ah-projects__counter {
  display: grid;
  min-width: 118px;
  gap: 2px;
  text-align: end;
}

.ah-projects__counter span,
.ah-projects__counter small {
  color: var(--ah-color-text-muted);
  font-family: var(--ah-font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.ah-projects__counter strong {
  color: var(--ah-color-text);
  font-family: var(--ah-font-mono);
  font-size: clamp(2.2rem, 3.2vw, 3.35rem);
  letter-spacing: -0.06em;
  line-height: 1;
}

.ah-projects__explorer {
  display: grid;
  grid-template-columns: minmax(286px, 0.31fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(26px, 3vw, 42px);
  margin-block-start: clamp(56px, 6.5vw, 82px);
}

.ah-projects__list {
  position: sticky;
  inset-block-start: 116px;
  display: grid;
  align-self: start;
  align-content: start;
  overflow: hidden;
  border: 1px solid var(--ah-color-border);
  border-radius: var(--ah-radius-lg);
  background: color-mix(in srgb, var(--ah-color-surface) 78%, transparent);
  box-shadow: var(--ah-shadow-sm);
}

.ah-project-tab {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  min-height: 106px;
  align-items: center;
  gap: 14px;
  border-block-end: 1px solid var(--ah-color-border);
  color: var(--ah-color-text-secondary);
  padding: 18px 18px;
  text-align: start;
  transition:
    color var(--ah-duration-base) var(--ah-ease-standard),
    background-color var(--ah-duration-base) var(--ah-ease-standard);
}

.ah-project-tab:hover,
.ah-project-tab:focus-visible {
  color: var(--ah-color-text);
}

.ah-project-tab.is-active {
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--ah-color-brand) 12%, transparent),
      color-mix(in srgb, var(--ah-color-brand) 3%, transparent) 68%,
      transparent
    );
  color: var(--ah-color-text);
}

.ah-project-tab.is-active::before {
  position: absolute;
  inset-inline-start: 0;
  inset-block: 18px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    var(--ah-color-brand),
    var(--ah-color-intelligence)
  );
  content: "";
}

.ah-project-tab__number {
  color: var(--ah-color-text-muted);
  font-family: var(--ah-font-mono);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ah-project-tab.is-active .ah-project-tab__number {
  color: var(--ah-color-brand);
}

.ah-project-tab__main {
  display: grid;
  gap: 5px;
}

.ah-project-tab__main strong {
  color: inherit;
  font-size: 1rem;
  letter-spacing: -0.018em;
}

.ah-project-tab__main small {
  color: var(--ah-color-text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.ah-project-tab__arrow {
  color: var(--ah-color-brand);
  opacity: 0;
  transform: translateX(-5px);
  transition:
    opacity var(--ah-duration-fast) var(--ah-ease-standard),
    transform var(--ah-duration-fast) var(--ah-ease-standard);
}

.ah-project-tab.is-active .ah-project-tab__arrow {
  opacity: 1;
  transform: none;
}

.ah-projects__open-slot {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  border-block-end: 0;
  background: color-mix(in srgb, var(--ah-color-intelligence) 3%, transparent);
  padding: 22px 18px 24px;
}

.ah-projects__open-slot > span {
  color: var(--ah-color-intelligence);
  font-family: var(--ah-font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.ah-projects__open-slot > div {
  display: grid;
  gap: 8px;
}

.ah-projects__open-slot strong {
  color: var(--ah-color-text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.ah-projects__open-slot a {
  color: var(--ah-color-brand);
  font-size: 0.73rem;
  font-weight: 650;
}

.ah-projects__preview {
  min-width: 0;
  align-self: start;
}

.ah-project-panel {
  overflow: hidden;
  border: 1px solid var(--ah-color-border);
  border-radius: var(--ah-radius-xl);
  background:
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--ah-color-brand) 3%, var(--ah-color-surface)),
      var(--ah-color-surface)
    );
}

.ah-project-panel[hidden] {
  display: none;
}

.ah-project-panel__meta {
  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.54rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  padding-inline: 20px;
}

.ah-project-panel__body {
  display: grid;
  min-height: 520px;
  grid-template-columns: minmax(0, 0.98fr) minmax(360px, 1.02fr);
  align-items: center;
  gap: clamp(30px, 3.6vw, 50px);
  padding: clamp(30px, 3.5vw, 46px);
}

.ah-project-panel__copy {
  min-width: 0;
}

.ah-project-panel__type {
  display: block;
  margin-block-end: 16px;
  color: var(--ah-color-brand);
  font-family: var(--ah-font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ah-project-panel h3 {
  max-width: 17ch;
  color: var(--ah-color-text);
  font-size: clamp(2rem, 2.85vw, 3rem);
  letter-spacing: -0.05em;
  line-height: 1.05;
}

.ah-project-panel__copy > p {
  max-width: 54ch;
  margin-block-start: 20px;
  color: var(--ah-color-text-secondary);
  font-size: 0.94rem;
  line-height: 1.72;
}

.ah-project-panel__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-block: 28px 30px;
}

.ah-project-panel__tags span {
  border: 1px solid var(--ah-color-border);
  border-radius: var(--ah-radius-pill);
  color: var(--ah-color-text-secondary);
  font-family: var(--ah-font-mono);
  font-size: 0.55rem;
  font-weight: 600;
  padding: 7px 9px;
}

.ah-project-interface {
  position: relative;
  overflow: hidden;
  min-height: 372px;
  border: 1px solid var(--ah-color-border);
  border-radius: 18px;
  background: var(--ah-color-surface-soft);
  box-shadow: var(--ah-shadow-md);
}

.ah-project-interface__bar {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-block-end: 1px solid var(--ah-color-border);
  color: var(--ah-color-text-muted);
  font-family: var(--ah-font-mono);
  font-size: 0.49rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  padding-inline: 16px;
}

.ah-project-interface__canvas {
  display: grid;
  min-height: 323px;
  grid-template-columns: 48px minmax(0, 1fr);
}

.ah-project-interface__sidebar {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 14px;
  border-inline-end: 1px solid var(--ah-color-border);
  padding-block-start: 22px;
}

.ah-project-interface__sidebar i {
  width: 18px;
  height: 18px;
  border: 1px solid var(--ah-color-border);
  border-radius: 6px;
  background: var(--ah-color-surface);
}

.ah-project-interface__sidebar i:first-child {
  border-color: var(--ah-color-brand);
  background: color-mix(in srgb, var(--ah-color-brand) 10%, var(--ah-color-surface));
}

.ah-project-interface__content {
  padding: 24px;
}

.ah-project-interface__headline {
  display: grid;
  gap: 8px;
}

.ah-project-interface__headline span,
.ah-project-interface__headline strong,
.ah-project-interface__headline i {
  display: block;
  border-radius: var(--ah-radius-pill);
  background: var(--ah-color-border-strong);
}

.ah-project-interface__headline span {
  width: 22%;
  height: 5px;
  background: var(--ah-color-brand);
}

.ah-project-interface__headline strong {
  width: 58%;
  height: 12px;
}

.ah-project-interface__headline i {
  width: 40%;
  height: 6px;
  opacity: 0.65;
}

.ah-project-interface__metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-block-start: 22px;
}

.ah-project-interface__metric-grid div {
  display: grid;
  gap: 7px;
  min-height: 72px;
  align-content: center;
  border: 1px solid var(--ah-color-border);
  border-radius: 12px;
  background: var(--ah-color-surface);
  padding: 10px;
}

.ah-project-interface__metric-grid span,
.ah-project-interface__metric-grid strong {
  display: block;
  border-radius: var(--ah-radius-pill);
}

.ah-project-interface__metric-grid span {
  width: 46%;
  height: 4px;
  background: var(--ah-color-border-strong);
}

.ah-project-interface__metric-grid strong {
  width: 70%;
  height: 8px;
  background: var(--ah-color-brand);
}

.ah-project-interface__main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(120px, 0.65fr);
  gap: 10px;
  margin-block-start: 10px;
}

.ah-project-interface__chart,
.ah-project-interface__stack > div {
  border: 1px solid var(--ah-color-border);
  border-radius: 12px;
  background: var(--ah-color-surface);
}

.ah-project-interface__chart {
  position: relative;
  min-height: 188px;
  overflow: hidden;
}

.ah-project-interface__chart span {
  position: absolute;
  inset-inline: 14px;
  inset-block-end: 28px;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--ah-color-brand),
    var(--ah-color-intelligence),
    var(--ah-color-signal)
  );
  transform: rotate(-7deg);
  transform-origin: left center;
}

.ah-project-interface__chart i {
  position: absolute;
  inset-block-end: 22px;
  width: 10%;
  border-radius: 6px 6px 2px 2px;
  background: color-mix(in srgb, var(--ah-color-brand) 22%, var(--ah-color-border));
}

.ah-project-interface__chart i:nth-of-type(1) { inset-inline-start: 14%; height: 34%; }
.ah-project-interface__chart i:nth-of-type(2) { inset-inline-start: 34%; height: 50%; }
.ah-project-interface__chart i:nth-of-type(3) { inset-inline-start: 54%; height: 62%; }
.ah-project-interface__chart i:nth-of-type(4) { inset-inline-start: 74%; height: 76%; }

.ah-project-interface__stack {
  display: grid;
  gap: 8px;
}

.ah-project-interface__stack > div {
  min-height: 57px;
}

.ah-project-interface__signal {
  position: absolute;
  inset-inline-end: 16px;
  inset-block-end: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ah-color-border);
  border-radius: var(--ah-radius-pill);
  background: color-mix(in srgb, var(--ah-color-surface) 94%, transparent);
  box-shadow: var(--ah-shadow-sm);
  padding: 8px 11px;
}

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

.ah-project-interface__signal strong {
  color: var(--ah-color-text);
  font-size: 0.66rem;
}

.ah-project-panel[data-ah-project-kind="ulpress"] .ah-project-interface {
  background:
    radial-gradient(circle at 78% 18%, rgba(32, 199, 214, 0.09), transparent 24%),
    var(--ah-color-surface-soft);
}

.ah-project-panel[data-ah-project-kind="ah-digital"] .ah-project-interface {
  background:
    radial-gradient(circle at 78% 18%, rgba(86, 87, 230, 0.12), transparent 26%),
    var(--ah-color-surface-soft);
}


@media (min-width: 1121px) and (max-width: 1320px) {
  .ah-projects__explorer {
    grid-template-columns: minmax(270px, 0.32fr) minmax(0, 1fr);
    gap: 28px;
  }

  .ah-project-panel__body {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr);
    gap: 32px;
  }

  .ah-project-panel h3 {
    font-size: clamp(2rem, 2.65vw, 2.75rem);
  }
}

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

  .ah-projects__list {
    position: static;
    inset-block-start: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--ah-color-border);
    border-radius: var(--ah-radius-lg);
    overflow: hidden;
  }

  .ah-project-tab {
    border-block-end: 0;
    border-inline-end: 1px solid var(--ah-color-border);
  }

  .ah-project-tab:nth-child(2) {
    border-inline-end: 0;
  }

  .ah-projects__open-slot {
    grid-column: 1 / -1;
    border-block-start: 1px solid var(--ah-color-border);
    border-block-end: 0;
    padding-inline: 18px;
  }
}

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

  .ah-project-interface {
    width: min(100%, 720px);
  }
}

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

  .ah-projects__intro {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .ah-projects__counter {
    display: none;
  }

  .ah-projects__explorer {
    margin-block-start: 52px;
  }

  .ah-projects__list {
    display: flex;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .ah-project-tab {
    min-width: 230px;
    flex: 0 0 auto;
    border-inline-end: 1px solid var(--ah-color-border);
  }

  .ah-projects__open-slot {
    min-width: 250px;
    grid-column: auto;
    flex: 0 0 auto;
    border-block-start: 0;
    border-inline-start: 0;
  }

  .ah-project-panel {
    border-radius: var(--ah-radius-lg);
  }

  .ah-project-panel__body {
    min-height: 0;
    padding: 26px;
  }

  .ah-project-interface__content {
    padding: 16px;
  }

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

  .ah-project-interface__stack {
    display: none;
  }
}

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

  .ah-project-interface__metric-grid div:nth-child(n+2) {
    display: none;
  }
}

@supports not (color: color-mix(in srgb, black, white)) {
  .ah-project-tab.is-active {
    background: var(--ah-color-surface-soft);
  }

  .ah-project-panel,
  .ah-project-interface,
  .ah-project-interface__signal {
    background: var(--ah-color-surface);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ah-project-tab,
  .ah-project-tab__arrow {
    transition: none;
  }
}
