/* ================================================================
   FetchWire v1.1.0 — All 5 Layouts, fully responsive
   ================================================================ */

/* ── CSS custom properties ──────────────────────────────────────── */
.fw-wrap {
	--fw-accent:  var(--color-accent, #c8102e);
	--fw-radius:  12px;
	--fw-gap:     1.25rem;
	--fw-shadow:  0 2px 14px rgba(0, 0, 0, 0.08);
	width: 100%;
	max-width: 100%;
	overflow-x: hidden;
	box-sizing: border-box;
	font-family: inherit;
}

*, *::before, *::after { box-sizing: inherit; }

/* ── Shared: category badge ─────────────────────────────────────── */
.fw-cat {
	display: inline-block;
	align-self: flex-start;
	width: fit-content;
	max-width: 100%;
	padding: 0.2rem 0.6rem;
	border-radius: 100px;
	background: var(--fw-accent);
	color: #fff;
	font-size: 0.6rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	line-height: 1.4;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── Shared: date ───────────────────────────────────────────────── */
.fw-date {
	font-size: 0.72rem;
	font-weight: 600;
	color: #aaa;
	white-space: nowrap;
}

/* ── Shared: read more ──────────────────────────────────────────── */
.fw-read-more {
	font-size: 0.72rem;
	font-weight: 700;
	color: var(--fw-accent);
	white-space: nowrap;
}

/* ── Shared: no-image placeholder ──────────────────────────────── */
.fw-no-img {
	width: 100%;
	height: 100%;
	min-height: 120px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #1a1a2e, #16213e);
	color: rgba(255, 255, 255, 0.2);
	font-size: clamp(1.25rem, 4vw, 2rem);
	font-weight: 900;
	letter-spacing: -0.02em;
	user-select: none;
}

/* ── Shared: anchor reset ───────────────────────────────────────── */
.fw-card,
.fw-mag-featured,
.fw-mag-item,
.fw-list-item,
.fw-overlay-card,
.fw-ticker-item {
	text-decoration: none;
	color: inherit;
	display: block;
}

/* ── Empty / error state ────────────────────────────────────────── */
.fw-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	padding: 3rem 1rem;
	text-align: center;
	color: #bbb;
	border: 2px dashed #e0e0e0;
	border-radius: var(--fw-radius);
}

.fw-empty p { margin: 0; font-size: 0.9rem; color: #999; }
.fw-empty__reason { max-width: 420px; text-align: center; line-height: 1.6; color: #888 !important; font-size: 0.82rem !important; }

/* ── Section header ─────────────────────────────────────────────── */
.fw-header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
	flex-wrap: wrap;
}

.fw-header__text { min-width: 0; flex: 1; }

.fw-header__title {
	font-size: clamp(1rem, 2.5vw, 1.25rem);
	font-weight: 900;
	color: #111;
	margin: 0 0 0.2rem;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.fw-header__sub {
	font-size: 0.85rem;
	color: #888;
	margin: 0;
	line-height: 1.5;
}

.fw-header__link {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--fw-accent);
	text-decoration: none;
	white-space: nowrap;
	flex-shrink: 0;
}

.fw-header__link:hover { text-decoration: underline; }

/* ── Column grid helpers ────────────────────────────────────────── */
.fw-cards-grid,
.fw-overlay-grid {
	display: grid;
	gap: var(--fw-gap);
	/* Prevent the grid itself from overflowing its Elementor container */
	width: 100%;
	max-width: 100%;
	overflow: hidden;
}

.fw-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fw-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fw-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ================================================================
   LAYOUT 1 — CARDS GRID
   ================================================================ */

.fw-card {
	background: #fff;
	border-radius: var(--fw-radius);
	overflow: hidden;
	box-shadow: var(--fw-shadow);
	transition: transform 0.25s, box-shadow 0.25s;
	display: flex;
	flex-direction: column;
	height: 100%;
	min-width: 0; /* allow grid item to shrink below content width */
}

.fw-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.13);
}

.fw-card__img {
	position: relative;
	width: 100%;
	overflow: hidden;
	aspect-ratio: 3 / 2;
	background: #f0f0f0;
	flex-shrink: 0;
}

.fw-card__img img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.fw-card:hover .fw-card__img img { transform: scale(1.05); }

