/* Category archive — one template for every category.
   Built from design/source/Category.dc.html (desktop) and M-Topic.dc.html (phone).
   Mobile-first: the phone layout is the default and widens at 768px / 1024px. */

.amg-archive { background: var(--amg-bg); }

/* --------------------------------------------------------------------- hero */

.amg-archive__hero { padding: 28px 0 26px; }
.amg-archive__hero-inner { position: relative; display: flex; flex-direction: column; gap: 10px; }

.amg-archive__hero-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.amg-archive__crumbs { font-size: 12px; color: var(--amg-on-dark-muted); display: flex; flex-wrap: wrap; gap: 6px; }
.amg-archive__crumbs a { color: var(--amg-on-dark-muted); }
.amg-archive__crumbs a:hover { color: #fff; }

.amg-archive__eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--amg-on-dark-muted); }

/* The element selector is needed: tokens.css sets `.amg h1 { color: green }`,
   which is more specific than a lone class and would hide this on the hero. */
h1.amg-archive__title { margin: 0; font-size: 32px; line-height: 1.05; color: #fff; font-weight: 700; }
.amg-archive__desc { margin: 0; color: var(--amg-topbar-text); font-size: 15px; }
.amg-archive__meta { margin: 0; font-size: 13px; color: var(--amg-on-dark-muted); }
.amg-archive__meta a { color: #fff; }

.amg-archive__hero-img { flex: 0 0 96px; width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 5px solid var(--amg-green-2); align-self: flex-start; }

/* On phones the title block and the round image sit side by side. */
@media (max-width: 767px) {
  .amg-archive__hero-inner { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
  .amg-archive__hero-text { flex: 1 1 180px; }
  .amg-archive__desc, .amg-archive__meta { flex: 1 1 100%; }
}

@media (min-width: 768px) {
  .amg-archive__hero { padding: 64px 0; }
  .amg-archive__hero-inner { flex-direction: row; flex-wrap: wrap; gap: 40px; align-items: center; }
  .amg-archive__hero-text { flex: 1 1 480px; gap: 12px; }
  .amg-archive__crumbs { font-size: 14px; }
  .amg-archive__eyebrow { font-size: 15px; }
  h1.amg-archive__title { font-size: clamp(34px, 4.6vw, 54px); line-height: 1.06; }
  .amg-archive__desc { font-size: 17px; max-width: 560px; }
  .amg-archive__meta { font-size: 14px; }
  .amg-archive__hero-img { flex: 0 1 360px; width: 360px; height: auto; aspect-ratio: 1; border-width: 8px; align-self: auto; }
}

/* --------------------------------------------------------------- switcher */

.amg-archive__switcher {
  position: sticky; top: var(--amg-header-h); z-index: 4;
  background: var(--amg-surface); border-bottom: 1px solid var(--amg-line);
  padding: 10px 0;
}
.amg-archive__switcher-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.amg-archive__switcher-row::-webkit-scrollbar { display: none; }

.amg-archive__switcher-item {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500;
  padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid var(--amg-border); background: #fff; color: var(--amg-text);
  text-decoration: none; white-space: nowrap; min-height: var(--amg-tap);
}
.amg-archive__switcher-item:hover { color: var(--amg-green); border-color: var(--amg-green); text-decoration: none; }
.amg-archive__switcher-item.is-current { border-color: var(--amg-green); background: var(--amg-green); color: #fff; }
.amg-archive__switcher-item img { display: none; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }

@media (min-width: 768px) {
  .amg-archive__switcher { padding: 12px 0; }
  .amg-archive__switcher-row { gap: 8px; }
  .amg-archive__switcher-item { padding: 6px 14px 6px 6px; }
  .amg-archive__switcher-item img { display: block; }
}

/* ------------------------------------------------------------------- body */

.amg-archive__body { display: flex; flex-direction: column; gap: 24px; padding-top: 18px; padding-bottom: 32px; }
.amg-archive__main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }

@media (min-width: 1024px) {
  .amg-archive__body { flex-direction: row; flex-wrap: wrap; gap: 40px; align-items: flex-start; padding-top: 36px; padding-bottom: 72px; }
  .amg-archive__main { flex: 999 1 580px; gap: 22px; }
  .amg-archive__aside { flex: 1 1 280px; }
}

/* ---------------------------------------------------------------- feature */

.amg-archive__feature { display: flex; flex-direction: column; gap: 8px; color: inherit; text-decoration: none; position: relative; }
.amg-archive__feature:hover { color: inherit; text-decoration: none; }
.amg-archive__feature:hover .amg-archive__feature-title { text-decoration: underline; }
.amg-archive__feature-img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--amg-radius); display: block; }
.amg-archive__feature-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.amg-archive__feature-flag {
  position: absolute; left: 10px; top: 10px;
  background: var(--amg-gold); color: var(--amg-green);
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: .05em;
}
.amg-archive__feature-title { font-size: 19px; font-weight: 700; line-height: 1.25; color: var(--amg-green); font-family: var(--amg-font-heading); }
.amg-archive__feature-excerpt { font-size: 14px; }
.amg-archive__feature-meta { font-size: 12px; color: var(--amg-muted); }

@media (min-width: 768px) {
  .amg-archive__feature {
    flex-direction: row; flex-wrap: wrap; gap: 22px; align-items: center;
    background: var(--amg-surface); border: 1px solid var(--amg-line);
    border-radius: var(--amg-radius); padding: 16px;
  }
  .amg-archive__feature-img { flex: 1 1 240px; max-width: 320px; aspect-ratio: 3 / 2; border-radius: var(--amg-radius-sm); }
  .amg-archive__feature-text { flex: 1 1 280px; gap: 8px; }
  .amg-archive__feature-flag {
    position: static; background: none; color: var(--amg-warm);
    padding: 0; font-size: 12px; letter-spacing: .05em;
  }
  .amg-archive__feature-title { font-size: 22px; }
  .amg-archive__feature-excerpt { font-size: 15px; }
  .amg-archive__feature-meta { font-size: 13px; }
}

/* ---------------------------------------------------------------- toolbar */

.amg-archive__toolbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: space-between; align-items: center;
  border-bottom: 2px solid var(--amg-green); padding-bottom: 10px; margin: 0;
}
.amg-archive__list-title { margin: 0; font-size: 20px; font-weight: 700; color: var(--amg-green); }

