.td-category-archive__shell {
  padding-block: 10px clamp(48px, 6vw, 78px);
}

.td-category-breadcrumbs {
  margin-bottom: 14px;
}

.td-category-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  max-width: none;
  margin-bottom: clamp(20px, 3vw, 30px);
  padding: 24px 40px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 88% 18%, rgb(128 178 216 / 0.28), transparent 25%),
    linear-gradient(135deg, #081938 0%, #123565 100%);
  color: #fff;
  box-shadow: 0 24px 70px rgb(8 25 56 / 0.14);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 30px;
}

.td-category-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -80px -130px auto;
  width: 360px;
  aspect-ratio: 1;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 50%;
  box-shadow:
    0 0 0 44px rgb(255 255 255 / 0.035),
    0 0 0 88px rgb(255 255 255 / 0.025);
}

.td-category-hero__eyebrow {
  color: #a9d1ef;
}

.td-category-hero h1 {
  max-width: 850px;
  font-size: 32px;
  line-height: 1.1;
  margin: 0 0 8px 0;
}

.td-category-hero__description {
  max-width: 720px;
  color: rgb(255 255 255 / 0.78);
  font-size: 16px;
  line-height: 1.4;
  margin: 0;
}

.td-hero-text-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.td-hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.td-hero-sidebar .td-category-semantic__stats {
  margin-top: 0;
}

.td-hero-sidebar .td-category-semantic__children {
  margin-top: 0;
}

.td-category-semantic {
  display: grid;
  grid-template-columns: minmax(250px, 0.78fr) minmax(0, 1.7fr);
  gap: clamp(24px, 4vw, 52px);
  margin-bottom: clamp(30px, 4vw, 48px);
  padding: clamp(24px, 3.5vw, 40px);
  border: 1px solid rgb(10 26 60 / 0.12);
  border-radius: 26px;
  background: linear-gradient(135deg, rgb(238 246 252 / 0.94), rgb(255 255 255 / 0.98));
  box-shadow: 0 18px 55px rgb(10 26 60 / 0.07);
}

.td-category-semantic__intro {
  align-self: start;
}

.td-category-semantic__eyebrow {
  margin: 0 0 8px;
  color: #3f6f99;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.td-category-semantic__intro h2 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.td-category-semantic__intro > p:not(.td-category-semantic__eyebrow) {
  margin: 14px 0 0;
  color: var(--td-archive-muted);
  line-height: 1.58;
}

.td-category-semantic__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.td-category-semantic__stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 8px 11px;
  border: 1px solid rgb(10 26 60 / 0.1);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.72);
  color: var(--td-archive-muted);
  font-size: 0.8rem;
}

.td-category-semantic__stats strong {
  color: var(--td-archive-accent);
  font-size: 1rem;
}

.td-category-semantic__all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: var(--td-archive-accent);
  font-weight: 800;
  text-decoration: none;
}

.td-category-semantic__all:hover,
.td-category-semantic__all:focus-visible {
  text-decoration: underline;
}

.td-category-semantic__axes {
  display: grid;
  gap: 20px;
}

.td-category-semantic__axis + .td-category-semantic__axis {
  padding-top: 18px;
  border-top: 1px solid rgb(10 26 60 / 0.1);
}

.td-category-semantic__axis h3 {
  margin: 0 0 12px;
  color: #3f5367;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.td-category-semantic__paths {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.td-category-semantic__path {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgb(10 26 60 / 0.1);
  border-radius: 16px;
  background: rgb(255 255 255 / 0.88);
}

.td-category-semantic__path-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.td-category-semantic__path-head strong,
.td-category-semantic__path-head a {
  min-width: 0;
  color: var(--td-archive-text);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}

.td-category-semantic__path-head a:hover,
.td-category-semantic__path-head a:focus-visible {
  color: var(--td-archive-accent);
  text-decoration: underline;
}

.td-category-semantic__path-head > span {
  flex: 0 0 auto;
  color: var(--td-archive-muted);
  font-size: 0.74rem;
  white-space: nowrap;
}

.td-category-semantic__children {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.td-category-semantic__children a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 999px;
  background: #edf4f9;
  color: #173c62;
  font-size: 0.78rem;
  line-height: 1.2;
  text-decoration: none;
}

.td-category-semantic__children a:hover,
.td-category-semantic__children a:focus-visible {
  background: #dcecf7;
  text-decoration: underline;
}

.td-category-semantic__children span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-category-semantic__children small {
  font-weight: 800;
}

.td-category-results__heading {
  margin-bottom: 18px;
}

.td-category-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(18px, 2.4vw, 28px);
}

.td-category-card {
  grid-column: span 4;
  box-shadow: 0 12px 34px rgb(10 26 60 / 0.055);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.td-category-card:hover {
  transform: translateY(-3px);
  border-color: rgb(10 26 60 / 0.22);
  box-shadow: 0 18px 48px rgb(10 26 60 / 0.11);
}

.td-category-card:first-child {
  display: grid;
  grid-column: span 8;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
}

.td-category-card:first-child .td-category-card__media {
  min-height: 100%;
  aspect-ratio: auto;
}

.td-category-card:first-child .td-category-card__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 3vw, 38px);
}

