/*
  Glass/material design layer.
  Intent: keep xemX structure/content intact and add a 10-20% Apple glass /
  Google Material influence through surfaces, elevation, and interaction polish.
*/

:root {
  --r: 16px;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-tint: #f7f8fc;
  --surface-line: rgba(0, 0, 48, 0.09);
  --elevation-1: 0 1px 2px rgba(0, 0, 48, 0.05), 0 10px 24px rgba(0, 0, 48, 0.06);
  --elevation-2: 0 2px 5px rgba(0, 0, 48, 0.08), 0 18px 42px rgba(0, 0, 48, 0.11);
  --glass-line: rgba(255, 255, 255, 0.18);
  --glass-fill: rgba(255, 255, 255, 0.08);
}

body {
  background: var(--surface-tint);
  color: #080835;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

nav {
  height: 68px;
  background: rgba(0, 0, 48, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 48, 0.12);
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
}

nav ul {
  gap: 1.45rem;
}

nav ul a {
  border-radius: 999px;
  padding: 0.34rem 0.1rem;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

nav ul a:hover {
  color: #fff;
  transform: translateY(-1px);
}

nav ul a.nav-link-active {
  border-bottom: none;
  color: #fff;
  background: rgba(157, 195, 250, 0.1);
  padding: 0.34rem 0.62rem;
}

.nav-cta {
  border-radius: 999px;
  background: linear-gradient(135deg, var(--purple), #7354f6) !important;
  box-shadow: 0 8px 22px rgba(95, 55, 240, 0.26);
}

#hero,
#header {
  background:
    linear-gradient(180deg, rgba(0, 0, 48, 1) 0%, rgba(5, 5, 74, 1) 72%, rgba(9, 15, 82, 1) 100%);
}

#hero::before,
#header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 38%),
    linear-gradient(0deg, rgba(157, 195, 250, 0.08), rgba(157, 195, 250, 0) 52%);
  opacity: 0.8;
}

.hero-inner,
.header-inner {
  position: relative;
  z-index: 1;
}

h1.hero-h {
  letter-spacing: 0;
}

.hero-sub,
.intro,
.intro-dark,
.contact-intro,
.tech-description,
.mat-card p,
.biz-card p,
.loop-card span,
.app-card p,
.public-case-card span,
.evidence-card span,
.basis-card span,
.detail-card li,
.ref-card p,
.t-bio {
  line-height: 1.72;
}

.hero-figure {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: 0 24px 60px rgba(0, 0, 48, 0.28);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.hero-figure img {
  border-radius: 12px;
}

.figure-expand-trigger,
.figure-lightbox-close {
  border-color: rgba(0, 0, 48, 0.12);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 22px rgba(0, 0, 48, 0.16);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}

.stats {
  position: relative;
  background: rgba(5, 5, 74, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.stat {
  min-width: 150px;
  border: 1px solid rgba(157, 195, 250, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.sec-white {
  background: #ffffff;
}

.sec-light,
.sec-mid {
  background: var(--surface-tint);
}

.sec-dark,
#contact,
footer {
  background:
    linear-gradient(180deg, rgba(0, 0, 48, 1), rgba(4, 4, 58, 1));
}

.rule {
  height: 4px;
  width: 50px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--purple), var(--sky));
}

.btn {
  border-radius: 999px;
  min-height: 44px;
  box-shadow: 0 1px 2px rgba(0, 0, 48, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-p {
  background: linear-gradient(135deg, var(--purple), #7657f8);
  box-shadow: 0 10px 24px rgba(95, 55, 240, 0.24);
}

.btn-p:hover {
  box-shadow: 0 14px 32px rgba(95, 55, 240, 0.3);
}

.btn-g,
.btn-g-light {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}

.sec-white .btn-g-light,
.sec-light .btn-g-light {
  background: rgba(95, 55, 240, 0.05);
}

.mat-card,
.biz-card,
.loop-card,
.app-card,
.public-case-card,
.detail-card,
.evidence-card,
.basis-card,
.ref-card,
.figure-card,
.team-card,
.note-box {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-top-color: rgba(95, 55, 240, 0.22);
  border-radius: var(--r);
  box-shadow: var(--elevation-1);
}

.mat-card,
.biz-card,
.app-card,
.public-case-card {
  border-top-width: 1px;
}

.basis-card {
  border-left: 1px solid var(--surface-line);
}

.evidence-card,
.pitch-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 244, 255, 0.86));
}

.pitch-card {
  border-radius: var(--r);
  box-shadow: var(--elevation-1);
}

.mat-card:hover,
.biz-card:hover,
.loop-card:hover,
.app-card:hover,
.public-case-card:hover,
.detail-card:hover,
.evidence-card:hover,
.basis-card:hover,
.ref-card:hover,
.figure-card:hover,
.team-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--elevation-2);
  border-color: rgba(95, 55, 240, 0.2);
}

.loop-card,
.detail-card,
.basis-card,
.team-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.figure-card {
  overflow: hidden;
}

.figure-card img {
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 48, 0.08);
}

.spec-t tr,
.char-list li,
.method-block {
  border-color: rgba(0, 0, 48, 0.09);
}

.char-list li::before,
.detail-card li::before,
.use-case-examples li::before {
  background: linear-gradient(135deg, var(--purple), var(--sky));
}

.el {
  border-radius: 7px;
}

.el-on {
  background: linear-gradient(135deg, var(--purple), #7758f7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.el-off {
  background: rgba(0, 0, 48, 0.045);
  color: rgba(0, 0, 48, 0.28);
}

.header-meta {
  gap: 1rem;
  border-top-color: rgba(255, 255, 255, 0.12);
}

.meta-item {
  flex: 1 1 280px;
  max-width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  background: var(--glass-fill);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.meta-item:first-child {
  flex: 1.8 1 520px;
}

.figure-lightbox {
  background: rgba(0, 0, 48, 0.72);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.figure-lightbox-panel {
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 36px 90px rgba(0, 0, 48, 0.42);
}

@media (max-width: 768px) {
  nav {
    height: 62px;
  }

  nav ul {
    top: 62px;
    background: rgba(0, 0, 48, 0.9);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
  }

  nav ul a.nav-link-active {
    background: transparent;
    padding: 0;
  }

  .stat {
    flex: 1 1 140px;
  }

  .hero-figure {
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/*
  Deep-glass concept.
  Source content remains the hosted xemx-materials.com homepage; this layer
  pushes the preview toward a more dimensional Apple-like glass surface system.
*/

:root {
  --r: 18px;
  --glass-panel: rgba(255, 255, 255, 0.74);
  --glass-panel-strong: rgba(255, 255, 255, 0.9);
  --glass-panel-dark: rgba(12, 15, 64, 0.58);
  --glass-border: rgba(255, 255, 255, 0.46);
  --glass-border-dark: rgba(157, 195, 250, 0.26);
  --glass-sheen: linear-gradient(135deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.08) 34%, rgba(255, 255, 255, 0) 66%);
  --glass-shadow: 0 1px 2px rgba(0, 0, 48, 0.08), 0 22px 60px rgba(0, 0, 48, 0.16);
  --glass-shadow-dark: 0 1px 2px rgba(0, 0, 48, 0.18), 0 28px 80px rgba(0, 0, 48, 0.32);
  --xemx-wash: linear-gradient(120deg, rgba(95, 55, 240, 0.18), rgba(157, 195, 250, 0.12) 42%, rgba(215, 235, 240, 0.08));
}

body {
  background:
    linear-gradient(120deg, rgba(95, 55, 240, 0.1), transparent 28%, rgba(157, 195, 250, 0.12) 72%, transparent),
    linear-gradient(180deg, #000030 0, #05054a 38rem, #f4f7fb 38.1rem, #f8f9fd 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.055), transparent 32%),
    linear-gradient(180deg, rgba(157, 195, 250, 0.035), transparent 58%);
  mask-image: linear-gradient(180deg, black, transparent 66%);
}

nav {
  width: calc(100% - 32px);
  max-width: 1680px;
  left: auto;
  right: auto;
  margin: 12px auto 0;
  translate: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(0, 0, 48, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 18px 50px rgba(0, 0, 48, 0.28);
}

#hero {
  min-height: calc(100vh - 28px);
  padding-top: clamp(6.8rem, 10vh, 8rem);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 34%),
    linear-gradient(180deg, #000030 0%, #05054a 78%, #11106a 100%);
}

#hero::before {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.13), transparent 24%, rgba(157, 195, 250, 0.08) 58%, transparent);
  opacity: 0.72;
}

.hero-copy {
  padding: clamp(1.2rem, 3vw, 2.1rem);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13), var(--glass-shadow-dark);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

h1.hero-h {
  max-width: 720px;
  font-size: clamp(2.5rem, 4.4vw, 4.45rem);
  text-wrap: balance;
}

.hero-sub {
  color: rgba(215, 235, 240, 0.92);
  font-size: clamp(1.04rem, 1.6vw, 1.22rem);
}

.hero-figure {
  position: relative;
  overflow: hidden;
  padding: 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(240, 240, 245, 0.68));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84), var(--glass-shadow-dark);
}

.hero-figure::before,
.mat-card::before,
.app-card::before,
.public-case-card::before,
.evidence-card::before,
.team-card::before,
.figure-card::before,
.pitch-card::before,
.pt-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--glass-sheen);
  opacity: 0.72;
}

.hero-figure img {
  position: relative;
  border: 1px solid rgba(0, 0, 48, 0.08);
  border-radius: 20px;
}

.hero-figure figcaption {
  position: relative;
  color: rgba(0, 0, 48, 0.7);
}

.stats {
  padding-top: 3rem;
  padding-bottom: 3rem;
  background:
    linear-gradient(180deg, rgba(17, 16, 106, 1), rgba(0, 0, 48, 1));
}

.stat {
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 18px 48px rgba(0, 0, 48, 0.18);
}

.sec {
  position: relative;
  overflow: hidden;
}

.sec-white,
.sec-light,
.sec-mid {
  background:
    linear-gradient(135deg, rgba(95, 55, 240, 0.08), transparent 24%, rgba(157, 195, 250, 0.1) 86%),
    #f7f9fd;
}

.sec-dark,
#contact,
footer {
  background:
    linear-gradient(135deg, rgba(157, 195, 250, 0.1), transparent 34%, rgba(95, 55, 240, 0.14)),
    linear-gradient(180deg, #000030, #05054a);
}

.mat-card,
.biz-card,
.loop-card,
.app-card,
.public-case-card,
.detail-card,
.evidence-card,
.basis-card,
.ref-card,
.figure-card,
.team-card,
.note-box,
.pitch-card,
.pt-wrap,
.contact-card,
.method-card {
  position: relative;
  overflow: hidden;
  border-color: var(--glass-border);
  border-top-color: rgba(255, 255, 255, 0.74);
  background: linear-gradient(145deg, var(--glass-panel-strong), var(--glass-panel));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), var(--glass-shadow);
  backdrop-filter: blur(20px) saturate(135%);
  -webkit-backdrop-filter: blur(20px) saturate(135%);
}

.sec-dark .app-card,
.sec-dark .loop-card,
#contact .contact-card,
footer .footer-card {
  border-color: var(--glass-border-dark);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.045));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--glass-shadow-dark);
}

