/* ═══════════════════════════════════════════════════════════════
   CONTRIBUTION-SKYLINE.CSS — 3D GitHub Contribution Skyline Heatmap
   Compact footprint, high-contrast functional segmented toggle with visible text,
   adaptive multi-theme styling, and responsive layout.
   ═══════════════════════════════════════════════════════════════ */

/* ── COMPACT SECTION WRAPPER ──────────────────────────────────── */
.section--skyline {
  position: relative;
  padding: 1.5rem 0 2.25rem 0;
  overflow: hidden;
  background: transparent;
}

.container--skyline {
  width: 100%;
  max-width: 980px; /* Sleek, compact width preventing giant canyon-like canvas */
  margin: 0 auto;
  padding: 0 clamp(0.85rem, 3vw, 1.75rem);
  box-sizing: border-box;
}

/* ── COMPACT HEADER TELEMETRY ────────────────────────────────── */
.skyline-header-lead {
  margin-bottom: 0.85rem;
}

.skyline-pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: skylinePulse 2s infinite ease-out;
}

@keyframes skylinePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb, 0, 161, 155), 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(var(--accent-rgb, 0, 161, 155), 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb, 0, 161, 155), 0);
  }
}

.skyline-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.skyline-title-row .section__title {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  line-height: 1.2;
}

.skyline-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 12px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--t-fast, 0.2s ease);
}

.skyline-profile-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light, rgba(0, 161, 155, 0.08));
  transform: translateY(-1px);
}

.skyline-profile-link svg {
  transition: transform var(--t-fast, 0.2s ease);
}

.skyline-profile-link:hover svg {
  transform: translate(2px, -2px);
}

/* ── COMPACT SKYLINE CARD ────────────────────────────────────── */
.skyline-card {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: clamp(0.75rem, 2vw, 1.15rem);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.06));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.skyline-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md, 0 6px 20px rgba(0, 0, 0, 0.09));
}

/* ── CARD HEADER & SEGMENTED 2D/3D TOGGLE WITH VISIBLE TEXT ─── */
.skyline-card-header {
  margin-bottom: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.skyline-heading {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.skyline-heading-total {
  font-weight: 700;
  font-family: var(--font-display, 'DM Sans', sans-serif);
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-size: 0.98rem;
}

/* ── ULTRA-LUXURY GLASSMORPHISM 2D/3D TOGGLE ──────────────────── */
.skyline-view-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 5px;
  border-radius: 9999px; /* Seamless glass capsule */
  
  /* Translucent frosted glass */
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  
  /* Dual specular glass borders & shadows */
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 
    0 10px 30px -5px rgba(0, 0, 0, 0.08),
    0 4px 12px 0 rgba(0, 0, 0, 0.04),
    inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 1.5px 0 rgba(0, 0, 0, 0.04);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-mode="dark"] .skyline-view-toggle {
  background: rgba(18, 28, 34, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 10px 30px -5px rgba(0, 0, 0, 0.45),
    0 4px 12px 0 rgba(0, 0, 0, 0.25),
    inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 1.5px 0 rgba(0, 0, 0, 0.3);
}

.skyline-toggle-btn {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 5px 13px;
  min-height: 29px;
  border: 1px solid transparent;
  cursor: pointer;
  border-radius: 9999px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-user-select: none;
}

/* Inactive button hover: delicate glass refraction */
.skyline-toggle-btn:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
  color: var(--accent);
}

[data-mode="dark"] .skyline-toggle-btn:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  color: var(--accent);
}

/* Active Button: Complete Glowing Liquid Glassmorphism Pill */
.skyline-toggle-btn.is-active {
  background: linear-gradient(135deg, 
    color-mix(in srgb, var(--accent) 90%, white 10%), 
    color-mix(in srgb, var(--accent) 98%, black 2%)
  ) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border: 1px solid rgba(255, 255, 255, 0.45) !important;
  box-shadow: 
    0 4px 16px -2px color-mix(in srgb, var(--accent) 55%, transparent),
    inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 1px 0 rgba(0, 0, 0, 0.18) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transform: translateY(-0.5px);
}

[data-mode="dark"] .skyline-toggle-btn.is-active {
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  box-shadow: 
    0 4px 20px -2px color-mix(in srgb, var(--accent) 65%, transparent),
    inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.45) !important;
}

