/* MiyaTube Explorer — Visual refinement v1
   Fine-tuning layer after iPhone visual gate. Presentation only. */

:root {
  --refined-header-height: 80px;
  --refined-content-x: 18px;
  --refined-shadow: 0 5px 16px rgba(8, 30, 63, .045);
}

/* 1. Brand header: keep authority, recover vertical space. */
.app-header {
  min-height: var(--refined-header-height);
  padding: calc(11px + env(safe-area-inset-top)) var(--refined-content-x) 11px;
  gap: 13px;
}

.brand-lockup {
  gap: 12px;
}

.brand-icon {
  width: 50px;
  height: 50px;
  flex-basis: 50px;
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(7, 26, 56, .16), inset 0 1px 0 rgba(255,255,255,.1);
}

.brand-play {
  border-top-width: 10px;
  border-bottom-width: 10px;
  border-left-width: 16px;
}

.brand-lockup h1 {
  font-size: clamp(20px, 5.4vw, 22px);
  line-height: 1.04;
}

.brand-lockup p {
  max-width: 290px;
  margin-top: 4px;
  font-size: clamp(11.5px, 3.25vw, 13px);
  line-height: 1.24;
}

/* 2. Global hierarchy and density. */
.main-content {
  padding: 22px var(--refined-content-x) calc(100px + env(safe-area-inset-bottom));
}

.page-heading {
  margin-bottom: 18px;
}

.page-heading .eyebrow {
  margin-bottom: 8px;
}

.page-heading h2 {
  font-size: clamp(30px, 8.2vw, 38px);
  line-height: 1.01;
  letter-spacing: -.043em;
}

.page-heading > p:last-child {
  margin-top: 9px;
  font-size: 15px;
  line-height: 1.4;
}

.compact-heading {
  margin: 18px 0 14px;
}

.compact-heading h2,
.explore-heading h2 {
  font-size: clamp(30px, 8.1vw, 37px);
  line-height: 1;
}

/* 3. Explore: more editorial, less vertical waste. */
.explore-view .video-compact {
  margin-bottom: 18px;
  padding: 12px;
  box-shadow: var(--refined-shadow);
}

.explore-view .video-compact .video-thumb {
  width: 104px;
  border-radius: 14px;
}

.explore-view .video-compact .video-title {
  font-size: 16px;
}

.explore-heading {
  margin-bottom: 14px;
}

.explore-heading > p:last-child {
  margin-top: 8px;
  font-size: 15px;
}

.explore-back {
  margin-bottom: 10px;
}

/* Primary intention nav stays at hand while browsing long sections. */
.explore-view .intent-tabs {
  position: sticky;
  top: calc(var(--refined-header-height) + env(safe-area-inset-top));
  z-index: 18;
  gap: 7px;
  margin: 0 -4px 10px;
  padding: 6px 4px;
  background: rgba(255, 253, 249, .94);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}

.explore-view .intent-tab {
  min-height: 48px;
  border-radius: 14px;
  font-size: 13.5px;
  box-shadow: 0 3px 10px rgba(8,30,63,.035);
}

.explore-view .intent-tab.is-active {
  box-shadow: 0 7px 15px rgba(169,121,32,.16);
}

