:root{
  /* theme variables are defined in theme-default.css */
  --radius:18px;
  --shadow: 0 10px 30px rgba(0,0,0,.10);
  --max: 1100px;

  --tile-img-radius: 14px;
  --tile-img-aspect: 16 / 9; /* can be overridden by theme */
  --ad-img-aspect: 16 / 6;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Top Bar */
.appbar{
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--appbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.appbar__inner{
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}
.brand{
  color: var(--text);
  text-decoration:none;
  font-weight: 900;
  letter-spacing:.4px;
}
.appnav{ display:flex; gap: 10px; }
.appnav a{
  color: var(--muted);
  text-decoration:none;
  padding: 8px 10px;
  border-radius: 12px;
}
.appnav a.active, .appnav a:hover{
  color: var(--text);
  background: var(--hover);
}

.wrap{
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px;
}

/* Tiles grid */
.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
@media (min-width: 720px){
  .grid{ grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 980px){
  .grid{ grid-template-columns: repeat(4, 1fr); }
}

.tile{
  display:flex;
  flex-direction: column;
  text-decoration:none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow:hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}

.tile__media{
  width: 100%;
  aspect-ratio: var(--tile-img-aspect);
  background: var(--media-bg);
  display:flex;
  align-items:center;
  justify-content:center;
}

.tile__img{
  width: 100%;
  height: 100%;
  object-fit: cover;   /* looks clean for tiles */
  display:block;
}

.tile__ph{
  width:100%;
  height:100%;
  background: var(--media-bg);
}

.tile__meta{
  padding: 10px 12px 12px;
}
.tile__title{
  font-weight: 900;
  font-size: 14px;
  line-height: 1.25;
}
.tile__sub{
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

/* Full-width blocks (modules) */
.block{
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.block__title{
  font-weight: 900;
  margin-bottom: 10px;
}

/* Lists */
.list{
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.list__item{
  text-decoration:none;
  color: var(--text);
  padding: 10px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card2);
}
.list__item:hover{
  background: var(--hover);
}
.list__title{
  font-weight: 800;
  font-size: 14px;
}

/* Ads */
.adgrid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 720px){
  .adgrid{ grid-template-columns: 1fr 1fr; }
}

.adcard__media{
  width:100%;
  aspect-ratio: var(--ad-img-aspect);
  max-height: 120px;            /* ✅ caps banner height */
  background: var(--media-bg);
  display:flex;
  align-items:center;
  justify-content:center;
}

.adcard__img{
  max-width: 100%;
  max-height: 120px;            /* ✅ matches cap */
  width: auto;
  height: auto;
  object-fit: contain;
  display:block;
}


.adcard__media{
  width:100%;
  aspect-ratio: var(--ad-img-aspect);
  background: var(--media-bg);
}


.adcard__ph{
  height: 140px;
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--muted);
}
.adcard__label{
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* Article */
.article{
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.article__title{ margin: 6px 0 12px; font-size: 20px; }
.article__body img{ max-width:100%; height:auto; }

/* Empty */
.empty{ color: var(--muted); padding: 16px 0; }

/* Modal */
.modal{ position: fixed; inset: 0; display: none; z-index: 100; }
.modal.is-open{ display: block; }
.modal__backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.55); }
.modal__panel{
  position:absolute;
  left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  width: min(960px, 94vw);
  height: min(720px, 86vh);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow:hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display:flex;
  flex-direction: column;
}
.modal__bar{
  display:flex;
  justify-content:flex-end;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.modal__btn{
  border: 1px solid var(--line);
  background: var(--card2);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
  font-weight: 800;
}
.modal__btn:hover{ background: var(--hover); }
.modal__frame{
  flex:1;
  width:100%;
  border:0;
  background: #fff;
}
