/* ==========================================================================
   AsherLab · Technology Tutorials Compass Showcase (技术教程指南针展示页)
   Matching the architectural paper-craft design system of Project & Notes
   Enlarged visual proportion & upward-shifted center for full cover visibility
   ========================================================================== */

.tutorials-compass-shell {
  position: relative;
  width: 100%;
  max-width: 1380px;
  margin: 0 auto 32px;
  padding: 24px 20px 24px;
}

/* Screen-reader H1 for accessibility */
.tutorials-compass-shell .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;
}

/* --- Compass Stage Container --- */
.compass-stage {
  position: relative;
  width: 100%;
  height: 800px;
  margin: 0 auto;
  isolation: isolate;
}

/* --- Outlined Background Wordmark: TUTORIALS (Plural) --- */
.showcase-wordmark.tutorial-wordmark {
  position: absolute;
  width: min(100%, 1320px);
  height: 230px;
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
  overflow: visible;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.showcase-wordmark.tutorial-wordmark text {
  fill: none;
  stroke: var(--mag-teal, #1D6B69);
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-weight: 700;
  font-size: 240px;
  letter-spacing: 0.04em;
  paint-order: stroke;
}

/* --- Central Compass Device (Enlarged 420px, Shifted Up to top: 48%) --- */
.compass-device-wrap {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 420px;
  height: 420px;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  user-select: none;
}

.compass-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Needle Smooth Rotation */
#compass-needle {
  transform-origin: 200px 200px;
  transition: transform 0.9s cubic-bezier(0.34, 1.25, 0.64, 1);
  will-change: transform;
}

/* Subtle idle pulse on needle center jewel */
.compass-jewel-pulse {
  animation: jewelPulse 3.5s ease-in-out infinite;
}

@keyframes jewelPulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* --- 4 Cardinal Tutorial Cover Cards (254px Width) --- */
.compass-card {
  position: absolute;
  width: 254px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid rgba(29, 107, 105, 0.22);
  box-shadow: 0 12px 32px rgba(10, 20, 23, 0.08), 0 3px 8px rgba(10, 20, 23, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-decoration: none;
  color: var(--mag-ink, #0A1417);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0.78;
  z-index: 3;
  transform-origin: center center;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.45s ease,
              box-shadow 0.45s ease,
              border-color 0.45s ease,
              filter 0.45s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.compass-card:hover {
  opacity: 0.98;
  border-color: var(--mag-teal, #1D6B69);
  box-shadow: 0 18px 44px rgba(29, 107, 105, 0.20);
}

.compass-card:focus-visible {
  outline: 3px solid var(--mag-coral, #F27B51);
  outline-offset: 4px;
}

/* Symmetrical Radial Coordinates Shifted Upwards */
.compass-card-north {
  left: 50%;
  top: 14%;
  transform: translate(-50%, -50%);
}

.compass-card-east {
  left: calc(50% + 316px);
  top: 48%;
  transform: translate(-50%, -50%);
}

.compass-card-south {
  left: 50%;
  top: 81.5%;
  transform: translate(-50%, -50%);
}

.compass-card-west {
  left: calc(50% - 316px);
  top: 48%;
  transform: translate(-50%, -50%);
}

/* --- Card Interior Layout --- */
.compass-card-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 13px 5px;
  font-family: var(--mag-mono, monospace);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--mag-teal, #1D6B69);
  text-transform: uppercase;
}

.compass-card-dir {
  background: rgba(29, 107, 105, 0.08);
  padding: 2px 6.5px;
  border-radius: 4px;
}

.compass-card-arrow {
  color: var(--mag-coral, #F27B51);
  font-size: 11.5px;
}

.compass-card-figure {
  width: 100%;
  height: 152px;
  margin: 0;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.compass-card-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.4s ease;
}

.compass-card-caption {
  padding: 9px 13px 13px;
  text-align: center;
  border-top: 1px solid rgba(10, 20, 23, 0.06);
  background: rgba(255, 255, 255, 0.7);
}

.compass-card-title {
  margin: 0;
  font-family: var(--mag-sans, sans-serif);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--mag-ink, #0A1417);
}

.compass-card-desc {
  margin: 3.5px 0 0;
  font-family: var(--mag-sans, sans-serif);
  font-size: 12px;
  color: var(--mag-ink-muted, #53615F);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Active State: Lift, Scale 1.09, Brighten, Glow --- */
.compass-card.is-active {
  opacity: 1;
  border-color: var(--mag-teal, #1D6B69);
  border-width: 2px;
  box-shadow: 0 22px 52px rgba(29, 107, 105, 0.24),
              0 8px 18px rgba(10, 20, 23, 0.09),
              0 0 20px rgba(242, 123, 81, 0.18);
  z-index: 10;
}

.compass-card-north.is-active {
  transform: translate(-50%, -50%) translateY(-16px) scale(1.09);
}

.compass-card-east.is-active {
  transform: translate(-50%, -50%) translateY(-16px) scale(1.09);
}

.compass-card-south.is-active {
  transform: translate(-50%, -50%) translateY(-16px) scale(1.09);
}

.compass-card-west.is-active {
  transform: translate(-50%, -50%) translateY(-16px) scale(1.09);
}

/* Float movement when active */
.compass-card.is-active .compass-card-figure img {
  animation: cardImgFloat 4s ease-in-out infinite;
}

@keyframes cardImgFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* --- Bottom Actions Bar (Pause Toggle + View All Button) --- */
.compass-bottom-bar {
  position: absolute;
  right: 24px;
  bottom: 8px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Pause / Play Auto-Rotate Toggle */
.compass-pause-btn {
  display: inline-flex;
  align-items: center;
  gap: 6.5px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(10, 20, 23, 0.16);
  color: var(--mag-ink-muted, #53615F);
  font-family: var(--mag-sans, sans-serif);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.compass-pause-btn:hover {
  background: #FFFFFF;
  color: var(--mag-ink, #0A1417);
  border-color: var(--mag-teal, #1D6B69);
}

.compass-pause-btn:focus-visible {
  outline: 2px solid var(--mag-coral, #F27B51);
  outline-offset: 3px;
}

/* View All Tutorials Button (matching poker-mini-all-btn) */
.compass-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 6.5px;
  padding: 7px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.90);
  border: 1.5px solid var(--mag-teal, #1D6B69);
  color: var(--mag-teal, #1D6B69) !important;
  font-family: var(--mag-sans, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(10, 20, 23, 0.06);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.compass-all-btn:hover {
  background: var(--mag-teal, #1D6B69);
  color: #FFFFFF !important;
  box-shadow: 0 4px 16px rgba(29, 107, 105, 0.25);
  transform: translateY(-1px);
}

.compass-all-btn:focus-visible {
  outline: 3px solid var(--mag-coral, #F27B51);
  outline-offset: 3px;
}

/* --- Responsive Adjustments --- */
@media (max-width: 1320px) {
  .compass-stage {
    height: 770px;
  }
  .showcase-wordmark.tutorial-wordmark text {
    font-size: 205px;
  }
  .compass-device-wrap {
    width: 380px;
    height: 380px;
    top: 48%;
  }
  .compass-card {
    width: 232px;
  }
  .compass-card-figure {
    height: 140px;
  }
  .compass-card-east {
    left: calc(50% + 280px);
    top: 48%;
  }
  .compass-card-west {
    left: calc(50% - 280px);
    top: 48%;
  }
  .compass-card-north {
    top: 14%;
  }
  .compass-card-south {
    top: 81%;
  }
}

@media (max-width: 1040px) {
  .compass-stage {
    height: 720px;
  }
  .showcase-wordmark.tutorial-wordmark text {
    font-size: 165px;
  }
  .compass-device-wrap {
    width: 320px;
    height: 320px;
    top: 48%;
  }
  .compass-card {
    width: 198px;
  }
  .compass-card-figure {
    height: 122px;
  }
  .compass-card-title {
    font-size: 13.5px;
  }
  .compass-card-desc {
    display: none;
  }
  .compass-card-east {
    left: 82%;
    top: 48%;
  }
  .compass-card-west {
    left: 18%;
    top: 48%;
  }
  .compass-card-north {
    top: 14%;
  }
  .compass-card-south {
    top: 80%;
  }
}

/* Mobile: Diamond / Cross Layout (390px reference) */
@media (max-width: 640px) {
  .tutorials-compass-shell {
    padding: 12px 10px 28px;
    margin-bottom: 24px;
  }
  .compass-stage {
    height: 640px;
  }
  .showcase-wordmark.tutorial-wordmark {
    top: 4px;
    height: 110px;
  }
  .showcase-wordmark.tutorial-wordmark text {
    font-size: 110px;
    stroke-width: 2.2;
  }
  .compass-device-wrap {
    width: 205px;
    height: 205px;
    top: 50%;
  }
  .compass-card {
    width: 136px;
    border-radius: 14px;
  }
  .compass-card-figure {
    height: 86px;
    padding: 0 6px;
  }
  .compass-card-caption {
    padding: 6px 8px 8px;
  }
  .compass-card-title {
    font-size: 12px;
  }
  .compass-card-badge {
    padding: 4px 8px 2px;
    font-size: 9px;
  }
  .compass-card-desc {
    display: none;
  }

  /* Diamond layout positions */
  .compass-card-north {
    left: 50%;
    top: 19%;
  }
  .compass-card-east {
    left: 81%;
    top: 50%;
  }
  .compass-card-south {
    left: 50%;
    top: 81%;
  }
  .compass-card-west {
    left: 19%;
    top: 50%;
  }

  .compass-card-north.is-active,
  .compass-card-east.is-active,
  .compass-card-south.is-active,
  .compass-card-west.is-active {
    transform: translate(-50%, -50%) translateY(-10px) scale(1.08);
  }

  .compass-bottom-bar {
    right: 12px;
    bottom: 4px;
    gap: 8px;
  }
  .compass-pause-btn {
    padding: 4px 10px;
    font-size: 11px;
  }
  .compass-all-btn {
    padding: 4px 12px;
    font-size: 11px;
  }
}

/* Reduced Motion Mode */
@media (prefers-reduced-motion: reduce) {
  #compass-needle {
    transition: none;
  }
  .compass-card {
    transition: none;
  }
  .compass-card.is-active .compass-card-figure img,
  .compass-jewel-pulse {
    animation: none;
  }
}
