/* TSNYC Visual Overhaul - intentionally broad but non-destructive */
.tsnyc-visual-overhaul {
  --tsnyc-text:#151515;
  --tsnyc-muted:#626262;
  --tsnyc-border:rgba(0,0,0,.09);
  --tsnyc-shadow:0 10px 28px rgba(0,0,0,.08);
  --tsnyc-shadow-hover:0 16px 38px rgba(0,0,0,.13);
}

.tsnyc-visual-overhaul main img,
.tsnyc-visual-overhaul article img,
.tsnyc-visual-overhaul .entry-content img,
.tsnyc-visual-overhaul .elementor img {
  max-width:100%;
  height:auto;
}

/* Cards used by WordPress, Elementor and custom TSNYC layouts */
.tsnyc-visual-overhaul :is(article,.wp-block-post,.elementor-post,.elementor-grid-item,.tsnyc-card,.post-card,.blog-card,.guide-card,.hub-card) {
  border-radius:var(--tsnyc-radius,16px);
}

.tsnyc-visual-overhaul.tsnyc-improve-cards :is(.wp-block-post,.elementor-post,.elementor-grid-item,.tsnyc-card,.post-card,.blog-card,.guide-card,.hub-card) {
  overflow:hidden;
  background:#fff;
  border:1px solid var(--tsnyc-border);
  box-shadow:var(--tsnyc-shadow);
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tsnyc-visual-overhaul.tsnyc-improve-cards :is(.wp-block-post,.elementor-post,.elementor-grid-item,.tsnyc-card,.post-card,.blog-card,.guide-card,.hub-card):hover {
  transform:translateY(-2px);
  box-shadow:var(--tsnyc-shadow-hover);
  border-color:rgba(0,0,0,.15);
}

/* Normalize card/featured images only - not ordinary inline article photos */
.tsnyc-visual-overhaul.tsnyc-force-ratio :is(.wp-block-post-featured-image,.elementor-post__thumbnail,.post-thumbnail,.featured-image,.card-image,.hero-card) img {
  width:100%;
  aspect-ratio:16/9;
  object-fit:cover;
  object-position:center;
  display:block;
}

/* Image readability: JS adds this only to blocks where text overlaps an image */
.tsnyc-visual-overhaul .tsnyc-has-image-text {
  position:relative;
  isolation:isolate;
  overflow:hidden;
}
.tsnyc-visual-overhaul .tsnyc-has-image-text::before {
  content:"";
  position:absolute;
  inset:0;
  z-index:-1;
  pointer-events:none;
  background:linear-gradient(to top, rgba(0,0,0,calc(var(--tsnyc-overlay,.34) + .14)) 0%, rgba(0,0,0,var(--tsnyc-overlay,.34)) 58%, rgba(0,0,0,.06) 100%);
}
.tsnyc-visual-overhaul .tsnyc-has-image-text :is(h1,h2,h3,h4,p,.category,.eyebrow,.meta,.label,a) {
  text-shadow:0 2px 8px rgba(0,0,0,.58);
}
.tsnyc-visual-overhaul .tsnyc-has-image-text :is(h1,h2,h3,h4) { color:#fff !important; }
.tsnyc-visual-overhaul .tsnyc-has-image-text :is(p,.meta,.category,.eyebrow,.label) { color:rgba(255,255,255,.94) !important; }

/* If a photo itself is extremely dark, slightly lift it rather than darkening it further. */
.tsnyc-visual-overhaul .tsnyc-dark-photo img { filter:brightness(1.12) contrast(.98); }

/* Better typography and line lengths on generated hub/category pages */
.tsnyc-visual-overhaul main :is(h1,h2,h3) { text-wrap:balance; }
.tsnyc-visual-overhaul main p { text-wrap:pretty; }
.tsnyc-visual-overhaul main :is(p,li) { line-height:1.62; }
.tsnyc-visual-overhaul main h1 { line-height:1.08; }
.tsnyc-visual-overhaul main h2 { line-height:1.15; }
.tsnyc-visual-overhaul main h3 { line-height:1.22; }

/* Clean small topic chips / category links */
.tsnyc-visual-overhaul .tsnyc-topic-chip {
  display:inline-flex;
  align-items:center;
  min-height:36px;
  padding:8px 13px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.10);
  background:#fff;
  text-decoration:none;
  font-weight:600;
  line-height:1.1;
}
.tsnyc-visual-overhaul .tsnyc-topic-chip:hover { border-color:rgba(0,0,0,.24); transform:translateY(-1px); }

/* Make image links feel clickable */
.tsnyc-visual-overhaul a:has(> img) img { transition:transform .22s ease, filter .22s ease; }
.tsnyc-visual-overhaul a:has(> img):hover img { transform:scale(1.012); }

/* remove visual gap when JS hides duplicate/empty items */
.tsnyc-visual-overhaul .tsnyc-hidden { display:none !important; }

/* Prevent super-wide text blocks on hub pages while preserving full-width imagery */
.tsnyc-visual-overhaul .entry-content > :is(p,ul,ol,h1,h2,h3,h4,blockquote):not(.alignwide):not(.alignfull) {
  max-width:78ch;
}

@media (max-width: 782px) {
  .tsnyc-visual-overhaul main h1 { font-size:clamp(2rem,9vw,3rem); }
  .tsnyc-visual-overhaul main h2 { font-size:clamp(1.5rem,6.5vw,2.25rem); }
  .tsnyc-visual-overhaul :is(.wp-block-post,.elementor-post,.elementor-grid-item,.tsnyc-card,.post-card,.blog-card,.guide-card,.hub-card) { border-radius:14px; }
}
