@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ═══════════════════════════════════════════════════════════
   RESET — scoped tight so theme can't bleed in
═══════════════════════════════════════════════════════════ */
#ttf-root { box-sizing: border-box !important; }
#ttf-root * { box-sizing: border-box !important; }

/* ── Root wrapper ─────────────────────────────────────── */
#ttf-root {
  font-family: 'Inter', sans-serif !important;
  background: #ffffff !important;
  color: #222 !important;
  width: 100% !important;
  border-radius: 0 !important;
  overflow: visible !important;
  position: relative !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* ═══════════════════════════════════════════════════════════
   TOP BAR
═══════════════════════════════════════════════════════════ */
#ttf-root .ttf-topbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 14px 0 14px 0 !important;
  gap: 12px !important;
  background: #ffffff !important;
  border-bottom: 3px solid #f5a623 !important;
  flex-wrap: wrap !important;
  margin-bottom: 0 !important;
}

#ttf-root .ttf-title {
  font-family: 'Oswald', sans-serif !important;
  font-size: 1.6rem !important;
  font-weight: 700 !important;
  color: #111 !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
  text-transform: uppercase !important;
  line-height: 1 !important;
}
#ttf-root .ttf-title span { color: #f5a623 !important; }

#ttf-root .ttf-controls {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

/* ── Search ───────────────────────────────────────────── */
#ttf-root .ttf-search-wrap { position: relative !important; }

#ttf-root .ttf-search-wrap svg {
  position: absolute !important;
  left: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: #aaa !important;
  pointer-events: none !important;
  width: 14px !important;
  height: 14px !important;
}

#ttf-root .ttf-search {
  background: #f8f8f8 !important;
  border: 1px solid #ddd !important;
  border-radius: 6px !important;
  color: #222 !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.85rem !important;
  padding: 9px 12px 9px 34px !important;
  outline: none !important;
  width: 220px !important;
  transition: border-color 0.2s, width 0.2s !important;
  height: auto !important;
  line-height: 1.4 !important;
}
#ttf-root .ttf-search:focus {
  border-color: #f5a623 !important;
  width: 260px !important;
  box-shadow: 0 0 0 3px rgba(245,166,35,.12) !important;
}
#ttf-root .ttf-search::placeholder { color: #bbb !important; }

/* ── Refresh btn ──────────────────────────────────────── */
#ttf-root .ttf-refresh-btn {
  background: #f8f8f8 !important;
  border: 1px solid #ddd !important;
  border-radius: 6px !important;
  color: #888 !important;
  cursor: pointer !important;
  padding: 9px 11px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: color 0.2s, border-color 0.2s !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
  height: auto !important;
}
#ttf-root .ttf-refresh-btn:hover { color: #f5a623 !important; border-color: #f5a623 !important; }
#ttf-root .ttf-refresh-btn.spinning svg { animation: ttf-spin 0.8s linear infinite !important; }
@keyframes ttf-spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   FILTER / CATEGORY BAR
═══════════════════════════════════════════════════════════ */
#ttf-root .ttf-filterbar {
  display: flex !important;
  align-items: stretch !important;
  justify-content: space-between !important;
  gap: 0 !important;
  background: #f8f8f8 !important;
  border: 1px solid #eee !important;
  border-radius: 8px !important;
  padding: 0 !important;
  margin: 16px 0 20px !important;
  flex-wrap: wrap !important;
  overflow: visible !important;
}

#ttf-root .ttf-filter-left {
  display: flex !important;
  align-items: center !important;
  flex: 1 !important;
  min-width: 0 !important;
  overflow: visible !important;
  padding: 0 !important;
}

#ttf-root .ttf-filter-icon {
  color: #ccc !important;
  display: flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
  padding: 0 12px !important;
  border-right: 1px solid #eee !important;
  align-self: stretch !important;
}