.td-category-card:first-child h3 {
  font-size: clamp(1.55rem, 2.4vw, 2.3rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.td-category-card:first-child .td-category-card__excerpt {
  font-size: 1rem;
}

.td-category-card__body {
  padding: 18px;
}

.td-category-card h3 {
  font-size: clamp(1.05rem, 1.4vw, 1.3rem);
}

@media (max-width: 980px) {
  .td-category-semantic {
    grid-template-columns: minmax(0, 1fr);
  }

  .td-category-semantic__intro {
    max-width: 680px;
  }

  .td-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .td-category-card {
    grid-column: auto;
  }

  .td-category-card:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .td-category-hero {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 26px 22px;
    border-radius: 22px;
  }

  .td-category-semantic {
    padding: 22px 18px;
    border-radius: 22px;
  }

  .td-category-semantic__paths {
    grid-template-columns: minmax(0, 1fr);
  }

  .td-category-card:first-child {
    display: block;
  }

  .td-category-card:first-child .td-category-card__media {
    aspect-ratio: 16 / 10;
  }

  .td-category-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .td-category-card {
    transition: none;
  }
}

/* --- Restructuring and Editorial Overrides --- */

/* Cookie CMP Banner mobile overflow fix */
.qc-cmp2-container, #qc-cmp2-container, .qc-cmp2-ui, #qc-cmp2-ui {
  max-width: 100vw !important;
  box-sizing: border-box !important;
}

/* Ingress Chips below Category Hero */
.td-category-ingressi {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.td-category-ingresso-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* A11y Touch target */
  padding: 8px 20px;
  border-radius: 100px;
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease-in-out;
  border: 1px solid rgb(255 255 255 / 0.08);
}
.td-category-ingresso-chip:hover, .td-category-ingresso-chip:focus {
  background: #fff;
  color: #081938;
  box-shadow: 0 8px 20px rgb(255 255 255 / 0.15);
  transform: translateY(-2px);
}

/* Search and Filters Bar */
.td-category-filter-bar {
  background: #f4f8fb;
  border: 1px solid rgb(8 25 56 / 0.08);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 30px;
  display: grid;
  gap: 20px;
}
.td-category-filter-bar__title {
  margin: 0 0 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #081938;
}
.td-category-search-input-group {
  display: flex;
  gap: 10px;
  max-width: 600px;
}
.td-category-search-input-group input[type="text"] {
  flex: 1;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgb(8 25 56 / 0.15);
  border-radius: 10px;
  font-size: 0.95rem;
  color: #081938;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}
.td-category-search-input-group input[type="text"]:focus {
  border-color: #123565;
}
.td-category-search-input-group button {
  min-height: 44px;
  padding: 0 24px;
  background: #081938;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.td-category-search-input-group button:hover {
  background: #123565;
}
.td-category-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.td-category-filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 16px;
  border-radius: 100px;
  background: #fff;
  border: 1px solid rgb(8 25 56 / 0.1);
  color: #081938;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s;
}
.td-category-filter-chip:hover {
  background: #eef6fc;
  border-color: #123565;
}
.td-category-filter-chip--active {
  background: #123565;
  border-color: #123565;
  color: #fff;
}

/* Card metadata formatting overrides */
.td-category-card__topic {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 800;
  color: #3f6f99;
  letter-spacing: 0.08em;
}
.td-category-card__author {
  font-weight: 600;
  color: #333;
}
.td-category-card__separator {
  color: rgb(0 0 0 / 0.15);
  margin-inline: 4.5vw; /* Fluid separator margin */
}
@media (min-width: 980px) {
  .td-category-card__separator {
    margin-inline: 8px;
  }
}
.td-category-card__reading-time {
  color: #666;
}

/* Text-only layout degradation for empty cards */
.td-category-card.td-category-card--no-media {
  display: block !important;
  grid-column: span 4 !important;
}
.td-category-card.td-category-card--no-media .td-category-card__media {
  display: none !important;
}

/* Mobile folding/disclosure section for Design Navigator */
.td-category-semantic__mobile-disclosure {
  display: contents;
}
.td-category-semantic__mobile-summary {
  display: none;
  min-height: 44px;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  color: #081938;
  border-bottom: 1px solid rgb(10 26 60 / 0.1);
  margin-bottom: 15px;
}

@media (max-width: 980px) {
  .td-category-semantic {
    display: block;
  }
  .td-category-semantic__mobile-disclosure {
    display: block;
    border-top: 1px solid rgb(10 26 60 / 0.1);
    margin-top: 15px;
  }
  .td-category-semantic__mobile-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .td-category-semantic__mobile-summary::after {
    content: "▼";
    font-size: 0.8rem;
    transition: transform 0.2s;
  }
  .td-category-semantic__mobile-disclosure[open] .td-category-semantic__mobile-summary::after {
    transform: rotate(180deg);
  }
  .td-category-semantic__mobile-disclosure:not([open]) .td-category-semantic__axes {
    display: none;
  }
}