.fw-card__img .fw-cat {
	position: absolute;
	bottom: 0.6rem;
	left: 0.6rem;
	z-index: 1;
}

.fw-card__img .fw-no-img { min-height: 0; height: 100%; position: absolute; inset: 0; }

.fw-card__body {
	padding: 1rem 1.1rem 1.1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	flex: 1;
}

.fw-card__title {
	font-size: clamp(0.85rem, 1.5vw, 0.95rem);
	font-weight: 800;
	color: #111;
	margin: 0;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fw-card:hover .fw-card__title { color: var(--fw-accent); }

.fw-card__excerpt {
	font-size: 0.82rem;
	color: #666;
	line-height: 1.6;
	margin: 0;
	flex: 1;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fw-card__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-top: auto;
	padding-top: 0.6rem;
	border-top: 1px solid #f5f5f5;
	flex-wrap: wrap;
}

/* ================================================================
   LAYOUT 2 — MAGAZINE
   ================================================================ */

.fw-magazine {
	display: grid;
	grid-template-columns: 1fr 300px;
	gap: var(--fw-gap);
	align-items: stretch;
}

/* Featured hero */
.fw-mag-featured {
	position: relative;
	border-radius: var(--fw-radius);
	overflow: hidden;
	min-height: 400px;
	display: flex;
	align-items: flex-end;
	background: #111;
}

.fw-mag-featured__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.5s ease;
}

.fw-mag-featured:hover .fw-mag-featured__img { transform: scale(1.04); }

.fw-mag-featured__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.9)  0%,
		rgba(0, 0, 0, 0.4)  45%,
		transparent         72%
	);
}

.fw-mag-featured__body {
	position: relative;
	z-index: 1;
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
	width: 100%;
}

