/* 
  Vibe Commons (static)
  Local dev: serve the folder so fetch("/commons/vibe_commons_cards.json") works.
  Put JSON at /commons/vibe_commons_cards.json, images in /commons/images, icons in /commons/icons.
*/

:root{
  --bg1:#667eea;
  --bg2:#764ba2;
  --ink:#151515;
  --muted:#666;
  --card:#ffffff;
  --soft:#f6f7fb;
  --line:#e7e7ef;
  --shadow: 0 20px 60px rgba(0,0,0,.18);
  --shadow2: 0 12px 28px rgba(0,0,0,.12);
  --radius: 16px;
  --radius2: 12px;
  --focus: 0 0 0 3px rgba(102,126,234,.35);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Helvetica Neue",Arial,sans-serif;
  color:var(--ink);
  background:
    radial-gradient(1200px 800px at 80% 0%, rgba(168, 225, 255, .55) 0%, rgba(168, 225, 255, 0) 60%),
    radial-gradient(900px 700px at 10% 20%, rgba(184, 120, 255, .45) 0%, rgba(184, 120, 255, 0) 55%),
    linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
}

a{color:inherit}
.link{color:#2b6cb0; text-decoration:none}
.link:hover{text-decoration:underline}

.container{
  width:min(1100px, calc(100% - 40px));
  margin:0 auto;
}

.skip-link{
  position:absolute;
  left:-999px; top:8px;
  background:#000; color:#fff;
  padding:10px 12px;
  border-radius:10px;
  z-index:9999;
}
.skip-link:focus{left:12px; outline:none; box-shadow:var(--focus)}

.muted{color:var(--muted)}
.tiny{font-size:12px}

.btn{
  appearance:none;
  border:2px solid var(--line);
  background:#fff;
  color:#333;
  padding:12px 16px;
  border-radius:12px;
  font-weight:700;
  cursor:pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover{transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0,0,0,.10)}
.btn:active{transform: translateY(0)}
.btn:focus{outline:none; box-shadow:var(--focus)}
.btn.primary{
  border:none;
  color:#fff;
  background: linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 100%);
}
.btn.ghost{
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  color:#fff;
  backdrop-filter: blur(6px);
}
.btn.ghost:hover{background: rgba(255,255,255,.18)}

/* Fix contrast for ghost buttons inside white cards */
.filters-card .btn.ghost{
  background: rgba(102,126,234,.10);
  border: 1px solid rgba(102,126,234,.30);
  color:#333;
  backdrop-filter: none;
}
.filters-card .btn.ghost:hover{
  background: rgba(102,126,234,.14);
}

.icon-btn{
  width:40px; height:40px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.35);
  color:#fff;
  cursor:pointer;
}
.icon-btn:hover{background: rgba(0,0,0,.45)}
.icon-btn:focus{outline:none; box-shadow:0 0 0 3px rgba(255,255,255,.25)}

.hero{
  position:relative;
  min-height: 64vh;
  display:flex;
  align-items:center;
  padding: 46px 0 32px;
}
.hero-bg{
  position:absolute; inset:0;
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.35) 40%, rgba(0,0,0,.55) 100%),
    url("/commons/images/hero.png");
  background-size: cover;
  background-position: center;
  filter: saturate(1.02);
}
.hero-inner{position:relative; z-index:1}
.hero-card{
  width:min(720px, 100%);
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 22px;
  padding: 28px;
  color:#fff;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.eyebrow{
  margin:0 0 10px;
  font-size:12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity:.85;
}
.hero h1{
  margin:0 0 12px;
  font-size: clamp(30px, 4vw, 46px);
  line-height:1.1;
}
.subhead{
  margin:0 0 18px;
  font-size: 16px;
  line-height:1.6;
  opacity:.95;
}
.hero-actions{display:flex; gap:12px; flex-wrap:wrap; margin-top: 18px}
.hero-note{margin:16px 0 0; opacity:.85; font-size: 13px}

.section{
  padding: 36px 0;
}
.section-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:14px;
  margin-bottom: 14px;
  color:#fff;
}
.section-head h2{margin:0; font-size: 22px}
.section-head p{margin:0}

.today-card{
  background: var(--card);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow);
  display:grid;
  grid-template-columns: 280px 1fr;
}
.today-media{
  min-height: 260px;
  background: #111;
  background-size: cover;
  background-position: center;
}
.today-content{padding: 22px}
.today-top{
  display:flex;
  gap:14px;
  align-items:flex-start;
}
.today-top h3{margin:0 0 6px; font-size: 20px}
.today-top p{margin:0}