.pt-wrap {
  border-radius: 26px;
  padding: clamp(1rem, 3vw, 1.6rem);
}

.pt-grid {
  margin-inline: calc(clamp(1rem, 3vw, 1.6rem) * -0.28);
  padding: 0.25rem 0.45rem 0.8rem;
  overscroll-behavior-x: contain;
  scrollbar-color: rgba(95, 55, 240, 0.42) rgba(0, 0, 48, 0.08);
}

.pt-row {
  min-width: 760px;
}

.pt-legend {
  gap: 0.75rem 1.15rem;
  align-items: center;
  max-width: 100%;
}

.pt-legend-item {
  min-width: 0;
  flex: 0 1 auto;
  color: rgba(0, 0, 48, 0.68);
  line-height: 1.35;
}

.pt-dot {
  flex: 0 0 auto;
}

.pt-note {
  max-width: 48rem;
  color: rgba(0, 0, 48, 0.5);
  line-height: 1.55;
}

.el {
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.42);
}

.el-on {
  background: linear-gradient(145deg, #7758f7, var(--purple));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 8px 18px rgba(95, 55, 240, 0.18);
}

.el-off {
  background: rgba(255, 255, 255, 0.48);
}

.btn-p {
  background: linear-gradient(135deg, #7559ff, var(--purple) 62%, #3c22bb);
}

.btn-g,
.btn-g-light {
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

@media (max-width: 980px) {
  nav {
    width: 100%;
    max-width: none;
    margin-top: 0;
    translate: 0 0;
    left: 0;
    border-radius: 0;
  }

  #hero {
    padding-top: 5.75rem;
  }

  .hero-copy {
    border-radius: 22px;
  }
}

@media (max-width: 760px) {
  .pt-wrap {
    padding: 1rem;
  }

  .pt-label {
    line-height: 1.35;
  }

  .pt-grid {
    margin-inline: -0.55rem;
    padding-inline: 0.55rem;
  }

  .pt-row {
    min-width: 680px;
  }

  .pt-legend {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pt-legend-item {
    align-items: flex-start;
  }
}

/* Balanced production pass: stable nav, calmer hero, no generic grid wallpaper. */
body::before {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.055), transparent 32%),
    linear-gradient(180deg, rgba(157, 195, 250, 0.035), transparent 58%);
  background-size: auto;
}

.skip-link {
  top: -4rem;
}

.skip-link:focus {
  top: 0;
}

nav {
  position: fixed;
  top: 12px;
  width: min(calc(100% - 32px), 1680px);
  max-width: calc(100% - 32px);
  left: 0;
  right: 0;
  margin: 0 auto;
  transform: none;
  translate: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

#hero {
  padding-top: clamp(5.8rem, 7vh, 6.7rem);
  min-height: clamp(600px, calc(100vh - 190px), 720px);
  align-items: center;
  padding-bottom: clamp(3.5rem, 6vh, 4.5rem);
}

#hero::before {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.12), transparent 28%, rgba(157, 195, 250, 0.07) 62%, transparent);
  background-size: auto;
  opacity: 0.68;
}