/* On a phone the search box takes its own line; the sort and Apply sit under it.
   Without wrapping, the three together are wider than a 320px screen. */
.amg-archive__controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 100%; min-width: 0; }
.amg-archive__search {
  flex: 1 1 100%; min-width: 0; display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1.5px solid var(--amg-border); border-radius: var(--amg-radius);
  padding: 0 10px; color: var(--amg-muted);
}
.amg-archive__search svg { flex: 0 0 auto; width: 16px; height: 16px; }
.amg-archive__search input {
  flex: 1; min-width: 0; border: 0; outline: none; font: inherit;
  font-size: 16px; padding: 11px 0; background: transparent; color: var(--amg-green);
}
.amg-archive__sort select {
  min-height: var(--amg-tap); padding: 0 10px; max-width: 100%;
  border: 1.5px solid var(--amg-border); border-radius: var(--amg-radius);
  background: #fff; color: var(--amg-green); font: inherit; font-size: 14px; cursor: pointer;
}
/* With JavaScript the controls apply themselves; without it the button submits. */
.amg .amg-archive__apply {
  min-height: var(--amg-tap); padding: 0 14px;
  border: 1.5px solid var(--amg-green); border-radius: var(--amg-radius);
  background: var(--amg-green); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}

@media (min-width: 768px) {
  .amg-archive__list-title { font-size: 22px; }
  .amg-archive__controls { flex: 0 0 auto; flex-wrap: nowrap; }
  .amg-archive__search { flex: 0 0 auto; }
  .amg-archive__search input { font-size: 14px; padding: 10px 0; width: 170px; flex: 0 0 auto; }
}

/* ------------------------------------------------------------------- list */

.amg-archive__list { display: flex; flex-direction: column; }

.amg-archive__row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--amg-line);
  color: inherit; text-decoration: none;
}
.amg-archive__row:hover { color: inherit; text-decoration: none; }
.amg-archive__row:hover .amg-card__title { text-decoration: underline; }
.amg-archive__row .amg-card__img { flex: 0 0 104px; width: 104px; height: 74px; object-fit: cover; border-radius: var(--amg-radius-sm); }
.amg-archive__row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.amg-archive__row .amg-card__title { font-size: 15px; font-weight: 600; line-height: 1.33; }
.amg-archive__row .amg-card__meta { font-size: 12px; }
.amg-archive__row-excerpt { display: none; font-size: 15px; color: var(--amg-text); }
.amg-card__new { color: var(--amg-warm); font-weight: 600; }

@media (min-width: 768px) {
  .amg-archive__row { gap: 20px; padding: 18px 0; }
  .amg-archive__row .amg-card__img { flex: 0 0 156px; width: 156px; height: 104px; }
  .amg-archive__row-text { gap: 5px; }
  .amg-archive__row .amg-card__title { font-size: 18px; line-height: 1.35; }
  .amg-archive__row .amg-card__meta { font-size: 13px; }
  .amg-archive__row-excerpt { display: block; }
}

.amg-archive__empty { margin: 16px 0; color: var(--amg-muted); }

/* ------------------------------------------------------ pagination / more */

