/**
 * Shared chrome: logo row + site hamburger menu (shell_top_bar.html).
 * Loaded after base.css (app shell) or after albums_terminal.css (/albums).
 * Expects :root tokens: --accent, --panel, --line, --fg, --muted, --pop, --accent-glow.
 */

.site-header__inner {
  box-sizing: border-box;
  max-width: 1100px;
  margin: 0 auto;
  /* top / right / bottom / left — match physical edges to env insets */
  padding: 0 max(18px, env(safe-area-inset-right, 0px)) 0 max(18px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

/* Logo · terminal · menu on one row */
.term-top > .site-header__inner,
.site-header > .site-header__inner {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.site-header__bar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px 10px;
  min-width: 0;
  width: 100%;
  justify-content: flex-start;
}

.site-header__terminal-slot {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(8px, 2.1vw, 10px);
  line-height: 1.2;
}

.site-header__terminal-slot:empty {
  display: none;
}

.site-header__terminal-slot .term-terminal,
.site-header__terminal-slot .term-line,
.site-header__terminal-slot .shell-terminal-tw,
.site-header__terminal-slot .shell-terminal-tw.term-brand,
.site-header__terminal-slot .term-brand,
.site-header__terminal-slot .term-brand--shell-row,
.site-header__terminal-slot .term-line__buffer,
.site-header__terminal-slot .term-prompt,
.site-header__terminal-slot .term-cmd,
.site-header__terminal-slot .term-arg,
.site-header__terminal-slot .term-sp {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

.site-header__terminal-slot .term-terminal,
.site-header__terminal-slot .term-line,
.site-header__terminal-slot .shell-terminal-tw {
  width: 100%;
  min-width: 0;
}

.site-header__terminal-slot .term-terminal {
  gap: 2px;
}

.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;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand--logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--fg);
  text-shadow: var(--accent-glow);
  border-bottom: none;
}

.brand--logo:hover {
  border-bottom: none;
}

.brand--logo:hover .brand__logo {
  filter:
    drop-shadow(0 0 6px rgba(34, 211, 238, 0.85))
    drop-shadow(0 0 14px rgba(34, 211, 238, 0.55))
    drop-shadow(0 0 24px rgba(34, 211, 238, 0.32));
}

.brand__logo {
  display: block;
  height: calc(36px * 1.1);
  width: auto;
  max-width: calc(150px * 1.1);
  object-fit: contain;
  filter:
    drop-shadow(0 0 5px rgba(34, 211, 238, 0.65))
    drop-shadow(0 0 12px rgba(34, 211, 238, 0.42))
    drop-shadow(0 0 20px rgba(34, 211, 238, 0.22));
  transition: filter 0.2s ease;
}

.site-menu-hub {
  margin-left: 0;
  position: relative;
  flex-shrink: 0;
  line-height: 0;
}

@media (max-width: 520px) {
  .site-header__bar {
    gap: 6px 8px;
  }

  .brand__logo {
    height: 32px;
    max-width: 120px;
  }

  .site-header__terminal-slot {
    font-size: clamp(7px, 1.9vw, 9px);
  }

  .site-menu-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
  }
}

.site-menu-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  color: var(--accent);
  background: rgba(34, 211, 238, 0.06);
  border: 1px dashed rgba(34, 211, 238, 0.4);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.18);
}

.site-menu-btn[aria-expanded="false"]:hover {
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.65);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.28);
}

.site-menu-btn[aria-expanded="true"] {
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow: 0 0 14px rgba(248, 113, 113, 0.3);
}

.site-menu-btn[aria-expanded="true"]:hover {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.65);
  box-shadow: 0 0 18px rgba(248, 113, 113, 0.38);
}

.site-menu-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-menu-btn[aria-expanded="true"]:focus-visible {
  outline-color: #f87171;
}

.site-menu-btn__icon-wrap {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.site-menu-btn__svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  transform-origin: 50% 50%;
}

.site-menu-btn__svg--hamburger {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  transition:
    opacity 0.34s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.42s cubic-bezier(0.34, 1.28, 0.64, 1);
}

.site-menu-btn__svg--close-x {
  opacity: 0;
  transform: scale(0.52) rotate(-92deg);
  transition:
    opacity 0.36s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.44s cubic-bezier(0.34, 1.35, 0.64, 1);
}

.site-menu-btn[aria-expanded="true"] .site-menu-btn__svg--hamburger {
  opacity: 0;
  transform: scale(0.68) rotate(92deg);
  pointer-events: none;
}

.site-menu-btn[aria-expanded="true"] .site-menu-btn__svg--close-x {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

@media (prefers-reduced-motion: reduce) {
  .site-menu-btn__svg--hamburger,
  .site-menu-btn__svg--close-x {
    transition-duration: 0.06s;
    transition-timing-function: ease;
  }
}

.site-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  box-sizing: border-box;
  width: max-content;
  max-width: calc(100vw - 20px);
  padding: 8px 4px 10px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(167, 139, 250, 0.08),
    0 12px 36px rgba(0, 0, 0, 0.55);
  z-index: 40;
}

.site-nav-drawer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 4px;
  font-size: clamp(16px, 3.6vw, 18px);
  width: max-content;
  max-width: 100%;
}

.site-nav-drawer > a {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: max-content;
  max-width: 100%;
  align-self: flex-end;
  min-height: 44px;
  padding: 10px 2px 10px 10px;
  box-sizing: border-box;
  text-align: right;
  text-decoration: none;
  color: var(--accent);
  text-shadow: var(--accent-glow);
  border: 0;
  border-bottom: 1px dashed transparent;
  -webkit-tap-highlight-color: transparent;
}

.site-nav-drawer > a:hover,
.site-nav-drawer > a:focus-visible {
  color: var(--pop);
  border-bottom-color: rgba(255, 61, 172, 0.45);
}

.site-nav-drawer__form {
  margin: 0;
  padding: 0;
  width: max-content;
  max-width: 100%;
  align-self: flex-end;
  display: flex;
  justify-content: flex-end;
}

.site-nav-drawer__form .link-button {
  min-height: 44px;
  padding: 10px 2px 10px 10px;
  font-size: inherit;
  text-align: right;
  -webkit-tap-highlight-color: transparent;
}

.inline-form {
  display: inline;
  margin: 0;
}

.link-button {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-shadow: var(--accent-glow);
  border-bottom: 1px dashed transparent;
}

.link-button:hover {
  color: var(--pop);
  border-bottom-color: rgba(255, 61, 172, 0.45);
}