h1.hero-h {
  font-size: clamp(2.5rem, 4.4vw, 4.45rem);
}

@media (max-width: 980px) {
  nav {
    top: 0;
    width: 100%;
    max-width: none;
    left: 0;
    right: 0;
    margin: 0;
    transform: none;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  #hero {
    padding-top: 5.75rem;
    min-height: auto;
    align-items: flex-start;
  }
}

@media (max-width: 860px) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

  #hero {
    width: 100%;
    padding: 5.35rem 1rem 2.6rem;
  }

  .hero-inner {
    width: 100%;
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.65rem;
  }

  .hero-copy,
  .hero-figure {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .hero-copy {
    padding: clamp(1.18rem, 5.2vw, 1.65rem);
  }

  h1.hero-h {
    max-width: 100%;
    font-size: clamp(2.08rem, 9.4vw, 2.8rem);
    line-height: 1.05;
  }

  .hero-sub {
    max-width: 100%;
    font-size: 1rem;
    line-height: 1.6;
  }

  .eyebrow {
    line-height: 1.35;
    white-space: normal;
  }

  .hero-actions {
    flex-wrap: wrap;
  }

  .hero-actions .btn {
    min-width: min(11rem, 100%);
  }

  .hero-figure img {
    max-width: 100%;
  }
}