[data-mode="dark"][data-theme="ice"] .skyline-toggle-btn.is-active,
[data-mode="dark"][data-theme="imperial"] .skyline-toggle-btn.is-active,
[data-mode="dark"][data-theme="emerald"] .skyline-toggle-btn.is-active {
  color: #081816 !important;
  text-shadow: none;
}

.skyline-toggle-btn svg {
  display: block;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  fill: currentColor;
  stroke: currentColor;
}

.skyline-toggle-btn.is-active svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

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

/* ── COMPACT STAGE & CANVAS CONTAINER ────────────────────────── */
.skyline-stage-outer {
  position: relative;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  background: var(--bg-root);
  overflow: hidden;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.skyline-stage-inner {
  position: relative;
  padding: 0.5rem 0.5rem 0 0.5rem;
}

.skyline-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 0.45rem;
  outline-offset: 3px;
  touch-action: pan-y;
  transition: height 0.25s ease-out;
}

.skyline-canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

/* ── COMPACT FLOATING CORNER STATS OVERLAY IN 3D ─────────────── */
.skyline-corner-stats-tr,
.skyline-corner-stats-bl {
  position: absolute;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: opacity 0.45s cubic-bezier(0.65, 0, 0.35, 1), transform 0.45s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: 5;
}

.skyline-corner-stats-tr {
  top: 6px;
  right: 10px;
  align-items: flex-end;
  text-align: right;
}

.skyline-corner-stats-bl {
  bottom: 6px;
  left: 10px;
  align-items: flex-start;
  text-align: left;
}

.skyline-stat-unit {
  min-width: 0;
}

.skyline-stat-label {
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  line-height: 1.1;
}

.skyline-stat-main {
  margin-top: 1px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.skyline-stat-val {
  font-weight: 700;
  font-family: var(--font-display, sans-serif);
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  line-height: 0.95;
  letter-spacing: -0.02em;
  transition: color 0.4s ease;
}

.skyline-stat-unit-text {
  font-size: 11px;
  color: var(--text-secondary);
}

.skyline-stat-sub {
  margin-top: 1px;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── FLOATING HOVER TOOLTIP ──────────────────────────────────── */
.skyline-tooltip {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 30;
  white-space: nowrap;
  border-radius: 0.38rem;
  padding: 5px 10px;
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
  opacity: 0;
  background: var(--text-primary);
  color: var(--bg-root);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  transition: opacity 0.15s ease, transform 0.05s linear;
}

.skyline-tooltip.is-active {
  opacity: 1;
}

.skyline-tooltip-arrow {
  position: absolute;
  top: 100%;
  height: 0;
  width: 0;
  margin-left: -4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--text-primary);
}

/* ── COMPACT STATS DRAWER (2D & MOBILE) ──────────────────────── */
.skyline-stats-drawer {
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.45s ease;
}

.skyline-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 0.85rem;
  padding: 0.65rem 0.85rem 0.35rem 0.85rem;
  border-top: 1px solid var(--border-faint, var(--border));
}

@media (min-width: 640px) {
  .skyline-stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ── COMPACT FOOTER BAR (HINT & LEGEND) ──────────────────────── */
.skyline-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.85rem;
  font-size: 11px;
  color: var(--text-muted);
}

.skyline-hint-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
  height: 16px;
}

.skyline-hint-text {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.skyline-hint-text.is-active {
  opacity: 1;
  pointer-events: auto;
}

.skyline-legend-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.skyline-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 0;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.2);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease;
}

.skyline-legend-swatch:hover,
.skyline-legend-swatch.is-active {
  transform: scale(1.35);
  box-shadow: 0 0 0 2px var(--accent);
}

.skyline-legend-swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── RESPONSIVE TWEAKS ───────────────────────────────────────── */
@media (max-width: 600px) {
  .skyline-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .skyline-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .skyline-view-toggle {
    width: 100%;
    justify-content: stretch;
  }
  .skyline-toggle-btn {
    flex: 1;
  }
  .skyline-card-footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .skyline-legend-wrap {
    width: 100%;
    justify-content: flex-end;
  }
}
