/* Categories directory: a calmer, searchable extension of the magazine system. */
.category-hero { position: relative; overflow: hidden; background: var(--orange); }
.category-hero::before { position: absolute; top: -170px; right: -80px; width: 460px; height: 460px; content: ""; background: var(--orange-light); border-radius: 50%; opacity: .72; }
.category-hero::after { position: absolute; bottom: -95px; left: 10%; width: 300px; height: 150px; content: ""; border: 2px solid rgba(255,255,255,.28); border-radius: 50%; transform: rotate(-18deg); }
.category-hero__layout { position: relative; z-index: 1; display: grid; min-height: 500px; padding-block: 80px; grid-template-columns: minmax(0, 1fr) minmax(260px, .42fr); align-items: center; gap: 70px; color: var(--white); }
.category-hero .eyebrow { color: var(--orange-light); }
.category-hero h1 { max-width: 780px; margin-bottom: 25px; font-family: var(--serif); font-weight: 500; }
.category-hero h1 em { color: var(--orange-light); font-weight: 400; }
.category-hero__lead { max-width: 630px; color: rgba(255,255,255,.86); font-size: 1.05rem; }
.category-hero .quiet-link { color: var(--white); }
.category-hero__stamp { position: relative; display: flex; width: 250px; height: 250px; margin-inline: auto; flex-direction: column; justify-content: center; align-items: center; color: var(--charcoal-deep); background: var(--orange-light); border: 12px solid rgba(255,255,255,.28); border-radius: 50%; box-shadow: 0 22px 45px rgba(23,23,23,.18); transform: rotate(7deg); }
.category-hero__stamp::before { position: absolute; inset: 11px; content: ""; border: 1px solid var(--charcoal-deep); border-radius: 50%; opacity: .3; }
.category-hero__stamp span, .category-hero__stamp strong, .category-hero__stamp small { position: relative; z-index: 1; }
.category-hero__stamp span { font-size: .68rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.category-hero__stamp strong { margin-block: 5px; font-family: var(--serif); font-size: 4.8rem; line-height: .9; }
.category-hero__stamp small { font-size: .68rem; font-weight: 900; text-transform: uppercase; }
.category-hero__stamp i { position: absolute; right: 17px; bottom: 25px; width: 27px; height: 27px; background: var(--leaf-green); border-radius: 50%; }

.category-directory { background: var(--ivory); }
.directory-controls { width: min(100%, 1030px); margin-bottom: 26px; padding: 25px 28px 28px; background: var(--paper); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 14px 32px rgba(23,23,23,.07); }
.directory-controls__intro { display: flex; margin-bottom: 22px; justify-content: space-between; align-items: end; gap: 30px; }
.directory-controls__intro .eyebrow { margin-bottom: 7px; }
.directory-controls__intro h3 { margin: 0; color: var(--charcoal-deep); font-family: var(--serif); font-size: clamp(1.7rem, 3vw, 2.35rem); font-weight: 500; }
.directory-controls__intro > p { max-width: 42ch; margin: 0 0 3px; color: var(--muted); font-size: .78rem; }
.directory-controls__fields { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: end; gap: 20px; }
.directory-search { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.directory-search > span, .category-selector > label { color: var(--charcoal-deep); font-size: .68rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.directory-search__field { position: relative; display: flex; min-width: 0; height: 50px; align-items: center; color: var(--muted); background: var(--ivory); border: 1px solid var(--orange); border-radius: 14px; transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease; }
.directory-search__field:focus-within { background: var(--paper); border-color: var(--charcoal); box-shadow: 0 0 0 3px rgba(232,91,36,.14); }
.directory-search__field > svg { width: 19px; height: 19px; margin-left: 15px; flex: 0 0 auto; color: var(--orange); }
.directory-search__field input { width: 100%; min-width: 0; height: 100%; padding: 10px 12px; color: var(--charcoal-deep); background: transparent; border: 0; outline: 0; }
.directory-search__field input::placeholder { color: var(--muted); opacity: .9; }
.directory-search__field > button { display: grid; width: 28px; height: 28px; margin-right: 10px; padding: 0; flex: 0 0 auto; place-items: center; color: var(--charcoal-deep); background: var(--orange-light); border: 0; border-radius: 50%; font-size: 1.15rem; line-height: 1; cursor: pointer; }
.directory-search__field > button:hover { color: var(--white); background: var(--orange); }
.category-directory__tools { display: grid; width: min(100%, 1040px); margin-bottom: 18px; grid-template-columns: minmax(220px, 300px) minmax(420px, 680px); align-items: start; gap: 36px; }
.category-directory .search-box { display: flex; width: 100%; flex-direction: column; gap: 7px; }
.category-directory .search-box > span, .category-selector > label { color: var(--charcoal-deep); font-size: .68rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.category-directory .search-box input { width: 100%; min-height: 48px; padding: 10px 15px; color: var(--charcoal-deep); background: var(--paper); border: 1px solid var(--orange); border-radius: 13px; outline: none; }
.category-directory .search-box input:focus { border-color: var(--charcoal); box-shadow: 0 0 0 3px rgba(232,91,36,.16); }
.category-selector { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.category-selector__row { display: flex; width: 100%; min-width: 0; align-items: stretch; gap: 10px; }
.category-selector select { width: 100%; min-height: 48px; padding: 10px 38px 10px 15px; color: var(--charcoal-deep); background-color: var(--paper); background-image: linear-gradient(45deg, transparent 50%, var(--orange) 50%), linear-gradient(135deg, var(--orange) 50%, transparent 50%); background-position: calc(100% - 19px) 20px, calc(100% - 13px) 20px; background-repeat: no-repeat; background-size: 6px 6px, 6px 6px; border: 1px solid var(--orange); border-radius: 13px; appearance: none; cursor: pointer; }
.category-selector select:focus { border-color: var(--charcoal); outline: 3px solid rgba(232,91,36,.16); outline-offset: 1px; }
.category-selector__reset { flex: 0 0 auto; min-height: 48px; padding: 9px 15px; color: var(--charcoal-deep); background: var(--orange-light); border: 1px solid var(--orange); border-radius: 13px; font-size: .7rem; font-weight: 900; cursor: pointer; transition: color 180ms ease, background 180ms ease, transform 180ms ease; }
.category-selector__reset:hover, .category-selector__reset:focus-visible { color: var(--white); background: var(--orange); transform: translateY(-2px); }
.category-selector > p { max-width: 62ch; margin: 5px 0 0; color: var(--muted); font-size: .7rem; }
.category-directory .directory-count { margin: 0 0 25px; color: var(--muted); font-size: .75rem; font-weight: 800; }
.category-directory .empty-state { padding: 45px; background: var(--paper); border: 1px dashed var(--orange); border-radius: var(--radius-md); text-align: center; }
.category-directory .empty-state p { margin: 5px 0 0; color: var(--muted); }
.category-brand-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.category-brand-card { position: relative; isolation: isolate; display: flex; min-height: 235px; padding: 20px; flex-direction: column; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 22px 22px 22px 6px; box-shadow: 0 9px 25px rgba(23,23,23,.05); transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease; }
.category-brand-card::after { position: absolute; z-index: -1; right: -25px; bottom: -30px; width: 115px; height: 115px; content: ""; background: var(--orange-soft); border-radius: 50%; }
.category-brand-card:nth-child(3n)::after { background: rgba(204,214,63,.22); }
.category-brand-card:hover, .category-brand-card:focus-within { border-color: var(--orange); box-shadow: var(--shadow-small); transform: translateY(-4px); }
.category-brand-card__topline { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.category-brand-card__logo { display: grid; width: 82px; height: 54px; padding: 5px; place-items: center; overflow: hidden; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.category-brand-card__logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.category-brand-card__logo .image-fallback { padding: 0; color: var(--orange-dark); font-family: var(--serif); font-size: .9rem; }
.category-brand-card__number { color: var(--muted); font-size: .63rem; font-weight: 900; letter-spacing: .05em; text-align: right; text-transform: uppercase; }
.category-brand-card__copy { margin-top: auto; padding-top: 14px; }
.category-brand-card__copy small { color: var(--orange-dark); font-size: .64rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.category-brand-card__copy .brand-category-list { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.category-brand-card__copy .brand-category-list .brand-category { display: inline-flex; margin: 0; align-items: center; gap: 3px; color: var(--orange-dark); font-size: .58rem; line-height: 1.2; }
.category-brand-card__copy .brand-category-list .brand-category span { display: inline; width: auto; height: auto; color: var(--orange); background: transparent; font-size: .72rem; line-height: 1; }
.category-brand-card__copy .brand-category-list .brand-category img { width: 16px; height: 16px; flex: 0 0 16px; object-fit: contain; }
.category-brand-card h3 { margin: 8px 0 0; color: var(--charcoal-deep); font-family: var(--serif); font-size: 1.48rem; font-weight: 500; line-height: 1.04; }
.category-brand-card--long-name h3 { font-size: 1.22rem; line-height: 1.08; text-wrap: balance; }
.category-brand-card > p { display: flex; margin: 18px 0 0; padding-top: 11px; align-items: center; gap: 6px; color: var(--muted); border-top: 1px solid var(--line); font-size: .72rem; }
.category-brand-card > p span { color: var(--orange); font-size: 1rem; }
.category-brand-card__meta { display: flex; min-width: 0; flex-direction: column; align-items: flex-end; gap: 8px; }
.brand-socials { display: flex; margin: 0; align-items: center; justify-content: flex-end; gap: 5px; }
.brand-socials a { display: grid; width: 30px; height: 30px; place-items: center; color: var(--charcoal-deep); background: var(--orange-soft); border-radius: 50%; transition: color 180ms ease, background 180ms ease, transform 180ms ease; }
.brand-socials a:hover, .brand-socials a:focus-visible { color: var(--white); background: var(--orange); transform: translateY(-2px); }
.brand-socials svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.brand-socials a:nth-child(1) svg { fill: currentColor; stroke: none; }

.category-note { position: relative; overflow: hidden; color: var(--white); background: var(--charcoal-deep); }
.category-note::before { position: absolute; top: -120px; right: 18%; width: 300px; height: 250px; content: ""; background: var(--orange); border-radius: 44% 56% 49% 51%; opacity: .8; }
.category-note__layout { position: relative; z-index: 1; display: grid; padding-block: 78px; grid-template-columns: minmax(0, 1.05fr) minmax(260px, .7fr) auto; align-items: center; gap: 45px; }
.category-note h2 { max-width: 650px; margin: 0; color: var(--white); font-family: var(--serif); font-size: clamp(2.25rem, 4vw, 4rem); font-weight: 500; }
.category-note__layout > p { margin: 0; color: rgba(255,255,255,.76); font-size: .88rem; }

@media (max-width: 1000px) {
  .category-brand-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .category-note__layout { grid-template-columns: minmax(0, 1fr) minmax(240px, .7fr); }
  .category-note .button { grid-column: 2; grid-row: 1; justify-self: end; }
}

@media (max-width: 850px) {
  .category-hero__layout { min-height: 0; padding-block: 64px; grid-template-columns: 1fr; gap: 35px; }
  .category-hero__stamp { width: 190px; height: 190px; margin-inline: auto; }
  .category-hero__stamp strong { font-size: 3.65rem; }
  .category-hero__layout > div:first-child { text-align: center; }
  .category-hero__lead { margin-inline: auto; }
  .category-hero .action-row { justify-content: center; }
  .directory-controls { padding: 22px; }
  .directory-controls__intro { align-items: start; flex-direction: column; gap: 8px; }
  .directory-controls__intro > p { max-width: 58ch; }
  .directory-controls__fields { grid-template-columns: 1fr; align-items: stretch; }
  .category-directory__tools { grid-template-columns: 1fr; align-items: stretch; }
  .category-selector__row { max-width: 650px; }
  .category-brand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-note__layout { grid-template-columns: 1fr; gap: 22px; }
  .category-note .button { grid-column: auto; grid-row: auto; justify-self: start; }
  .category-directory .section-heading--editorial {
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
  }

  .category-directory .section-heading--editorial > p {
    max-width: 60ch;
    margin: 0;
  }
}

@media (max-width: 620px) {
  .category-hero__layout { padding-block: 48px; }
  .directory-controls { padding: 19px 16px 20px; border-radius: 19px; }
  .directory-controls__intro { margin-bottom: 18px; }
  .directory-controls__intro h3 { font-size: 1.75rem; }
  .category-brand-grid { gap: 10px; }
  .category-selector__row { flex-direction: column; }
  .category-selector__reset { width: 100%; }
  .category-brand-card { min-height: 205px; padding: 15px; border-radius: 18px 18px 18px 5px; }
  .category-brand-card__logo { width: 68px; height: 45px; }
  .category-brand-card__number { max-width: 72px; font-size: .56rem; }
  .category-brand-card h3 { font-size: 1.2rem; }
  .category-brand-card > p { align-items: flex-start; font-size: .65rem; }
  .category-note__layout { padding-block: 60px; }
}

@media (max-width: 410px) {
  .category-brand-grid { grid-template-columns: 1fr; }
  .category-brand-card { min-height: 190px; }
}
/* Directory refinements: keep the controls aligned with the cards and preserve logo proportions. */
.directory-controls {
    width: 100%;
}

.category-brand-card__logo {
    width: 112px;
    height: 72px;
    padding: 8px;
}

.category-brand-card__logo img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
}

@media (max-width: 620px) {
    .category-brand-card__logo {
        width: 88px;
        height: 58px;
    }
}

/* Keep the full source artwork visible; some official logos use nearly square artwork. */
.category-brand-card__logo {
    display: flex;
    width: 120px;
    height: 80px;
    padding: 0;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.category-brand-card__logo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

.category-brand-card__topline,
.category-brand-card__copy,
.category-brand-card > p {
    min-width: 0;
}

.category-brand-card__number,
.category-brand-card h3,
.category-brand-card > p {
    overflow-wrap: anywhere;
}

.category-brand-card > p > span {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    place-items: center;
    color: var(--orange-dark);
    background: var(--orange-soft);
    border-radius: 50%;
}

.category-brand-card > p > span svg {
    width: 14px;
    height: 14px;
}

.directory-pagination {
    display: flex;
    width: fit-content;
    margin: 26px auto 0;
    align-items: center;
    gap: 14px;
}

.directory-pagination button {
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    color: var(--charcoal-deep);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
}

.directory-pagination button:hover:not(:disabled),
.directory-pagination button:focus-visible:not(:disabled) {
    color: var(--white);
    background: var(--orange);
    border-color: var(--orange);
}

.directory-pagination button:disabled {
    cursor: default;
    opacity: .35;
}

.directory-pagination span {
    min-width: 88px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    text-align: center;
}

@media (max-width: 620px) {
    .category-brand-card__logo {
        width: 110px;
        height: 72px;
    }
}

@media (max-width: 410px) {
    .category-brand-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .category-brand-card {
        min-height: 190px;
        padding: 12px;
    }

    .category-brand-card__logo {
        width: 82px;
        height: 54px;
    }

    .category-brand-card__number {
        max-width: 58px;
        font-size: .52rem;
    }

    .category-brand-card h3 {
        font-size: 1.05rem;
    }

    .category-brand-card > p {
        gap: 4px;
        font-size: .6rem;
    }

    .category-brand-card > p > span {
        width: 22px;
        height: 22px;
        flex-basis: 22px;
    }

    .category-brand-card > p > span svg {
        width: 12px;
        height: 12px;
    }
}
