/* Profiles page — card grid + drawer. Inherits typography/colors from styles.css. */

/* Compact hero so the grid sits above the fold. */
.section--hero.profiles-hero {
  padding: 2.5rem 1.5rem 1rem;
}
.profiles-hero h1 {
  font-size: clamp(1.8rem, 1.8vw + 0.9rem, 2.5rem);
  line-height: 1.12;
  margin-bottom: 0.75rem;
}
.profiles-hero .lede {
  font-size: 0.98rem;
  margin-bottom: 1.25rem;
}
.profiles-hero .numbers { margin-top: 1rem; }
.profiles-hero .numbers .n { padding: 0.65rem 1rem; gap: 0.15rem; }
.profiles-hero .numbers .n strong { font-size: 1.25rem; }
.profiles-hero .numbers .n span { font-size: 0.78rem; line-height: 1.3; }
.profiles-hero + .section {
  padding-top: 1rem;
  padding-bottom: 2rem;
}

/* ── Toolbar ────────────────────────────────────────── */

.profiles-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.profiles-search {
  flex: 1 1 280px;
  min-width: 220px;
  padding: 0.5rem 0.85rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  font-size: 0.95rem;
}

.profiles-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.7);
}

.profiles-sort select {
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  font-size: 0.9rem;
  background: white;
}

/* ── Card grid ──────────────────────────────────────── */

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}

.profiles-loading,
.profiles-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: rgba(0, 0, 0, 0.55);
  font-style: italic;
  padding: 2rem;
}

.profile-card {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 0.95rem 1.05rem;
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.08s ease;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
}

.profile-card:hover,
.profile-card:focus {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(42, 95, 223, 0.08);
  border-color: rgba(42, 95, 223, 0.3);
  outline: none;
}

.profile-card__head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* Flag-icons sizing — overrides the library's default 1em width so the
   chip-and-flag pair sits nicely with the country name. */
.profile-card__flag {
  width: 1.6em;
  height: 1.2em;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.profile-detail__flag {
  width: 2.2em;
  height: 1.65em;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.profile-card__iso {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--color-primary, #2a5fdf);
  color: white;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

.profile-card h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  text-wrap: balance;
  line-height: 1.2;
}

.profile-card__offices {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.7);
  line-height: 1.4;
}

.profile-card__meta {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(0, 0, 0, 0.55);
  margin-top: auto;
}

.profile-card__meta strong {
  color: rgba(0, 0, 0, 0.85);
}

.muted { color: rgba(0, 0, 0, 0.5); font-size: 0.9em; }
.error { color: #c0392b; }

/* ── Drawer ────────────────────────────────────────── */

.profiles-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: flex-end;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.profiles-drawer[aria-hidden="false"] {
  pointer-events: auto;
  opacity: 1;
}

.profiles-drawer__inner {
  background: white;
  width: min(720px, 100%);
  height: 100%;
  overflow-y: auto;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.18s ease;
  display: flex;
  flex-direction: column;
}

.profiles-drawer[aria-hidden="false"] .profiles-drawer__inner {
  transform: translateX(0);
}

.profiles-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  background: white;
}

.profiles-drawer__header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.profiles-drawer__close {
  appearance: none;
  background: transparent;
  border: 0;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.45);
  padding: 0 0.5rem;
}

.profiles-drawer__close:hover {
  color: rgba(0, 0, 0, 0.9);
}

.profiles-drawer__body {
  padding: 1.25rem 1.5rem 2rem;
}

.profile-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1rem;
  row-gap: 0.3rem;
  margin: 0 0 1rem;
  font-size: 0.92rem;
}

.profile-facts dt {
  font-weight: 600;
  color: rgba(0, 0, 0, 0.6);
}

.profile-facts dd {
  margin: 0;
  word-break: break-word;
}

.profile-detail__offices,
.profile-detail__gii,
.profile-detail__lede {
  margin: 0.6rem 0;
  line-height: 1.5;
  font-size: 0.95rem;
}

.profile-detail__lede {
  color: rgba(0, 0, 0, 0.78);
  background: rgba(42, 95, 223, 0.05);
  border-left: 3px solid var(--color-primary, #2a5fdf);
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
  white-space: pre-wrap;
}

.profile-detail__links {
  margin-top: 1.5rem;
}

.profile-detail__links h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--color-primary, #2a5fdf);
}

/* Quick-links list — just resource names as clickable rows. Full URLs
   stay in the anchor href for accessibility / right-click "Copy link"
   but are not rendered in the visible text. */
.profile-links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.4rem;
}

.profile-links-list li {
  margin: 0;
}

.profile-links-list a {
  display: block;
  padding: 0.55rem 0.85rem;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  font-size: 0.92rem;
  transition: border-color 0.08s ease, background 0.08s ease;
}

.profile-links-list a:hover,
.profile-links-list a:focus {
  border-color: rgba(42, 95, 223, 0.45);
  background: rgba(42, 95, 223, 0.04);
  outline: none;
}

.profile-links-list a span[aria-hidden] {
  color: rgba(0, 0, 0, 0.4);
  margin-left: 0.25rem;
  font-size: 0.9em;
}

body.drawer-open { overflow: hidden; }

/* ── Per-country detail page (/profiles/{iso2}) ───────── */

.profile-detail {
  padding: 2rem 1.5rem 3rem;
}

.profile-detail__breadcrumb {
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.55);
  margin: 0 0 1rem;
}
.profile-detail__breadcrumb a {
  color: inherit;
  text-decoration: none;
}
.profile-detail__breadcrumb a:hover { text-decoration: underline; }

.profile-detail__header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}
.profile-detail__header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 1.6vw + 0.9rem, 2.2rem);
  font-weight: 700;
  line-height: 1.15;
}
.profile-detail__header .profile-card__iso {
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
}

.profile-detail .profile-facts {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.profile-detail__lede {
  margin: 1rem 0;
  background: rgba(42, 95, 223, 0.05);
  border-left: 3px solid var(--color-primary, #2a5fdf);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  color: rgba(0, 0, 0, 0.78);
}

.profile-detail__offices,
.profile-detail__gii {
  margin: 0.6rem 0;
  font-size: 0.95rem;
  line-height: 1.55;
}

/* Cross-link CTA to /fees when fee schedules exist for this jurisdiction. */
.profile-detail__cta {
  margin: 1.5rem 0;
}
.profile-detail__cta-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 1rem;
  background: rgba(42, 95, 223, 0.05);
  border: 1px solid rgba(42, 95, 223, 0.25);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: background 0.08s ease, border-color 0.08s ease;
}
.profile-detail__cta-link:hover {
  background: rgba(42, 95, 223, 0.09);
  border-color: rgba(42, 95, 223, 0.45);
}
.profile-detail__cta-link strong {
  color: var(--color-primary, #2a5fdf);
  font-size: 0.95rem;
}
.profile-detail__cta-link span {
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.65);
}

.profile-detail__links { margin-top: 2rem; }
.profile-detail__links h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--color-primary, #2a5fdf);
}
