/* Xtradite Digital design-system refinement: type, layout, interaction and resilience. */

:root {
  --content-measure: 68ch;
  --heading-measure: 18ch;
  --control-radius: 14px;
  --control-height: 48px;
}

:where(.container, .grid-2, .grid-3, .grid-4, .card, .section-head, .hero, .hero-copy,
  .service-v3-engagement-shell, .service-v3-engagement-panel, .service-delivery-phase,
  .cs-hero, .cs-hero-copy, .cs-evidence-card, .cs-timeline-panel, .mega-menu-column,
  .mega-menu-entry, .article-layout__main, .featured-work-grid, .featured-work-story) {
  min-width: 0;
}

h1, h2, h3, h4 {
  text-wrap: balance;
  overflow-wrap: normal;
}

.hero h1,
.page-hero h1,
.cs-hero h1,
#cs-headline {
  max-width: var(--heading-measure);
  font-size: clamp(2.55rem, 5.5vw, 5.35rem);
  line-height: .98;
  letter-spacing: -.045em;
}

.section-head {
  max-width: min(760px, 100%);
}

.section-head h2,
.service-v3-engagement-heading h2,
.service-v3-delivery-heading h2 {
  max-width: 22ch;
  font-size: clamp(2rem, 3.8vw, 3.75rem);
  line-height: 1.04;
}

.card h3,
.related-post-card h4,
.mega-menu-intro h2 {
  max-width: 28ch;
  font-size: clamp(1.12rem, 1.5vw, 1.55rem);
  line-height: 1.18;
}

.section-head p,
.hero-sub,
.card-desc,
.cs-story-copy,
.cs-timeline-panel-copy p {
  max-width: var(--content-measure);
}

/* Context-aware eyebrows --------------------------------------------------- */
.eyebrow {
  width: max-content;
  max-width: 100%;
  min-height: 30px;
  margin-bottom: var(--space-18, 18px);
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1;
}

.section-head:not(.left) .eyebrow,
.hero:not(.left-aligned) .eyebrow {
  margin-inline: auto;
}

.section-head.left .eyebrow,
.hero.left-aligned .eyebrow,
.card .eyebrow,
.cs-hero .eyebrow {
  margin-left: 0;
  margin-right: 0;
}

/* First-paint header and mega-menu layering -------------------------------- */
.site-header,
.site-header.has-layered-navigation {
  z-index: 10000;
  isolation: isolate;
  overflow: visible;
}

.header-inner,
.site-nav.mega-nav,
.mega-nav-item {
  overflow: visible;
}

.mega-menu-panel {
  z-index: 10020;
  max-height: min(680px, calc(100vh - 104px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.mega-nav-item::after {
  content: "";
  position: absolute;
  top: 100%;
  left: -10px;
  right: -10px;
  height: 20px;
  pointer-events: none;
}

.mega-nav-item.is-open::after { pointer-events: auto; }

.mega-menu-entry-title,
.mega-insight-links strong {
  font-size: .84rem;
  line-height: 1.3;
}

.mega-menu-entry-copy,
.mega-insight-links small {
  font-size: .72rem;
  line-height: 1.45;
}

.mega-menu-list--services,
.mega-menu-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Cards and intrinsic sizing ------------------------------------------------ */
.grid-2, .grid-3, .grid-4 {
  align-items: start;
}

.service-card,
.case-card,
.blog-card,
.related-post-card,
.industry-card,
.cs-related-case {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  overflow: clip;
}

.service-card .card-desc,
.case-card .card-desc,
.blog-card .card-desc {
  flex: 1 1 auto;
  line-height: 1.62;
}

.card .card-link { margin-top: auto; }

.tech-logo-grid,
.logo-grid,
.service-v3-technology-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  align-items: start;
}

.tech-logo-item {
  min-height: 0;
  align-self: start;
}

/* Homepage hero ------------------------------------------------------------- */
.home-hero {
  padding: clamp(96px, 11vw, 150px) 0 clamp(64px, 8vw, 104px);
  text-align: left;
  overflow: clip;
}

.home-hero .container {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: clamp(36px, 6vw, 86px);
  align-items: center;
  max-width: 1240px;
}

.home-hero h1 {
  max-width: 12ch;
  margin-bottom: var(--space-24);
  font-size: clamp(3rem, 6.5vw, 6.35rem);
}

.home-hero .hero-sub {
  max-width: 650px;
  font-size: clamp(1.05rem, 1.5vw, 1.28rem);
  line-height: 1.65;
}

.home-hero .hero-ctas { justify-content: flex-start; }
.home-hero .btn-secondary { background: color-mix(in oklab, white 72%, transparent); }

.hero-emphasis {
  position: relative;
  display: inline-block;
  color: var(--color-primary-active);
}

.hero-emphasis::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -.08em;
  height: .1em;
  border-radius: 999px;
  background: var(--gradient-sunset);
  transform: scaleX(0);
  transform-origin: left;
  animation: heroUnderline 900ms 260ms cubic-bezier(.2,.8,.2,1) forwards;
}

@keyframes heroUnderline { to { transform: scaleX(1); } }

.home-hero-system {
  position: relative;
  display: grid;
  gap: 12px;
  padding: clamp(24px, 3vw, 38px);
  border: 1px solid color-mix(in oklab, var(--color-ink) 10%, transparent);
  border-radius: 28px;
  background: color-mix(in oklab, white 82%, var(--color-cream));
  box-shadow: 0 34px 70px -44px color-mix(in oklab, var(--color-ink) 46%, transparent);
}

.home-hero-system::before {
  content: "Strategy connected to delivery";
  color: var(--color-text-muted);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hero-system-stage {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-bg);
  transition: transform .25s ease, border-color .25s ease, background .25s ease;
}

.hero-system-stage.is-active {
  transform: translateX(-8px);
  border-color: color-mix(in oklab, var(--color-primary) 42%, var(--color-border));
  background: color-mix(in oklab, var(--color-primary) 7%, white);
}

.hero-system-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-text-primary);
  color: white;
  font-size: .72rem;
  font-weight: 800;
}