/* ── Category tab chips ───────────────────────────────── */
#ttf-root .ttf-cat-chips {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0 !important;
  padding: 6px 8px !important;
  margin: 0 !important;
  list-style: none !important;
  width: 100% !important;
}

#ttf-root .ttf-cat-chip {
  background: #fff !important;
  border: 1px solid #e0e0e0 !important;
  border-radius: 20px !important;
  color: #555 !important;
  cursor: pointer !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  padding: 7px 14px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: color 0.15s, background 0.15s, border-color 0.15s !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  margin: 4px !important;
  min-height: 34px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
#ttf-root .ttf-cat-chip:hover {
  color: #111 !important;
  background: #f5f5f5 !important;
  border-color: #bbb !important;
}
#ttf-root .ttf-cat-chip.active {
  color: #fff !important;
  font-weight: 600 !important;
  background: #f5a623 !important;
  border-color: #f5a623 !important;
}

/* ── Source dropdown ───────────────────────────────────── */
#ttf-root .ttf-filter-right {
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  padding: 8px 12px !important;
  border-left: 1px solid #eee !important;
}

#ttf-root .ttf-source-select {
  background: #fff !important;
  border: 1px solid #ddd !important;
  border-radius: 6px !important;
  color: #555 !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 0.8rem !important;
  padding: 8px 28px 8px 10px !important;
  outline: none !important;
  cursor: pointer !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  min-width: 130px !important;
  min-height: 36px !important;
  height: auto !important;
}
#ttf-root .ttf-source-select:focus { border-color: #f5a623 !important; }

/* ═══════════════════════════════════════════════════════════
   FEATURED ROW — top 3 large cards side-by-side
═══════════════════════════════════════════════════════════ */
#ttf-root .ttf-featured-row {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 18px !important;
  margin-bottom: 32px !important;
}
@media (max-width: 860px) {
  #ttf-root .ttf-featured-row { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 520px) {
  #ttf-root .ttf-featured-row { grid-template-columns: 1fr !important; }
}

/* ── Featured card ────────────────────────────────────── */
#ttf-root .ttf-feat-card {
  display: flex !important;
  flex-direction: column !important;
  background: #fff !important;
  border: 1px solid #e8e8e8 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  text-decoration: none !important;
  color: inherit !important;
  transition: box-shadow 0.2s, transform 0.2s !important;
  cursor: pointer !important;
}
#ttf-root .ttf-feat-card:hover {
  box-shadow: 0 6px 28px rgba(0,0,0,.10) !important;
  transform: translateY(-3px) !important;
  text-decoration: none !important;
}

/* IMAGE CONTAINER — use aspect-ratio NOT padding-top (theme overrides padding) */
#ttf-root .ttf-feat-img-wrap {
  width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  overflow: hidden !important;
  background: #e8e8e8 !important;
  position: relative !important;
  display: block !important;
  flex-shrink: 0 !important;
  /* Fallback for browsers without aspect-ratio */
  min-height: 160px !important;
}

#ttf-root .ttf-feat-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  transition: transform 0.3s !important;
}
#ttf-root .ttf-feat-card:hover .ttf-feat-img { transform: scale(1.04) !important; }

#ttf-root .ttf-feat-badge {
  position: absolute !important;
  bottom: 8px !important;
  left: 8px !important;
  color: #fff !important;
  font-size: 0.6rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  padding: 3px 8px !important;
  border-radius: 4px !important;
  text-transform: uppercase !important;
  z-index: 2 !important;
  line-height: 1.4 !important;
}

#ttf-root .ttf-feat-body {
  padding: 14px 16px 16px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  flex: 1 !important;
}

#ttf-root .ttf-feat-cat {
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  color: #f5a623 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.8px !important;
  line-height: 1 !important;
}

#ttf-root .ttf-feat-title {
  font-family: 'Oswald', sans-serif !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  color: #111 !important;
  line-height: 1.35 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 3 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  margin: 0 !important;
}
#ttf-root .ttf-feat-card:hover .ttf-feat-title { color: #f5a623 !important; }

