/* Header / Navigation */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 20px 48px;
  transition: color var(--transition-base);
}

/* Blur + gradient fade background via ::before */
.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  z-index: -1;
  transition: background var(--transition-base);
  pointer-events: none;
}

/* Header states */
.header--transparent {
  color: var(--color-text-dark);
}

.header--transparent::before {
  background: transparent;
}

.header--light {
  color: var(--color-text-light);
}

.header--light::before {
  background: linear-gradient(to bottom, rgba(245, 240, 235, 0.95) 0%, rgba(245, 240, 235, 0.3) 60%, transparent 100%);
  /* -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px); */
}

.header--dark {
  color: var(--color-text-dark);
}

.header--dark::before {
  background: linear-gradient(to bottom,
    rgba(18, 10, 4, 0.7) 0%,
    rgba(18, 10, 4, 0.5) 20%,
    rgba(18, 10, 4, 0.3) 40%,
    rgba(18, 10, 4, 0.15) 60%,
    rgba(18, 10, 4, 0.05) 80%,
    transparent 100%);
}

/* Logo */
.header__logo {
  grid-column: 1;
  position: absolute;
  top: 45px;
  left: 20px;
  z-index: 1;
}

.header__logo a {
  display: block;
  position: relative;
}

.header__logo--hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.header__logo:not(.header__logo--hidden) {
  transition: opacity 0.5s ease;
}

.header__logo-img {
  height: 140px;
  width: auto;
  transition: opacity var(--transition-base);
}

/* Dual-logo system: light PNG for dark backgrounds, dark PNG for light backgrounds */
/* Light image is the layout anchor (relative), dark image overlays it (absolute) */
.header__logo-img--light {
  position: relative;
}

.header__logo-img--dark {
  position: absolute;
  top: 0;
  left: 0;
}

/* Default: show light logo, hide dark */
.header__logo-img--light { opacity: 1; }
.header__logo-img--dark  { opacity: 0; }

/* Light header: show dark logo, hide light */
.header--light .header__logo-img--light { opacity: 0; }
.header--light .header__logo-img--dark  { opacity: 1; }

/* Dark / transparent header: show light logo */
.header--dark .header__logo-img--light,
.header--transparent .header__logo-img--light { opacity: 1; }
.header--dark .header__logo-img--dark,
.header--transparent .header__logo-img--dark  { opacity: 0; }

/* Fallback text logo (when SVG not available) */
.header__logo-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-mincho-demibold);
  font-size: var(--text-xl);
  letter-spacing: 0.3em;
  line-height: 1;
  white-space: nowrap;
}

/* Navigation */
.header__nav {
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.header__nav-link {
  font-size: 14px;
  letter-spacing: 0.12em;
  position: relative;
  transition: opacity var(--transition-fast);
}

.header__nav-link::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: currentColor;
  transition: width var(--transition-base);
}

.header__nav-link:hover {
  opacity: 1;
}

.header__nav-link:hover::after {
  width: 100%;
}

.header__nav-link--active::after {
  width: 100%;
}

/* Reservation button */
.header__reserve {
  grid-column: 3;
  justify-self: end;
}

