.thjapan-header {
  --gutter: clamp(20px, 4.2vw, 72px);
  --paper: #f7f4eb;
  --panel: #eee8d9;
  --line: #d8d0bd;
  --header-paper: #f7efdb;
  --header-ink: #253b2d;
  --header-rule: #758253;
  position: relative;
  z-index: 1;
  isolation: isolate;
  background: linear-gradient(109deg, #eee0bc, var(--header-paper) 30% 72%, #efe2bf);
  border-block: 1px solid #b69a66;
  color: var(--header-ink);
  font: 500 1rem/normal Inter, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-synthesis: initial;
}
.thjapan-header:has(.online-menu[open]) { padding-block-end: 96px; }
.thjapan-header::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 7px;
  border: 1px solid #b0905c;
  border-radius: 33px 13px 33px 13px;
  box-shadow: inset 0 0 0 4px #fcf5df9c, inset 0 0 0 5px #ccb37caa;
  pointer-events: none;
}
.thjapan-header-inner {
  display: grid;
  grid-template-columns: minmax(150px, 218px) minmax(0, 1fr);
  align-items: center;
  gap: 16px clamp(18px, 3vw, 36px);
  width: min(1280px, calc(100% - 2 * var(--gutter)));
  min-height: clamp(186px, 18vw, 216px);
  margin-inline: auto;
  padding-block: 26px;
}
.thjapan-header-brand { display: inline-flex; text-decoration: none; }
.thjapan-header-brand img { display: block; width: 100%; height: auto; }
.thjapan-header-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 3px clamp(8px, 1.35vw, 14px);
}
.thjapan-header-nav a { color: inherit; font-size: .86rem; text-decoration: none; }
.thjapan-header-nav a:hover { text-decoration: underline; text-underline-offset: .25em; }
.thjapan-header-nav > a, .thjapan-header-nav .online-menu summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: .875rem;
  white-space: nowrap;
}
.thjapan-header-nav .header-home-link { gap: 5px; }
.thjapan-header-nav .header-home-link svg { flex: none; }
.thjapan-header-nav a:is([aria-current="page"], [aria-current="location"]) {
  text-decoration: underline;
  text-decoration-color: var(--header-rule);
  text-underline-offset: .3em;
}
.thjapan-header-contact { padding-inline: 12px; border: 1px solid var(--header-rule); }
.thjapan-header-nav .thjapan-header-contact:hover {
  background: var(--header-ink);
  color: var(--header-paper);
  text-decoration: none;
}
.online-menu { position: relative; }
.online-menu summary { display: flex; align-items: center; gap: .5em; cursor: pointer; font-size: .86rem; list-style: none; white-space: nowrap; }
.online-menu summary::-webkit-details-marker { display: none; }
.online-menu summary::after { content: ""; width: .43em; height: .43em; border: solid currentColor; border-width: 0 1px 1px 0; transform: translateY(-.12em) rotate(45deg); }
.online-menu[open] summary::after { transform: translateY(.12em) rotate(225deg); }
.online-menu summary:focus-visible { outline: 3px solid #58793a; outline-offset: 5px; }
.online-menu-links {
  position: absolute;
  z-index: 2;
  inset-block-start: calc(100% + 10px);
  inset-inline-end: 0;
  width: min(18rem, 100vw - 2 * var(--gutter));
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  box-shadow: 0 8px 20px #25241d1a;
}
.online-menu-links a { display: block; padding: 11px 13px; line-height: 1.5; }
.online-menu-links a + a { border-block-start: 1px solid var(--line); }
.online-menu-links a:hover { background: var(--panel); }
.thjapan-header :is(a, summary):focus-visible {
  outline: 2px solid #58793a;
  outline-offset: 1px;
}

.header-flourish {
  position: absolute;
  z-index: -1;
  aspect-ratio: 3;
  background: url("./mucha-header-flourish.webp") center / contain no-repeat;
  pointer-events: none;
}
.header-flourish-start {
  inset: 13px auto auto 16px;
  width: min(11vw, 128px);
  transform: scaleX(-1);
  opacity: .82;
}
.header-flourish-end {
  inset: auto 17px 13px auto;
  width: clamp(136px, 16vw, 193px);
  opacity: .82;
}
.header-flourish-middle { display: none; }

@media (max-width: 1100px) {
  .header-flourish-end { width: 105px; }
}

@media (min-width: 1150px) {
  .thjapan-header:has(.online-menu[open]) { padding-block-end: 76px; }
  .thjapan-header-inner { grid-template-columns: 218px minmax(0, 1fr) auto; }
  .header-flourish-middle {
    display: block;
    position: relative;
    inset: auto;
    justify-self: center;
    width: min(100%, 265px);
  }
}

@media (max-width: 940px) {
  .thjapan-header:has(.online-menu[open]) { padding-block-end: 142px; }
  .thjapan-header-nav { position: relative; }
  .thjapan-header-nav .online-menu { position: static; }
  .thjapan-header-nav .online-menu-links { inset-block-start: calc(100% + 8px); }
}

@media (max-width: 760px) {
  .thjapan-header-inner {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 10px;
    padding-block: 32px 36px;
  }
  .thjapan-header-brand img { width: 194px; }
  .thjapan-header-nav { justify-content: center; }
  .header-flourish-start { width: min(27vw, 119px); }
  .header-flourish-end { width: min(24vw, 92px); }
}

@media (max-width: 500px) {
  .online-menu summary { font-size: .78rem; }
}

@media (max-width: 360px) {
  .thjapan-header-nav > a, .thjapan-header-nav .online-menu summary { font-size: .8125rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .header-flourish { animation: header-flourish-reveal 1.55s ease-out both; }
  .header-flourish-end { animation-delay: .14s; }
  .header-flourish-middle { animation-delay: .26s; }
}
@keyframes header-flourish-reveal {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0); }
}