.today-snippets{
  margin-top: 16px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.snippet{
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.snippet-label{
  margin:0 0 6px;
  font-size:12px;
  color:#555;
  font-weight:800;
  letter-spacing: .6px;
  text-transform: uppercase;
}
.snippet-body{
  margin:0;
  color:#222;
  line-height:1.55;
}

.today-actions{margin-top: 14px; display:flex; gap:10px; flex-wrap:wrap}

.filters-card{
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.filter-block{margin-bottom: 16px}
.filter-label{
  margin: 0 0 8px;
  font-weight: 900;
  font-size: 13px;
  letter-spacing:.6px;
  text-transform: uppercase;
  color:#333;
}
.filter-label-row{display:flex; justify-content:space-between; gap:10px; align-items:baseline}
.chip-row{display:flex; gap:10px; flex-wrap:wrap}

.chip{
  border: 2px solid var(--line);
  background:#fff;
  color:#333;
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 800;
  cursor:pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.chip:hover{transform: translateY(-1px)}
.chip[aria-pressed="true"]{
  background: linear-gradient(135deg, rgba(102,126,234,.12) 0%, rgba(118,75,162,.12) 100%);
  border-color: rgba(102,126,234,.45);
}

.search-row{display:flex; gap:10px; flex-wrap:wrap}
#searchInput{
  flex:1;
  min-width: 240px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
}
#searchInput:focus{outline:none; box-shadow: var(--focus); border-color: rgba(102,126,234,.55)}

.results-bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.results-count{font-size: 18px; font-weight: 1000}
.empty-hint{
  margin-top: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color:#7c2d12;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
}

/* Loading state (minimal, matches existing card vibe) */
.loading-state{
  margin-top: 14px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
  border: 1px solid rgba(0,0,0,.06);
  padding: 16px 18px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
  grid-column: 1 / -1; /* span full grid width */
}

.grid-head{
  margin-top: 18px;
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  color:#fff;
}
.grid-title{margin:0}

.card-grid{
  margin-top: 14px;
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.problem-card{
  background: #fff;
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow2);
  border: 1px solid rgba(0,0,0,.06);
  display:flex;
  flex-direction:column;
  cursor:pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.problem-card:hover{transform: translateY(-2px); box-shadow: 0 20px 42px rgba(0,0,0,.16)}
.problem-card:focus{outline:none; box-shadow: var(--focus), var(--shadow2)}

.card-media{
  height: 124px;
  background-size: cover;
  background-position: center 35%;
  position:relative;
}
.card-media::after{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(180deg, rgba(0,0,0,.00) 0%, rgba(0,0,0,.45) 100%);
}

.card-body{padding: 14px}
.card-top{
  display:flex;
  gap:10px;
  align-items:flex-start;
  margin-bottom: 8px;
}
.problem-icon{
  width: 44px; height: 44px;
  border-radius: 12px;
  flex: 0 0 auto;
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.06);
  object-fit: cover;
}
.problem-icon.lg{width: 56px; height: 56px; border-radius: 14px}

.problem-title{
  margin:0;
  font-size: 16px;
  line-height:1.25;
}
.problem-oneliner{
  margin: 8px 0 0;
  color:#444;
  line-height:1.5;
  font-size: 14px;
}

.badges{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top: 12px;
}
.badge{
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color:#333;
}

.meters{
  margin-top: 12px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
.meter{
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}
.meter-label{
  display:flex;
  justify-content:space-between;
  gap:10px;
  font-size: 12px;
  font-weight: 900;
  color:#333;
  margin-bottom: 8px;
}
.bar{
  height: 8px;
  background: #e9e9f3;
  border-radius: 999px;
  overflow:hidden;
}
.bar > span{
  display:block;
  height:100%;
  background: linear-gradient(90deg, var(--bg1) 0%, var(--bg2) 100%);
  width: 50%;
}

.empty-state{
  margin-top: 18px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.empty-state h3{margin:0 0 6px}
.empty-state p{margin:0 0 12px}

.footer{
  padding: 22px 0 34px;
}
.footer-inner{
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--radius);
  padding: 18px 18px;
  color: #222;
  box-shadow: var(--shadow2);
}
.footer-inner p{margin:6px 0}

.detail-dialog{
  max-height: calc(100vh - 24px);
  width:min(980px, calc(100% - 24px));
  border:none;
  border-radius: 18px;
  padding:0;
  overflow:hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.45);
}
.detail-dialog::backdrop{
  background: rgba(0,0,0,.55);
}
.detail-shell{background:#fff; display:flex; flex-direction:column; max-height: calc(100vh - 24px);}
.detail-banner{
  height: 320px;
  background:#111;
  background-size: cover;
  background-position: center 35%;
}
.detail-topbar{
  position: relative;
  margin-top: -18px;
  padding: 0 16px;
  display:flex;
  justify-content:flex-end;
}
.detail-body{padding: 0 18px 18px; overflow:auto; -webkit-overflow-scrolling: touch; flex:1;}
.detail-footer{
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  display:flex;
  justify-content:flex-end;
}

.detail-header{
  display:flex;
  gap:14px;
  align-items:flex-start;
  margin-top: 8px;
}
.detail-header h2{margin:0 0 6px; font-size: 24px}
.detail-header p{margin:0; color:#444; line-height:1.6}

.detail-meta{margin-top: 12px; display:flex; flex-wrap:wrap; gap:8px}

.detail-section{
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.detail-section h3{
  margin:0 0 8px;
  font-size: 13px;
  letter-spacing:.6px;
  text-transform: uppercase;
  color:#667eea;
}
.detail-section p{margin:0; line-height:1.65; color:#333}
.detail-section ul{margin: 8px 0 0 18px; color:#333}
.detail-section li{margin: 6px 0; line-height:1.55}

details{
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}
details > summary{
  cursor:pointer;
  font-weight: 900;
  color:#333;
}
details[open]{padding-bottom: 12px}

.kv{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
.kv .meter{margin:0}

.ref-list{
  font-size: 12px;
  color:#666;
}
.ref-list a{color:#2b6cb0}

@media (max-width: 960px){
  .card-grid{grid-template-columns: repeat(2, 1fr)}
  .today-card{grid-template-columns: 1fr}
  .today-media{min-height: 180px}
}
@media (max-width: 640px){
  .container{width:min(1100px, calc(100% - 28px))}
  .hero{min-height: 62vh}
  .today-snippets{grid-template-columns: 1fr}
  .card-grid{grid-template-columns: 1fr}
  .meters{grid-template-columns: 1fr}
  .kv{grid-template-columns: 1fr}
}

body.modal-open{overflow:hidden;}

.site-footer{
  padding: 0 0 22px;
}
.site-footer p{
  margin: 0;
  color: rgba(255,255,255,.85);
  font-size: 12px;
  text-align: center;
}

.more-filters{
  margin-top: 10px;
  border-radius: 14px;
  border: 1px dashed rgba(102,126,234,.35);
  background: rgba(102,126,234,.06);
  padding: 10px 12px;
}
.more-filters[open]{background: rgba(102,126,234,.08)}
.more-filters-summary{
  list-style: none;
  cursor: pointer;
  font-weight: 800;
  color: #2b2b2b;
}
.more-filters-summary::-webkit-details-marker{display:none}
.more-filters-summary::after{
  content:"▾";
  float:right;
  opacity:.7;
}
.more-filters[open] .more-filters-summary::after{content:"▴"}
.more-filters .in-details{padding-top: 10px}


/* Detail accordions */
.detail-accordions{
  margin-top: 10px;
}
.detail-acc{
  border-top: 1px solid var(--line);
  padding: 0;
}
.detail-acc summary{
  list-style: none;
  cursor: pointer;
  padding: 14px 0;
  font-weight: 900;
  color: #2a2f45;
}
.detail-acc summary::-webkit-details-marker{ display:none; }
.detail-acc summary:after{
  content: "▾";
  float: right;
  color: #6a6f86;
  font-weight: 900;
}
.detail-acc[open] summary:after{ content: "▴"; }
.detail-acc .acc-body{
  padding: 0 0 16px;
  color: #222;
  line-height: 1.6;
}
.detail-acc ul{ margin: 8px 0 0 18px; }
.detail-acc li{ margin: 6px 0; }

.subblock{
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 14px;
  padding: 12px 12px;
  margin-top: 10px;
}
.subblock-title{
  font-weight: 900;
  margin-bottom: 6px;
  color:#2a2f45;
}
.subblock-body p{ margin: 8px 0; }

.detail-share{
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.share-row{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-bottom: 10px;
}
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

@media (max-width: 700px){
  .detail-banner{ height: 220px; }
  .detail-header h2{ font-size: 26px; }
}


.meters:empty{display:none;}
.problem-icon{display:block; image-rendering:auto;}
