/* SPEC-183: /discover semantic idea-galaxy. Layered on the base.css design
   tokens (no new colour system). Styles the galaxy canvas + its overlays and
   the server-rendered "browse by region" fallback. */

.dg-head { max-width: 60ch; margin: 8px 0 24px; }
.dg-head h1 { font-family: var(--font-serif); font-size: clamp(34px, 4.6vw, 52px); font-weight: 500; letter-spacing: -.01em; margin: 10px 0 12px; }
.dg-head p { color: var(--text-2); font-size: 17px; line-height: 1.6; }
.dg-head .count-note { color: var(--text-3); }

/* ---- modern scrollbar moved to base.css (SPEC-BUG-091) so it applies
   site-wide, not just on /discover. The universal `*` rules and the `.mscroll`
   container-hover brighten now live there; discover.html keeps using the
   `.mscroll` class on its horizontal strips. ---- */

/* ---- galaxy canvas + overlays (full-bleed: break out of .container, mirror SPEC-179) ---- */
.dg {
  position: relative; left: 50%; width: 100vw; margin-left: -50vw;
  height: min(82vh, 860px); min-height: 520px; overflow: hidden;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: radial-gradient(120% 90% at 50% 0%, #0a0c12, #070809);
}
#dg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#dg-canvas.drag { cursor: grabbing; }

.dg-ask { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); width: min(620px, 88%); z-index: 6; text-align: center; }
.dg-ask .eyebrow { display: block; margin-bottom: 9px; text-shadow: 0 2px 12px rgba(0, 0, 0, .8); }
.dg-search { position: relative; display: flex; align-items: center; }
.dg-search svg { position: absolute; left: 16px; width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.dg-search input {
  width: 100%; background: rgba(12, 14, 20, .82); backdrop-filter: blur(8px);
  border: 1px solid var(--border-2); color: var(--text); border-radius: var(--radius-pill);
  padding: 13px 18px 13px 44px; font-size: 15px; font-family: var(--font-sans); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.dg-search input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.dg-sugg { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin-top: 11px; }
.dg-sugg button {
  font-family: var(--font-sans); font-size: 12px; color: var(--text-2);
  background: rgba(12, 14, 20, .7); backdrop-filter: blur(6px); border: 1px solid var(--border-2);
  border-radius: var(--radius-pill); padding: 5px 11px; cursor: pointer; transition: all .2s;
}
.dg-sugg button:hover { color: var(--accent); border-color: var(--accent-line); }

.dg-legend {
  position: absolute; top: 22px; right: 22px; z-index: 6; width: 226px;
  background: rgba(12, 14, 20, .78); backdrop-filter: blur(10px); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 13px 7px; max-height: calc(100% - 150px); overflow: auto;
}
.dg-legend h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-3); margin-bottom: 11px; display: flex; justify-content: space-between; align-items: center; }
.dg-legend h4 button { background: none; border: 0; color: var(--text-3); cursor: pointer; font-size: 11px; font-family: var(--font-mono); }
.dg-lg { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 7px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--text-2); text-align: left; transition: background .15s; }
.dg-lg:hover { background: var(--surface-3); color: var(--text); }
.dg-lg .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dg-lg .c { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

.dg-ctl { position: absolute; left: 22px; bottom: 126px; z-index: 6; display: flex; flex-direction: column; gap: 8px; }
.dg-ctl button { width: 40px; height: 40px; border-radius: 10px; background: rgba(12, 14, 20, .8); border: 1px solid var(--border-2); color: var(--text); font-size: 18px; cursor: pointer; backdrop-filter: blur(6px); transition: all .2s; }
.dg-ctl button:hover { border-color: var(--accent-line); color: var(--accent); }

.dg-hover { position: absolute; z-index: 8; pointer-events: none; width: 260px; background: rgba(13, 15, 21, .96); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); opacity: 0; transition: opacity .12s; backdrop-filter: blur(8px); }
.dg-hover.show { opacity: 1; }
.dg-hover .g { font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: .04em; margin-bottom: 4px; }
.dg-hover h4 { font-family: var(--font-serif); font-size: 17px; font-weight: 600; line-height: 1.15; margin-bottom: 8px; }
.dg-hover p { color: var(--text-2); font-size: 12.5px; line-height: 1.45; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dg-hover .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.dg-hover .tag { font-size: 10.5px; color: var(--text-3); font-family: var(--font-mono); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }

.dg-rail { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; padding: 14px 22px 18px; background: linear-gradient(0deg, rgba(7, 8, 9, .95), transparent); transform: translateY(112%); transition: transform .3s var(--ease); }
.dg-rail.show { transform: none; }
.dg-rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 14px; flex-wrap: wrap; }
.dg-rail-count { font-size: 14px; color: var(--text-2); }
.dg-rail-count b { color: var(--text); font-family: var(--font-serif); font-size: 17px; }
.dg-rail-close { background: rgba(255, 255, 255, .05); border: 1px solid var(--border-2); color: var(--text); border-radius: var(--radius-pill); padding: 6px 14px; font-size: 13px; cursor: pointer; }
.dg-rail-strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.dg-rcard { min-width: 248px; max-width: 248px; display: flex; gap: 11px; align-items: center; text-align: left; background: rgba(16, 18, 22, .92); border: 1px solid var(--border-2); border-radius: 12px; padding: 11px; cursor: pointer; transition: all .2s; }
.dg-rcard:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.dg-rcard .th { width: 62px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; flex: none; background: var(--surface-3); }
.dg-rcard .th img { width: 100%; height: 100%; object-fit: cover; }
.dg-rcard .m { min-width: 0; display: flex; flex-direction: column; }
.dg-rcard .m .t { font-size: 13px; color: var(--text); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dg-rcard .m .s { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); margin-top: 3px; }