.amg-archive__more { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 8px; }
.amg-archive__more .page-numbers { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; justify-content: center; }
.amg-archive__more .page-numbers li { margin: 0; }
.amg-archive__more .page-numbers a,
.amg-archive__more .page-numbers span {
  display: flex; align-items: center; justify-content: center;
  min-width: var(--amg-tap); min-height: var(--amg-tap); padding: 0 12px;
  border: 1.5px solid var(--amg-border); border-radius: var(--amg-radius);
  background: #fff; color: var(--amg-green); text-decoration: none; font-weight: 500;
}
.amg-archive__more .page-numbers .current { background: var(--amg-green); border-color: var(--amg-green); color: #fff; }

.amg-archive__showmore {
  min-height: 50px; width: 100%;
  border: 1.5px solid var(--amg-green); background: #fff; color: var(--amg-green);
  font: inherit; font-weight: 600; border-radius: var(--amg-radius); cursor: pointer;
}
@media (min-width: 768px) {
  .amg-archive__showmore { width: auto; align-self: center; min-height: 0; padding: 12px 22px; }
}

/* ------------------------------------------------------------------ aside */

.amg-archive__aside { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.amg-archive__aside-head { margin: 0 0 4px; font-weight: 700; font-size: 18px; color: var(--amg-green); }

.amg-archive__tools-list { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.amg-archive__tools-list::-webkit-scrollbar { display: none; }
.amg-archive__tool {
  flex: 0 0 230px; display: flex; flex-direction: column; gap: 6px;
  background: var(--amg-green); color: #fff; border-radius: var(--amg-radius-lg);
  padding: 16px; position: relative; overflow: hidden; text-decoration: none;
}
.amg-archive__tool:hover { color: #fff; text-decoration: none; }
.amg-archive__tool-circle { position: absolute; width: 110px; height: 110px; border-radius: 50%; background: var(--amg-green-2); right: -40px; bottom: -50px; }
.amg-archive__tool strong { position: relative; font-size: 16px; line-height: 1.3; }
.amg-archive__tool-go { position: relative; color: var(--amg-gold); font-size: 14px; font-weight: 600; }

/* On desktop the matched tools are a plain list in the sidebar, as designed. */
@media (min-width: 1024px) {
  .amg-archive__aside-head { border-bottom: 2px solid var(--amg-green); padding-bottom: 8px; font-size: 17px; }
  .amg-archive__tools-list { flex-direction: column; gap: 0; overflow: visible; padding-bottom: 0; }
  .amg-archive__tool {
    flex: 0 0 auto; flex-direction: row; justify-content: space-between; align-items: center; gap: 10px;
    background: none; color: var(--amg-green); border-radius: 0;
    padding: 13px 0; border-bottom: 1px solid var(--amg-line); min-height: var(--amg-tap);
  }
  .amg-archive__tool:hover { color: var(--amg-green); }
  .amg-archive__tool:hover strong { text-decoration: underline; }
  .amg-archive__tool-circle { display: none; }
  .amg-archive__tool strong { font-size: 15px; font-weight: 500; }
  .amg-archive__tool-go { color: var(--amg-gold-dark); font-size: 0; }
  .amg-archive__tool-go::after { content: "\2192"; font-size: 16px; }
}

.amg-archive__editor {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--amg-surface); border: 1px solid var(--amg-line);
  border-radius: var(--amg-radius); padding: 18px;
}
.amg-archive__editor img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; object-position: top; flex: 0 0 auto; }
.amg-archive__editor-text { font-size: 14px; line-height: 1.5; }
.amg-archive__editor-text strong { display: block; color: var(--amg-green); font-size: 15px; }

/* The help card is cream on phones and green in the desktop sidebar. */
.amg-archive__help {
  background: var(--amg-cream); border-radius: var(--amg-radius-lg); padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.amg-archive__help-title { font-family: var(--amg-font-heading); font-weight: 700; font-size: 20px; color: var(--amg-green); line-height: 1.3; }
.amg-archive__help-body { font-size: 14px; }
.amg-archive__help .amg-btn { width: 100%; }

@media (min-width: 1024px) {
  .amg-archive__help { background: var(--amg-green); border-radius: var(--amg-radius); padding: 22px; }
  .amg-archive__help-title { color: #fff; font-size: 19px; font-weight: 600; }
  .amg-archive__help-body { color: var(--amg-topbar-text); }
}

/* ----------------------------------------------------------------- shared */

.amg-archive .screen-reader-text {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.amg-archive :focus-visible { outline: 3px solid var(--amg-gold); outline-offset: 2px; }
.amg-archive.is-loading { cursor: progress; }


/* The template supplies its own full-width hero, so the theme's content
   container must not box it in. Scoped to our archive pages only. */
.amg-archive-page .rishi-container { width: 100%; max-width: none; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
.amg-archive-page .main-content-wrapper { width: 100%; max-width: none; margin: 0; }
/* The theme's top margin would leave a cream band above the green hero.
   !important is needed because Rishi writes this value into dynamically
   generated customiser CSS that loads after this file. */
.amg-archive-page .main-content-wrapper { margin-top: 0 !important; }
.amg-archive-page .site-content { padding-top: 0; }
