/* =====================================================
   CREATORZ TOOLS HUB — Frontend Styles v2.5
   Exact match to the editorial reference design:
   warm ivory canvas, single terracotta accent, serif
   display headings, clean 1px borders, no gradients.
   Class names/hooks unchanged so search/filter/pagination
   JS keeps working — only the visuals were rebuilt.
   ===================================================== */

.cth-hub, .cth-hub *, .cth-hub *::before, .cth-hub *::after { box-sizing: border-box; }

.cth-hub {
  --cth-bg:          #FAF8F5;   /* warm ivory canvas */
  --cth-surface:     #ffffff;
  --cth-border:      #E6E2DC;   /* clean structural borders */
  --cth-text:        #2C3531;   /* soft dark charcoal */
  --cth-muted:       #626B66;   /* subtle mid-tone */
  --cth-muted-soft:  #9A9F98;
  --cth-card-bg:     #ffffff;
  --cth-shadow:      rgba(0,0,0,.03);
  --cth-input-bg:    #ffffff;
  --cth-pill-bg:     none;
  --cth-pill-border: #E6E2DC;
  --cth-accent-1:    #D96B43;   /* terracotta/clay accent */
  --cth-accent-2:    #D96B43;
  --cth-accent-soft: #FCEBE6;
  --cth-focus:       #D96B43;
  --cth-radius:      6px;
  --cth-font-d:      Georgia, Times, 'Times New Roman', serif;
  --cth-font-b:      system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Design Customizer overrides (set inline per-instance; these are fallbacks) */
  --cth-border-width: 1px;
  --cth-card-padding: 40px;
  --cth-grid-gap:      32px;
  --cth-overlay:       rgba(0,0,0,0);
  --cth-anim-speed:    450ms;

  display: block;
  font-family:    var(--cth-font-b);
  color:          var(--cth-text);
  background:     var(--cth-bg);
  padding:        0 0 8rem;
  position:       relative;
  overflow:       hidden;
  min-height:     480px;
  line-height:    1.6;
  -webkit-font-smoothing: antialiased;
  transition:     background .3s ease, color .3s ease;
}

/* Dark mode kept as a bonus (reference has no dark variant,
   so it simply inverts the same palette). */
.cth-hub.cth-dark {
  --cth-bg:          #131B16;
  --cth-surface:     #1B231E;
  --cth-border:      #2A322D;
  --cth-text:        #FAF8F5;
  --cth-muted:       #A3ACA6;
  --cth-muted-soft:  #78827C;
  --cth-card-bg:     #1B231E;
  --cth-shadow:      rgba(0,0,0,.4);
  --cth-input-bg:    #1F2822;
  --cth-pill-border: #2A322D;
  --cth-accent-1:    #E2825D;
  --cth-accent-2:    #E2825D;
  --cth-accent-soft: rgba(226,130,93,.16);
  --cth-focus:       #E2825D;
}

.cth-hub::before { content: none; }
.cth-hub > * { position: relative; z-index: 1; box-sizing: border-box; font-family: var(--cth-font-b); }