.hero-system-stage strong { color: var(--color-text-primary); font-size: .9rem; }
.hero-system-stage small { color: var(--color-text-muted); font-size: .72rem; }
.hero-system-stage > span:last-child { color: var(--color-primary); font-size: .74rem; font-weight: 800; }

.home-proof-strip {
  margin-top: -1px;
}

.home-proof-strip .stats-strip {
  gap: 0;
  padding-block: 0;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  overflow: hidden;
  background: color-mix(in oklab, white 76%, var(--color-cream));
}

.home-proof-strip .stat-item {
  min-width: 0;
  min-height: 130px;
  padding: 24px;
  border-right: 1px solid var(--color-border);
}
.home-proof-strip .stat-item:last-child { border-right: 0; }
.home-proof-strip .stat-number { font-size: clamp(2rem, 3.5vw, 3.4rem); }

/* Featured work ------------------------------------------------------------- */
.featured-work-section { overflow: clip; }
.featured-work-root { min-height: 420px; }
.featured-work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(300px, .68fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: stretch;
}

.featured-work-story {
  display: grid;
  gap: 28px;
  padding: clamp(28px, 5vw, 64px);
  border-radius: 28px;
  background: var(--color-text-primary);
  color: white;
  box-shadow: var(--shadow-lift);
}

.featured-work-story h3 {
  max-width: 18ch;
  color: white;
  font-size: clamp(2rem, 4vw, 4.1rem);
  line-height: 1.02;
}

.featured-work-story p { max-width: 62ch; color: rgb(255 255 255 / 76%); }
.featured-work-journey { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.featured-work-step { padding: 16px; border: 1px solid rgb(255 255 255 / 16%); border-radius: 16px; }
.featured-work-step span { display: block; color: #ffad72; font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.featured-work-step strong { display: block; margin-top: 8px; color: white; font-size: .9rem; line-height: 1.35; }
.featured-work-result { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-top: 24px; border-top: 1px solid rgb(255 255 255 / 16%); }
.featured-work-result strong { color: white; font-family: var(--font-display); font-size: clamp(2rem, 4vw, 4.5rem); line-height: .95; }
.featured-work-result span { max-width: 30ch; color: rgb(255 255 255 / 68%); }

.featured-work-aside { display: grid; gap: 16px; }
.featured-work-secondary {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-bg-secondary);
}
.featured-work-secondary h4 { font-size: clamp(1.1rem, 1.7vw, 1.45rem); }
.featured-work-empty { padding: 48px; border: 1px dashed var(--color-border); border-radius: 22px; text-align: center; }

/* Tabs and selectors -------------------------------------------------------- */
:where(.service-v3-engagement-tabs, .service-content-tablist, .service-coverage-tabs, .tag-filter-bar, .cs-timeline-track) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  width: 100%;
}

