/* TPPA prototype v14.3: split-flap clock, responsive header and editorial rail. */

/* Editorial rail typography follows the page body instead of shrinking into
   sidebar fine print. Tags and dates remain compact metadata. */
.page-rail__publications .publication-tags a,
.page-rail__publications .publication-tags span {
  min-height: 29px;
  padding: 5px 8px;
  font-size: 12px;
}

.publication-card__excerpt {
  max-height: 4.8em;
  font-size: 17px;
  line-height: 1.2;
}

.publication-card__details {
  font-size: 17px;
}

/* Each value is assembled from equal, independent digit cards. */
.page-hero--aside-service_age .service-age,
.page-hero--aside-service_age .service-age.page-rail__panel {
  --age-digit-w: clamp(21px, 1.7vw, 25px);
  --age-digit-h: calc(var(--age-digit-w) * 1.62);
  --age-digit-gap: 3px;
  --age-digit-font: calc(var(--age-digit-w) * 1.18);
  gap: 10px;
  padding: 47px 20px 19px;
  overflow: hidden;
  align-content: center;
}

.page-hero--aside-service_age .page-hero__copy {
  align-self: start;
  padding-block: 20px 4px;
}

.service-board__overline {
  font-size: 12px;
}

.brand-logo__caption {
  font-size: max(calc(var(--logo-h) * .132), 10.5px);
}

.page-hero--aside-service_age .service-age::after {
  top: 24px;
  right: auto;
  left: 50%;
  width: min(320px, 82%);
  height: min(320px, 82%);
  border: 0;
  background:
    radial-gradient(circle at 38% 34%, rgba(255, 255, 255, .72), transparent 21%),
    color-mix(in srgb, var(--accent) 24%, #fff);
  opacity: .88;
  transform: translateX(-50%);
}

.service-age__years {
  display: flex;
  gap: 10px;
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  padding: 7px 11px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 10%, rgba(255, 255, 255, .9));
}

.service-age__digits {
  display: flex;
  gap: var(--age-digit-gap);
  width: max-content;
  min-width: 0;
  align-items: center;
  justify-content: center;
}

.age-flap {
  position: relative;
  display: block;
  flex: 0 0 var(--age-digit-w);
  width: var(--age-digit-w);
  min-width: var(--age-digit-w);
  height: var(--age-digit-h);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 3px;
  background: #111416;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .035),
    inset 0 -8px 14px rgba(0, 0, 0, .22),
    0 5px 12px rgba(0, 0, 0, .2);
  color: #fff;
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  font-size: var(--age-digit-font);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1;
  perspective: 420px;
  transform: translateZ(0);
}

.age-flap::before,
.age-flap::after {
  content: "";
  position: absolute;
  z-index: 6;
  top: 50%;
  pointer-events: none;
}

.age-flap::before {
  right: 2px;
  left: 2px;
  height: 1px;
  background: rgba(0, 0, 0, .82);
  box-shadow: 0 1px rgba(255, 255, 255, .08);
}

.age-flap::after {
  right: 0;
  left: 0;
  height: 4px;
  border-inline: 2px solid #080a0b;
  transform: translateY(-2px);
}

.age-flap__static,
.age-flap__leaf,
.age-flap__face {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
}

.age-flap__static--top,
.age-flap__leaf {
  top: 0;
}

.age-flap__static--bottom {
  bottom: 0;
}