#ttf-root .ttf-feat-desc {
  font-size: 0.78rem !important;
  color: #666 !important;
  line-height: 1.55 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  flex: 1 !important;
  margin: 0 !important;
}

#ttf-root .ttf-feat-meta {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 0.7rem !important;
  color: #aaa !important;
  margin-top: 4px !important;
  flex-wrap: wrap !important;
}
#ttf-root .ttf-feat-meta-dot {
  width: 3px !important;
  height: 3px !important;
  border-radius: 50% !important;
  background: #ccc !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

/* ═══════════════════════════════════════════════════════════
   SECTION DIVIDER
═══════════════════════════════════════════════════════════ */
#ttf-root .ttf-divider {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  margin-bottom: 18px !important;
}
#ttf-root .ttf-divider-label {
  font-family: 'Oswald', sans-serif !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  color: #111 !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  white-space: nowrap !important;
}
#ttf-root .ttf-divider-line {
  flex: 1 !important;
  height: 1px !important;
  background: #e8e8e8 !important;
}

/* ═══════════════════════════════════════════════════════════
   CARD GRID — remaining items (4-col on desktop)
═══════════════════════════════════════════════════════════ */
#ttf-root .ttf-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 16px !important;
  margin-bottom: 4px !important;
}
@media (max-width: 960px)  { #ttf-root .ttf-grid { grid-template-columns: repeat(3, 1fr) !important; } }
@media (max-width: 680px)  { #ttf-root .ttf-grid { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 400px)  { #ttf-root .ttf-grid { grid-template-columns: 1fr !important; } }

/* ── Grid card ────────────────────────────────────────── */
#ttf-root .ttf-card {
  display: flex !important;
  flex-direction: column !important;
  background: #fff !important;
  border: 1px solid #e8e8e8 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  text-decoration: none !important;
  color: inherit !important;
  transition: box-shadow 0.2s, transform 0.2s !important;
  cursor: pointer !important;
}
#ttf-root .ttf-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.09) !important;
  transform: translateY(-2px) !important;
  text-decoration: none !important;
}

/* ── Card image — aspect-ratio approach (NO padding-top) ─ */
#ttf-root .ttf-card-img-wrap {
  width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  overflow: hidden !important;
  background: #e0e0e0 !important;
  position: relative !important;
  display: block !important;
  flex-shrink: 0 !important;
  min-height: 130px !important;
}

#ttf-root .ttf-card-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  transition: transform 0.3s !important;
}
#ttf-root .ttf-card:hover .ttf-card-img { transform: scale(1.05) !important; }

#ttf-root .ttf-card-badge {
  position: absolute !important;
  bottom: 6px !important;
  left: 6px !important;
  color: #fff !important;
  font-size: 0.57rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.4px !important;
  padding: 2px 7px !important;
  border-radius: 3px !important;
  text-transform: uppercase !important;
  z-index: 2 !important;
  line-height: 1.5 !important;
}

#ttf-root .ttf-card-body {
  padding: 12px 13px 14px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
  flex: 1 !important;
}

#ttf-root .ttf-card-cat {
  font-size: 0.6rem !important;
  font-weight: 700 !important;
  color: #f5a623 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.6px !important;
  line-height: 1 !important;
}

#ttf-root .ttf-card-title {
  font-family: 'Inter', sans-serif !important;
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  color: #111 !important;
  line-height: 1.42 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 3 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  flex: 1 !important;
  margin: 0 !important;
}
#ttf-root .ttf-card:hover .ttf-card-title { color: #f5a623 !important; }

#ttf-root .ttf-card-footer {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-top: 8px !important;
  padding-top: 8px !important;
  border-top: 1px solid #f0f0f0 !important;
}
#ttf-root .ttf-card-time {
  color: #bbb !important;
  font-size: 0.67rem !important;
  line-height: 1 !important;
}
#ttf-root .ttf-card-read {
  font-size: 0.67rem !important;
  font-weight: 600 !important;
  color: #f5a623 !important;
  display: flex !important;
  align-items: center !important;
  gap: 3px !important;
  opacity: 0 !important;
  transition: opacity 0.18s !important;
  text-decoration: none !important;
}
#ttf-root .ttf-card:hover .ttf-card-read { opacity: 1 !important; }