.cth-hub a:focus-visible,
.cth-hub button:focus-visible,
.cth-hub input:focus-visible {
  outline: 2.5px solid var(--cth-focus) !important;
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .cth-hub, .cth-hub * { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

/* ── HERO HEADER (exact match to reference .hero) ── */
.cth-hub-header {
  max-width:       1400px;
  margin:          0 auto;
  padding:         6rem 2rem 4rem;
  border-bottom:   1px solid var(--cth-border);
  display:         block;
}
.cth-hub-header-text { max-width: 900px; }

.cth-hub-title {
  font-family:    var(--cth-font-d);
  font-size:      clamp(2.5rem, 5vw, 4rem);
  line-height:    1.15;
  font-weight:    400;
  color:          var(--cth-text);
  max-width:      900px;
  margin:         0 0 1.5rem;
  letter-spacing: -1px;
}
.cth-hub-title .cth-accent { font-style: italic; color: var(--cth-accent-1); }

.cth-hub-subtitle {
  font-size:   1.2rem;
  color:       var(--cth-muted);
  margin:      0;
  max-width:   600px;
  font-weight: 400;
}

/* Search + theme toggle sit in their own row under the hero,
   styled as plain as the reference's filter buttons. */
.cth-hub-controls {
  max-width:   1400px;
  margin:      0 auto;
  padding:     1.5rem 2rem 0;
  display:     flex;
  align-items: center;
  justify-content: flex-end;
  gap:         .5rem;
  flex-wrap:   wrap;
}

.cth-search-wrap {
  display:        flex;
  align-items:    center;
  gap:            9px;
  flex:           0 1 260px;
  min-width:      0;
  height:         38px;
  padding:        0 1rem;
  background:     none !important;
  border:         1px solid var(--cth-border) !important;
  border-radius:  4px !important;
  box-shadow:     none !important;
  outline:        none !important;
  transition:     border-color .18s ease;
}
.cth-search-wrap:focus-within { border-color: var(--cth-accent-1) !important; }
.cth-search-icon { flex: 0 0 15px; width: 15px; height: 15px; color: var(--cth-muted-soft); pointer-events: none; }
.cth-search-wrap:focus-within .cth-search-icon { color: var(--cth-accent-1); }
.cth-search-input {
  flex: 1 1 auto; min-width: 0; width: 100%; height: 100%;
  color: var(--cth-text) !important; font-size: .9rem !important; font-family: var(--cth-font-b) !important;
  background: transparent !important; border: 0 !important; outline: 0 !important; box-shadow: none !important;
  padding: 0 !important; margin: 0 !important; -webkit-appearance: none; appearance: none;
}
.cth-search-input::placeholder { color: var(--cth-muted-soft); opacity: 1; }

.cth-theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 4px !important;
  border: 1px solid var(--cth-border) !important;
  background: none !important;
  color: var(--cth-muted);
  cursor: pointer; outline: none !important; box-shadow: none !important;
  transition: border-color .18s ease, color .18s ease;
}
.cth-theme-toggle:hover { color: var(--cth-accent-1); border-color: var(--cth-accent-1) !important; }
.cth-theme-toggle svg { width: 16px; height: 16px; }
.cth-theme-toggle .cth-icon-moon { display: none; }
.cth-hub.cth-dark .cth-theme-toggle .cth-icon-sun  { display: none; }
.cth-hub.cth-dark .cth-theme-toggle .cth-icon-moon { display: block; }

/* ── UTILITY BAR / CATEGORY FILTERS (exact match) ── */
.cth-cats {
  max-width:       1400px;
  margin:          0 auto;
  padding:         2.5rem 2rem;
  display:         flex;
  flex-wrap:       wrap;
  gap:             .5rem;
}
.cth-cat {
  background:    none !important;
  border:        1px solid var(--cth-border) !important;
  border-radius: 4px !important;
  color:         var(--cth-muted);
  font-family:   var(--cth-font-b);
  font-size:     .9rem;
  font-weight:   400;
  padding:       .5rem 1rem;
  cursor:        pointer;
  outline:       none !important;
  box-shadow:    none !important;
  transition:    all .2s ease;
  display:       inline-flex;
  align-items:   center;
  gap:           6px;
  white-space:   nowrap;
}
.cth-cat.active, .cth-cat:hover {
  background-color: var(--cth-text) !important;
  color:            #fff;
  border-color:     var(--cth-text) !important;
}
.cth-cat-count { font-size: .78rem; opacity: .8; }

/* ── TOOLS GRID (exact match to .tools-grid) ── */
.cth-grid {
  max-width:              1400px;
  margin:                 0 auto;
  padding:                0 2rem;
  display:                grid;
  grid-template-columns:  repeat(auto-fill, minmax(320px, 1fr));
  gap:                    var(--cth-grid-gap, 2rem);
  transition:             opacity .3s ease;
}

/* ── TOOL CARD (exact match to .tool-card) ── */
.cth-card {
  position:       relative;
  background:     var(--cth-card-bg);
  border:         var(--cth-border-width, 1px) solid var(--cth-border);
  border-radius:  var(--cth-radius, 6px);
  padding:        var(--cth-card-padding, 40px) calc(var(--cth-card-padding, 40px) * .8);
  display:        flex;
  flex-direction: column;
  justify-content: space-between;
  cursor:         pointer;
  overflow:       hidden;
  transition:     transform .2s ease, box-shadow .2s ease;
  animation:      cthCardIn var(--cth-anim-speed, 450ms) ease both;
}
.cth-card:nth-child(1) { animation-delay: .03s; }
.cth-card:nth-child(2) { animation-delay: .06s; }
.cth-card:nth-child(3) { animation-delay: .09s; }
.cth-card:nth-child(4) { animation-delay: .12s; }
.cth-card:nth-child(5) { animation-delay: .15s; }
.cth-card:nth-child(6) { animation-delay: .18s; }
.cth-card:nth-child(7) { animation-delay: .21s; }
.cth-card:nth-child(8) { animation-delay: .24s; }
@keyframes cthCardIn      { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cthCardInFade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes cthCardInZoom  { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes cthCardInSlide { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: translateX(0); } }

/* Entrance style is selected via [data-animation] on the .cth-hub wrapper,
   set from the Design Customizer's "Card Entrance Style" setting. */
.cth-hub[data-animation="none"]      .cth-card { animation: none; opacity: 1; }
.cth-hub[data-animation="fade-up"]   .cth-card { animation-name: cthCardIn; }
.cth-hub[data-animation="fade"]      .cth-card { animation-name: cthCardInFade; }
.cth-hub[data-animation="zoom"]      .cth-card { animation-name: cthCardInZoom; }
.cth-hub[data-animation="slide"]     .cth-card { animation-name: cthCardInSlide; }

.cth-card:hover {
  transform:  translateY(-2px);
  box-shadow: 0 10px 30px var(--cth-shadow);
}

/* ── CARD OVERLAY TINT ──
   A colour wash that fades in over the card on hover. Fully transparent
   (opacity 0) by default so it's invisible unless enabled via the
   Design Customizer's Overlay Colour + Overlay Opacity settings. */
.cth-card-overlay {
  position:       absolute;
  inset:          0;
  background:     var(--cth-overlay, rgba(0,0,0,0));
  opacity:        0;
  pointer-events: none;
  transition:     opacity .25s ease;
  z-index:        0;
}
.cth-card:hover .cth-card-overlay { opacity: 1; }
.cth-card > div,
.cth-card > .cth-launch { position: relative; z-index: 1; }

.cth-card-top {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-bottom:   1.5rem;
}

.cth-badge {
  font-size:      .75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight:    600;
  padding:        .25rem .5rem;
  border-radius:  3px;
  background-color: #F0EDE9;
  color:          var(--cth-muted);
}
.cth-hub.cth-dark .cth-badge { background-color: rgba(255,255,255,.08); }
.cth-card.hot .cth-badge {
  background-color: var(--cth-accent-soft);
  color:            var(--cth-accent-1);
}

.cth-tool-name {
  font-family: var(--cth-font-d);
  font-size:   1.6rem;
  font-weight: 400;
  margin:      0 0 .75rem;
  color:       var(--cth-text);
}

.cth-tool-desc {
  font-size:   .95rem;
  color:       var(--cth-muted);
  margin:      0 0 2.5rem;
  line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── LAUNCH BUTTON (exact match to .tool-action) ── */
.cth-launch {
  display:          inline-flex;
  align-items:      center;
  justify-content:  space-between;
  width:            100%;
  padding:          .85rem 1rem;
  background-color: var(--cth-bg) !important;
  border:           1px solid var(--cth-border) !important;
  color:            var(--cth-text) !important;
  text-decoration:  none !important;
  font-weight:      500;
  font-size:        .95rem;
  border-radius:    4px;
  cursor:           pointer;
  transition:       all .2s ease;
}
.cth-launch:hover {
  background-color: var(--cth-accent-1) !important;
  border-color:     var(--cth-accent-1) !important;
  color:            #fff !important;
  text-decoration:  none !important;
}
.cth-launch span[aria-hidden] { font-size: 1rem; }

/* ── PAGINATION ── */
.cth-pag { max-width: 1400px; margin: 3rem auto 0; padding: 0 2rem; display: flex; align-items: center; justify-content: center; gap: 14px; }
.cth-pag-arrow {
  display: flex; align-items: center; gap: 6px;
  background: none !important; border: 1px solid var(--cth-border) !important; border-radius: 4px !important;
  color: var(--cth-muted); font-family: var(--cth-font-b); font-size: .86rem; font-weight: 500;
  padding: 9px 16px; cursor: pointer; outline: none !important; box-shadow: none !important; transition: all .18s ease;
}
.cth-pag-arrow:hover:not(:disabled) { color: #fff; border-color: var(--cth-accent-1) !important; background: var(--cth-accent-1) !important; }
.cth-pag-arrow:disabled { opacity: .35; cursor: not-allowed; }
.cth-pag-arrow svg { width: 17px; height: 17px; }
.cth-dots { display: flex; gap: 7px; align-items: center; }
.cth-dot { width: 8px; height: 8px; border: 0; border-radius: 4px; background: var(--cth-border); cursor: pointer; padding: 0; outline: none; transition: all .2s ease; }
.cth-dot.active { background: var(--cth-accent-1); width: 22px; }
.cth-dot:hover:not(.active) { background: var(--cth-muted-soft); }

/* ── NO RESULTS ── */
.cth-no-results { text-align: center; color: var(--cth-muted); padding: 56px 20px; font-size: .95rem; }

/* ── HIDDEN (for filter/pagination) ── */
.cth-card.cth-hidden { display: none !important; }
.cth-grid.cth-fading { opacity: .4; }

/* ── MOBILE (exact match to reference breakpoint) ── */
@media (max-width: 768px) {
  .cth-hub-header  { padding: 4rem 1rem 2rem; }
  .cth-hub-controls { padding: 1rem 1rem 0; justify-content: flex-start; }
  .cth-cats        { padding: 1.5rem 1rem; }
  .cth-grid        { padding: 0 1rem; gap: 1.25rem; }
  .cth-card        { padding: 2rem 1.5rem; }
  .cth-pag         { padding: 0 1rem; }
}