/* Secondary dimension nav uses navy for location, as in approved direction. */
.dimension-tabs {
  position: sticky;
  top: calc(var(--refined-header-height) + env(safe-area-inset-top) + 60px);
  z-index: 17;
  gap: 6px;
  margin: 0 -4px 14px;
  padding: 6px 4px;
  background: rgba(255, 253, 249, .95);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.dimension-tab {
  min-height: 40px;
  min-width: 98px;
  padding-inline: 13px;
  border-radius: 11px;
  font-size: 12.5px;
}

/* 4. Overview: clear editorial order, compact map, limited theme noise. */
.overview-premium {
  gap: 13px;
}

.overview-intro-card,
.map-panel,
.overview-highlight-panel,
.overview-topic-panel {
  border-radius: 18px;
  box-shadow: var(--refined-shadow);
}

.overview-intro-card {
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
}

.overview-intro-card h3 {
  font-size: 18px;
}

.overview-intro-card p {
  margin-top: 5px;
  font-size: 13.5px;
  line-height: 1.43;
}

.overview-themes {
  flex-wrap: wrap;
  overflow: visible;
  gap: 6px;
  margin-top: 10px;
}

.overview-themes .theme-chip {
  flex: 0 1 auto;
  max-width: min(100%, 240px);
  padding: 6px 9px;
  font-size: 11.5px;
}

.overview-themes .theme-chip:nth-child(n+4) {
  display: none;
}

.map-panel,
.overview-highlight-panel,
.overview-topic-panel {
  padding: 15px;
}

.overview-panel-title {
  gap: 10px;
  margin-bottom: 11px;
}

.overview-panel-title h3 {
  font-size: 17px;
}

.map-grid-premium {
  gap: 7px;
}

.map-stat {
  min-height: 72px;
  padding: 9px;
  border-radius: 13px;
  box-shadow: none;
}

.intent-overview-grid {
  gap: 7px;
}

.intent-overview-card {
  min-height: 102px;
  gap: 7px;
  padding: 11px;
  border-radius: 15px;
  box-shadow: 0 3px 11px rgba(8,30,63,.035);
}

.preview-highlight {
  padding-block: 11px;
}

/* 5. Knowledge cards: stronger dimension identity, calmer containers. */
.explore-view .explore-list {
  gap: 10px;
}

.explore-view .knowledge-card {
  padding: 14px;
  border-radius: 17px;
  box-shadow: var(--refined-shadow);
}

.card-topline {
  margin-bottom: 8px;
}

.card-kind-icon {
  width: 35px;
  height: 35px;
  flex-basis: 35px;
}

.card-main-title {
  font-size: 16.5px;
  line-height: 1.25;
}

.card-main-copy {
  font-size: 13.5px;
  line-height: 1.43;
}

.card-time-pill,
.topic-time-range {
  padding: 5px 8px;
  font-size: 10.5px;
}

/* Semantic accents remain secondary to navy/gold brand colors. */
.knowledge-idea .card-kind-icon { background: #fff0c8; color: #ae7715; }
.knowledge-highlight .card-kind-icon { background: #fff3d3; color: #b67c16; }
.knowledge-example .card-kind-icon { background: #eaf4ff; color: #2f73b4; }
.knowledge-tool .card-kind-icon { background: #e8f7ee; color: #28784c; }
.knowledge-entity .card-kind-icon { background: #eef1ff; color: #4d61a7; }
.knowledge-number .card-kind-icon { background: #f0eafa; color: #7551ad; }
.search-result-card .card-kind-icon { background: #edf5ff; color: #347ec0; }

/* Actions read like a light toolbar instead of separate utility buttons. */
.item-actions {
  gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
}

.item-actions button {
  min-height: 38px;
  padding: 0 9px;
  border-radius: 10px;
  background: transparent;
  color: #345878;
  font-size: 11.5px;
}

.item-actions button:not(:last-child) {
  border-right: 1px solid #edf1f5;
}

.item-actions .watch-action {
  margin-left: auto;
  padding-inline: 12px;
  color: #805b13;
  background: #fff2d3;
  border-right: 0;
}

.item-actions .more-action {
  min-width: 38px;
  padding-inline: 6px;
  border-right: 0;
}

/* 6. Organize: emphasize personal collection, not dashboard density. */
.organize-view .page-heading {
  margin-bottom: 16px;
}

.library-toolbar {
  gap: 11px;
  margin-bottom: 14px;
}

.library-search {
  min-height: 54px;
  border-radius: 17px;
  box-shadow: var(--refined-shadow);
}

.library-filter {
  min-height: 42px;
  border-radius: 13px;
}

.library-summary {
  min-height: 34px;
  margin-bottom: 10px;
}

.library-list {
  gap: 11px;
}

.library-card.library-card-premium {
  min-height: 106px;
  border-radius: 18px;
  box-shadow: var(--refined-shadow);
}

.library-card-title {
  font-size: 15.5px;
}

.library-card-channel {
  margin-top: 5px;
  font-size: 12.5px;
}

/* 7. Bottom nav: keep large hit area, reduce visual capsule weight. */
.bottom-nav {
  padding-top: 5px;
}

.nav-item {
  position: relative;
  min-height: 64px;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.nav-item.is-active {
  color: var(--premium-gold-deep) !important;
  background: transparent !important;
}

.nav-item.is-active .nav-icon {
  color: var(--premium-gold-deep) !important;
  transform: translateY(-1px);
}

.nav-item::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 50%;
  width: 30px;
  height: 3px;
  border-radius: 999px;
  background: transparent;
  transform: translateX(-50%);
}

.nav-item.is-active::before {
  background: var(--premium-gold);
}

/* 8. Softer global depth. */
.processing-card,
.video-compact,
.library-card,
.knowledge-card,
.overview-intro-card,
.map-panel,
.overview-highlight-panel,
.overview-topic-panel,
.intent-card {
  box-shadow: var(--refined-shadow);
}

@media (min-width: 380px) {
  .map-grid-premium {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .map-stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    text-align: center;
  }

  .map-stat-icon {
    width: 34px;
    height: 34px;
  }

  .map-stat strong {
    font-size: 20px;
  }
}

@media (max-width: 379px) {
  .map-grid-premium {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  :root {
    --refined-header-height: 76px;
    --refined-content-x: 16px;
  }

  .brand-icon {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .brand-lockup h1 {
    font-size: 20px;
  }

  .brand-lockup p {
    max-width: 250px;
    font-size: 11.5px;
  }

  .page-heading h2,
  .compact-heading h2,
  .explore-heading h2 {
    font-size: clamp(29px, 8.4vw, 34px);
  }

  .explore-view .intent-tab {
    min-height: 46px;
    padding-inline: 7px;
    font-size: 12.5px;
  }

  .explore-view .intent-tab svg {
    width: 18px;
    height: 18px;
  }

  .dimension-tabs {
    top: calc(var(--refined-header-height) + env(safe-area-inset-top) + 58px);
  }

  .library-card.library-card-premium {
    grid-template-columns: 102px minmax(0, 1fr) 18px;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-item.is-active .nav-icon {
    transform: none;
  }
}