:where(.service-v3-engagement-tabs, .service-content-tablist, .service-coverage-tabs, .tag-filter-bar, .cs-timeline-track) button {
  min-width: 0;
  min-height: var(--control-height);
  border-radius: var(--control-radius);
}

.tag-filter-chip { white-space: nowrap; }

/* FAQ system ---------------------------------------------------------------- */
.faq-list {
  width: min(920px, 100%);
  margin-inline: auto;
  border-top: 1px solid var(--color-border);
}

.faq-item { border-bottom: 1px solid var(--color-border); }
.faq-question {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 38px;
  gap: 16px;
  align-items: center;
  width: 100%;
  min-height: 82px;
  padding: 18px 4px;
  border: 0;
  background: transparent;
  color: var(--color-text-primary);
  text-align: left;
}
.faq-number { color: var(--color-primary-active); font-size: .72rem; font-weight: 800; letter-spacing: .08em; }
.faq-label { font-family: var(--font-display); font-size: clamp(1rem, 1.45vw, 1.25rem); line-height: 1.32; }
.faq-symbol { position: relative; width: 34px; height: 34px; border: 1px solid var(--color-border); border-radius: 50%; }
.faq-symbol i { position: absolute; top: 50%; left: 50%; width: 13px; height: 2px; background: currentColor; transform: translate(-50%, -50%); transition: transform .2s ease; }
.faq-symbol i:last-child { transform: translate(-50%, -50%) rotate(90deg); }
.faq-item.open .faq-symbol i:last-child { transform: translate(-50%, -50%) rotate(0deg); }
.faq-answer { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .28s ease, opacity .22s ease; }
.faq-answer > * { overflow: hidden; }
.faq-answer p { max-width: 72ch; padding: 0 58px 0 60px; color: var(--color-text-tertiary); line-height: 1.72; }
.faq-item.open .faq-answer { grid-template-rows: 1fr; opacity: 1; }
.faq-item.open .faq-answer p { padding-bottom: 24px; }

/* Service composition ------------------------------------------------------- */
.service-v3-engagement-shell { grid-template-columns: 1fr; gap: 16px; align-items: start; }
.service-v3-engagement-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.service-v3-engagement-tabs button { min-height: 86px; transform: none; }
.service-v3-engagement-tabs button:hover { transform: translateY(-2px); }
.service-v3-engagement-panels { min-height: 0; }
.service-v3-engagement-panel { min-height: 0; }
.service-v3-technology-panel { display: grid; gap: 22px; }
.service-v3-technology-category { display: grid; gap: 12px; }
.service-v3-technology-category h3 { font-size: 1rem; }
.service-v3-technology-example { display: grid; grid-template-columns: minmax(120px, .3fr) minmax(0, .7fr); gap: 16px; padding: 16px; border: 1px solid var(--color-border); border-radius: 14px; }
.service-v3-technology-example strong { color: var(--color-text-primary); }
.service-v3-technology-example p { color: var(--color-text-tertiary); font-size: .88rem; line-height: 1.55; }
.service-v3-delivery-layout { display: block; margin-top: var(--space-40); }
.service-v3-tech-rail { position: static; max-height: none; overflow: visible; }

/* Case-study resilience and narrative --------------------------------------- */
.cs-hero {
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, .88fr);
  align-items: stretch;
  min-height: 0;
}

#cs-headline {
  max-width: 17ch;
  font-size: clamp(2.35rem, 4.8vw, 5rem);
  line-height: 1;
}