.dg-focus { min-width: 340px; max-width: 460px; background: rgba(16, 18, 22, .95); border: 1px solid var(--accent-line); border-radius: 12px; padding: 16px 18px; }
.dg-focus .g { font-family: var(--font-mono); font-size: 11px; color: var(--accent); margin-bottom: 5px; }
.dg-focus h3 { font-family: var(--font-serif); font-size: 20px; margin-bottom: 8px; line-height: 1.15; }
.dg-focus p { color: var(--text-2); font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
.dg-focus .fb { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- region shelves (browse below the galaxy; cards are real <a> links, so
   this is also the crawlable / no-JS browse) ---- */
.dg-shelves { padding: 50px 0 30px; }
.dg-shelves-head { margin-bottom: 26px; }
.dg-shelves-head h2 { font-family: var(--font-serif); font-size: clamp(26px, 3vw, 36px); font-weight: 500; margin: 10px 0 8px; }
.dg-shelves-head p { color: var(--text-2); }
.dg-shelf { margin-bottom: 28px; }
.dg-shelf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dg-shelf-head .dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.dg-shelf-head h3 { font-family: var(--font-serif); font-size: 19px; font-weight: 500; }
.dg-shelf-head .c { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); }
.dg-shelf-head .see-all { margin-left: auto; color: var(--accent); font-size: 13px; font-weight: 500; white-space: nowrap; }
.dg-shelf-strip { display: flex; gap: 16px; overflow-x: auto; padding: 2px 2px 14px; scroll-snap-type: x mandatory; }
.dg-ecard { display: block; min-width: 236px; max-width: 236px; scroll-snap-align: start; text-decoration: none; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); transition: transform .25s var(--ease), border-color .25s, box-shadow .25s; }
.dg-ecard:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: var(--shadow); }
.dg-ecard .pos { position: relative; display: flex; align-items: flex-end; aspect-ratio: 16/9; overflow: hidden; padding: 12px; }
.dg-ecard .pos::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(8, 9, 11, .92)); }
.dg-ecard .pos img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5; }
.dg-ecard .gn { position: relative; z-index: 2; font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: #fff; line-height: 1.1; text-shadow: 0 2px 16px rgba(0, 0, 0, .7); }
.dg-ecard .dur { position: absolute; top: 10px; right: 10px; z-index: 2; font-family: var(--font-mono); font-size: 10px; color: #fff; background: rgba(8, 9, 11, .55); border: 1px solid rgba(255, 255, 255, .16); border-radius: 6px; padding: 2px 7px; backdrop-filter: blur(3px); }
.dg-ecard .bd { display: block; padding: 11px 13px 13px; }
.dg-ecard .bd .tt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; color: var(--text); line-height: 1.3; }
.dg-ecard .bd .rt { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); margin-top: 5px; }
/* poster gradients (home.css's t1..t6 are not loaded on /discover, so scope them here) */
.dg-ecard .pos.t1 { background: radial-gradient(120% 120% at 70% 20%, #16202c, #0c0d10); }
.dg-ecard .pos.t2 { background: radial-gradient(120% 120% at 30% 10%, #142028, #0c0d10); }
.dg-ecard .pos.t3 { background: radial-gradient(120% 120% at 75% 15%, #1b2030, #0c0d10); }
.dg-ecard .pos.t4 { background: radial-gradient(120% 120% at 25% 20%, #11212a, #0c0d10); }
.dg-ecard .pos.t5 { background: radial-gradient(120% 120% at 70% 25%, #1a1f2e, #0c0d10); }
.dg-ecard .pos.t6 { background: radial-gradient(120% 120% at 30% 15%, #142433, #0c0d10); }
/* region dot colours, matched to the galaxy palette (discover-galaxy.js PAL) */
.dg-c0{background:#5fd2e6}.dg-c1{background:#5cc6e8}.dg-c2{background:#5fb0f0}.dg-c3{background:#6ea8fe}.dg-c4{background:#7c97ff}.dg-c5{background:#8f8cff}.dg-c6{background:#a487f5}.dg-c7{background:#b884ec}.dg-c8{background:#67d2b8}.dg-c9{background:#74c98f}.dg-c10{background:#9ad1ff}.dg-c11{background:#c0a3ff}

.dg-empty { text-align: center; padding: 90px 24px; color: var(--text-2); }
.dg-empty p { font-size: 16px; margin-bottom: 20px; }

@media (max-width: 760px) {
  .dg { height: 66vh; }
  .dg-legend { display: none; }
}
