/* "About our work" slider — built from Figma "marketplace" frames
   479:4895 (management) · 479:4936 (diplomacy) · 479:4980 (media) · 479:5024 (infrastructure).
   Motion follows the reference video: the chosen tab widens, the others close,
   then the text and photo fade in. */

.about-work {
  --aw-bg: #000000;
  --aw-heading: rgba(255, 255, 255, 0.75);
  --aw-title: rgba(255, 255, 255, 0.75);
  --aw-text: rgba(255, 255, 255, 0.65);
  --aw-label: rgba(255, 255, 255, 0.5);
  --aw-number: rgba(255, 255, 255, 0.1);
  --aw-line: rgba(255, 255, 255, 0.3);
  --aw-btn: rgba(217, 217, 217, 0.25);

  /* sizes scale with the block width (cqw); at 1920px they equal the Figma values */
  --aw-rail: clamp(78px, 6.98cqw, 134px);      /* tab strip: arrow, label, number */
  --aw-gap: clamp(24px, 6.56cqw, 126px);       /* empty space left of a closed tab */
  --aw-gap-first: clamp(10px, 1.72cqw, 33px);
  --aw-pad: clamp(28px, 6cqw, 146px);          /* text start inside an open tab */
  --aw-pad-first: clamp(20px, 2.76cqw, 53px);
  --aw-track-h: clamp(520px, 40.4cqw, 775px);
  --aw-img-h: calc(var(--aw-track-h) - 91px);
  /* width of an open tab's content area (worst case: three closed tabs + its own rail) */
  --aw-open: calc(100cqw - 3 * (var(--aw-gap) + var(--aw-rail)) - var(--aw-rail));
  --aw-text-w: clamp(190px, 18cqw, 345px);
  --aw-img-gap: clamp(20px, 2.1cqw, 40px);
  --aw-speed: 0.8s;
  --aw-ease: cubic-bezier(0.77, 0, 0.18, 1);

  container-type: inline-size;
  background: var(--aw-bg);
  color: #fff;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow: hidden;
}

.about-work__heading {
  margin: 0;
  padding: clamp(36px, 3.2cqw, 62px) var(--aw-pad-first) clamp(16px, 1.2cqw, 23px);
  font-size: clamp(32px, 2.6cqw, 50px);
  font-weight: 300;
  line-height: 74px;
  color: var(--aw-heading);
}

.aw-track {
  display: flex;
  height: var(--aw-track-h);
}

/* ---------- one tab ---------- */
.aw-item {
  position: relative;
  display: flex;
  flex: 0 0 calc(var(--aw-gap) + var(--aw-rail));
  min-width: 0;
  transition: flex-grow var(--aw-speed) var(--aw-ease);
  cursor: pointer;
}
.aw-item:first-child { flex-basis: calc(var(--aw-gap-first) + var(--aw-rail)); }
.aw-item.is-open { flex-grow: 1; cursor: default; }

/* left area: holds the text + photo when the tab is open */
.aw-content {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.aw-panel {
  position: absolute;
  top: 28px;
  left: var(--aw-pad);
  width: calc(var(--aw-open) - var(--aw-pad) - 24px);
  height: var(--aw-img-h);
  display: flex;
  align-items: flex-end;
  gap: var(--aw-img-gap);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.aw-item:first-child .aw-panel { left: var(--aw-pad-first); width: calc(var(--aw-open) - var(--aw-pad-first) - 24px); }
.aw-item.is-open .aw-panel {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease calc(var(--aw-speed) * 0.55), visibility 0s;
}

.aw-text {
  flex: 0 0 var(--aw-text-w);
  min-width: 0;
}
.aw-title {
  margin: 0 0 12px;
  font-size: clamp(21px, 1.36cqw, 26px);
  font-weight: 400;
  line-height: 30px;
  color: var(--aw-title);
}
.aw-desc {
  margin: 0 0 29px;
  max-width: 300px;
  font-size: clamp(13px, 0.73cqw, 14px);
  line-height: 24px;
  color: var(--aw-text);
}
.aw-btn {
  display: inline-grid;
  place-items: center;
  width: 157px;
  height: 46px;
  border-radius: 30px;
  background: var(--aw-btn);
  color: #fff;
  font-size: 14px;
  line-height: 24px;
  text-decoration: none;
  transition: background 0.2s ease;
}
.aw-btn:hover { background: rgba(217, 217, 217, 0.4); }

.aw-photo {
  flex: 0 1 auto;
  min-width: 0;
  width: min(414px, 100%);
  height: 100%;
  order: 2;            /* text left, photo right — as in Figma */
  object-fit: cover;
  transform: translateX(40px) scale(1.04);
  filter: brightness(0.5);
  transition: transform 0.9s var(--aw-ease), filter 0.9s ease;
}
.aw-item.is-open .aw-photo {
  transform: none;
  filter: none;
  transition-delay: calc(var(--aw-speed) * 0.45);
}

/* right strip: arrow, vertical label, big number */
.aw-rail {
  position: relative;
  flex: 0 0 var(--aw-rail);
  height: 100%;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--aw-line);
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
}
.aw-item:last-child .aw-rail { border-right: 0; }
.aw-item.is-open .aw-rail { cursor: default; }
.aw-rail:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.6); outline-offset: -4px; }