.header__reserve-btn {
  display: inline-block;
  font-size: 14px;
  letter-spacing: 0.15em;
  padding: 0.6em 5em;
  border: 1px solid currentColor;
  border-radius: 9999px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.header__reserve-btn:hover {
  opacity: 1;
  background-color: var(--color-text-light);
  color: var(--color-bg-light);
}

.header--dark .header__reserve-btn:hover,
.header--transparent .header__reserve-btn:hover {
  background-color: var(--color-text-dark);
  color: var(--color-bg-dark);
}

/* Hamburger button — hidden on desktop */
.header__hamburger {
  display: none;
}

/* Language link next to hamburger — hidden on desktop */
.header__lang {
  display: none;
}

/* ================================================
   Mobile (max-width: 768px)
   ================================================ */
@media (max-width: 768px) {

  /* --- Closed state --- */
  .header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 30px 20px 16px;
  }

  .header::before {
    display: none;
  }

  .header__logo {
    position: static;
    flex-shrink: 0;
  }

  .header__logo-img {
    height: auto;
    width: 30px;
  }

  .header__nav {
    display: none;
  }

  /* Reserve button: fixed bottom bar */
  .header__reserve {
    position: fixed;
    bottom: -50px;
    left: 0;
    width: 100vw;
    z-index: 99;
    display: block;
    padding: 12px 20px;
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
    text-align: center;
    background: var(--color-bg-light);
    transition: background var(--transition-base);
  }

  .header--dark .header__reserve {
    background: var(--color-bg-dark);
  }

  .header__reserve-btn {
    display: inline-block;
    width: 320px;
    height: 44px;
    line-height: 44px;
    padding: 0;
    border-color: transparent;
    font-size: var(--text-base);
    letter-spacing: 0.15em;
    background: rgb(202, 194, 184);
    color: rgb(255, 255, 255);
  }

  .header--dark .header__reserve-btn {
    background: rgb(90, 83, 78);
    color: rgb(242, 239, 235);
  }

  /* Hamburger button (2 lines) */
  .header__hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 7px;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    position: relative;
    z-index: 2;
  }

  .header__hamburger span {
    display: block;
    width: 30px;
    height: 1.5px;
    background-color: currentColor;
    transition: transform 0.3s ease, opacity 0.3s ease, background-color var(--transition-base);
  }

  /* Hamburger & lang: explicit theme colors */
  .header--light .header__hamburger span { background-color: var(--color-text-light); }
  .header--dark .header__hamburger span,
  .header--transparent .header__hamburger span { background-color: var(--color-text-dark); }

  .header--light .header__lang { color: var(--color-text-light); }
  .header--dark .header__lang,
  .header--transparent .header__lang { color: var(--color-text-dark); }

  /* Right side wrapper: hamburger + lang */
  .header__right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-top: -20px;
  }

  /* Language link under hamburger */
  .header__lang {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-size: 14px;
    letter-spacing: 0.08em;
    color: currentColor;
    text-decoration: none;
  }

  /* --- Open state (full overlay) --- */
  .header--menu-open {
    position: fixed;
    inset: 0;
    z-index: 200;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 20px 40px;
    background: var(--color-bg-light);
    color: var(--color-text-light);
    overflow-y: auto;
    animation: menuFadeIn 0.3s ease;
  }

  @keyframes menuFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  .header--menu-open::before {
    display: none;
  }

  /* Logo: center, force dark version */
  .header--menu-open .header__logo {
    order: 1;
    margin-top: 40px;
  }

  .header--menu-open .header__logo-img {
    height: 100px;
  }

  .header--menu-open .header__logo-img--light { opacity: 0; }
  .header--menu-open .header__logo-img--dark  { opacity: 1; }

  /* Close button (right side) */
  .header--menu-open .header__right {
    position: absolute;
    top: 30px;
    right: 20px;
  }

  /* Hamburger → ×: force dark color on light menu bg */
  .header--menu-open .header__hamburger span {
    background-color: var(--color-text-light);
  }

  .header--menu-open .header__hamburger span:first-child {
    transform: translateY(4.25px) rotate(45deg);
  }

  .header--menu-open .header__hamburger span:last-child {
    transform: translateY(-4.25px) rotate(-45deg);
  }

  /* Lang link color in open state */
  .header--menu-open .header__lang {
    color: var(--color-text-light);
  }

  /* Nav links: visible, centered column */
  .header--menu-open .header__nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    order: 2;
    margin-top: var(--space-xl);
    color: var(--color-text-light);
  }

  .header--menu-open .header__nav-link {
    font-size: var(--text-base);
    letter-spacing: 0.2em;
  }

  /* Hide ENG/JPN link inside nav on mobile */
  .header__nav-link--lang {
    display: none;
  }

  /* Reserve button in menu: reposition into flow */
  .header--menu-open .header__reserve {
    position: static;
    order: 3;
    margin-top: var(--space-xl);
    max-width: 300px;
    background: none;
    padding: 0;
  }

  .header--menu-open .header__reserve-btn {
    background: rgb(202, 194, 184);
    color: var(--color-text-light);
    border: none;
  }
}
