/*
Theme Name: ChainLoupe
Description: Original bilingual crypto data and news theme for chainloupe.com.
Version: 1.0.0
Requires PHP: 8.0
Text Domain: chainloupe
*/
:root{--bg:#f5f6f8;--surface:#fff;--surface2:#f0f2f6;--ink:#0f1728;--muted:#5d6779;--line:#e2e6ed;--accent:#2f5cf5;--accent-ink:#fff;--up:#0a9468;--down:#d43848;--up-bg:#e5f6ef;--down-bg:#fdecee;--amber:#d98a00;--shadow:0 1px 2px rgba(15,23,40,.05),0 6px 20px rgba(15,23,40,.05);--radius:14px}
:root[data-theme=dark]{--bg:#0a0e16;--surface:#111723;--surface2:#182030;--ink:#e9edf4;--muted:#8f9aad;--line:#222c3d;--accent:#7b96ff;--accent-ink:#0a0e16;--up:#2fd39a;--down:#ff6b78;--up-bg:#0f2a23;--down-bg:#33161b;--amber:#f2b23a;--shadow:0 1px 2px rgba(0,0,0,.4)}
*,*:before,*:after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.6 system-ui,-apple-system,"Segoe UI",Roboto,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans CJK SC",sans-serif;-webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
a:hover{color:var(--accent)}
img,svg{max-width:100%;vertical-align:middle}
h1,h2,h3{line-height:1.25;margin:0;letter-spacing:-.01em;text-wrap:balance}
button,input,select{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}
.wrap{max-width:1240px;margin:0 auto;padding-inline:20px}
.num{font-variant-numeric:tabular-nums}
.up,.cl-up{color:var(--up)}.down,.cl-down{color:var(--down)}.flat,.cl-flat{color:var(--muted)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.skip{position:absolute;left:-999px}.skip:focus{left:12px;top:12px;background:var(--surface);padding:8px 12px;z-index:99;border-radius:8px}

/* header */
.topbar{border-bottom:1px solid var(--line);font-size:13px;color:var(--muted)}
.topbar .wrap{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:36px}
.topbar-tools{display:flex;align-items:center;gap:6px}
.lang a{padding:3px 8px;border-radius:6px}
.lang a[aria-current]{background:var(--surface2);color:var(--ink);font-weight:600}
.icon-btn{border:0;background:none;cursor:pointer;padding:6px;border-radius:8px;display:inline-flex;color:var(--muted)}
.icon-btn:hover{background:var(--surface2);color:var(--ink)}
.icon-btn svg{width:18px;height:18px}
:root[data-theme=dark] .i-moon,:root:not([data-theme=dark]) .i-sun{display:none}
.site-head{background:var(--surface);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:30}
.site-head .wrap{display:flex;align-items:center;gap:28px;min-height:64px}
.logo{display:flex;align-items:center;gap:10px;font-size:22px;font-weight:800;letter-spacing:-.03em;flex:none}
.logo svg{width:34px;height:34px;color:var(--accent)}
.logo b{color:var(--accent);font-weight:800}
.nav{display:flex;gap:4px;flex:1;min-width:0}
.nav a{padding:8px 12px;border-radius:8px;font-weight:600;font-size:15px;color:var(--muted);white-space:nowrap}
.nav a:hover,.nav a[aria-current]{color:var(--ink);background:var(--surface2)}
.search{display:flex;align-items:center;background:var(--surface2);border-radius:10px;padding:0 10px;flex:none}
.search input{border:0;background:none;padding:8px 6px;width:150px;outline:0}
.search svg{width:16px;height:16px;color:var(--muted)}
.menu-btn{display:none}
.ticker{background:var(--surface);border-bottom:1px solid var(--line);overflow-x:auto;scrollbar-width:none}
.ticker::-webkit-scrollbar{display:none}
.ticker .wrap{display:flex;gap:26px;min-height:42px;align-items:center;font-size:13.5px;white-space:nowrap}
.ticker a{display:flex;gap:8px;align-items:baseline}
.ticker .sym{font-weight:700}

/* generic */
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.panel-head{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid var(--line)}
.panel-head h2{font-size:17px}
.panel-body{padding:16px 20px}
.more{font-size:13.5px;color:var(--accent);font-weight:600;white-space:nowrap}
.kicker{font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--accent)}
.meta{font-size:13px;color:var(--muted)}
.section{margin-top:28px}
.section-title{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:14px}
.section-title h2{font-size:22px}
main{padding-block:26px 56px}
.live{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--amber);margin-right:8px;animation:pulse 2s infinite}
@keyframes pulse{50%{opacity:.35}}
@media (prefers-reduced-motion:reduce){.live{animation:none}html{scroll-behavior:auto}}

/* home lead */
.lead-grid{display:grid;grid-template-columns:minmax(0,1.75fr) minmax(300px,1fr);gap:24px;align-items:start}
.lead-card{display:block;overflow:hidden}
.lead-card .cover{aspect-ratio:21/9}
.lead-card .body{padding:22px 24px 24px}
.lead-card h1,.lead-card h2{font-size:clamp(22px,2.6vw,32px);margin:8px 0 10px}
.lead-card p{margin:0 0 12px;color:var(--muted);font-size:16.5px}
.sub-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:16px;margin-top:16px}
.sub-list .panel{padding:16px 18px}
.sub-list h3{font-size:16px;margin:6px 0}
.cover{position:relative;background:linear-gradient(135deg,#1b2a6b,#2f5cf5 60%,#5fd0c5);overflow:hidden;display:flex;align-items:flex-end;color:#fff}
.cover img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.cover--up{background:linear-gradient(135deg,#063b2d,#0a9468 65%,#7fe3b9)}
.cover--down{background:linear-gradient(135deg,#3f0f18,#c2364a 65%,#f5a37f)}
.cover:before,.cover:after{content:"";position:absolute;border-radius:50%;border:2px solid rgba(255,255,255,.22)}
.cover:before{width:62%;aspect-ratio:1;right:-12%;top:-45%;box-shadow:0 0 0 26px rgba(255,255,255,.06),0 0 0 60px rgba(255,255,255,.04)}
.cover:after{width:26%;aspect-ratio:1;right:9%;bottom:-30%;border-width:1px}
.cover-label{position:relative;z-index:1;padding:14px 18px;font-weight:700;font-size:13px;letter-spacing:.05em;text-transform:uppercase;opacity:.95}

/* flash */
.flash-list{list-style:none;margin:0;padding:6px 20px 8px}
.flash-list li{display:grid;grid-template-columns:58px 1fr;gap:10px;padding:12px 0;border-bottom:1px dashed var(--line)}
.flash-list li:last-child{border:0}
.flash-time{font-size:12.5px;color:var(--amber);font-weight:700;padding-top:2px}
.flash-title{font-size:14.5px;font-weight:600;line-height:1.45;display:block}
.src{display:inline-block;font-size:12px;color:var(--muted);margin-top:4px}
.flash-page .flash-list{padding:4px 24px 12px}
.flash-page .flash-list li{grid-template-columns:70px 1fr;padding:16px 0}
.flash-page .flash-title{font-size:17px}
.day-head{padding:14px 24px;background:var(--surface2);font-weight:700;font-size:14px;border-block:1px solid var(--line)}
.day-head:first-child{border-top:0;border-radius:var(--radius) var(--radius) 0 0}

/* stats */
.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}
.stat{padding:16px 18px}
.stat .label{font-size:13px;color:var(--muted)}
.stat .value{font-size:24px;font-weight:750;letter-spacing:-.02em;margin-top:2px}
.stat .sub{font-size:13px}
.gauge{height:8px;border-radius:99px;background:linear-gradient(90deg,#d43848,#e8892a,#e3c12f,#6bbf4e,#0a9468);position:relative;margin:12px 0 4px}
.gauge i{position:absolute;top:-4px;width:4px;height:16px;border-radius:2px;background:var(--ink);box-shadow:0 0 0 2px var(--surface);transform:translateX(-2px)}
.gauge-scale{display:flex;justify-content:space-between;font-size:11.5px;color:var(--muted)}
.two-col{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px}
.tron-top{display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap;align-items:flex-end}
.big{font-size:28px;font-weight:750;letter-spacing:-.02em}
.share-bar{display:flex;height:14px;border-radius:99px;overflow:hidden;margin:14px 0 10px;background:var(--surface2)}
.share-bar i{display:block;height:100%}
.legend{display:flex;flex-wrap:wrap;gap:6px 16px;font-size:13px;color:var(--muted);list-style:none;margin:0;padding:0}
.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:6px}
.c0{background:#e5383b}.c1{background:#5b7bf7}.c2{background:#e9b10c}.c3{background:#1fb89a}.c4{background:#9b6bdf}.c5{background:#8793a8}.c6{background:#c4cad6}
.movers{display:grid;grid-template-columns:1fr 1fr}
.movers>div{padding:14px 20px}
.movers>div+div{border-left:1px solid var(--line)}
.movers h3{font-size:13px;color:var(--muted);font-weight:600;margin-bottom:6px}
.mv{display:flex;justify-content:space-between;gap:8px;padding:7px 0;font-size:14.5px}
.mv b{font-weight:650}
.mv small{color:var(--muted);margin-left:6px}

/* post grid */
.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}
.card{display:flex;flex-direction:column;overflow:hidden}
.card .cover{aspect-ratio:16/8}
.card .body{padding:16px 18px 18px;display:flex;flex-direction:column;gap:8px;flex:1}
.card h3{font-size:17.5px}
.card p{margin:0;color:var(--muted);font-size:14.5px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.card .meta{margin-top:auto}
.pager{display:flex;justify-content:center;gap:6px;margin-top:30px;flex-wrap:wrap}
.pager .page-numbers{padding:8px 14px;border-radius:9px;background:var(--surface);border:1px solid var(--line);font-weight:600;font-size:14px}
.pager .current{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.page-head{margin-bottom:22px}
.page-head h1{font-size:clamp(26px,3.4vw,38px)}
.page-head p{color:var(--muted);margin:8px 0 0;max-width:70ch}

/* article */
.article{max-width:800px;margin:0 auto}
.article-head h1{font-size:clamp(26px,3.6vw,40px);margin:10px 0 14px}
.article-body{padding:28px clamp(18px,4vw,40px);margin-top:20px;font-size:17px;line-height:1.75}
.article-body h2{font-size:23px;margin:1.7em 0 .6em}
.article-body h3{font-size:19px;margin:1.5em 0 .5em}
.article-body p,.article-body ul,.article-body ol{margin:0 0 1.1em}
.article-body a{color:var(--accent);text-decoration:underline;text-underline-offset:3px}
.article-body>*:first-child{margin-top:0}
.article-body figure{margin:0 0 1.2em;overflow-x:auto}
.article-body table{width:100%;border-collapse:collapse;font-size:15px;font-variant-numeric:tabular-nums}
.article-body th,.article-body td{padding:10px 12px;border-bottom:1px solid var(--line);text-align:right;white-space:nowrap}
.article-body th:first-child,.article-body td:first-child{text-align:left}
.article-body th{font-size:13px;color:var(--muted);font-weight:600}
.article-body td a{color:var(--ink);text-decoration:none;font-weight:650}
.article-body small{color:var(--muted)}
.cl-note,.note{font-size:14px;color:var(--muted);background:var(--surface2);padding:12px 16px;border-radius:10px;border-left:3px solid var(--accent)}
.badge{display:inline-block;font-size:12px;font-weight:700;padding:3px 9px;border-radius:99px;background:var(--surface2);color:var(--muted)}

/* markets */
.tools{display:flex;gap:12px;flex-wrap:wrap;align-items:center;justify-content:space-between;padding:14px 20px;border-bottom:1px solid var(--line)}
.input{background:var(--surface2);border:1px solid transparent;border-radius:10px;padding:9px 12px;min-width:0}
.input:focus{border-color:var(--accent);outline:0}
.table-wrap{overflow-x:auto}
.mk{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums;font-size:14.5px}
.mk th,.mk td{padding:12px 14px;text-align:right;white-space:nowrap;border-bottom:1px solid var(--line)}
.mk th{font-size:12.5px;color:var(--muted);font-weight:600;cursor:pointer;user-select:none;background:var(--surface)}
.mk th[aria-sort=ascending]:after{content:" ▲";font-size:9px}.mk th[aria-sort=descending]:after{content:" ▼";font-size:9px}
.mk th:nth-child(2),.mk td:nth-child(2){text-align:left}
.mk td:first-child,.mk th:first-child{text-align:center;color:var(--muted);width:44px}
.mk tbody tr:hover{background:var(--surface2)}
.mk tbody tr:last-child td{border-bottom:0}
.coin-cell{display:flex;align-items:center;gap:10px;font-weight:650}
.coin-cell img{width:24px;height:24px;border-radius:50%}
.coin-cell small{color:var(--muted);font-weight:500}
.spark{width:120px;height:36px}
.heat{display:flex;flex-wrap:wrap;gap:4px;padding:16px 20px}
.heat a{flex:1 1 auto;min-height:64px;border-radius:8px;padding:8px 10px;color:#fff;display:flex;flex-direction:column;justify-content:center;font-size:13px;line-height:1.3}
.heat a:hover{color:#fff;filter:brightness(1.1)}
.heat b{font-size:14.5px}
.conv{display:grid;grid-template-columns:1fr auto 1fr;gap:12px;align-items:end}
.conv label{display:grid;gap:6px;font-size:13px;color:var(--muted)}
.conv .row{display:flex;gap:8px}
.conv .row .input{flex:1}
.conv .eq{padding-bottom:10px;color:var(--muted);font-weight:700}
.fng-hist{display:flex;align-items:flex-end;gap:3px;height:70px;margin-top:14px}
.fng-hist i{flex:1;border-radius:3px 3px 0 0;background:var(--accent);opacity:.75;min-height:3px}

/* coin */
.coin-head{display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.coin-head img{width:52px;height:52px;border-radius:50%}
.coin-head h1{font-size:30px}
.coin-price{display:flex;gap:14px;align-items:baseline;flex-wrap:wrap;margin-top:14px}
.coin-price .big{font-size:42px}
.chip{font-weight:700;padding:3px 10px;border-radius:8px;font-size:15px}
.chip.up{background:var(--up-bg)}.chip.down{background:var(--down-bg)}.chip.flat{background:var(--surface2)}
.chart{width:100%;height:auto;display:block}
.kv{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0}
.kv div{padding:14px 20px;border-bottom:1px solid var(--line);border-right:1px solid var(--line)}
.kv dt{font-size:13px;color:var(--muted)}
.kv dd{margin:2px 0 0;font-weight:650;font-size:16.5px}
.crumbs{font-size:13.5px;color:var(--muted);margin-bottom:14px}
.crumbs a{color:var(--muted)}.crumbs a:hover{color:var(--accent)}

/* footer */
.site-foot{background:var(--surface);border-top:1px solid var(--line);padding:36px 0 28px;font-size:14px;color:var(--muted)}
.foot-grid{display:grid;grid-template-columns:2fr 1fr 1fr;gap:32px}
.site-foot h4{margin:0 0 10px;color:var(--ink);font-size:14px}
.site-foot ul{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.foot-note{border-top:1px solid var(--line);margin-top:26px;padding-top:18px;font-size:12.5px;display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap}
.empty{padding:40px 20px;text-align:center;color:var(--muted)}

@media (max-width:1000px){
 .lead-grid,.two-col{grid-template-columns:minmax(0,1fr)}
 .grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 .search input{width:110px}
}
@media (max-width:760px){
 .menu-btn{display:inline-flex;margin-left:auto}
 .site-head .wrap{gap:10px;flex-wrap:wrap;min-height:56px}
 .nav{display:none;flex-basis:100%;flex-direction:column;padding-bottom:12px;order:3}
 .nav.open{display:flex}
 .search{display:none}
 .nav.open+.search{display:flex;flex-basis:100%;order:4;margin-bottom:12px}
 .nav.open+.search input{width:100%;flex:1}
 .grid{grid-template-columns:minmax(0,1fr)}
 .kv{grid-template-columns:repeat(2,minmax(0,1fr))}
 .foot-grid{grid-template-columns:minmax(0,1fr)}
 .conv{grid-template-columns:minmax(0,1fr)}.conv .eq{display:none}
 .movers{grid-template-columns:minmax(0,1fr)}.movers>div+div{border-left:0;border-top:1px solid var(--line)}
 .topbar .date{display:none}.topbar .wrap{justify-content:flex-end}
 .coin-price .big{font-size:32px}
 .lead-card .cover{aspect-ratio:16/8}
}
.mk .spark{max-width:none;display:block;margin-left:auto}
.mk td:last-child,.mk th:last-child{min-width:148px}
.mk th,.mk td{padding-inline:11px}
.heat:after{content:"";flex-grow:9999}
.mk td:nth-child(2){max-width:250px}
.mk .coin-cell{min-width:0}
.mk .coin-cell small{overflow:hidden;text-overflow:ellipsis}

/* hero (home lead) */
:root{--tint:#f2f5ff;--cover-a:#eef2ff;--cover-b:#dfe7ff;--cover-ink:#2a3f9e}
:root[data-theme=dark]{--tint:#151d30;--cover-a:#18213a;--cover-b:#1f2c52;--cover-ink:#b9c6ff}
.hero{overflow:hidden}
.hero-text{display:block;padding:26px 28px 22px}
.hero-text:hover{color:inherit}
.hero-text:hover h2{color:var(--accent)}
.hero-tags{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.hero-text h2{font-size:clamp(23px,2.7vw,33px);margin:12px 0 10px;transition:color .15s}
.hero-text p{margin:0 0 14px;color:var(--muted);font-size:16.5px;max-width:62ch}
.hero-img{display:block;aspect-ratio:21/9;overflow:hidden}
.hero-img img{width:100%;height:100%;object-fit:cover}
.hero-chart{display:block;border-top:1px solid var(--line);background:linear-gradient(180deg,var(--surface),var(--tint));padding-top:18px}
.hero-chart:hover{color:inherit}
.hero-chart-head{display:flex;align-items:center;gap:8px 16px;flex-wrap:wrap;padding:0 28px 6px}
.hero-chart-head .big{font-size:30px}
.hero-chart-head .meta{margin-left:auto}
.hero-chart .chart{height:250px}
.majors{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-top:16px}
.major{padding:14px 16px 10px;display:flex;flex-direction:column;gap:4px;transition:border-color .15s,transform .15s}
.major:hover{color:inherit;border-color:var(--accent);transform:translateY(-2px)}
.major-head{display:flex;justify-content:space-between;align-items:center;font-size:14px}
.major-price{font-size:20px;font-weight:750;letter-spacing:-.02em}
.major .spark{width:100%;height:40px;margin-top:2px}
/* lighter covers for cards */
.cover,.cover--up,.cover--down{background:linear-gradient(135deg,var(--cover-a),var(--cover-b));color:var(--cover-ink)}
.cover--up{--cover-a:#e9f8f1;--cover-b:#cdeedd;--cover-ink:#0a6e4f}
.cover--down{--cover-a:#fff0f1;--cover-b:#ffd9dd;--cover-ink:#a52838}
:root[data-theme=dark] .cover--up{--cover-a:#10271f;--cover-b:#154033;--cover-ink:#7fe3b9}
:root[data-theme=dark] .cover--down{--cover-a:#2c1519;--cover-b:#4a1c24;--cover-ink:#ffb0b8}
.cover:before,.cover:after{border-color:currentColor;opacity:.18}
.cover:before{box-shadow:none}
@media (max-width:760px){.majors{grid-template-columns:repeat(2,minmax(0,1fr))}.hero-text{padding:20px 18px 16px}.hero-chart-head{padding-inline:18px}.hero-chart-head .meta{margin-left:0}.hero-chart .chart{height:140px}}

/* flash timeline */
.flash-list,.flash-page .flash-list{padding:18px 20px 6px 26px}
.flash-list li,.flash-page .flash-list li{display:block;position:relative;padding:0 0 20px 20px;border:0;border-left:2px solid var(--line)}
.flash-list li:last-child{border-left-color:transparent;padding-bottom:10px}
.flash-list li:before{content:"";position:absolute;left:-6px;top:3px;width:10px;height:10px;border-radius:50%;background:var(--surface);border:2px solid var(--accent);box-sizing:border-box}
.flash-list li:first-child:before{background:var(--accent);box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 18%,transparent)}
.flash-meta{display:flex;align-items:center;gap:8px;font-size:12.5px;line-height:1.3}
.flash-time{color:var(--ink);font-weight:700;font-size:12.5px;padding:0}
.flash-meta .src{margin:0;background:var(--surface2);color:var(--muted);padding:2px 8px;border-radius:99px;font-size:11.5px;font-weight:600}
.flash-ago{margin-left:auto;color:var(--muted);font-size:12px}
.flash-title{margin-top:6px;font-size:14.5px;font-weight:600;line-height:1.45}
.flash-page .flash-list{padding:22px 24px 8px 32px}
.flash-page .flash-list li{padding-bottom:26px}
.flash-page .flash-title{font-size:17px;margin-top:8px}