.age-flap__static--top,
.age-flap__face--front {
  background: linear-gradient(180deg, #25292d 0%, #1b1e21 100%);
}

.age-flap__static--bottom,
.age-flap__face--back {
  background: linear-gradient(180deg, #141719 0%, #0c0e10 100%);
}

.age-flap__static i,
.age-flap__face i {
  position: absolute;
  left: 0;
  display: grid;
  width: 100%;
  height: var(--age-digit-h);
  margin: 0;
  place-items: center;
  font: inherit;
  font-style: normal;
  color: inherit;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .85);
}

.age-flap__static--top i,
.age-flap__face--front i {
  top: 0;
}

.age-flap__static--bottom i,
.age-flap__face--back i {
  bottom: 0;
}

.age-flap__leaf {
  z-index: 4;
  overflow: visible;
  transform: rotateX(0deg);
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  will-change: transform;
}

.age-flap__face {
  top: 0;
  height: 100%;
  backface-visibility: hidden;
}

.age-flap__face--back {
  transform: rotateX(180deg);
}

.age-flap.is-flipping .age-flap__leaf {
  animation: age-flap-turn 480ms cubic-bezier(.28, .72, .24, 1) both;
}

@keyframes age-flap-turn {
  0% { transform: rotateX(0deg); }
  42% { transform: rotateX(-86deg); }
  58% { transform: rotateX(-96deg); }
  100% { transform: rotateX(-180deg); }
}

.service-age__years-label {
  padding: 0;
  color: var(--accent-dark);
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 650;
  line-height: 1;
}

.service-age__units {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.service-age__unit {
  display: grid;
  gap: 5px;
  min-width: 0;
  align-content: start;
  justify-items: center;
  text-align: center;
}

.service-age__unit small {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.service-age__caption,
.page-home .service-age__caption {
  margin-top: 2px;
  overflow: visible;
  font-size: clamp(14px, 1.12vw, 16px);
  line-height: 1.12;
  text-align: center;
  white-space: normal;
  transform: none;
}

.service-age__caption-text {
  display: block;
  width: 100%;
  max-width: 100%;
  transform: none;
  transform-origin: center;
}

.service-age__proof {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 8px 4px;
  font-size: clamp(12.5px, .97vw, 14px);
  font-weight: 820;
  line-height: 1.2;
  text-align: center;
}

.service-age__proof strong {
  font-weight: 900;
}

/* Portrait iPad: a readable 2x2 instrument panel remains in the right column. */
@media (min-width: 761px) and (max-width: 1023.98px) {
  html:root {
    --logo-h: clamp(66px, 7vw, 72px);
  }

  body[class] .site-header__inner {
    grid-template-columns: calc(var(--logo-h) * 4) minmax(0, 1fr) 54px;
    gap: 10px;
    width: calc(100% - 24px);
    min-height: 96px;
    padding-inline: 0;
  }

  body[class] .site-header__inner .brand {
    grid-column: 1;
    grid-row: 1;
  }

  body[class] .site-header__inner .header-contacts {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    gap: clamp(16px, 2.4vw, 28px);
    padding-inline: 4px;
    justify-content: space-evenly;
  }

  body[class] .site-header__inner .header-telegram {
    display: none;
  }

  body[class] .site-header__inner .menu-toggle {
    grid-column: 3;
    grid-row: 1;
    width: 54px;
    height: 54px;
    align-self: center;
    justify-self: end;
  }

  .site-header__inner .menu-toggle svg {
    width: 28px;
    height: 28px;
  }

  .site-header__inner .header-contact {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
  }

  .site-header__inner .brand-logo__caption {
    font-size: max(calc(var(--logo-h) * .132), 10.5px);
  }

  .page-hero--aside-service_age .service-age,
  .page-hero--aside-service_age .service-age.page-rail__panel {
    --age-digit-w: clamp(24px, 2.75vw, 28px);
    gap: 9px;
    min-height: 330px;
    padding: 45px 14px 15px;
  }

  .service-age__years {
    gap: 9px;
    padding: 6px 10px;
  }

  .service-age__years-label {
    font-size: 20px;
  }

  .service-age__units {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 6px;
  }

  .service-age__unit small {
    font-size: 12px;
  }

  .page-article .page-hero__visual-shell--image,
  .page-article .page-hero__topic-image,
  .page-article .article-hero-image {
    min-height: 0;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .page-article .page-hero__topic-image img,
  .page-article .article-hero-image img {
    min-height: 0;
    height: 100%;
    object-fit: cover;
  }

  .service-age__caption,
  .page-home .service-age__caption {
    font-size: clamp(13px, 1.45vw, 15px);
  }

  .service-age__proof {
    padding-block: 6px;
    font-size: clamp(12px, 1.45vw, 14px);
  }
}

/* Phone header: the large square control is centred across both header rows. */
@media (max-width: 760px) {
  html {
    scrollbar-gutter: auto;
  }

  body {
    min-width: 0;
  }

  :root {
    --menu-mobile: clamp(58px, 17vw, 68px);
    --logo-h: min(80px, calc((100vw - var(--menu-mobile) - 40px) / 4));
  }

  .site-header__inner {
    grid-template-columns: minmax(0, 1fr) var(--menu-mobile);
    grid-template-rows: var(--logo-h) auto;
    gap: 6px 8px;
    width: calc(100% - 16px);
    min-height: calc(var(--logo-h) + 44px);
    padding: 6px 0;
  }

  .site-header__inner .brand {
    grid-column: 1;
    grid-row: 1;
    width: calc(var(--logo-h) * 4);
    max-width: 100%;
    justify-self: start;
  }

  .site-header__inner .brand-logo {
    width: calc(var(--logo-h) * 4);
    max-width: 100%;
  }

  .site-header__inner .menu-toggle {
    grid-column: 2;
    grid-row: 1 / 3;
    width: var(--menu-mobile);
    height: var(--menu-mobile);
    min-width: var(--menu-mobile);
    min-height: var(--menu-mobile);
    margin: 0;
    padding: 0;
    align-self: center;
    justify-self: end;
    border-width: 1px;
    border-radius: 3px;
    border-color: color-mix(in srgb, var(--accent) 72%, transparent);
    background: color-mix(in srgb, var(--accent) 8%, #fff);
    color: var(--accent-dark);
  }

  .site-header__inner .menu-toggle svg {
    width: clamp(31px, 9vw, 36px);
    height: clamp(31px, 9vw, 36px);
    stroke-width: 1.75;
  }

  .site-header__inner .menu-toggle[aria-expanded="true"],
  .site-header__inner .menu-toggle:focus-visible {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    transform: none;
  }

  .site-header__inner .header-contacts {
    display: flex;
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 0 0 0 calc(var(--logo-h) * .847);
    align-items: center;
    justify-content: flex-start;
  }

  .site-header__inner .header-contact--phone {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
  }

  body[class] .site-header__inner .header-contacts .header-contact--phone strong {
    font-size: clamp(19px, 5.35vw, 22px);
    line-height: 1.1;
  }

  .site-header__inner .brand-logo__caption {
    font-size: max(calc(var(--logo-h) * .132), 10.5px);
  }

  .page-hero.page-hero--aside-service_age {
    grid-template-columns: minmax(0, 1fr) clamp(140px, 42vw, 220px);
    gap: 9px;
    align-items: stretch;
  }

  .page-hero--aside-service_age .page-hero__copy {
    min-width: 0;
    padding-block: 12px 2px;
  }

  .page-home .page-hero--aside-service_age h1,
  .page-industry .page-hero--aside-service_age h1 {
    font-size: clamp(22px, 6.45vw, 27px);
    line-height: 1.05;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  .page-hero--aside-service_age h2 {
    margin-top: 9px;
    font-size: clamp(16px, 4.55vw, 19px);
    line-height: 1.17;
  }

  .page-hero--aside-service_age .page-hero__lead {
    margin-top: 9px;
    font-size: 16px;
    line-height: 1.38;
  }

  .page-hero--aside-service_age .page-hero__eyebrow {
    margin-bottom: 7px;
    font-size: 12px;
    letter-spacing: .065em;
    line-height: 1.2;
  }

  .page-hero--aside-service_age .service-age,
  .page-hero--aside-service_age .service-age.page-rail__panel {
    --age-digit-w: clamp(18px, 5.45vw, 24px);
    --age-digit-h: calc(var(--age-digit-w) * 1.58);
    --age-digit-gap: 2px;
    --age-digit-font: calc(var(--age-digit-w) * 1.14);
    gap: 7px;
    min-height: 0;
    padding: 39px 8px 11px;
    align-content: center;
  }

  .page-hero--aside-service_age .service-age::after {
    top: 37px;
    width: 128px;
    max-width: 90%;
    height: 128px;
    opacity: .73;
  }

  .service-age__overline {
    top: 14px;
    left: 9px;
    font-size: 12px;
    letter-spacing: .07em;
  }

  .service-age__years {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 5px;
    width: 100%;
    padding: 5px 6px;
    align-items: center;
  }

  .service-age__years .service-age__digits {
    grid-column: 2;
    grid-row: 1;
  }

  .service-age__years-label {
    grid-column: 1;
    grid-row: 1;
    padding: 0;
    font-family: var(--font-sans);
    font-size: clamp(12px, 3.5vw, 15px);
    font-weight: 820;
    text-align: left;
  }

  .service-age__units {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .service-age__unit {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 5px;
    align-items: center;
    justify-items: stretch;
    text-align: left;
  }

  .service-age__unit .service-age__digits {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .service-age__unit small {
    grid-column: 1;
    grid-row: 1;
    font-size: 12px;
    line-height: 1.05;
    text-align: left;
  }

  .service-age__caption,
  .page-home .service-age__caption {
    margin-top: 2px;
    font-size: clamp(12px, 3.45vw, 14px);
    line-height: 1.13;
    text-align: left;
    white-space: normal;
  }

  .service-age__caption-text {
    width: 100%;
    transform: none;
  }

  .service-age__proof {
    gap: 2px;
    padding: 7px 1px;
    font-size: clamp(13px, 3.4vw, 14px);
    line-height: 1.17;
    text-align: left;
  }

  .service-age__details,
  .service-age .button--rail,
  .service-age__link {
    min-height: 44px;
    padding: 8px 6px;
    font-size: 14px;
    line-height: 1.15;
  }

  .page-rail__publications .publication-tags a,
  .page-rail__publications .publication-tags span {
    min-height: 29px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .publication-card__date {
    font-size: 12px;
  }

  .feature-banner__topics-label {
    font-size: 12px;
    letter-spacing: .1em;
  }

  .page-article .page-hero__visual-shell--image,
  .page-article .page-hero__topic-image,
  .page-article .article-hero-image {
    min-height: 0;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .page-article .page-hero__topic-image img,
  .page-article .article-hero-image img {
    min-height: 0;
    height: 100%;
    object-fit: cover;
  }

  .site-navigation__head strong {
    overflow-wrap: normal;
    word-break: normal;
  }
}

/* Narrow phones: the proposition reads first at full width; the proof stays
   visibly anchored in the right-hand column beside the concise lead. */
@media (max-width: 480px) {
  .page-hero.page-hero--aside-service_age {
    grid-template-rows: auto auto auto auto;
  }

  .page-hero--aside-service_age .page-hero__copy {
    display: contents;
  }

  .page-hero--aside-service_age .page-hero__eyebrow {
    grid-column: 1 / -1;
    grid-row: 1;
    margin: 0 0 7px;
  }

  .page-hero--aside-service_age h1 {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: 100%;
  }

  .page-hero--aside-service_age h2 {
    grid-column: 1 / -1;
    grid-row: 3;
    max-width: 100%;
  }

  .page-hero--aside-service_age .page-hero__lead {
    grid-column: 1;
    grid-row: 4;
    min-width: 0;
    max-width: 100%;
    align-self: start;
  }

  .page-hero--aside-service_age .service-age,
  .page-hero--aside-service_age .service-age.page-rail__panel {
    --age-digit-w: clamp(17px, 5.45vw, 24px);
    grid-column: 2;
    grid-row: 4;
    align-self: stretch;
    height: 100%;
  }

  .service-age__units {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 4px;
  }

  .service-age__unit {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
    justify-items: center;
    text-align: center;
  }

  .service-age__unit .service-age__digits,
  .service-age__unit small {
    grid-column: 1;
    justify-self: center;
    text-align: center;
  }

  .service-age__unit .service-age__digits {
    grid-row: 1;
  }

  .service-age__unit small {
    grid-row: 2;
  }
}

@media (max-width: 360px) {
  .site-navigation__head strong {
    font-size: 18px;
    letter-spacing: -.01em;
    white-space: nowrap;
  }

  .publication-card__meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    align-items: end;
  }

  .publication-card__details {
    justify-self: end;
  }
}

/* Wider phones can use the available width without turning the clock into a tall tower. */
@media (min-width: 481px) and (max-width: 760px) {
  .service-age__units {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .service-age__unit {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    justify-items: center;
    text-align: center;
  }

  .service-age__unit .service-age__digits,
  .service-age__unit small {
    grid-column: 1;
    justify-self: center;
    text-align: center;
  }

  .service-age__unit .service-age__digits {
    grid-row: 1;
  }

  .service-age__unit small {
    grid-row: 2;
  }

  .service-age__caption,
  .page-home .service-age__caption,
  .service-age__proof {
    text-align: center;
  }
}

@media (hover: hover) {
  .site-header__inner .menu-toggle:hover {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
  }
}

/* The wider rail uses four editorial cards; compact landscape layouts keep a
   fifth so the right column finishes just before the main column. */
@media (min-width: 1280px) {
  .page-home .page-rail__publications li.publication-card:nth-child(n + 5) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .age-flap.is-flipping .age-flap__leaf {
    animation: none !important;
  }
}