.fw-mag-featured__title {
	font-size: clamp(1rem, 2.2vw, 1.45rem);
	font-weight: 900;
	color: #fff;
	margin: 0;
	line-height: 1.25;
	letter-spacing: -0.02em;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fw-mag-featured__excerpt {
	font-size: 0.83rem;
	color: rgba(255, 255, 255, 0.68);
	line-height: 1.55;
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fw-mag-featured .fw-date { color: rgba(255, 255, 255, 0.48); }

/* Secondary sidebar */
.fw-mag-secondary {
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: var(--fw-radius);
	overflow: hidden;
	box-shadow: var(--fw-shadow);
}

.fw-mag-item {
	display: flex;
	gap: 0.85rem;
	align-items: center;
	padding: 0.85rem 1rem;
	border-bottom: 1px solid #f5f5f5;
	transition: background 0.15s;
	flex: 1;
}

.fw-mag-item:last-child { border-bottom: none; }
.fw-mag-item:hover { background: #fafafa; }

.fw-mag-item__img {
	width: 66px;
	height: 54px;
	min-width: 66px;
	flex-shrink: 0;
	border-radius: 7px;
	overflow: hidden;
	background: #f0f0f0;
}

.fw-mag-item__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s;
}

.fw-mag-item:hover .fw-mag-item__img img { transform: scale(1.06); }

.fw-mag-item__img .fw-no-img { min-height: 0; height: 100%; font-size: 0.7rem; }

.fw-mag-item__body {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	min-width: 0;
	flex: 1;
}

.fw-mag-item__title {
	font-size: 0.8rem;
	font-weight: 700;
	color: #111;
	margin: 0;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fw-mag-item:hover .fw-mag-item__title { color: var(--fw-accent); }

/* ================================================================
   LAYOUT 3 — LIST
   ================================================================ */

.fw-list {
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: var(--fw-radius);
	overflow: hidden;
	box-shadow: var(--fw-shadow);
}

.fw-list-item {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid #f5f5f5;
	transition: background 0.15s;
	min-height: 88px;
}

.fw-list-item:last-child { border-bottom: none; }
.fw-list-item:hover { background: #fafafa; }

.fw-list-item__num {
	font-size: 0.7rem;
	font-weight: 900;
	color: var(--fw-accent);
	opacity: 0.5;
	width: 22px;
	min-width: 22px;
	text-align: center;
	flex-shrink: 0;
	transition: opacity 0.2s;
}

.fw-list-item:hover .fw-list-item__num { opacity: 1; }

.fw-list-item__img {
	width: 96px;
	min-width: 96px;
	height: 68px;
	flex-shrink: 0;
	border-radius: 8px;
	overflow: hidden;
	background: #f0f0f0;
}

.fw-list-item__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s;
}

.fw-list-item:hover .fw-list-item__img img { transform: scale(1.06); }

.fw-list-item__img .fw-no-img { min-height: 0; height: 100%; font-size: 0.7rem; }

.fw-list-item__body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.28rem;
}

.fw-list-item__title {
	font-size: clamp(0.82rem, 1.8vw, 0.92rem);
	font-weight: 800;
	color: #111;
	margin: 0;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fw-list-item:hover .fw-list-item__title { color: var(--fw-accent); }

.fw-list-item__excerpt {
	font-size: 0.78rem;
	color: #888;
	margin: 0;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fw-list-item__arrow {
	color: #d0d0d0;
	flex-shrink: 0;
	transition: color 0.2s, transform 0.2s;
	margin-left: 0.5rem;
}

.fw-list-item:hover .fw-list-item__arrow {
	color: var(--fw-accent);
	transform: translateX(3px);
}

/* ================================================================
   LAYOUT 4 — OVERLAY CARDS
   ================================================================ */

.fw-overlay-card {
	position: relative;
	border-radius: var(--fw-radius);
	overflow: hidden;
	aspect-ratio: 2 / 3;
	min-width: 0; /* allow grid item to shrink below content width */
	background-size: cover;
	background-position: center;
	background-color: #111;
	display: flex;
	align-items: flex-end;
	transition: transform 0.3s;
}

.fw-overlay-card:hover { transform: scale(1.02); }

.fw-overlay-card--no-img { background: linear-gradient(135deg, #1a1a2e, #16213e); }

.fw-overlay-card__gradient {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.92) 0%,
		rgba(0, 0, 0, 0.5)  42%,
		rgba(0, 0, 0, 0.08) 72%,
		transparent         100%
	);
	transition: background 0.3s;
}

.fw-overlay-card:hover .fw-overlay-card__gradient {
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.96) 0%,
		rgba(0, 0, 0, 0.62) 48%,
		rgba(0, 0, 0, 0.15) 75%,
		transparent         100%
	);
}

.fw-overlay-card__body {
	position: relative;
	z-index: 1;
	padding: 1.1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	width: 100%;
}

.fw-overlay-card__title {
	font-size: clamp(0.82rem, 1.6vw, 0.95rem);
	font-weight: 800;
	color: #fff;
	margin: 0;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fw-overlay-card .fw-date { color: rgba(255, 255, 255, 0.48); }

/* ================================================================
   LAYOUT 5 — TICKER
   ================================================================ */

.fw-ticker {
	display: flex;
	flex-direction: column;
	border-radius: var(--fw-radius);
	overflow: hidden;
	box-shadow: var(--fw-shadow);
}

.fw-ticker-item {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	padding: 0.8rem 1rem;
	background: #fff;
	border-bottom: 1px solid #f2f2f2;
	transition: background 0.15s;
	min-height: 60px;
}

.fw-ticker-item:last-child { border-bottom: none; }
.fw-ticker-item:hover { background: #fafafa; }
.fw-ticker-item:nth-child(even) { background: #fdfdfd; }
.fw-ticker-item:nth-child(even):hover { background: #f7f7f7; }

.fw-ticker-item__num {
	font-size: 0.65rem;
	font-weight: 900;
	color: var(--fw-accent);
	opacity: 0.4;
	min-width: 20px;
	text-align: center;
	flex-shrink: 0;
	transition: opacity 0.2s;
}

.fw-ticker-item:hover .fw-ticker-item__num { opacity: 1; }

.fw-ticker-item__img {
	width: 46px;
	height: 46px;
	min-width: 46px;
	flex-shrink: 0;
	border-radius: 6px;
	overflow: hidden;
	background: #e8e8e8;
}

.fw-ticker-item__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.fw-ticker-item__img .fw-no-img { min-height: 0; height: 100%; font-size: 0.55rem; }

.fw-ticker-item__body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.fw-ticker-item__title {
	font-size: clamp(0.78rem, 1.4vw, 0.85rem);
	font-weight: 700;
	color: #222;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color 0.15s;
}

.fw-ticker-item:hover .fw-ticker-item__title { color: var(--fw-accent); }

.fw-ticker-item .fw-cat { margin-top: 0; }

.fw-ticker-item__right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.3rem;
	flex-shrink: 0;
}

.fw-ticker-item__right svg {
	color: #ccc;
	transition: color 0.15s, transform 0.15s;
}

.fw-ticker-item:hover .fw-ticker-item__right svg {
	color: var(--fw-accent);
	transform: translateX(2px);
}

/* ================================================================
   RESPONSIVE — Desktop large (1280px+): no changes needed
   ================================================================ */

/* ── 1200px: 4-col → 3-col ────────────────────────────────────── */
@media (max-width: 1200px) {
	.fw-cols-4 { grid-template-columns: repeat(3, 1fr); }
}

/* ── 1024px: 3-col → 2-col, magazine tightens ─────────────────── */
@media (max-width: 1024px) {
	.fw-cols-3,
	.fw-cols-4 { grid-template-columns: repeat(2, 1fr); }

	.fw-magazine { grid-template-columns: 1fr 260px; }

	.fw-mag-featured { min-height: 340px; }
}

/* ── 900px: magazine sidebar flips to 2-col strip ─────────────── */
@media (max-width: 900px) {
	.fw-magazine {
		grid-template-columns: 1fr;
	}

	.fw-mag-featured { min-height: 300px; }

	.fw-mag-secondary {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
	}

	.fw-mag-item {
		border-bottom: 1px solid #f5f5f5;
		border-right: none;
	}

	/* Remove bottom border on last row items */
	.fw-mag-secondary .fw-mag-item:nth-last-child(-n+2) {
		border-bottom: none;
	}
}

/* ── 768px: 2-col → 1-col for overlay; list tightens ──────────── */
@media (max-width: 768px) {
	.fw-cols-2 { grid-template-columns: repeat(2, 1fr); }

	/* Cards stay 2-col down to 768 */
	.fw-cols-3,
	.fw-cols-4 { grid-template-columns: repeat(2, 1fr); }

	/* Overlay: portrait ratio relaxed */
	.fw-overlay-card { aspect-ratio: 3 / 4; }

	/* List */
	.fw-list-item__img { width: 80px; min-width: 80px; height: 60px; }
	.fw-list-item { padding: 0.85rem 1rem; }

	/* Ticker */
	.fw-ticker-item { padding: 0.7rem 0.85rem; }

	.fw-header { margin-bottom: 1.1rem; }
}

/* ── 600px: magazine 2-col strip → 1-col ──────────────────────── */
@media (max-width: 600px) {
	.fw-mag-secondary { grid-template-columns: 1fr; }

	.fw-mag-secondary .fw-mag-item:nth-last-child(-n+2) {
		border-bottom: 1px solid #f5f5f5;
	}
	.fw-mag-secondary .fw-mag-item:last-child { border-bottom: none; }
}

/* ── 520px: everything single column ──────────────────────────── */
@media (max-width: 520px) {
	.fw-cols-2,
	.fw-cols-3,
	.fw-cols-4 { grid-template-columns: 1fr; }

	.fw-mag-featured { min-height: 260px; }

	.fw-mag-featured__body { padding: 1rem; }

	.fw-overlay-card { aspect-ratio: 4 / 3; }

	/* List: hide number, shrink image */
	.fw-list-item__num { display: none; }
	.fw-list-item__img { width: 68px; min-width: 68px; height: 56px; }
	.fw-list-item__excerpt { display: none; }

	/* Ticker: hide number */
	.fw-ticker-item__num { display: none; }

	.fw-header__link { font-size: 0.7rem; }
}

/* ── 380px: very small phones ─────────────────────────────────── */
@media (max-width: 380px) {
	.fw-card__body { padding: 0.85rem; }

	.fw-list-item { gap: 0.65rem; padding: 0.75rem 0.85rem; }
	.fw-list-item__img { width: 58px; min-width: 58px; height: 50px; }

	.fw-ticker-item__img { width: 38px; height: 38px; min-width: 38px; }

	.fw-mag-featured__title { -webkit-line-clamp: 2; }
}
