/* Tandem News — front-end layouts */

.tn-news {
	--tn-gap: 24px;
	--tn-radius: 10px;
	--tn-accent: #1d4ed8;
	--tn-text: inherit;
	--tn-muted: #6b7280;
	--tn-card-bg: #fff;
	--tn-border: rgba(0, 0, 0, .08);
	--tn-ratio: 16 / 9;
	--tn-logo-height: 48px;
	box-sizing: border-box;
}
.tn-news *, .tn-news *::before, .tn-news *::after { box-sizing: inherit; }

/* Shared item parts ------------------------------------------------------ */
.tn-item { position: relative; display: flex; flex-direction: column; min-width: 0; color: var(--tn-text); }
.tn-item__media { position: relative; overflow: hidden; aspect-ratio: var(--tn-ratio); background: #f3f4f6; }
.tn-item__media a { display: block; height: 100%; }
.tn-item__image { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.tn-item:hover .tn-item__image { transform: scale(1.04); }

.tn-item__body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 18px; }
.tn-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: .8rem; color: var(--tn-muted); }
.tn-item__medium { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--tn-accent); }
.tn-item__medium-logo { display: block; height: 22px; width: auto; max-width: 120px; object-fit: contain; }
.tn-item__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.tn-item__cat { padding: 2px 9px; border: 1px solid currentColor; border-radius: 999px; font-size: .7rem; line-height: 1.4; opacity: .8; }
.tn-item__title { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.tn-item__title a { color: inherit; text-decoration: none; }
.tn-item__title a:hover { color: var(--tn-accent); }
.tn-item__excerpt { font-size: .95rem; line-height: 1.55; color: var(--tn-muted); }
.tn-item__button {
	align-self: flex-start; margin-top: auto; padding: 8px 16px; border-radius: 6px;
	background: var(--tn-accent); color: #fff; font-size: .875rem; font-weight: 600; text-decoration: none;
	transition: opacity .2s;
}
.tn-item__button:hover { opacity: .85; color: #fff; }

/* Grid --------------------------------------------------------------------- */
.tn-news--grid,
.tn-news--overlay,
.tn-news--logos {
	display: grid;
	gap: var(--tn-gap);
	grid-template-columns: repeat(var(--tn-cols, 3), minmax(0, 1fr));
}
.tn-news--grid .tn-item {
	background: var(--tn-card-bg); border: 1px solid var(--tn-border); border-radius: var(--tn-radius); overflow: hidden;
	transition: box-shadow .25s, transform .25s;
}
.tn-news--grid .tn-item:hover { box-shadow: 0 12px 30px rgba(0, 0, 0, .08); transform: translateY(-2px); }

/* List --------------------------------------------------------------------- */
.tn-news--list { display: flex; flex-direction: column; gap: var(--tn-gap); }
.tn-news--list .tn-item {
	flex-direction: row; background: var(--tn-card-bg); border: 1px solid var(--tn-border);
	border-radius: var(--tn-radius); overflow: hidden;
}
.tn-news--list .tn-item__media { flex: 0 0 34%; aspect-ratio: auto; min-height: 180px; }
.tn-news--list .tn-item__body { padding: 20px 24px; }

/* Overlay ------------------------------------------------------------------ */
.tn-news--overlay .tn-item { border-radius: var(--tn-radius); overflow: hidden; min-height: 320px; background: #111827; color: #fff; }
.tn-news--overlay .tn-item__media { position: absolute; inset: 0; aspect-ratio: auto; }
.tn-news--overlay .tn-item__media::after {
	content: ""; position: absolute; inset: 0; pointer-events: none;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, .85) 100%);
}
.tn-news--overlay .tn-item__body { position: relative; z-index: 1; justify-content: flex-end; padding: 24px; pointer-events: none; }
.tn-news--overlay .tn-item__body a { pointer-events: auto; }
.tn-news--overlay .tn-item__meta,
.tn-news--overlay .tn-item__excerpt { color: rgba(255, 255, 255, .85); }
.tn-news--overlay .tn-item__medium { color: #fff; }
.tn-news--overlay .tn-item__title a:hover { color: #fff; text-decoration: underline; }
.tn-news--overlay .tn-item__button { margin-top: 4px; }
.tn-news--overlay .tn-item__medium-logo { filter: brightness(0) invert(1); }

/* Carousel (CSS scroll-snap, no JS) ---------------------------------------- */
.tn-news--carousel {
	display: grid; grid-auto-flow: column;
	grid-auto-columns: calc((100% - (var(--tn-cols, 3) - 1) * var(--tn-gap)) / var(--tn-cols, 3));
	gap: var(--tn-gap); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px;
	scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.tn-news--carousel .tn-item {
	scroll-snap-align: start; background: var(--tn-card-bg); border: 1px solid var(--tn-border);
	border-radius: var(--tn-radius); overflow: hidden;
}

/* Minimal headline list ---------------------------------------------------- */
.tn-news--minimal { display: flex; flex-direction: column; }
.tn-news--minimal .tn-item--row {
	display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center;
	padding: 16px 0; border-bottom: 1px solid var(--tn-border);
}
.tn-news--minimal .tn-item--row:first-child { border-top: 1px solid var(--tn-border); }
.tn-news--minimal .tn-item__meta,
.tn-news--minimal .tn-item__title,
.tn-news--minimal .tn-item__excerpt { grid-column: 1; }
.tn-news--minimal .tn-item__arrow { grid-column: 2; grid-row: 1 / span 3; font-size: 1.25rem; color: var(--tn-accent); }
.tn-news--minimal .tn-item__title a::after { content: ""; position: absolute; inset: 0; }
.tn-news--minimal .tn-item--row:hover .tn-item__title { color: var(--tn-accent); }

/* Logos -------------------------------------------------------------------- */
.tn-news--logos { align-items: center; justify-items: center; }
.tn-logo { align-items: center; justify-content: center; width: 100%; }
.tn-logo__link { display: flex; align-items: center; justify-content: center; width: 100%; padding: 12px; text-decoration: none; color: inherit; }
.tn-logo__image {
	display: block; height: var(--tn-logo-height); width: auto; max-width: 100%; object-fit: contain;
	filter: grayscale(1); opacity: .65; transition: filter .25s, opacity .25s;
}
.tn-logo__link:hover .tn-logo__image { filter: none; opacity: 1; }
.tn-logo__name { font-weight: 800; font-size: 1.1rem; letter-spacing: .02em; text-align: center; opacity: .7; }
.tn-logo__link:hover .tn-logo__name { opacity: 1; color: var(--tn-accent); }

/* Magazine ----------------------------------------------------------------- */
.tn-news--magazine {
	--tn-ink: #111;
	--tn-paper: #fff;
	--tn-radius: 18px;
	--tn-ratio: 3 / 4;
	--tn-hero-height: 560px;
	--tn-big-height: 440px;
	color: var(--tn-ink);
}
.tn-news--magazine [hidden] { display: none !important; }

.tn-pill {
	display: inline-flex; align-items: center; justify-content: center; margin: 0;
	padding: 6px 22px; border: 1.5px solid currentColor; border-radius: 999px;
	background: transparent; color: inherit; font: inherit; font-size: .95rem; font-weight: 500; line-height: 1.3;
	white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color .2s, color .2s, border-color .2s;
}
span.tn-pill { cursor: default; }
button.tn-pill:hover { background: var(--tn-ink); border-color: var(--tn-ink); color: var(--tn-paper); }
.tn-pill.is-active { background: var(--tn-ink); border-color: var(--tn-ink); color: var(--tn-paper); }
.tn-pill--sm { padding: 2px 9px; border-width: 1px; font-size: .68rem; font-weight: 500; }

/* Hero */
.tn-mag__hero {
	position: relative; display: flex; align-items: flex-end; overflow: hidden;
	min-height: var(--tn-hero-height); background: #1f2937; color: #fff;
}
.tn-mag__hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tn-mag__hero::after {
	content: ""; position: absolute; inset: 0; pointer-events: none;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, .75) 100%);
}
.tn-mag__hero-body { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; max-width: min(640px, 100%); padding: 48px; }
.tn-mag__hero-title { margin: 0; color: inherit; font-size: clamp(1.5rem, 2.6vw, 2.25rem); font-weight: 800; line-height: 1.2; }
.tn-mag__hero-title a { color: inherit; text-decoration: none; }
.tn-mag__hero-title a:hover { text-decoration: underline; }
.tn-mag__hero .tn-mag__excerpt { color: rgba(255, 255, 255, .85); }
.tn-mag__hero .tn-mag__medium { color: rgba(255, 255, 255, .85); }

.tn-mag__cats--light .tn-pill, .tn-mag__card.is-big .tn-pill { border-color: #fff; color: #fff; }
.tn-mag__cats--light .tn-pill:hover, .tn-mag__card.is-big .tn-pill:hover,
.tn-mag__cats--light .tn-pill.is-active, .tn-mag__card.is-big .tn-pill.is-active { background: #fff; color: var(--tn-ink); }
.tn-mag__hero .tn-pill--sm { padding: 5px 18px; font-size: .85rem; }

/* Filter bar */
.tn-mag__filters { display: flex; flex-wrap: wrap; gap: 12px 16px; padding: 20px 16px; scroll-margin-top: 80px; }

/* Grid */
.tn-mag__grid {
	display: grid; gap: var(--tn-gap); padding: 0 16px;
	grid-template-columns: repeat(var(--tn-cols, 4), minmax(0, 1fr));
	grid-auto-flow: row dense;
}
.tn-mag__card { position: relative; display: flex; flex-direction: column; min-width: 0; }
.tn-mag__media { position: relative; overflow: hidden; aspect-ratio: var(--tn-ratio); border-radius: var(--tn-radius); background: #e5e7eb; }
.tn-mag__media > a { display: block; height: 100%; }
.tn-mag__image { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.tn-mag__card:hover .tn-mag__image { transform: scale(1.04); }
.tn-mag__card--no-image:not(.is-big) .tn-mag__media { aspect-ratio: auto; min-height: 56px; background: transparent; }
.tn-mag__badge {
	position: absolute; top: 12px; left: 12px; z-index: 2; padding: 4px 18px; border-radius: 999px;
	background: var(--tn-ink); color: var(--tn-paper); font-size: .72rem; font-weight: 500; line-height: 1.4; pointer-events: none;
}
.tn-mag__body { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; flex: 1; padding: 14px 8px 4px; }
.tn-mag__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.tn-mag__title { margin: 0; color: inherit; font-size: 1rem; font-weight: 700; line-height: 1.25; }
.tn-mag__title a { color: inherit; text-decoration: none; }
.tn-mag__title a:hover { text-decoration: underline; }
.tn-mag__excerpt { font-size: .9rem; line-height: 1.5; opacity: .8; }
.tn-mag__medium { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .7; }
.tn-mag__medium-logo { display: block; height: 20px; width: auto; max-width: 110px; object-fit: contain; }
.tn-mag__date { margin-top: auto; padding-top: 8px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; opacity: .65; }
.tn-mag__empty { padding: 32px 16px; text-align: center; opacity: .7; }

/* Big card: image fills the card, text over it */
.tn-mag__card.is-big {
	grid-column: span 2; min-height: var(--tn-big-height);
	overflow: hidden; border-radius: var(--tn-radius); background: #1f2937; color: #fff;
}
.tn-mag__card.is-big .tn-mag__media { position: absolute; inset: 0; aspect-ratio: auto; border-radius: 0; }
.tn-mag__card.is-big .tn-mag__media::after {
	content: ""; position: absolute; inset: 0; pointer-events: none;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, .8) 100%);
}
.tn-mag__card.is-big .tn-mag__badge { background: var(--tn-ink); color: var(--tn-paper); }
.tn-mag__card.is-big .tn-mag__body {
	position: relative; z-index: 1; justify-content: flex-end; max-width: 75%; padding: 24px; pointer-events: none;
}
.tn-mag__card.is-big .tn-mag__body a, .tn-mag__card.is-big .tn-mag__body button { pointer-events: auto; }
.tn-mag__card.is-big .tn-mag__title { order: 1; font-size: clamp(1.15rem, 1.6vw, 1.45rem); font-weight: 800; }
.tn-mag__card.is-big .tn-mag__excerpt { order: 2; }
.tn-mag__card.is-big .tn-mag__cats { order: 3; }
.tn-mag__card.is-big .tn-mag__date { display: none; }
.tn-mag__card.is-big .tn-pill--sm { padding: 4px 12px; font-size: .78rem; }

/* Single page source box --------------------------------------------------- */
.tn-source {
	display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 32px 0 0; padding: 20px;
	border: 1px solid rgba(0, 0, 0, .1); border-radius: 10px;
}
.tn-source__logo { height: 40px; width: auto; max-width: 140px; object-fit: contain; }
.tn-source__text { display: flex; flex-direction: column; flex: 1; min-width: 160px; }
.tn-source__label { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; opacity: .7; }
.tn-source__button { padding: 10px 18px; border-radius: 6px; background: #1d4ed8; color: #fff; font-weight: 600; text-decoration: none; }
.tn-source__button:hover { color: #fff; opacity: .85; }

/* Responsive --------------------------------------------------------------- */
@media (max-width: 1024px) {
	.tn-mag__grid { grid-template-columns: repeat(var(--tn-cols-tablet, 2), minmax(0, 1fr)); }
	.tn-news--grid, .tn-news--overlay, .tn-news--logos { grid-template-columns: repeat(var(--tn-cols-tablet, 2), minmax(0, 1fr)); }
	.tn-news--carousel { grid-auto-columns: calc((100% - (var(--tn-cols-tablet, 2) - 1) * var(--tn-gap)) / var(--tn-cols-tablet, 2)); }
}
@media (max-width: 767px) {
	.tn-news--grid, .tn-news--overlay, .tn-news--logos { grid-template-columns: repeat(var(--tn-cols-mobile, 1), minmax(0, 1fr)); }
	.tn-news--carousel { grid-auto-columns: calc((100% - (var(--tn-cols-mobile, 1) - 1) * var(--tn-gap)) / var(--tn-cols-mobile, 1) - 24px); }
	.tn-news--list .tn-item { flex-direction: column; }
	.tn-news--list .tn-item__media { flex-basis: auto; aspect-ratio: var(--tn-ratio); min-height: 0; }

	.tn-mag__hero { min-height: min(var(--tn-hero-height), 70vh); }
	.tn-mag__hero-body { padding: 24px 16px; }
	.tn-mag__filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
	.tn-mag__filters::-webkit-scrollbar { display: none; }
	.tn-mag__grid { grid-template-columns: repeat(var(--tn-cols-mobile, 1), minmax(0, 1fr)); }
	.tn-mag__card.is-big { grid-column: 1 / -1; min-height: 380px; }
	.tn-mag__card.is-big .tn-mag__body { max-width: none; }
}