@media (max-width: 430px) {
  #hero {
    padding-inline: 0.88rem;
  }

  .hero-copy {
    border-radius: 18px;
  }

  .hero-actions .btn {
    flex: 1 1 9.25rem;
    padding-inline: 1rem;
  }
}

/* Balanced card grid pass: avoid orphan cards and large dead rows at intermediate widths. */
:where(
  .pitch-grid,
  .biz-grid,
  .mat-grid,
  .loop-grid,
  .app-grid,
  .public-app-grid,
  .detail-grid,
  .evidence-grid,
  .basis-grid,
  .figure-grid,
  .ref-grid,
  .team-grid,
  .flow
) {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  align-items: stretch;
}

:where(
  .pitch-grid,
  .biz-grid,
  .mat-grid,
  .loop-grid,
  .app-grid,
  .public-app-grid,
  .detail-grid,
  .evidence-grid,
  .basis-grid,
  .figure-grid,
  .ref-grid,
  .team-grid,
  .flow
) > * {
  min-width: 0;
}

@media (min-width: 760px) {
  :where(
    .pitch-grid,
    .biz-grid,
    .mat-grid,
    .loop-grid,
    .app-grid,
    .public-app-grid,
    .detail-grid,
    .evidence-grid,
    .basis-grid,
    .figure-grid,
    .ref-grid,
    .team-grid,
    .flow
  ):has(> :nth-child(4):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  :where(
    .pitch-grid,
    .biz-grid,
    .mat-grid,
    .loop-grid,
    .app-grid,
    .public-app-grid,
    .detail-grid,
    .evidence-grid,
    .basis-grid,
    .figure-grid,
    .ref-grid,
    .team-grid,
    .flow
  ):has(> :nth-child(5):last-child) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  :where(
    .pitch-grid,
    .biz-grid,
    .mat-grid,
    .loop-grid,
    .app-grid,
    .public-app-grid,
    .detail-grid,
    .evidence-grid,
    .basis-grid,
    .figure-grid,
    .ref-grid,
    .team-grid,
    .flow
  ):has(> :nth-child(5):last-child) > * {
    grid-column: span 2;
  }

  :where(
    .pitch-grid,
    .biz-grid,
    .mat-grid,
    .loop-grid,
    .app-grid,
    .public-app-grid,
    .detail-grid,
    .evidence-grid,
    .basis-grid,
    .figure-grid,
    .ref-grid,
    .team-grid,
    .flow
  ):has(> :nth-child(5):last-child) > :nth-last-child(-n + 2) {
    grid-column: span 3;
  }

  :where(
    .pitch-grid,
    .biz-grid,
    .mat-grid,
    .loop-grid,
    .app-grid,
    .public-app-grid,
    .detail-grid,
    .evidence-grid,
    .basis-grid,
    .figure-grid,
    .ref-grid,
    .team-grid,
    .flow
  ):has(> :nth-child(7):last-child) {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  :where(
    .pitch-grid,
    .biz-grid,
    .mat-grid,
    .loop-grid,
    .app-grid,
    .public-app-grid,
    .detail-grid,
    .evidence-grid,
    .basis-grid,
    .figure-grid,
    .ref-grid,
    .team-grid,
    .flow
  ):has(> :nth-child(7):last-child) > * {
    grid-column: span 3;
  }

  :where(
    .pitch-grid,
    .biz-grid,
    .mat-grid,
    .loop-grid,
    .app-grid,
    .public-app-grid,
    .detail-grid,
    .evidence-grid,
    .basis-grid,
    .figure-grid,
    .ref-grid,
    .team-grid,
    .flow
  ):has(> :nth-child(7):last-child) > :nth-last-child(-n + 3) {
    grid-column: span 4;
  }
}

@media (min-width: 1200px) {
  :where(
    .pitch-grid,
    .biz-grid,
    .mat-grid,
    .loop-grid,
    .app-grid,
    .public-app-grid,
    .detail-grid,
    .evidence-grid,
    .basis-grid,
    .figure-grid,
    .ref-grid,
    .team-grid,
    .flow
  ):has(> :nth-child(4):last-child) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 760px) {
  :is(
    .pitch-grid,
    .biz-grid,
    .mat-grid,
    .loop-grid,
    .app-grid,
    .public-app-grid,
    .detail-grid,
    .evidence-grid,
    .basis-grid,
    .figure-grid,
    .ref-grid,
    .team-grid,
    .flow
  ):has(> :nth-child(6):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 759px) {
  :where(
    .pitch-grid,
    .biz-grid,
    .mat-grid,
    .loop-grid,
    .app-grid,
    .public-app-grid,
    .detail-grid,
    .evidence-grid,
    .basis-grid,
    .figure-grid,
    .ref-grid,
    .team-grid,
    .flow
  ) {
    grid-template-columns: minmax(0, 1fr);
  }

  :where(
    .pitch-grid,
    .biz-grid,
    .mat-grid,
    .loop-grid,
    .app-grid,
    .public-app-grid,
    .detail-grid,
    .evidence-grid,
    .basis-grid,
    .figure-grid,
    .ref-grid,
    .team-grid,
    .flow
  ) > * {
    grid-column: auto;
  }
}
