.derived-page .site-header { transform: translateX(-9px); }
.derived-main { padding-top: clamp(31px, 4vw, 58px); }
.derived-main h1,
.derived-main h2,
.derived-main h3 { font-family: var(--sans); }

.archive-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .7fr);
  gap: clamp(42px, 6vw, 86px);
  align-items: end;
  padding: clamp(28px, 3.7vw, 54px) clamp(28px, 3.2vw, 46px);
}
.archive-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 clamp(14px, 1.45vw, 21px);
  color: #777;
  font-size: clamp(9px, .85vw, 12px);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.archive-breadcrumb a { color: var(--orange-dark); text-decoration: none; }
.archive-breadcrumb .icon { width: 1.1em; height: 1.1em; }
.archive-hero h1 {
  max-width: 15em;
  margin: 0;
  font-size: clamp(39px, 4.25vw, 61px);
  line-height: 1.03;
  letter-spacing: -.05em;
  font-weight: 690;
}
.archive-hero h1 .underline {
  text-decoration-thickness: clamp(2px, .22vw, 3px);
  text-underline-offset: clamp(5px, .48vw, 7px);
}
.archive-title-with-icon {
  display: flex;
  align-items: center;
  gap: clamp(13px, 1.25vw, 18px);
}
.archive-title-with-icon .archive-title-icon {
  width: .68em;
  height: .68em;
  flex: 0 0 auto;
  color: var(--orange);
  stroke-width: 1.75;
}
.search-results-title { max-width: 15em; }
.search-results-title > span { color: var(--orange); }
.search-results-title .search-query {
  color: var(--orange);
  font-weight: inherit;
}
.archive-lede {
  max-width: 49em;
  margin: clamp(18px, 1.8vw, 26px) 0 0;
  color: #595959;
  font-size: clamp(13px, 1.23vw, 17.5px);
  line-height: 1.7;
}
.archive-context {
  padding-left: clamp(22px, 2.5vw, 36px);
  border-left: 1px solid var(--line);
}
.archive-context-icon {
  width: clamp(46px, 4.3vw, 62px);
  height: clamp(46px, 4.3vw, 62px);
  display: grid;
  place-items: center;
  margin-bottom: clamp(17px, 1.8vw, 26px);
  color: var(--orange);
  border: 1px solid #f1a16d;
  border-radius: 50%;
}
.archive-context-icon .icon { width: 48%; height: 48%; stroke-width: 1.55; }
.archive-context strong {
  display: block;
  margin-bottom: 7px;
  font-size: clamp(15px, 1.45vw, 21px);
  line-height: 1.5;
  letter-spacing: -.025em;
}
.archive-context p { margin: 0; color: #6c6c6c; font-size: clamp(11px, 1vw, 14px); line-height: 1.6; }

.archive-search-band {
  display: grid;
  grid-template-columns: 1fr minmax(260px, .7fr);
  gap: clamp(26px, 3vw, 43px);
  align-items: center;
  margin-top: clamp(12px, 1.2vw, 17px);
  padding: clamp(18px, 1.8vw, 26px) clamp(22px, 2.4vw, 35px);
}
.archive-search-band p { margin: 0; color: #666; font-size: clamp(11px, 1.05vw, 15px); line-height: 1.55; }
.derived-search { position: relative; display: flex; }
.derived-search input {
  width: 100%; min-height: clamp(43px, 4vw, 57px); padding: 0 52px 0 16px;
  color: var(--ink); background: #fafafa; border: 1px solid #dcdcd9; border-radius: 8px; outline: 0;
  font-size: clamp(11px, 1.02vw, 14.5px);
}
.derived-search input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,101,0,.12); }
.derived-search button { position: absolute; inset: 0 0 0 auto; width: 52px; border: 0; background: transparent; cursor: pointer; }
.derived-search .icon { width: 19px; height: 19px; }

