/* Спільна навігаційна шапка Theologia Crucis — сидить над обома розділами
   (Писання, Concordia), не є частиною жодної з двох дизайн-систем розділів.
   Колір троянди/вордмарку і тла керується власними змінними --bar-bg/
   --bar-ink, а не змінними розділу під шапкою (--canvas/--ink у Concordia,
   --paper/--ink у Писанні) — навмисно: шапка має лишатись однаковою,
   незалежно від того, яка з двох дизайн-систем під нею. Тема — спільний
   атрибут data-theme на <html> (перемикає assets/topbar.js), той самий
   підхід, що вже був у Писанні (клон BSEARCH) до появи цього файлу. */

:root {
  --bar-bg: #e7ded0;
  --bar-ink: #2b2620;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bar-bg: #14120d;
    --bar-ink: #e9e2d3;
  }
}

:root[data-theme="dark"] {
  --bar-bg: #14120d;
  --bar-ink: #e9e2d3;
}

.tc-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.2rem;
  background: var(--bar-bg);
  border-bottom: 1px solid color-mix(in srgb, var(--bar-ink) 18%, transparent);
  box-sizing: border-box;
  width: 100%;
  max-width: 100vw;
}

.tc-topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  flex: 0 0 auto;
}

.tc-topbar-rose,
.tc-topbar-logo {
  display: block;
  background-color: var(--bar-ink);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.tc-topbar-rose {
  width: 2.28rem;
  height: 2.28rem;
  -webkit-mask-image: url("brand/luthers-rose.png");
  mask-image: url("brand/luthers-rose.png");
}

.tc-topbar-logo {
  width: 10.2rem;
  height: 2.5rem;
  -webkit-mask-image: url("brand/logo-white.png");
  mask-image: url("brand/logo-white.png");
}

.tc-topbar-switch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.tc-topbar-switch a {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--bar-ink);
  opacity: 0.62;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  white-space: nowrap;
}

.tc-topbar-switch a:hover {
  opacity: 0.85;
  background: color-mix(in srgb, var(--bar-ink) 10%, transparent);
}

.tc-topbar-switch a.tc-current {
  opacity: 1;
  font-weight: 600;
}

.tc-topbar-theme {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--bar-ink) 25%, transparent);
  border-radius: 50%;
  background: transparent;
  color: var(--bar-ink);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.tc-topbar-theme:hover {
  background: color-mix(in srgb, var(--bar-ink) 10%, transparent);
}

.tc-theme-icon::before {
  content: "\263E";
}

:root[data-theme="dark"] .tc-theme-icon::before {
  content: "\2600";
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .tc-theme-icon::before {
    content: "\2600";
  }
}

@media (max-width: 640px) {
  .tc-topbar {
    padding: 0.45rem 0.5rem;
    gap: 0.25rem;
    justify-content: space-between;
    /* Logo + section switch + theme toggle + the official (non-shrinkable,
       fixed ~165px) Google button no longer fit on one row on narrow phones
       (320-375px) — without wrap the button was pushed past the right edge
       instead of dropping to its own line. */
    flex-wrap: wrap;
  }

  /* Alone on its own wrapped line, anchor it to the right like it already
     sits on the unwrapped desktop row, instead of falling to flex-start. */
  .tc-topbar-auth {
    margin-left: auto;
  }

  .tc-topbar-rose {
    display: none; /* Hide rose on mobile to preserve screen space */
  }

  .tc-topbar-logo {
    width: 5.4rem;
    height: 1.35rem;
  }

  .tc-topbar-switch {
    gap: 0.1rem;
    margin-left: auto;
  }

  .tc-topbar-switch a {
    font-size: 0.74rem;
    padding: 0.25rem 0.35rem;
    white-space: nowrap;
  }

  .tc-topbar-theme {
    width: 1.8rem;
    height: 1.8rem;
    font-size: 0.85rem;
  }

  .tc-auth-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    gap: 0.3rem;
  }

  .tc-user-avatar-btn {
    width: 1.85rem;
    height: 1.85rem;
    font-size: 0.85rem;
  }
}

/* Auth & User Profile Components in Header */
.tc-topbar-auth {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  position: relative;
}

.tc-auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--bar-ink) 25%, transparent);
  background: color-mix(in srgb, #6b1d2f 12%, transparent);
  color: var(--bar-ink);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.tc-auth-btn:hover {
  background: color-mix(in srgb, #6b1d2f 25%, transparent);
  border-color: color-mix(in srgb, #6b1d2f 60%, transparent);
  transform: translateY(-1px);
}

.tc-google-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.tc-gis-btn-wrap {
  display: flex;
  align-items: center;
  min-height: 2.1rem;
}

.tc-user-avatar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 2px solid #8b263e;
  background: #6b1d2f;
  color: #ffffff;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.tc-user-avatar-btn:hover {
  transform: scale(1.05);
  border-color: #aa334f;
}

.tc-user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tc-user-dropdown {
  position: absolute !important;
  top: calc(100% + 0.5rem) !important;
  right: 0 !important;
  width: 260px !important;
  max-width: calc(100vw - 20px) !important;
  background: var(--bar-bg, #e7ded0) !important;
  color: var(--bar-ink, #2b2620) !important;
  border: 1px solid color-mix(in srgb, var(--bar-ink, #2b2620) 22%, transparent) !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28) !important;
  padding: 0.5rem 0 !important;
  z-index: 99999 !important;
  display: none !important;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
  box-sizing: border-box !important;
}

.tc-user-dropdown.is-open {
  display: flex !important;
  flex-direction: column !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

.tc-user-header {
  padding: 0.5rem 1rem 0.75rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--bar-ink) 12%, transparent);
  margin-bottom: 0.35rem;
}

.tc-user-name {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--bar-ink);
  line-height: 1.2;
}

.tc-user-email {
  font-size: 0.78rem;
  color: color-mix(in srgb, var(--bar-ink) 65%, transparent);
  word-break: break-all;
}

.tc-user-status-badge {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  font-weight: 600;
  background: rgba(40, 167, 69, 0.15);
  color: #28a745;
  border: 1px solid rgba(40, 167, 69, 0.3);
}

.tc-user-status-badge.beta-pending {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
  border-color: rgba(220, 53, 69, 0.3);
}

.tc-dropdown-item {
  display: flex !important;
  align-items: center !important;
  gap: 0.6rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 0.55rem 1rem !important;
  font-family: Georgia, serif !important;
  font-size: 0.88rem !important;
  color: var(--bar-ink, #2b2620) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  text-align: left !important;
  cursor: pointer !important;
  text-decoration: none !important;
  outline: none !important;
  box-shadow: none !important;
  transition: background 0.15s ease !important;
}

.tc-dropdown-item:hover {
  background: color-mix(in srgb, var(--bar-ink, #2b2620) 10%, transparent) !important;
}

.tc-dropdown-divider {
  height: 1px;
  background: color-mix(in srgb, var(--bar-ink) 12%, transparent);
  margin: 0.35rem 0;
}

