/* Match the atelier header markup without changing the rest of the theme. */
body.template5 .atelier-header-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(140px,auto) minmax(0,1fr);
  align-items: center;
  gap: 24px;
  min-height: 96px;
}

body.template5 .header .atelier-brand {
  grid-column: 2;
  grid-row: 1;
  display: block;
  min-width: 0;
  max-width: 300px;
  justify-self: center;
  text-align: center;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

body.template5 .header .atelier-brand img {
  display: block;
  width: auto;
  height: auto;
  max-width: 180px;
  max-height: 64px;
  margin: auto;
}

body.template5 .header .atelier-navigation {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  position: static;
  align-items: center;
  gap: 24px;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

body.template5 .atelier-header-tools {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  justify-content: flex-end;
}

body.template5 .atelier-search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

body.template5 .header .menu-toggle { display: none; }

body.template5 .atelier-search-dialog {
  box-sizing: border-box;
  width: min(760px,calc(100% - 32px));
  max-height: 85dvh;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

body.template5 .atelier-search-dialog::backdrop { background: #0008; }
body.template5 .atelier-search-heading { display: flex; justify-content: flex-end; }
body.template5 .atelier-search-heading button {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 28px;
}
body.template5 .atelier-search-dialog .search-form {
  display: flex;
  width: 100%;
  max-width: none;
}
body.template5 .atelier-search-dialog input { min-width: 0; width: 0; }

@media(max-width:900px) {
  body.template5 .atelier-header-row {
    grid-template-columns: 44px minmax(0,1fr) 44px;
    min-height: 80px;
    gap: 12px;
  }
  body.template5 .header .atelier-brand { max-width: 100%; font-size: 22px; }
  body.template5 .header .atelier-brand img { max-width: 100%; max-height: 52px; }
  body.template5 .header .menu-toggle {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 10px;
  }
  body.template5 .menu-toggle span { display: block; width: 24px; height: 1px; background: currentColor; }
  body.template5 .atelier-search-toggle > span { display: none; }
  body.template5 .header .atelier-navigation {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    grid-column: auto;
    grid-row: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: #f6f2ed;
    z-index: 2;
  }
  body.template5 .header .atelier-navigation.open { display: flex; }
  body.template5 .header .atelier-navigation a { padding-block: 12px; }
  body.template5 .atelier-search-dialog { padding: 20px; }
  body.template5 .atelier-search-dialog .search-form { gap: 4px; padding-left: 8px; }
  body.template5 .atelier-search-dialog .search-type { max-width: 80px; }
}
