/* ==========================================================================
   Premium layer - loaded last. Ambient background, glass chrome, refined cards,
   motion. Pure polish: no layout or data changes.
   ========================================================================== */
:root{
  --ring: rgba(228,0,79,.16);
  --shadow-card: 0 1px 1px rgba(16,18,27,.03), 0 4px 10px -2px rgba(16,18,27,.05), 0 22px 44px -22px rgba(40,36,110,.20);
  --shadow-hover: 0 2px 2px rgba(16,18,27,.04), 0 10px 22px -6px rgba(16,18,27,.10), 0 30px 56px -24px rgba(228,0,79,.30);
  --ease: cubic-bezier(.22,.8,.24,1);
}
html{scroll-behavior:smooth}
body{
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Header: back to the clean original look */
.topbar .brand img{filter:drop-shadow(0 4px 10px rgba(252,108,0,.18))}

/* Section shells */
.report-section{
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.88));
  border: 1px solid rgba(255,255,255,.9);
  outline: 1px solid rgba(20,22,31,.06); outline-offset: -1px;
  border-radius: 26px;
  box-shadow: var(--shadow-card);
  overflow: visible;
}
.report-section::before{
  content:""; position:absolute; left:28px; right:28px; top:0; height:2px; border-radius:0 0 4px 4px;
  background: linear-gradient(90deg, #e4004f, #fc6c00 55%, #f59e0b);
  opacity:.85;
}
.eyebrow,.llm-eyebrow{
  display:inline-flex; align-items:center; gap:8px; width:max-content;
  padding:5px 11px 5px 9px; border-radius:999px;
  background: rgba(228,0,79,.08); border: 1px solid rgba(228,0,79,.14);
  letter-spacing:.14em;
}
.eyebrow::before,.llm-eyebrow::before{content:""; width:6px; height:6px; border-radius:50%; background:linear-gradient(135deg,#e4004f,#fc6c00); box-shadow:0 0 0 3px rgba(228,0,79,.14)}
.section-title{font-size:38px; letter-spacing:-.015em}
.llm-head h2{font-size:28px; letter-spacing:-.01em}

/* Cards */
.metric-card,.llm-card,.llm-panel,.chart-container-card,.table-card,.history-inspector-card,.city-card,.insight-card{
  border-radius: 20px;
  border-color: rgba(20,22,31,.07);
  box-shadow: var(--shadow-card);
  transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .2s;
}
.metric-card,.llm-card{position:relative; overflow:hidden}
.metric-card::after,.llm-card::after{
  content:""; position:absolute; inset:0; pointer-events:none; opacity:0; transition:opacity .3s;
  background: radial-gradient(260px 120px at 85% -10%, rgba(255,92,141,.22), transparent 70%);
}
.metric-card:hover,.llm-card:hover{transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: rgba(228,0,79,.28)}
.metric-card:hover::after,.llm-card:hover::after{opacity:1}
.metric-card.active-inspect{box-shadow: 0 0 0 3px var(--ring), var(--shadow-hover); border-color: var(--brand)}
.metric-card:active{transform: translateY(-1px) scale(.992)}
.metric-value{font-family:'Instrument Serif',Georgia,serif; letter-spacing:-.01em}
.llm-card-val{letter-spacing:-.03em}
.llm-card.total{background: linear-gradient(150deg,#ffffff 20%, #eceaff 100%)}
.llm-panel:hover,.city-card:hover,.history-inspector-card:hover{box-shadow: var(--shadow-hover)}

/* Delta chips get a touch more depth */
.delta-badge,.llm-chip{box-shadow: inset 0 0 0 1px rgba(20,22,31,.04)}

/* Buttons & controls */
.btn-primary{background: linear-gradient(180deg,#5b53ec,#c40043); box-shadow: 0 6px 16px -6px rgba(228,0,79,.6), inset 0 1px 0 rgba(255,255,255,.22)}
.btn-primary:hover{filter:brightness(1.06)}
.layout-btn,.metric-tab,.view-seg-btn,.llm-leg{transition: background .18s, color .18s, box-shadow .18s, transform .18s var(--ease)}
.llm-leg:hover{transform:translateY(-1px)}
:focus-visible{outline:2px solid var(--brand); outline-offset:2px; border-radius:8px}

/* Tooltips: deeper glass */
.chart-tooltip{background: rgba(17,19,30,.94); box-shadow: 0 18px 40px -10px rgba(10,12,24,.55), 0 0 0 1px rgba(255,255,255,.10); border-radius:12px}

/* Modal */
.filter-builder-modal{box-shadow: 0 40px 90px -24px rgba(20,22,31,.45), 0 0 0 1px rgba(255,255,255,.6) inset}
.filter-builder-modal-wrap{-webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px)}

/* Scroll reveal (class added by premium.js, so no-JS stays visible) */
.reveal{opacity:0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease)}
.reveal.in{opacity:1; transform:none}
@keyframes rise{from{opacity:0; transform:translateY(14px)}}
.metrics-grid .metric-card{animation: rise .6s var(--ease) backwards}
.metrics-grid .metric-card:nth-child(2){animation-delay:.05s}.metrics-grid .metric-card:nth-child(3){animation-delay:.10s}
.metrics-grid .metric-card:nth-child(4){animation-delay:.15s}.metrics-grid .metric-card:nth-child(5){animation-delay:.20s}
.metrics-grid .metric-card:nth-child(6){animation-delay:.25s}.metrics-grid .metric-card:nth-child(7){animation-delay:.30s}

@media (max-width:768px){.section-title{font-size:30px}.report-section::before{left:18px;right:18px}}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none!important; transition:none!important}
  .reveal{opacity:1; transform:none}
}

/* give the side-by-side chart + table cards room for the 2-line channel legend */
.analytics-split-layout.side-by-side .chart-container-card,.analytics-split-layout.side-by-side .table-card{height:548px;max-height:548px;min-height:548px}

/* ==========================================================================
   Responsive: phones -> ultra-wide. Fluid padding, wrapping controls, collapsing grids.
   ========================================================================== */
html,body{max-width:100%}
body{overflow-x:clip}
.page,.canvas,.report-section,.report-section > *{min-width:0}
img,svg,canvas{max-width:100%}
body{padding-left:max(clamp(12px,3vw,24px),env(safe-area-inset-left,0px));padding-right:max(clamp(12px,3vw,24px),env(safe-area-inset-right,0px));padding-block:clamp(14px,2.4vw,28px)}
.page{max-width:2000px;margin-inline:auto}
.report-section{padding:clamp(14px,2.2vw,28px);border-radius:clamp(16px,2.2vw,26px);gap:clamp(16px,2vw,24px)}
.report-section::before{left:clamp(14px,2.2vw,28px);right:clamp(14px,2.2vw,28px)}
.section-title{font-size:clamp(26px,3.2vw,38px)}
.topbar{flex-wrap:wrap;gap:12px 20px}
.brand img{width:clamp(96px,11vw,132px)}
.topbar h1{font-size:clamp(24px,3vw,34px)}
.range{flex-wrap:wrap}
.metrics-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,168px),1fr))}
.llm-cards{grid-template-columns:repeat(auto-fit,minmax(min(100%,170px),1fr))}
@media (max-width:1100px){
  .analytics-split-layout.side-by-side{grid-template-columns:1fr}
  .analytics-split-layout.side-by-side .chart-container-card,.analytics-split-layout.side-by-side .table-card{height:auto;max-height:none;min-height:0}
  .analytics-split-layout .table-scroll{max-height:460px}
  .layout-toggle-group{display:none}
}
@media (max-width:760px){
  .topbar{flex-direction:column;align-items:flex-start}
  .range{width:100%}.range .field{flex:1;min-width:0;padding:0 10px}.range input[type="date"]{font-size:13px;min-width:0;width:100%}
  .section-head{flex-direction:column}
  .llm-grid,.gsc-pies,.kw-grid{grid-template-columns:1fr}
  .llm-head{align-items:flex-start}
  .vis-actions{flex-wrap:wrap}
  .metric-value{font-size:26px}
  .chart-container-card,.table-card,.history-inspector-card,.city-card,.insight-card,.llm-panel{padding-left:14px;padding-right:14px}
  .inspector-header{flex-direction:column;align-items:flex-start}
  .table-scroll{overflow-x:auto!important}
  .analytics-split-layout .table-card table{min-width:560px}
  .filter-builder-modal{max-width:100%;max-height:92vh}
}
@media (max-width:480px){
  .section-title,.llm-head h2{font-size:24px}
  .eyebrow,.llm-eyebrow{font-size:10.5px}
  .kw-badge{font-size:13.5px}
  .insight-card{min-height:0}
}
@media (min-width:1900px){html{font-size:17px}}

/* Header: plain, just pinned while scrolling */
.topbar{position:sticky;top:0;z-index:70;background:var(--bg);padding-top:10px}
@media (max-width:560px){.topbar{position:static}}
/* Notes & media: items fill the section width */
.notes-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr))}
.note-card{width:100%;min-width:0}
.note-card.photo img{width:100%;height:auto;max-height:560px;object-fit:contain;background:#f3f2ff}
