/* v0.2: market page rebuilt on the reference's structure:
   hero -> glowing app frame -> sticky 3D globe stage with live stats ->
   particle morph into a gold bar -> glowing tool cards. */
body { background: var(--bg); }
.globe-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.globe-layer canvas { width: 100% !important; height: 100% !important; display: block; }
.demo-banner, .layout { position: relative; z-index: 2; }
.topbar { z-index: 30; }
.tabbar { z-index: 40; }
.bg-glow { background: radial-gradient(55% 38% at 50% -6%, rgba(0, 179, 140, .20), transparent 70%); mask-image: none; }

/* hero */
.hero { text-align: center; padding: clamp(36px, 9vh, 110px) 0 0; display: flex; flex-direction: column; align-items: center; }
.pill-link { transition: border-color .2s; } .pill-link:hover { border-color: rgba(207, 242, 230, .45); }
.hero-title { font-size: clamp(44px, 7.4vw, 100px); margin: 22px 0 10px; letter-spacing: -.035em; line-height: 1; }
html[lang="ar"] .hero-title { letter-spacing: 0; line-height: 1.2; font-weight: 500; }
.hero-sub { margin: 0; font-size: clamp(18px, 2.1vw, 28px); font-weight: 500; color: var(--ink); min-height: 1.3em; }
.hero-desc { max-width: 540px; margin: 12px auto 0; color: var(--ink-2); font-size: clamp(14px, 1.2vw, 16px); }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 26px; }
.hero .status-line { margin-top: 16px; }
.btn.glow { background: #F2FFFA; color: var(--bg); border-color: transparent;
  box-shadow: 0 0 0 1px rgba(207, 242, 230, .55), 0 0 22px 2px rgba(0, 179, 140, .55), inset 0 -3px 8px rgba(0, 179, 140, .35); }