.archive-results { margin-top: clamp(16px, 1.65vw, 24px); }
.archive-results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(4px, .5vw, 8px) clamp(15px, 1.6vw, 23px);
}
.archive-results-head h2 { margin: 0; font-size: clamp(23px, 2.35vw, 34px); line-height: 1.08; letter-spacing: -.04em; }
.archive-count,
.archive-results-count { margin: 0; color: #777; font-size: clamp(10px, .9vw, 13px); }
.archive-feed { display: grid; gap: clamp(12px, 1.15vw, 17px); }
.derived-page .feed-card { min-height: clamp(205px, 19.2vw, 277px); }
.derived-page .feed-copy h3 { font-size: clamp(21px, 2.05vw, 29.5px); }
.derived-page .feed-copy > p { font-size: clamp(12px, 1.1vw, 16px); }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 clamp(14px, 1.5vw, 22px); padding: 0; list-style: none; }
.tag-list a { padding: 6px 10px; color: #626262; background: #f3f3f1; border-radius: 999px; font-size: clamp(9px, .8vw, 11.5px); text-decoration: none; }

.pagination a,
.pagination .page-numbers {
  min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: #fff; border-radius: 999px; font-size: 13px; font-weight: 650;
  box-shadow: 0 8px 24px rgba(30,30,30,.04); text-decoration: none;
}
.pagination a:hover, .pagination a:focus-visible { border-color: #ffc9a5; color: var(--orange-dark); }
.pagination [aria-current="page"] { color: #fff; background: var(--orange); box-shadow: 0 8px 18px rgba(255,101,0,.2); }
.pagination .page-direction { gap: 8px; min-width: 112px; padding: 0 17px; }
.pagination .page-direction .icon { width: 15px; height: 15px; }

.empty-state {
  min-height: clamp(390px, 39vw, 560px);
  display: grid;
  grid-template-columns: .72fr 1.28fr;
  align-items: center;
  gap: clamp(34px, 5vw, 72px);
  margin-top: clamp(16px, 1.65vw, 24px);
  padding: clamp(35px, 5vw, 72px);
}
.empty-mark { position: relative; display: grid; place-items: center; min-height: 230px; }
.empty-mark::before,
.empty-mark::after { content: ""; position: absolute; border-radius: 50%; }
.empty-mark::before { width: 210px; height: 210px; background: #efefec; }
.empty-mark::after { width: 118px; height: 118px; border: 2px solid #ffb27e; }
.empty-mark .icon { position: relative; z-index: 1; width: 58px; height: 58px; color: var(--orange); stroke-width: 1.35; }
.empty-copy h2 { margin: 0; font-size: clamp(29px, 3vw, 43px); line-height: 1.08; letter-spacing: -.045em; }
.empty-copy > p { max-width: 42em; margin: 17px 0 23px; color: #666; font-size: clamp(12px, 1.12vw, 16px); line-height: 1.68; }
.empty-secondary { margin: clamp(22px, 2vw, 29px) 0 0; color: #6a6a6a; font-size: clamp(11px, 1vw, 14px); line-height: 1.55; }
.empty-secondary a { color: var(--orange-dark); font-weight: 700; text-decoration-color: var(--orange); text-underline-offset: 4px; }

.derived-note { margin-top: 10px; color: #888; font-size: 10px; }

@media (max-width: 980px) and (min-width: 701px) {
  .archive-hero { grid-template-columns: minmax(0, 1.35fr) minmax(230px, .65fr); gap: 35px; }
  .archive-hero h1 { font-size: 43px; }
}

@media (max-width: 700px) {
  .derived-page .site-header { transform: none; }
  .derived-main { padding-top: 38px; }
  .archive-hero { grid-template-columns: 1fr; gap: 27px; padding: 29px 18px; }
  .archive-hero h1 { font-size: clamp(38px, 11.5vw, 49px); }
  .archive-lede { font-size: 13px; }
  .archive-context { display: grid; grid-template-columns: 48px 1fr; gap: 15px; align-items: center; padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .archive-context-icon { width: 48px; height: 48px; margin: 0; }
  .archive-context strong { font-size: 17px; }
  .archive-context p { font-size: 11px; }
  .archive-search-band { grid-template-columns: 1fr; gap: 15px; padding: 18px; }
  .archive-search-band p { font-size: 12px; }
  .derived-search input { min-height: 46px; font-size: 13px; }
  .archive-results-head { align-items: start; flex-direction: column; gap: 7px; padding-inline: 5px; }
  .archive-results-head h2 { font-size: 28px; }
  .derived-page .feed-card { min-height: 0; }
  .derived-page .feed-copy h3 { font-size: 24px; }
  .derived-page .feed-copy > p { font-size: 13px; }
  .pagination { flex-wrap: wrap; gap: 8px; }
  .pagination a, .pagination .page-numbers { min-width: 44px; height: 44px; }
  .pagination .page-direction { min-width: 105px; }
  .empty-state { min-height: 0; grid-template-columns: 1fr; gap: 12px; padding: 25px 18px 34px; }
  .empty-mark { min-height: 190px; }
  .empty-mark::before { width: 170px; height: 170px; }
  .empty-mark::after { width: 98px; height: 98px; }
  .empty-mark .icon { width: 49px; height: 49px; }
  .empty-copy h2 { font-size: 32px; }
  .empty-copy > p { font-size: 13px; }
}

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

/* Core block adapters for the approved derived archive geometry. */
.archive-main .site-header { transform: translateX(-9px); }

/* The derived archive/search references place the sticky shell at the visual
   origin.  Keep the global sticky offset elsewhere, but neutralise it here. */
body.search .site-header {
  transform: none;
}
/* Search uses the same initial floating-shell geometry, but its approved
   reference lets the shell leave the viewport while traversing results.  Keep
   the wrapper's native flow position so it does not cover the search band,
   while retaining its existing top/transform values for the initial frame. */
body.search header.wp-block-template-part {
  position: relative;
  transform: translateY(calc(-1 * clamp(8px, 1vw, 14px)));
}
@media (max-width: 980px) and (min-width: 701px) {
  /* Avoid compositing the full shell on a fractional vertical transform at
     tablet width: it changes glyph antialiasing despite equal DOM rects. */
  body.search header.wp-block-template-part {
    top: 0;
    transform: none;
  }
}
.archive-hero > .wp-block-group { min-width: 0; }
.archive-hero .archive-title,
.archive-hero .wp-block-query-title { max-width: 15em; margin: 0; }
.archive-hero .wp-block-term-description p { margin: 0; }
.archive-context > p { margin: 0; }
.archive-context > .wp-block-group p { margin: 0; }
.archive-context > .wp-block-group p + p { margin-top: 7px; color: #6c6c6c; font-size: clamp(11px, 1vw, 14px); line-height: 1.6; }
.archive-context > .wp-block-group > p:first-child { display: contents; }
.archive-context > .wp-block-group > .archive-context-note { margin-top: 0; }
.archive-search-band .wp-block-search,
.derived-search.wp-block-search { margin: 0; }
.archive-search-band .wp-block-search__inside-wrapper,
.derived-search .wp-block-search__inside-wrapper {
  position: relative;
  display: flex;
  padding: 0;
  border: 0;
  /* Core gives search blocks a pill radius globally. The archive field is a
     rounded rectangle, so the wrapper must clip to the same 8px frame as the
     input or the button edge can break the visible border. */
  border-radius: 8px;
  overflow: hidden;
}
.archive-search-band .wp-block-search__input,
.derived-search .wp-block-search__input {
  width: 100%;
  min-height: clamp(43px, 4vw, 57px);
  padding: 0 52px 0 16px;
  border: 1px solid #dcdcd9;
  border-radius: 8px;
  background: #fafafa;
}
.archive-search-band .wp-block-search__button,
.derived-search .wp-block-search__button {
  position: absolute;
  inset: 0 0 0 auto;
  width: 52px;
  min-width: 52px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
}
.archive-feed { display: grid; gap: clamp(12px, 1.15vw, 17px); }
.archive-feed > li { min-width: 0; }
.archive-feed .feed-card { min-height: clamp(205px, 19.2vw, 277px); }
.archive-feed .feed-copy h3 { font-size: clamp(21px, 2.05vw, 29.5px); }

/* A category route adds the generic `category` class to <body>. It must never
   inherit the compact, uppercase card-label treatment from that body class.
   Category cards intentionally share the fixed archive rhythm used in /blog,
   while their dynamic historical copy stays in the normal reading face. */
.category-main .archive-feed .feed-copy .wp-block-post-excerpt__excerpt,
.category-main .archive-feed .feed-copy .wp-block-post-excerpt,
.category-main .archive-feed .post-meta {
  font-weight: 400;
  text-transform: none;
}

@media (min-width: 701px) {
  .category-main .archive-feed .feed-card {
    height: clamp(190px, 18.6vw, 268px);
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }

  .category-main .archive-feed .feed-image-link {
    height: auto;
    align-self: stretch;
    aspect-ratio: auto !important;
  }
}

.category-main .archive-hero .archive-title {
  color: var(--orange-dark);
  /* Archive headings normally carry the page-scale H1. A taxonomy name is a
     qualifier of the archive, so keep it deliberately close to its label. */
  font-size: clamp(20px, 2.1vw, 30px);
  line-height: 1.12;
  letter-spacing: -.035em;
  text-transform: uppercase;
}

/* The dynamic Query Title remains the semantic H1.  The visible qualifier
   makes the archive's taxonomy meaning explicit without creating a second
   title source or a category-specific database override. */
.category-main .archive-hero .archive-title::before {
  content: "Territorio: ";
  color: #575757;
  /* Keep the taxonomy label on the same typographic line as its value. The
     value remains only marginally larger, rather than looking like a second
     heading with a drifting cap-height. */
  font-size: clamp(19px, 2vw, 29px);
  font-weight: 560;
  letter-spacing: -.025em;
  text-transform: none;
  line-height: 1.12;
  vertical-align: -.035em;
}

.category-main .archive-results-head .category-results-title {
  color: var(--orange-dark);
}

.category-main .archive-results-head .category-results-title::before {
  content: "Artículos del territorio: ";
  color: var(--ink);
}

/* A tag archive has its own editorial label, but must reuse the same archive
   card frame as Blog and categories. The value stays dynamic: no tag name is
   encoded in the filesystem or in a content override. */
.tag-main .archive-hero .archive-title {
  color: var(--orange-dark);
}

.tag-main .archive-hero .archive-title::before {
  content: "";
  display: inline-block;
  width: .72em;
  height: .72em;
  margin-right: .16em;
  background: url("../icons/tag-outline.svg") center / contain no-repeat;
  vertical-align: -.05em;
}

.tag-main .archive-results-head .tag-results-title {
  color: var(--orange-dark);
}

.tag-main .archive-results-head .tag-results-title::before {
  content: "Artículos de la etiqueta: ";
  color: var(--ink);
}

@media (min-width: 701px) {
  .tag-main .archive-feed .feed-card {
    height: clamp(190px, 18.6vw, 268px);
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }

  .tag-main .archive-feed .feed-image-link {
    height: auto;
    align-self: stretch;
    aspect-ratio: auto !important;
  }
}

/* Search results may contain substantially longer historical copy than the
   approved representative cards. Preserve the reference card rhythm while
   keeping each real result readable and its metadata visible. */
@media (min-width: 701px) {
  body.search .archive-feed .feed-card {
    height: clamp(205px, 19.2vw, 277px);
    min-height: 0;
  }

  body.search .archive-feed .feed-copy {
    display: flex;
    min-height: 0;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
  }

  body.search .archive-feed .feed-image-link {
    width: 100%;
    aspect-ratio: auto !important;
  }
}

body.search .archive-feed .wp-block-post-title,
body.search .archive-feed .wp-block-post-excerpt__excerpt {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

body.search .archive-feed .wp-block-post-title { -webkit-line-clamp: 2; }
body.search .archive-feed .wp-block-post-excerpt__excerpt { -webkit-line-clamp: 2; }
body.search .archive-feed .wp-block-read-more { display: none; }
.archive-results .empty-state { position: static; left: auto; width: 100%; }
.empty-state .empty-copy > .wp-block-search { margin-top: 23px; }
.search-main:has(.empty-state) .archive-search-band,
.search-main:has(.empty-state) .archive-results-head { display: none; }
.search-main:has(.empty-state) .archive-results { margin-top: clamp(16px, 1.65vw, 24px); }
.search-main:has(.empty-state) .search-results-title {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: clamp(2px, .22vw, 3px);
  text-underline-offset: clamp(5px, .48vw, 7px);
}
.search-main:has(.empty-state) .search-results-title::before {
  content: none;
  text-decoration-line: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: clamp(2px, .22vw, 3px);
  text-underline-offset: clamp(5px, .48vw, 7px);
}

@media (max-width: 700px) {
  .archive-main .site-header { transform: none; }
  body.search .site-header { transform: translate(0, 0); }
  body.search header.wp-block-template-part { transform: translateY(-7px); }
  .archive-feed .feed-card { min-height: 0; }
  body.search .archive-feed .feed-card {
    display: grid;
    /* The rendered V1 reference defines one fixed mobile card frame for
       search results. The first track follows the 1.6 media ratio and the
       second reserves the editorial copy slot, so real historical text
       cannot move pagination or leave an inconsistent card rhythm. */
    height: 493px;
    padding: 9px;
    gap: 13px;
    grid-template-columns: 1fr;
    grid-template-rows: calc((100vw - 55px) / 1.6) minmax(0, 1fr);
  }
  body.search .archive-feed .feed-image-link {
    height: auto !important;
    margin: 0 !important;
    aspect-ratio: 1.6 !important;
  }
  body.search .archive-feed .feed-copy { padding: 8px 13px 16px; }
  .archive-context > .wp-block-group p + p { font-size: 11px; }
}
