.brand-header {
  --header-gutter: max(clamp(1rem, 3vw, 2rem), calc((100% - 77.5rem) / 2));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: .5rem .75rem;
  padding: .625rem var(--header-gutter);
  border-bottom: 1px solid var(--line, #d7e0e7);
  background: var(--header, #fff);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.brand-header * {
  box-sizing: border-box;
}

.brand-art {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: .625rem;
  border-radius: .625rem;
  color: var(--heading, #17202a);
  font-size: 1.5625rem;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -.045em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: .625rem;
  background: #f9eef1;
}

/* The existing logo artwork places the pomegranate at the left edge. */
.brand-mark::before {
  content: "";
  width: 1.78125rem;
  height: 2.125rem;
  background: url("/assets/logo.webp") left center / auto 100% no-repeat;
}

html[data-theme="dark"] .brand-mark {
  background: #39252e;
}

html[data-theme="dark"] .brand-mark::before {
  background-image: url("/assets/logo-dark.webp");
}

.brand-header a:focus-visible,
.brand-header button:focus-visible,
.brand-header select:focus-visible {
  outline: 2px solid var(--blue, #0f6b78);
  outline-offset: 2px;
}

.brand-header .top-links {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: .125rem;
  min-width: 0;
}

.brand-header .top-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: .375rem .5625rem;
  border-radius: .5rem;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.brand-header .top-links a.donate-link {
  margin-left: .375rem;
  background: var(--additional-soft, #fff3dc);
  color: var(--additional-accent, #894811);
}

html[data-theme="dark"] .brand-header .top-links a.donate-link {
  background: #3a2e20;
  color: #f0b35e;
}

.brand-header .header-account-button,
.brand-header .theme-toggle {
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: .625rem;
  background: var(--surface, #fff);
  color: var(--heading);
}

.brand-header .top-links a:hover,
.brand-header .header-account-button:hover,
.brand-header .theme-toggle:hover {
  background: var(--surface-soft, var(--page));
  color: var(--heading);
}

.brand-header .header-account-button {
  grid-column: 3;
  gap: .5rem;
  min-width: 0;
  max-width: 14rem;
  padding: .375rem .625rem .375rem .4375rem;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

.header-account-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: .375rem;
  background: var(--notice-bg);
  color: var(--blue);
  font-size: .75rem;
  font-weight: 700;
  overflow: hidden;
}

.header-account-avatar.signed-out {
  background: var(--surface-soft, var(--page));
  color: var(--muted);
  font-size: 0;
}

.header-account-avatar.signed-out::before {
  content: "";
  width: 1rem;
  height: 1rem;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='3'/%3E%3Cpath d='M5 20v-1a5 5 0 0 1 5-5h4a5 5 0 0 1 5 5v1'/%3E%3C/svg%3E") center / contain no-repeat;
}

.header-account-avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}

.header-account-copy {
  min-width: 0;
}

.header-account-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-account-label,
.header-account-hint {
  display: none;
}

.brand-header .theme-toggle {
  grid-column: 5;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  cursor: pointer;
}

.brand-header .site-language {
  grid-column: 4;
  grid-row: 1;
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
  color: var(--heading, #17202a);
}

.brand-header .site-language[hidden] {
  display: none;
}

.theme-icon {
  display: none;
  width: 1.125rem;
  height: 1.125rem;
}

.theme-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

html:not([data-theme="dark"]) .theme-icon-moon,
html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

@media (max-width: 68rem) {
  .brand-header {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    column-gap: .5rem;
  }

  .brand-header .top-links {
    grid-area: 2 / 1 / auto / -1;
    justify-content: flex-start;
    margin-inline: calc(var(--header-gutter) * -1);
    padding: .375rem var(--header-gutter) 0;
    border-top: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .brand-header .top-links::-webkit-scrollbar {
    display: none;
  }

  .brand-header .top-links a.donate-link {
    margin-left: auto;
  }

  .brand-header .header-account-button {
    grid-column: 2;
  }

  .brand-header .site-language {
    grid-column: 3;
  }

  .brand-header .theme-toggle {
    grid-column: 4;
  }
}

/* French labels are longer, so the nav moves to its own row earlier. */
@media (max-width: 78rem) {
  html[lang="fr"] .brand-header {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    column-gap: .5rem;
  }

  html[lang="fr"] .brand-header .top-links {
    grid-area: 2 / 1 / auto / -1;
    justify-content: flex-start;
    margin-inline: calc(var(--header-gutter) * -1);
    padding: .375rem var(--header-gutter) 0;
    border-top: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
  }

  html[lang="fr"] .brand-header .top-links::-webkit-scrollbar {
    display: none;
  }

  html[lang="fr"] .brand-header .top-links a.donate-link {
    margin-left: auto;
  }

  html[lang="fr"] .brand-header .header-account-button {
    grid-column: 2;
  }

  html[lang="fr"] .brand-header .site-language {
    grid-column: 3;
  }

  html[lang="fr"] .brand-header .theme-toggle {
    grid-column: 4;
  }
}

@media (max-width: 27rem) {
  .brand-header .brand-art {
    gap: .375rem;
    font-size: 1.25rem;
  }

  .brand-header .brand-mark {
    width: 2.5rem;
  }

  .brand-header .header-account-button {
    justify-content: center;
    width: 2.75rem;
    padding: 0;
  }

  .header-account-copy {
    display: none;
  }

  .lang-picker-button .lang-picker-name {
    display: none;
  }
}

@media (max-width: 22rem) {
  .brand-header {
    --header-gutter: .625rem;
    column-gap: .3125rem;
  }

  .brand-header .brand-art {
    gap: .25rem;
    font-size: 1.125rem;
  }

  .brand-header .brand-mark {
    width: 2.25rem;
  }

}

/* Language picker: flag + native name, built by site-language.js over the hidden select. */
.site-language select {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.lang-picker {
  position: relative;
}

.lang-picker-button {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.75rem;
  margin: 0;
  padding: 0 .5rem 0 .75rem;
  border: 1px solid var(--line, #d7e0e7);
  border-radius: .625rem;
  background: var(--surface, #fff);
  color: var(--heading, #17202a);
  font: 600 .875rem/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
}

.lang-picker-button:hover,
.lang-picker-button[aria-expanded="true"] {
  background: var(--surface-soft, var(--page, #f8fbfc));
}

.lang-picker-button:disabled {
  cursor: progress;
  opacity: .7;
}

.lang-picker-button:focus-visible,
.lang-picker-option:focus-visible {
  outline: 2px solid var(--blue, #0f6b78);
  outline-offset: 2px;
}

.lang-flag {
  display: block;
  flex: none;
  width: 1.25rem;
  height: .9375rem;
  border-radius: .1875rem;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .14);
}

html[data-theme="dark"] .lang-flag {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .22);
}

.lang-picker-chevron {
  width: 1rem;
  height: 1rem;
  color: var(--muted, #5f6f7d);
  transition: transform .15s ease;
}

.lang-picker-button[aria-expanded="true"] .lang-picker-chevron {
  transform: rotate(180deg);
}

.lang-picker-menu {
  position: absolute;
  top: calc(100% + .375rem);
  right: 0;
  z-index: 60;
  min-width: 11rem;
  margin: 0;
  padding: .3125rem;
  list-style: none;
  border: 1px solid var(--line, #d7e0e7);
  border-radius: .75rem;
  background: var(--surface, #fff);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .06);
}

html[data-theme="dark"] .lang-picker-menu {
  box-shadow: 0 14px 36px rgba(0, 0, 0, .45);
}

.lang-picker-menu[hidden] {
  display: none;
}

.lang-picker-option {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5625rem .625rem;
  border-radius: .5rem;
  color: var(--heading, #17202a);
  font: 600 .875rem/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
}

.lang-picker-option:hover,
.lang-picker-option:focus {
  background: var(--surface-soft, var(--page, #f3f7f9));
  outline: none;
}

.lang-picker-check {
  width: 1rem;
  height: 1rem;
  margin-left: auto;
  color: var(--blue, #0f6b78);
  visibility: hidden;
}

.lang-picker-option[aria-selected="true"] .lang-picker-check {
  visibility: visible;
}

/* Site footer, shared by every page. */
.site-footer {
  margin: 2.5rem 0 0;
  border-top: 1px solid var(--line, #d7e0e7);
  background: var(--header, #fff);
  color: var(--muted, #5f6f7d);
  font: 400 .875rem/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: left;
}

.site-footer * {
  box-sizing: border-box;
}

.site-footer p {
  margin: 0;
}

.site-footer-inner {
  width: min(77.5rem, calc(100% - 2 * clamp(1rem, 3vw, 2rem)));
  margin: 0 auto;
  padding: 1.25rem 0 1rem;
}

.site-footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line, #d7e0e7);
}

.site-footer-logo {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--heading, #17202a);
  font-size: 1.125rem;
  font-weight: 750;
  letter-spacing: -.04em;
  text-decoration: none;
}

.site-footer-logo .brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: .5rem;
}

.site-footer-logo .brand-mark::before {
  width: 1.19rem;
  height: 1.42rem;
}

.site-footer-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .875rem;
}

.site-footer .site-footer-tagline {
  padding-left: .875rem;
  border-left: 1px solid var(--line, #d7e0e7);
  font-size: .8125rem;
}

.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem 1.25rem;
}

.site-footer-nav a {
  color: var(--muted, #5f6f7d);
  font-weight: 600;
  text-decoration: none;
}

.site-footer-nav a:hover {
  color: var(--heading, #17202a);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:focus-visible {
  outline: 2px solid var(--blue, #0f6b78);
  outline-offset: 2px;
  border-radius: .25rem;
}

.site-footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  padding-top: .875rem;
  font-size: .8125rem;
}

.site-footer-ruo {
  display: inline-block;
  margin-left: .5rem;
  padding: .125rem .5rem;
  border: 1px solid var(--line, #d7e0e7);
  border-radius: 999px;
  color: var(--heading, #17202a);
  font-size: .75rem;
  font-weight: 600;
}

.site-footer-origin {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .0625rem .1875rem .0625rem .625rem;
  border: 1px solid var(--line, #d7e0e7);
  border-radius: 999px;
  background: var(--surface-soft, var(--page, #f8fbfc));
  color: var(--heading, #17202a);
  font-weight: 600;
}

.fr-flag {
  display: inline-block;
  flex: none;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

@media (max-width: 40rem) {
  .site-footer-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-footer .site-footer-tagline {
    padding-left: 0;
    border-left: 0;
  }

  .site-footer-nav {
    gap: .25rem 1rem;
  }

  .site-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-footer-ruo {
    margin: .25rem 0 0;
  }
}
