
:root {
  --header-bg: #171b22;
  --header-bg-soft: #202630;
  --header-line: rgba(255,255,255,.10);
  --menu-text: #f7f2e8;
  --menu-muted: #c6bba9;
  --accent: #c99a4b;
  --accent-soft: #f0d7a4;
  --page-bg: #f7f2e8;
  --header-height: 72px;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: var(--page-bg);
  color: var(--menu-text);
  font-family: Inter, Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.site-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; min-height: 100dvh; }
.global-header {
  position: relative;
  z-index: 100;
  background: linear-gradient(180deg, #1e232c 0%, var(--header-bg) 100%);
  border-bottom: 1px solid var(--header-line);
  box-shadow: 0 5px 20px rgba(22, 18, 13, .16);
}
.header-inner {
  width: min(1180px, calc(100% - 32px));
  min-height: var(--header-height);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
}
.project-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  white-space: nowrap;
}
.brand-cross {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(240, 215, 164, .45);
  border-radius: 50%;
  color: var(--accent-soft);
  font-family: Georgia, serif;
  font-size: 22px;
  line-height: 1;
}
.brand-text { display: grid; gap: 1px; }
.brand-text strong { font-family: Georgia, "Times New Roman", serif; font-size: 16px; font-weight: 600; letter-spacing: .01em; }
.brand-text small { color: var(--menu-muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.menu-panel { min-width: 0; }
.primary-menu, .primary-menu ul { list-style: none; margin: 0; padding: 0; }
.primary-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.primary-menu > li {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  border-radius: 9px;
}
.primary-menu > li > a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  color: var(--menu-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 9px;
  transition: background .18s ease, color .18s ease;
}
.primary-menu > li:first-child > a:first-child { padding-right: 2px; }
.primary-menu > li > a:hover,
.primary-menu > li > a:focus-visible,
.primary-menu > li.open > a {
  background: rgba(255,255,255,.08);
  color: var(--accent-soft);
  outline: none;
}
.primary-menu img { display: block; }
.submenu-toggle {
  width: 28px;
  height: 36px;
  margin-left: -6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--menu-muted);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}
.primary-menu > li.open > .submenu-toggle { transform: rotate(180deg); background: rgba(255,255,255,.06); }
.submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: max-content;
  min-width: 245px;
  max-width: min(330px, calc(100vw - 28px));
  padding: 8px !important;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  background: rgba(24, 29, 37, .98);
  box-shadow: 0 18px 45px rgba(0,0,0,.28);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.primary-menu > li.open > .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.submenu li + li { border-top: 1px solid rgba(255,255,255,.07); }
.submenu a {
  display: block;
  padding: 9px 11px;
  border-radius: 7px;
  color: #ece4d7;
  font-size: 12px;
  line-height: 1.45;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.submenu a:hover, .submenu a:focus-visible { background: rgba(201,154,75,.15); color: #fff; outline: none; }
.youtube-link {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  overflow: hidden;
}
.youtube-link img { width: 22px; height: auto; }
.menu-button { display: none; }
.frame-area { min-height: 0; position: relative; background: #fff; }
.frame-area iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.fallback { margin: 24px; color: #2c2a27; }

@media (max-width: 1040px) {
  .header-inner { grid-template-columns: auto auto auto; justify-content: space-between; gap: 12px; min-height: 66px; }
  .menu-button {
    display: grid;
    gap: 4px;
    width: 42px;
    height: 42px;
    padding: 11px 9px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 9px;
    background: rgba(255,255,255,.04);
    cursor: pointer;
  }
  .menu-button > span:not(.sr-only) { display: block; height: 2px; border-radius: 2px; background: var(--menu-text); }
  .menu-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: min(72vh, 610px);
    overflow: auto;
    padding: 10px 16px 18px;
    border-top: 1px solid var(--header-line);
    background: rgba(23,27,34,.99);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
  }
  .global-header.menu-open .menu-panel { opacity: 1; visibility: visible; transform: translateY(0); }
  .primary-menu { width: min(720px, 100%); margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 6px; }
  .primary-menu > li { display: grid; grid-template-columns: minmax(0,1fr) auto; background: rgba(255,255,255,.035); }
  .primary-menu > li > a { min-width: 0; white-space: normal; }
  .primary-menu > li:first-child > a:nth-child(2) { grid-column: 1; }
  .submenu-toggle { grid-column: 2; grid-row: 1 / span 2; align-self: center; margin: 0 4px 0 0; }
  .submenu {
    position: static;
    grid-column: 1 / -1;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: 0;
    padding: 0 8px !important;
    border: 0;
    border-radius: 0 0 9px 9px;
    background: rgba(0,0,0,.13);
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    overflow: hidden;
    transform: none;
    transition: max-height .22s ease, padding .22s ease;
  }
  .primary-menu > li.open > .submenu { max-height: 560px; padding: 6px 8px 9px !important; }
}

@media (max-width: 620px) {
  .header-inner { width: min(100% - 20px, 1180px); grid-template-columns: minmax(0,1fr) auto; }
  .youtube-link { display: none; }
  .brand-text strong { font-size: 14px; }
  .brand-text small { font-size: 9px; }
  .brand-cross { width: 31px; height: 31px; font-size: 20px; }
  .primary-menu { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* v2: persistent dropdown clicks, separated cross shortcut, wider embedded landing */
.primary-menu > li.cross-home-item {
  flex: 0 0 auto;
  margin-right: 2px;
}
.primary-menu > li.cross-home-item > a.cross-home-link {
  display: grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid rgba(240, 215, 164, .24);
  border-radius: 50%;
  background: rgba(255,255,255,.035);
}
.primary-menu > li.cross-home-item > a.cross-home-link:hover,
.primary-menu > li.cross-home-item > a.cross-home-link:focus-visible {
  border-color: rgba(240, 215, 164, .58);
  background: rgba(201,154,75,.14);
}
.primary-menu > li.cross-home-item img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}
.primary-menu > li.donation-item > a { padding-inline: 11px; }
.primary-menu > li.open > .menu-parent-link {
  background: rgba(255,255,255,.08);
  color: var(--accent-soft);
}
.frame-area {
  display: flex;
  justify-content: center;
  min-width: 0;
}
.frame-area iframe {
  width: min(100%, 1240px);
  margin-inline: auto;
}

@media (max-width: 1040px) {
  .primary-menu > li.cross-home-item {
    display: block;
    min-height: 48px;
    background: transparent;
  }
  .primary-menu > li.cross-home-item > a.cross-home-link {
    width: 100%;
    min-width: 0;
    height: 48px;
    border-radius: 9px;
  }
  .primary-menu > li.donation-item { grid-template-columns: minmax(0,1fr) auto; }
}


/* v4: larger proportional top-right image and clearer dropdown arrows */
.youtube-link {
  width: 112px;
  height: 42px;
  padding: 6px 9px;
  border-radius: 11px;
  overflow: visible;
  flex: 0 0 auto;
}
.youtube-link img {
  display: block;
  width: 94px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.submenu-toggle {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 38px;
  margin-left: -4px;
  padding: 0;
  color: var(--accent-soft);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0;
  font-weight: 900;
  line-height: 1;
  transform: none;
  transition: background .18s ease, color .18s ease;
}
.submenu-toggle::before {
  content: "";
  width: 11px;
  height: 11px;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transform-origin: 58% 58%;
  transition: transform .2s ease;
}
.primary-menu > li.open > .submenu-toggle {
  transform: none;
  background: rgba(255,255,255,.08);
  color: #fff2cf;
}
.primary-menu > li.open > .submenu-toggle::before {
  transform: translateY(3px) rotate(225deg);
}
.submenu-toggle:hover,
.submenu-toggle:focus-visible {
  background: rgba(255,255,255,.09);
  color: #fff;
  outline: 2px solid rgba(240,215,164,.35);
  outline-offset: 1px;
}

@media (max-width: 1040px) {
  .youtube-link {
    width: 104px;
    height: 40px;
    padding: 6px 8px;
  }
  .youtube-link img { width: 86px; }
  .submenu-toggle {
    width: 42px;
    min-width: 42px;
    height: 42px;
    margin: 0 4px 0 0;
  }
  .submenu-toggle::before {
    width: 12px;
    height: 12px;
    border-right-width: 3px;
    border-bottom-width: 3px;
  }
}

@media (max-width: 620px) {
  .header-inner { grid-template-columns: minmax(0,1fr) auto auto; }
  .youtube-link {
    display: grid;
    width: 82px;
    height: 36px;
    padding: 5px 6px;
    border-radius: 9px;
  }
  .youtube-link img { width: 68px; }
}

@media (max-width: 430px) {
  .youtube-link {
    width: 68px;
    height: 34px;
    padding: 5px;
  }
  .youtube-link img { width: 56px; }
  .brand-text small { display: none; }
}


/* v5: non-clickable brand, slightly smaller arrows, larger top-right image */
.project-brand-static {
  cursor: default;
  user-select: none;
}
.project-brand-static:hover,
.project-brand-static:focus {
  color: inherit;
}

.youtube-link {
  width: 138px;
  height: 48px;
  padding: 6px 9px;
}
.youtube-link img {
  width: 120px;
}

.submenu-toggle {
  width: 30px;
  min-width: 30px;
  height: 36px;
}
.submenu-toggle::before {
  width: 9px;
  height: 9px;
  border-right-width: 2px;
  border-bottom-width: 2px;
}

@media (max-width: 1040px) {
  .youtube-link {
    width: 120px;
    height: 44px;
    padding: 6px 8px;
  }
  .youtube-link img { width: 104px; }
  .submenu-toggle {
    width: 38px;
    min-width: 38px;
    height: 40px;
  }
  .submenu-toggle::before {
    width: 9px;
    height: 9px;
    border-right-width: 2px;
    border-bottom-width: 2px;
  }
}

@media (max-width: 620px) {
  .youtube-link {
    width: 94px;
    height: 40px;
    padding: 5px 6px;
  }
  .youtube-link img { width: 80px; }
}

@media (max-width: 430px) {
  .youtube-link {
    width: 78px;
    height: 36px;
    padding: 5px;
  }
  .youtube-link img { width: 66px; }
}

/* v6: smaller dropdown arrows, positioned slightly below menu text */
.submenu-toggle {
  width: 26px;
  min-width: 26px;
  height: 34px;
  top: 3px;
  margin-left: -5px;
}
.submenu-toggle::before {
  width: 7px;
  height: 7px;
  border-right-width: 2px;
  border-bottom-width: 2px;
  transform: translateY(0) rotate(45deg);
}
.primary-menu > li.open > .submenu-toggle::before {
  transform: translateY(1px) rotate(225deg);
}

@media (max-width: 1040px) {
  .submenu-toggle {
    width: 34px;
    min-width: 34px;
    height: 38px;
    top: 2px;
    margin: 0 3px 0 0;
  }
  .submenu-toggle::before {
    width: 7px;
    height: 7px;
    border-right-width: 2px;
    border-bottom-width: 2px;
  }
}


/* v7: reliable iframe outside-click shield */
.frame-click-shield {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: none;
  background: transparent;
  cursor: default;
  touch-action: manipulation;
}
.frame-click-shield.is-active {
  display: block;
}

/* v8: keep the collapsed mobile menu button directly beside the project brand */
@media (max-width: 1040px) {
  .header-inner {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    justify-content: start;
    column-gap: 8px;
  }

  .project-brand-static {
    grid-column: 1;
  }

  .menu-button {
    grid-column: 2;
    justify-self: start;
  }

  .youtube-link {
    grid-column: 4;
    justify-self: end;
  }
}

@media (max-width: 620px) {
  .header-inner {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    column-gap: 6px;
  }
}
