/* Arctic Dark — winter theme overlays (gated by html[data-winter="true"]) */

html[data-winter="true"] .brand-mark,
html[data-winter="true"] .admin-sidebar__brand-mark,
html[data-winter="true"] .auth-logo {
  position: relative;
  overflow: visible;
}

html[data-winter="true"] .winter-hat {
  position: absolute;
  top: -13px;
  left: 3px;
  width: 30px;
  height: auto;
  pointer-events: none;
  user-select: none;
  z-index: 3;
  /* position restored; rotate right 2× (was -18deg left → +36deg) */
  transform: scaleX(-1) rotate(36deg);
  transform-origin: 50% 85%;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

/* WINTER badge removed from UI */
.winter-badge {
  display: none !important;
}

html[data-winter="false"] .winter-hat,
html:not([data-winter]) .winter-hat {
  display: none !important;
}

.winter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(140, 200, 255, 0.22);
  border-radius: 12px;
  background: rgba(12, 22, 40, 0.72);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
}

.winter-toggle img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.winter-toggle:hover {
  border-color: rgba(160, 220, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(120, 200, 255, 0.2), 0 0 16px rgba(80, 180, 255, 0.18);
}

.winter-toggle:active { transform: scale(0.96); }

html[data-winter="true"] .winter-toggle {
  box-shadow: 0 0 0 1px rgba(120, 200, 255, 0.28), 0 0 18px rgba(70, 170, 255, 0.22);
}

.site-nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.winter-toggle--nav {
  margin-left: 0;
}

.winter-toggle--admin-bar {
  margin-left: auto;
  margin-right: 0.35rem;
  width: 36px;
  height: 36px;
}

.winter-toggle--sidebar {
  width: 36px;
  height: 36px;
  margin: 0.55rem 0.5rem 0.15rem;
}

@media (min-width: 981px) {
  .winter-toggle--admin-bar { display: none; }
}

@media (max-width: 980px) {
  .winter-toggle--sidebar { display: none; }
}

html[data-winter="true"] .profile-avatar,
html[data-winter="true"] .profile-avatar-wrap {
  position: relative;
  overflow: visible;
}

html[data-winter="true"] .winter-frost-ring {
  position: absolute;
  inset: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  z-index: 2;
  opacity: 0.92;
}

html[data-winter="false"] .winter-frost-ring,
html:not([data-winter]) .winter-frost-ring {
  display: none !important;
}

html[data-winter="true"] .view-switch-tabs,
html[data-winter="true"] .goip-tabs {
  position: relative;
}

html[data-winter="true"] .winter-snow-cap-panel {
  position: absolute;
  top: -20px;
  left: 0;
  width: 100%;
  height: auto;
  max-height: 28px;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  z-index: 4;
}

html[data-winter="false"] .winter-snow-cap-panel,
html:not([data-winter]) .winter-snow-cap-panel,
html[data-winter="false"] .winter-snow-cap-btn,
html:not([data-winter]) .winter-snow-cap-btn,
html[data-winter="false"] .winter-frost-frame,
html:not([data-winter]) .winter-frost-frame {
  display: none !important;
}

html[data-winter="true"] .card,
html[data-winter="true"] .send-workspace,
html[data-winter="true"] .admin-home-lines,
html[data-winter="true"] .admin-home-feed,
html[data-winter="true"] .auth-card {
  position: relative;
}

html[data-winter="true"] .winter-frost-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  /* halved again */
  opacity: 0.15;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  border-radius: inherit;
}

html[data-winter="true"] .send-workspace > .winter-frost-frame {
  opacity: 0.14;
}

html[data-winter="true"] .btn-send-gradient,
html[data-winter="true"] .btn.winter-cta {
  position: relative;
  overflow: visible;
  z-index: 1;
}

html[data-winter="true"] .winter-snow-cap-btn {
  position: absolute;
  top: -8px;
  left: 0;
  width: 100%;
  height: auto;
  max-height: 18px;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  z-index: 3;
}

#winter-snow-root {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
}

html[data-winter="false"] #winter-snow-root,
html:not([data-winter="true"]) #winter-snow-root {
  display: none !important;
}

.winter-flake {
  position: absolute;
  top: -24px;
  border-radius: 50%;
  background: rgba(230, 245, 255, 0.55);
  opacity: 0.4;
  will-change: transform;
  animation-name: winter-fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.winter-flake--crystal {
  background: transparent;
  border-radius: 0;
  background-image: url("../winter/snowflake-crystal.png");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.35;
}

@keyframes winter-fall {
  0% { transform: translate3d(0, -10vh, 0); }
  100% { transform: translate3d(var(--wx, 12px), 110vh, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .winter-flake { animation: none !important; opacity: 0.2; top: 12%; }
}

@media (max-width: 720px) {
  html[data-winter="true"] .winter-hat {
    width: 26px;
    top: -11px;
    left: 2px;
    transform: scaleX(-1) rotate(36deg);
    transform-origin: 50% 85%;
  }
  html[data-winter="true"] .winter-snow-cap-panel {
    max-height: 18px;
    top: -15px;
  }
  html[data-winter="true"] .winter-snow-cap-btn {
    max-height: 14px;
    top: -6px;
  }
  html[data-winter="true"] .winter-frost-frame,
  html[data-winter="true"] .send-workspace > .winter-frost-frame {
    opacity: 0.1;
  }
  .winter-toggle--nav { width: 36px; height: 36px; }
}

/* Keep site chrome above snow — NEVER override .admin-sidebar position:fixed */
header.site,
.admin-mobile-bar,
.wrap,
.wrap-wide,
.app-root {
  position: relative;
  z-index: 1;
}

/* Sidebar must stay fixed (layout depends on it) */
.admin-sidebar {
  z-index: 120;
}

html[data-winter="true"] .admin-sidebar__brand {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

html[data-winter="true"] .admin-sidebar__brand .winter-toggle--sidebar {
  align-self: flex-start;
  margin: 0 0.5rem 0.25rem;
}

/* Don't put snow-cap / frost on admin chrome — breaks readability */
html[data-winter="true"] .admin-sidebar__brand > .winter-snow-cap-panel,
html[data-winter="true"] .admin-home-lines > .winter-frost-frame,
html[data-winter="true"] .admin-home-feed > .winter-frost-frame {
  display: none !important;
}