/* ═══════════════════════════════════════════════════════════
   LOAD MORE
═══════════════════════════════════════════════════════════ */
#ttf-root .ttf-load-more-wrap {
  text-align: center !important;
  padding: 28px 0 8px !important;
  margin: 0 !important;
}
#ttf-root .ttf-load-more {
  display: inline-block !important;
  background: #111 !important;
  border: 2px solid #111 !important;
  border-radius: 6px !important;
  color: #fff !important;
  cursor: pointer !important;
  font-family: 'Oswald', sans-serif !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  letter-spacing: 1px !important;
  text-transform: uppercase !important;
  padding: 13px 48px !important;
  transition: background 0.2s, color 0.2s, border-color 0.2s !important;
  line-height: 1 !important;
  min-height: 48px !important;
}
#ttf-root .ttf-load-more:hover {
  background: #f5a623 !important;
  border-color: #f5a623 !important;
  color: #111 !important;
}
#ttf-root .ttf-load-more:disabled { opacity: 0.45 !important; cursor: not-allowed !important; }

/* ═══════════════════════════════════════════════════════════
   LOADING / EMPTY / ERROR
═══════════════════════════════════════════════════════════ */
#ttf-root .ttf-loading {
  text-align: center !important;
  padding: 60px 24px !important;
  color: #999 !important;
  font-size: 0.85rem !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 14px !important;
  grid-column: 1 / -1 !important;
}
#ttf-root .ttf-spinner {
  width: 36px !important;
  height: 36px !important;
  border: 3px solid #eee !important;
  border-top-color: #f5a623 !important;
  border-radius: 50% !important;
  animation: ttf-spin 0.7s linear infinite !important;
}
#ttf-root .ttf-empty,
#ttf-root .ttf-error {
  text-align: center !important;
  padding: 60px 24px !important;
  color: #999 !important;
  font-size: 0.85rem !important;
  grid-column: 1 / -1 !important;
}
#ttf-root .ttf-error { color: #c44 !important; }

/* ═══════════════════════════════════════════════════════════
   MOBILE — large tap targets, readable text
═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  #ttf-root .ttf-topbar { padding: 12px 0 !important; }
  #ttf-root .ttf-title  { font-size: 1.3rem !important; }

  #ttf-root .ttf-filterbar {
    flex-direction: column !important;
    gap: 0 !important;
    margin: 12px 0 16px !important;
  }
  #ttf-root .ttf-filter-left {
    width: 100% !important;
    overflow: visible !important;
  }
  #ttf-root .ttf-filter-icon { display: none !important; }
  #ttf-root .ttf-cat-chips {
    padding: 6px 6px !important;
  }
  #ttf-root .ttf-cat-chip {
    font-size: 0.8rem !important;
    padding: 9px 14px !important;
    min-height: 38px !important;
    margin: 4px !important;
  }
  #ttf-root .ttf-filter-right {
    width: 100% !important;
    border-left: none !important;
    border-top: 1px solid #eee !important;
    padding: 10px 12px !important;
  }
  #ttf-root .ttf-source-select {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 0.85rem !important;
  }

  #ttf-root .ttf-search { width: 150px !important; font-size: 0.82rem !important; }
  #ttf-root .ttf-search:focus { width: 180px !important; }

  #ttf-root .ttf-load-more {
    width: 100% !important;
    padding: 16px 24px !important;
    font-size: 1rem !important;
    min-height: 54px !important;
    border-radius: 8px !important;
  }

  #ttf-root .ttf-feat-img-wrap { min-height: 200px !important; }
  #ttf-root .ttf-card-img-wrap  { min-height: 150px !important; }
}