.btn.glow:hover { box-shadow: 0 0 0 1px rgba(207, 242, 230, .8), 0 0 34px 6px rgba(0, 179, 140, .6), inset 0 -3px 8px rgba(0, 179, 140, .35); }
.btn.glow-gold { background: linear-gradient(180deg, #FFF3D6, #F2C46D); color: #1A1204; border-color: transparent; font-weight: 500;
  box-shadow: 0 0 0 1px rgba(255, 228, 170, .6), 0 0 26px 3px rgba(242, 196, 109, .5), inset 0 -3px 8px rgba(156, 107, 34, .35); }
.badge.gold { background: rgba(60, 40, 8, .55); border-color: rgba(242, 196, 109, .45); color: #F8DDA4; }
.badge.gold::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #F2C46D; box-shadow: 0 0 10px #F2C46D; }

/* glowing top edge (the reference's "border-shadow" technique) */
.glow-top { position: relative; }
.glow-top > .gt-line { position: absolute; top: -1px; left: 8%; right: 8%; height: 2px; pointer-events: none; z-index: 2;
  background: radial-gradient(50% 100% at 50% 50%, #00B38C, rgba(0, 179, 140, 0)); }
.glow-top > .gt-glow { position: absolute; top: -7px; left: 16%; right: 16%; height: 14px; border-radius: 50%; pointer-events: none; z-index: 1;
  box-shadow: inset 0 2px 20px 0 #00B38C, 0 -10px 50px 1px #00B38C; opacity: .85; clip-path: inset(-80px -40px 50% -40px); }

/* app frame */
.frame { margin: clamp(40px, 9vh, 96px) auto 0; max-width: 1180px; border-radius: 22px; padding: 12px 16px 18px;
  background: rgba(7, 10, 15, .82); border: 1px solid rgba(255, 255, 255, .1); box-shadow: var(--shadow-in), 0 40px 120px -40px rgba(0, 0, 0, .9);
  backdrop-filter: blur(6px); }
.frame-bar { display: flex; align-items: center; gap: 12px; padding: 2px 4px 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px; font-size: 13px; color: var(--ink-2); }
.frame-bar .dots { display: inline-flex; gap: 6px; } .frame-bar .dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.frame-bar .status-pill { margin-inline-start: auto; }
.frame .card { background: rgba(255, 255, 255, .025); background-image: linear-gradient(rgba(255, 255, 255, .04), rgba(255, 255, 255, .01)); }
.frame .market-grid { margin-top: 14px; }

/* sticky globe stage */
.stage { height: 230vh; position: relative; }
.stage-sticky { position: sticky; top: 0; height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 40vw) minmax(0, 1fr); align-items: center; gap: 20px; }
.stage-copy { grid-column: 1; opacity: clamp(0, calc(var(--a, 0) * 1.6 - .5), 1); transform: translateY(calc((1 - var(--a, 0)) * 30px)); }
.sec-title { font-size: clamp(30px, 4.4vw, 60px); margin: 16px 0 12px; line-height: 1.05; letter-spacing: -.025em; }
html[lang="ar"] .sec-title { letter-spacing: 0; line-height: 1.25; font-weight: 500; }
.sec-desc { color: var(--ink-3); font-size: 14px; max-width: 380px; margin: 0 0 18px; }
.stage-stats { grid-column: 3; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.stage-stats li { display: grid; grid-template-columns: 22px auto 1fr; align-items: baseline; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid rgba(16, 188, 131, .22);
  opacity: clamp(0, calc(var(--a, 0) * 2.2 - .6 - var(--i, 0) * .18), 1); transform: translateX(calc((1 - min(1, var(--a, 0) * 1.4)) * 24px)); }
.stage-stats .ic { color: var(--ink-3); font-size: 12px; }
.stage-stats .v { font-size: clamp(22px, 2.2vw, 30px); color: var(--ink); }
.stage-stats .l { color: var(--accent); font-size: clamp(13px, 1.1vw, 16px); }
.kw-tag { position: absolute; left: 50%; top: 50%; translate: 14px -46px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 999px; font-size: 12px; color: #F8DDA4; background: rgba(40, 28, 6, .7); border: 1px solid rgba(242, 196, 109, .45);
  opacity: clamp(0, calc((var(--a, 0) - .75) * 5), 1); pointer-events: none; white-space: nowrap; }
.kw-dot { width: 6px; height: 6px; border-radius: 50%; background: #F2C46D; box-shadow: 0 0 8px #F2C46D; }

/* ingot morph */
.ingot-sec { height: 210vh; position: relative; }
.ingot-sticky { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 12vh 0 10vh;
  opacity: clamp(0, calc(var(--b, 0) * 1.6 - .4), 1); }
.ingot-spacer { flex: 1; min-height: 42vh; }
.ingot-line { font-size: clamp(16px, 1.6vw, 20px); color: #F8DDA4; margin: 0 0 18px; }

/* tools */
.tools-sec { padding: 14vh 0 8vh; text-align: center; position: relative; }
.tool-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 34px; text-align: start; align-items: start; }
.tcard { position: relative; border-radius: 18px; padding: 24px; background: rgba(10, 13, 19, .85); background-image: linear-gradient(rgba(255, 255, 255, .05), rgba(255, 255, 255, .01));
  border: 1px solid rgba(255, 255, 255, .1); box-shadow: var(--shadow-in); transition: transform .25s, border-color .25s; }
.tcard:hover { transform: translateY(-4px); border-color: rgba(207, 242, 230, .28); }
.tcard.featured { border-color: rgba(16, 188, 131, .45); background-image: linear-gradient(rgba(16, 188, 131, .22), rgba(0, 0, 0, 0) 50%); transform: translateY(-12px); }
.tcard h3 { margin: 0 0 8px; font-size: 24px; font-weight: 500; }
.tcard p { margin: 0 0 18px; color: var(--ink-3); font-size: 13.5px; min-height: 3em; }
.tcard .btn { width: 100%; }
.tcard ul { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--ink-2); }
.tcard li::before { content: "✓"; color: var(--accent); margin-inline-end: 8px; }
.tbadge { position: absolute; top: 18px; inset-inline-end: 18px; }

/* no WebGL / CDN blocked: collapse the scroll stages */
.globe-layer.no-3d ~ .layout .stage, .globe-layer.no-3d ~ .layout .ingot-sec { height: auto; }
.globe-layer.no-3d ~ .layout .stage-sticky, .globe-layer.no-3d ~ .layout .ingot-sticky { position: static; height: auto; --a: 1; --b: 1; padding: 10vh 0; }

@media (max-width: 900px) {
  .hero { padding-top: 28px; }
  .frame { padding: 10px; border-radius: 18px; margin-top: 36px; }
  .frame-bar { padding-bottom: 10px; margin-bottom: 10px; }
  .stage { height: 200vh; }
  .stage-sticky { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; align-items: start; padding: 76px 0 110px; }
  .stage-copy { grid-column: 1; text-align: center; }
  .stage-copy .sec-desc { margin-inline: auto; }
  .stage-copy .btn { display: none; }
  .stage-stats { grid-column: 1; grid-row: 3; background: rgba(5, 7, 13, .6); backdrop-filter: blur(6px); border-radius: 16px; padding: 4px 14px; }
  .stage-stats li { padding: 9px 0; }
  .ingot-sec { height: 180vh; }
  .tool-cards { grid-template-columns: 1fr; }
  .tcard.featured { transform: none; }
}
.demo-ctrl button { white-space: nowrap; }

/* glowing app frame on the chart, calculator and assistant (same as the market board) */
.frame-glow { background: rgba(7, 10, 15, .82); background-image: linear-gradient(rgba(255, 255, 255, .035), rgba(255, 255, 255, .01));
  border: 1px solid rgba(255, 255, 255, .1); box-shadow: var(--shadow-in), 0 40px 120px -40px rgba(0, 0, 0, .9); }
.chart-shell.frame-glow { margin-top: 40px; }
.calc.frame-glow { margin-top: 48px; }
.chart-shell .chart-wrap { background: rgba(0, 0, 0, .35); border-color: rgba(255, 255, 255, .07); }
.calc .stat.hl { border-color: rgba(16, 188, 131, .35); background: linear-gradient(rgba(16, 188, 131, .12), rgba(16, 188, 131, .02)); }
.calc .seg.tabs button[aria-selected="true"] { background: #F2FFFA; color: var(--bg); box-shadow: 0 0 18px rgba(0, 179, 140, .45); }
.assistant.glow-top { overflow: visible; }
.assistant.glow-top > .gt-glow { top: -6px; }
.screen[data-screen="chart"], .screen[data-screen="calc"] { padding-top: 10px; }
.chart-shell:fullscreen > .gt-line, .chart-shell:fullscreen > .gt-glow, .chart-shell.fs > .gt-line, .chart-shell.fs > .gt-glow { display: none; }

/* phone: the stats panel over the globe gets a soft top edge instead of a hard cut,
   and the description under the title gets a halo so globe particles don't eat it */
@media (max-width: 900px) {
  .stage-stats { padding-top: 26px; border: 1px solid var(--line);
    -webkit-mask-image: linear-gradient(transparent 0, #000 26px); mask-image: linear-gradient(transparent 0, #000 26px); }
  .stage-copy .sec-desc { text-shadow: 0 0 6px var(--bg), 0 0 12px var(--bg), 0 0 2px var(--bg); }
}