.aw-arrow {
  position: absolute;
  top: 14px;
  right: calc(var(--aw-rail) * 0.27);
  width: clamp(34px, 2.55cqw, 49px);
  height: clamp(34px, 2.55cqw, 49px);
}
.aw-arrow img { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 0.4s ease; }
.aw-arrow .down { opacity: 0; }
.aw-item.is-open .aw-arrow .up { opacity: 0; }
.aw-item.is-open .aw-arrow .down { opacity: 1; }

.aw-label,
.aw-num {
  position: absolute;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}
.aw-label {
  left: calc(var(--aw-rail) * 0.42);
  bottom: calc(var(--aw-track-h) * 0.356);
  font-size: clamp(26px, 2.08cqw, 40px);
  font-weight: 400;
  line-height: 1;
  color: var(--aw-label);
  transition: color 0.4s ease;
}
.aw-item:not(.is-open):hover .aw-label { color: rgba(255, 255, 255, 0.85); }
/* big number: pushed past the divider line so the line clips its edge (as in Figma) */
.aw-num {
  right: -0.12em;
  bottom: calc(var(--aw-track-h) * 0.083);
  font-size: clamp(88px, 7.8cqw, 150px);
  font-weight: 600;
  line-height: 0.74;
  color: var(--aw-number);
  transition: color 0.5s ease;
}

/* ---------- tablet & phone: stacked accordion ---------- */
@media (max-width: 1000px) {
  .about-work__heading { padding: 44px 24px 18px; font-size: 34px; line-height: 1.2; }
  .aw-track { flex-direction: column; height: auto; border-bottom: 1px solid var(--aw-line); }
  .aw-item,
  .aw-item:first-child { flex: none; flex-direction: column-reverse; border-top: 1px solid var(--aw-line); }
  .aw-rail { flex: none; height: 84px; border-right: 0; text-align: left; }
  .aw-item:last-child .aw-rail { border-right: 0; }
  .aw-label,
  .aw-num { writing-mode: horizontal-tb; transform: none; }
  .aw-num { left: 24px; right: auto; top: 50%; bottom: auto; transform: translateY(-50%); font-size: 56px; line-height: 1; }
  .aw-label { left: 112px; top: 50%; bottom: auto; transform: translateY(-50%); font-size: 26px; }
  .aw-arrow { right: 24px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; }
  .aw-content { overflow: hidden; display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.6s var(--aw-ease); }
  .aw-item.is-open .aw-content { grid-template-rows: 1fr; }
  .aw-panel,
  .aw-item:first-child .aw-panel {
    position: static;
    min-height: 0;
    width: auto;
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: end;
    gap: 28px;
    padding: 0 24px 32px;
  }
  .aw-title { display: none; }          /* the tab row already shows the name */
  .aw-desc { max-width: none; font-size: 15px; }
  .aw-photo {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    margin: 0;
    order: 0;
  }
}
@media (max-width: 600px) {
  .about-work__heading { padding: 36px 20px 14px; font-size: 30px; }
  .aw-rail { height: 72px; }
  .aw-num { left: 20px; font-size: 44px; }
  .aw-label { left: 88px; font-size: 22px; }
  .aw-arrow { right: 20px; width: 32px; height: 32px; }
  .aw-panel,
  .aw-item:first-child .aw-panel { grid-template-columns: 1fr; gap: 18px; padding: 0 20px 28px; }
  .aw-photo { aspect-ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  .aw-item, .aw-panel, .aw-photo, .aw-content, .aw-arrow img { transition: none !important; }
}

/* closed panels sit off to the right; never let them widen the page */
.about-work { overflow-x: clip; }