.cs-hero-copy { align-self: center; padding-block: clamp(24px, 5vw, 64px); }
.cs-confidentiality { max-width: 46ch; line-height: 1.45; }
.cs-evidence-dashboard { align-items: start; }
.cs-evidence-card { min-height: 0; align-self: start; }
.cs-evidence-context { display: grid; gap: 7px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--color-border); }
.cs-evidence-context span { color: var(--color-text-muted); font-size: .69rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.cs-evidence-context p { color: var(--color-text-tertiary); font-size: .82rem; line-height: 1.5; }

.cs-context-visual {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-bg-secondary);
}
.capacity-chart { display: grid; gap: 12px; }
.capacity-chart-axis { display: flex; justify-content: space-between; color: var(--color-text-muted); font-size: .7rem; }
.capacity-chart-track { position: relative; min-height: 176px; border-left: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); background: repeating-linear-gradient(to top, transparent 0 34px, color-mix(in oklab, var(--color-ink) 6%, transparent) 35px); }
.capacity-chart-demand, .capacity-chart-output, .capacity-chart-cap { position: absolute; left: 8%; right: 7%; height: 4px; border-radius: 999px; transform-origin: left; }
.capacity-chart-demand { top: 28%; background: var(--color-primary); transform: rotate(-17deg); }
.capacity-chart-output { top: 62%; background: var(--color-indigo, #6658c7); transform: rotate(-7deg); }
.capacity-chart-cap { top: 42%; border-top: 2px dashed var(--color-text-muted); }
.capacity-chart-constraint { position: absolute; top: 34%; left: 62%; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--color-primary); box-shadow: 0 0 0 7px color-mix(in oklab, var(--color-primary) 14%, transparent); }
.capacity-chart-note { color: var(--color-text-secondary); font-size: .84rem; line-height: 1.5; }

.cs-process-visual { order: 1; }
#cs-approach { order: 2; }
.cs-approach { display: flex; flex-direction: column; }
.cs-timeline-track { grid-template-columns: repeat(var(--timeline-columns, 4), minmax(0, 1fr)); }
.cs-timeline-tab { min-height: 78px; border-radius: 12px; }
.cs-timeline-panel { grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr); align-items: center; }

/* Filters and presentation -------------------------------------------------- */
.tag-filter-bar { align-items: stretch; }
[data-deck-player] { min-width: 0; }
[data-deck-player]:hover { cursor: default; }

/* Responsive ---------------------------------------------------------------- */
@media (max-width: 1024px) {
  .home-hero .container,
  .featured-work-grid,
  .cs-hero { grid-template-columns: 1fr; }
  .home-hero-system { width: min(680px, 100%); }
  .home-proof-strip .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-proof-strip .stat-item:nth-child(2) { border-right: 0; }
  .home-proof-strip .stat-item:nth-child(-n+2) { border-bottom: 1px solid var(--color-border); }
  .service-v3-engagement-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mega-menu-panel { max-height: calc(100vh - 96px); }
}

@media (max-width: 760px) {
  .container { padding-inline: 18px; }
  section { padding-block: 64px; }
  .hero h1, .page-hero h1, #cs-headline { font-size: clamp(2.35rem, 11vw, 3.85rem); line-height: 1.02; }
  .section-head h2 { font-size: clamp(1.85rem, 8.5vw, 2.8rem); }
  .eyebrow { padding-inline: 11px; font-size: .65rem; letter-spacing: .1em; }
  .home-hero { padding-top: 86px; }
  .home-hero h1 { font-size: clamp(2.75rem, 14vw, 4.4rem); }
  .hero-system-stage { grid-template-columns: 32px minmax(0, 1fr); }
  .hero-system-stage > span:last-child { grid-column: 2; }
  .home-proof-strip .stats-strip { grid-template-columns: 1fr; }
  .home-proof-strip .stat-item { min-height: 0; border-right: 0; border-bottom: 1px solid var(--color-border); }
  .home-proof-strip .stat-item:last-child { border-bottom: 0; }
  .featured-work-journey { grid-template-columns: 1fr; }
  .featured-work-result { align-items: flex-start; flex-direction: column; }
  :where(.service-v3-engagement-tabs, .service-content-tablist, .service-coverage-tabs, .tag-filter-bar, .cs-timeline-track) {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    padding-bottom: 8px;
  }
  :where(.service-v3-engagement-tabs, .service-content-tablist, .service-coverage-tabs, .tag-filter-bar, .cs-timeline-track) button {
    flex: 0 0 min(78vw, 260px);
    scroll-snap-align: start;
  }
  .service-v3-technology-example { grid-template-columns: 1fr; }
  .faq-question { grid-template-columns: 34px minmax(0, 1fr) 34px; gap: 10px; }
  .faq-answer p { padding-inline: 44px 8px; }
  .cs-timeline-panel { grid-template-columns: 1fr; }
  .mega-menu-panel { overflow: visible; max-height: none; }
}

@media (max-width: 390px) {
  .eyebrow { border-radius: 9px; white-space: normal; }
  .hero-ctas .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .hero-emphasis::after { transform: scaleX(1); }
}
