/**
 * TotalOnlineNews - cricket and weather widgets.
 *
 * Replaces the BSE market tape and Sensex chart that used to sit between the
 * hero and the live-headlines desk. Everything is built from the theme's own
 * design tokens, so light and dark mode both follow the newsroom palette and
 * the red brand accent without a second set of colours.
 */

.ton-sw {
	display: grid;
	grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
	gap: 1rem;
	align-items: start;
	margin: 0 0 1.25rem;
}

@media (max-width: 1023px) {
	.ton-sw { grid-template-columns: minmax(0, 1fr); }
}

@keyframes ton-sw-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(185, 66, 73, .55); }
	70%  { box-shadow: 0 0 0 5px rgba(185, 66, 73, 0); }
	100% { box-shadow: 0 0 0 0 rgba(185, 66, 73, 0); }
}

/* ---- shared card chrome ---- */

.ton-cricket,
.ton-wx {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	border: 1px solid var(--canvas-border);
	border-radius: 12px;
	background: var(--canvas);
	box-shadow: var(--shadow-card);
}

.ton-sw__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: .75rem;
	padding: .85rem 1rem .8rem;
	border-bottom: 1px solid var(--canvas-border);
}

.ton-sw__head-copy { min-width: 0; }

.ton-sw__title {
	display: flex;
	align-items: center;
	gap: .45rem;
	margin: 0;
	color: var(--ink);
	font-family: var(--font-display);
	font-size: .92rem;
	font-weight: 800;
	letter-spacing: .045em;
	line-height: 1.2;
	text-transform: uppercase;
}

.ton-sw__mark { display: inline-flex; align-items: center; }

.ton-sw__sub {
	margin: .28rem 0 0;
	color: var(--ink-faint);
	font-size: .72rem;
	line-height: 1.35;
}

.ton-dot {
	display: inline-block;
	width: .46rem;
	height: .46rem;
	border-radius: 50%;
	background: var(--brand);
	animation: ton-sw-pulse 1.8s ease-out infinite;
}

.ton-dot--green { background: #1f9d55; animation-name: none; }

.ton-sw__more {
	flex: 0 0 auto;
	min-height: 30px;
	padding: .3rem .6rem;
	border: 1px solid var(--canvas-border);
	border-radius: 6px;
	background: var(--canvas);
	color: var(--brand);
	font: inherit;
	font-size: .66rem;
	font-weight: 800;
	letter-spacing: .03em;
	cursor: pointer;
	transition: border-color .25s ease, background .25s ease, color .25s ease;
}

.ton-sw__more:hover,
.ton-sw__more:focus-visible {
	border-color: var(--brand);
	background: var(--brand-tint);
}

.ton-sw__more[aria-expanded="true"] {
	border-color: var(--brand);
	background: var(--brand);
	color: #fff;
}

/* ---- tabs ---- */

.ton-sw__tabs {
	display: flex;
	gap: .15rem;
	padding: .45rem .65rem 0;
	border-bottom: 1px solid var(--canvas-border);
}

.ton-sw__tab {
	flex: 1 1 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .3rem;
	min-height: 32px;
	padding: .35rem .4rem .45rem;
	border: 0;
	border-bottom: 2px solid transparent;
	background: transparent;
	color: var(--ink-muted);
	font: inherit;
	font-size: .68rem;
	font-weight: 800;
	letter-spacing: .05em;
	cursor: pointer;
	transition: color .2s ease, border-color .2s ease;
}

.ton-sw__tab em {
	min-width: 1.05rem;
	padding: .05rem .3rem;
	border-radius: 999px;
	background: var(--canvas-light);
	color: var(--ink-muted);
	font-style: normal;
	font-size: .6rem;
	font-weight: 800;
	line-height: 1.3;
}

.ton-sw__tab:hover { color: var(--ink); }

.ton-sw__tab.is-active {
	border-bottom-color: var(--brand);
	color: var(--brand-dark);
}

.ton-sw__tab.is-active em {
	background: var(--brand-tint);
	color: var(--brand-dark);
}

.ton-sw__panels { flex: 1 1 auto; }

.ton-sw__panel[hidden] { display: none; }

.ton-sw__empty {
	padding: 1.15rem 1rem 1.3rem;
	text-align: center;
	color: var(--ink-faint);
}

.ton-sw__empty p { margin: 0; font-size: .74rem; line-height: 1.5; }

.ton-sw__empty-title {
	margin-bottom: .2rem !important;
	color: var(--ink-soft);
	font-size: .8rem !important;
	font-weight: 800;
}

.ton-sw__credit {
	margin: 0;
	padding: .5rem 1rem .7rem;
	border-top: 1px solid var(--canvas-border);
	color: var(--ink-faint);
	font-size: .6rem;
	letter-spacing: .02em;
}

/* ---- cricket ---- */

.ton-cricket__list {
	display: grid;
	gap: .5rem;
	margin: 0;
	padding: .65rem .75rem .75rem;
	list-style: none;
}

.ton-cricket__list > li:nth-child(n+3) { display: none; }
.ton-cricket.is-expanded .ton-cricket__list > li:nth-child(n+3) { display: block; }

.ton-match {
	padding: .6rem .7rem .55rem;
	border: 1px solid var(--canvas-border);
	border-radius: 9px;
	background: var(--canvas);
}

.ton-match.is-live {
	border-color: rgba(185, 66, 73, .42);
	background: linear-gradient(180deg, var(--brand-tint), var(--canvas) 72%);
}

.ton-match__top {
	display: flex;
	align-items: center;
	gap: .35rem;
	margin-bottom: .45rem;
}

.ton-match__series {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	color: var(--ink-faint);
	font-size: .63rem;
	font-weight: 700;
	letter-spacing: .04em;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}

.ton-match__type {
	flex: 0 0 auto;
	padding: .04rem .26rem;
	border: 1px solid var(--canvas-border);
	border-radius: 3px;
	color: var(--ink-muted);
	font-size: .55rem;
	font-weight: 800;
	letter-spacing: .05em;
}

.ton-match__live {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: .25rem;
	padding: .1rem .34rem;
	border-radius: 3px;
	background: var(--brand);
	color: #fff;
	font-size: .55rem;
	font-weight: 900;
	letter-spacing: .08em;
}

.ton-match__live i {
	width: .32rem;
	height: .32rem;
	border-radius: 50%;
	background: #fff;
	animation: ton-sw-pulse 1.4s ease-out infinite;
}

.ton-match__teams {
	display: grid;
	gap: .3rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ton-match__team {
	display: flex;
	align-items: center;
	gap: .45rem;
	min-width: 0;
	color: var(--ink);
	font-size: .82rem;
}

.ton-match__logo {
	flex: 0 0 26px;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--canvas-light);
	object-fit: contain;
}

.ton-match__logo--text {
	display: grid;
	place-items: center;
	color: var(--ink-muted);
	font-size: .55rem;
	font-weight: 900;
	letter-spacing: -.02em;
}

.ton-match__name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ton-match__score {
	flex: 0 0 auto;
	color: var(--ink);
	font-variant-numeric: tabular-nums;
	font-weight: 800;
	white-space: nowrap;
}

.ton-match__score em {
	color: var(--ink-faint);
	font-size: .68rem;
	font-style: normal;
	font-weight: 600;
}

.ton-match__score--muted {
	color: var(--ink-faint);
	font-size: .68rem;
	font-weight: 600;
}

.ton-match__status {
	margin: .4rem 0 0;
	color: var(--brand-dark);
	font-size: .72rem;
	font-weight: 700;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
}

.ton-match__meta {
	display: flex;
	flex-wrap: wrap;
	gap: .1rem .55rem;
	margin-top: .3rem;
	color: var(--ink-faint);
	font-size: .63rem;
}

.ton-match__meta span {
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---- weather ---- */

.ton-wx__locate {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border: 1px solid var(--canvas-border);
	border-radius: 8px;
	background: var(--canvas);
	color: var(--brand);
	cursor: pointer;
	transition: border-color .25s ease, background .25s ease;
}

.ton-wx__locate:hover,
.ton-wx__locate:focus-visible {
	border-color: var(--brand);
	background: var(--brand-tint);
}

.ton-wx__locate svg { width: 1.05rem; height: 1.05rem; }

.ton-wx__place { font-weight: 600; }

.ton-wx__body { padding: .8rem 1rem .9rem; }

.ton-wx__body.is-loading { opacity: .45; pointer-events: none; }

.ton-wx__now {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: center;
	gap: .1rem .75rem;
}

.ton-wx__icon { display: grid; place-items: center; }

.ton-wx__icon svg,
.ton-wx__fico svg {
	display: block;
	width: 2.5rem;
	height: 2.5rem;
	color: var(--brand);
}

.ton-wx__deg {
	display: block;
	color: var(--ink);
	font-family: var(--font-display);
	font-size: 1.85rem;
	font-weight: 800;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.ton-wx__deg sup {
	margin-left: .1rem;
	color: var(--ink-faint);
	font-size: .66rem;
	font-weight: 700;
	vertical-align: super;
}

.ton-wx__cond {
	display: block;
	margin-top: .18rem;
	color: var(--ink-muted);
	font-size: .74rem;
}

.ton-wx__stats {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: .35rem;
	margin: .75rem 0 0;
	padding: .55rem 0 0;
	border-top: 1px solid var(--canvas-border);
}

.ton-wx__stats > div { text-align: center; min-width: 0; }

.ton-wx__stats dt {
	color: var(--ink-faint);
	font-size: .58rem;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
}

.ton-wx__stats dd {
	margin: .12rem 0 0;
	color: var(--ink);
	font-size: .8rem;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ton-wx__forecast {
	display: grid;
	gap: .25rem;
	margin: .7rem 0 0;
	padding: .55rem 0 0;
	border-top: 1px solid var(--canvas-border);
	list-style: none;
}

.ton-wx__forecast li {
	display: grid;
	grid-template-columns: 3.1rem 1.5rem minmax(0, 1fr) auto;
	align-items: center;
	gap: .45rem;
	font-size: .76rem;
}

.ton-wx__forecast .ton-wx__fico svg { width: 1.2rem; height: 1.2rem; color: var(--ink-muted); }

.ton-wx__day {
	overflow: hidden;
	color: var(--ink-soft);
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ton-wx__range { min-width: 0; white-space: nowrap; }
.ton-wx__range strong { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.ton-wx__range em { margin-left: .35rem; color: var(--ink-faint); font-style: normal; font-variant-numeric: tabular-nums; }

.ton-wx__rain {
	color: #2a7fb8;
	font-size: .68rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

:root[data-ton-theme="dark"] .ton-wx__rain { color: #7cc0e8; }

.ton-wx__stale,
.ton-wx__unavailable {
	margin: .65rem 0 0;
	color: var(--ink-faint);
	font-size: .68rem;
	line-height: 1.45;
}

.ton-wx__unavailable p { margin: 0 0 .25rem; }

/* ---- state and city picker ---- */

.ton-wx__modal {
	box-sizing: border-box;
	width: min(92vw, 420px);
	max-width: 100%;
	max-height: min(82vh, 620px);
	margin-inline: auto;
	padding: 0;
	overflow: hidden;
	border: 1px solid var(--canvas-border);
	border-radius: 12px;
	background: var(--canvas);
	color: var(--ink);
	box-shadow: var(--shadow-pop);
}

.ton-wx__modal::backdrop { background: rgba(10, 10, 10, .52); }

/* Scroll lock while the picker is open (added/removed by widget.js). */
html.ton-modal-open { overflow: hidden; }

/* Head and search stay put; only the two lists scroll, so a focused input is
   never pushed off-screen by the on-screen keyboard. */
.ton-wx__modal-inner {
	display: flex;
	flex-direction: column;
	min-height: 0;
	max-height: inherit;
	padding: 1rem 1rem 1.1rem;
}

.ton-wx__modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .75rem;
	margin-bottom: .75rem;
}

.ton-wx__modal-head h2 {
	margin: 0;
	font-size: 1rem;
	font-weight: 800;
	letter-spacing: -.01em;
}

.ton-wx__modal-close {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border: 1px solid var(--canvas-border);
	border-radius: 7px;
	background: var(--canvas);
	color: var(--ink-muted);
	cursor: pointer;
}

.ton-wx__modal-close:hover { border-color: var(--brand); color: var(--brand); }
.ton-wx__modal-close svg { width: 1rem; height: 1rem; }

.ton-wx__search { display: block; margin-bottom: .75rem; }

.ton-wx__search input {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-height: 42px;
	padding: .4rem .7rem;
	border: 1px solid var(--canvas-border);
	border-radius: 7px;
	background: var(--canvas);
	color: var(--ink);
	font: inherit;
	font-size: 16px;
}

.ton-wx__search input:focus-visible {
	border-color: var(--brand);
	outline: 2px solid var(--brand-tint);
	outline-offset: 1px;
}

.ton-wx__modal-empty {
	margin: 0 0 .6rem;
	color: var(--ink-faint);
	font-size: .76rem;
}

.ton-wx__modal-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: .75rem;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
}

.ton-wx__states,
.ton-wx__cities {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	max-height: 100%;
	min-height: 0;
	margin: 0;
	padding: .25rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	list-style: none;
	border: 1px solid var(--canvas-border);
	border-radius: 9px;
	background: var(--canvas);
}

.ton-wx__states button,
.ton-wx__cities button {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .4rem;
	width: 100%;
	padding: .42rem .55rem;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--ink-soft);
	font: inherit;
	font-size: .78rem;
	text-align: left;
	cursor: pointer;
}

.ton-wx__states button:hover,
.ton-wx__cities button:hover,
.ton-wx__states button:focus-visible,
.ton-wx__cities button:focus-visible {
	background: var(--canvas-light);
	color: var(--ink);
	outline: none;
}

.ton-wx__states button[aria-selected="true"] {
	background: var(--brand-tint);
	color: var(--brand-dark);
	font-weight: 800;
}

.ton-wx__states button em {
	flex: 0 0 auto;
	color: var(--ink-faint);
	font-size: .58rem;
	font-style: normal;
	font-weight: 800;
	letter-spacing: .05em;
}

.ton-wx__cities-panel { display: flex; flex-direction: column; min-width: 0; }

.ton-wx__cities-hint {
	margin: .25rem .25rem .5rem;
	color: var(--ink-faint);
	font-size: .74rem;
	line-height: 1.4;
}

.ton-wx__cities:empty { display: none; }

.ton-wx__citystore { display: none; }

@media (max-width: 560px) {
	.ton-sw__head { padding: .75rem .8rem; }
	.ton-sw__title { font-size: .84rem; letter-spacing: .03em; }
	.ton-sw__more { padding: .28rem .5rem; font-size: .6rem; }
	.ton-sw__tab { font-size: .61rem; letter-spacing: .02em; }
	.ton-sw__tab em { display: none; }
	.ton-cricket__list { padding: .55rem .6rem .65rem; }
	.ton-match { padding: .55rem .6rem .5rem; }
	.ton-wx__body { padding: .7rem .8rem .8rem; }
	.ton-wx__deg { font-size: 1.6rem; }
	.ton-wx__icon svg { width: 2.1rem; height: 2.1rem; }
	.ton-wx__stats { gap: .2rem; }
	.ton-wx__stats dt { font-size: .52rem; letter-spacing: 0; }
	.ton-wx__stats dd { font-size: .72rem; }

	/* Full-screen sheet on phones. 100dvh tracks the visual viewport, so the
	   on-screen keyboard can no longer cover the city list; the search box is
	   pinned at the top and only the two lists scroll inside. */
	.ton-wx__modal {
		inset: 0;
		width: 100%;
		max-width: 100%;
		height: 100vh;
		height: 100dvh;
		max-height: none;
		margin: 0;
		border: 0;
		border-radius: 0;
	}
	.ton-wx__modal-inner {
		height: 100%;
		padding: .85rem .9rem calc(.85rem + env(safe-area-inset-bottom, 0px));
	}
	.ton-wx__modal-head,
	.ton-wx__search { flex: 0 0 auto; }
	.ton-wx__modal-grid {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: minmax(0, 38%) minmax(0, 1fr);
		gap: .5rem;
	}
	.ton-wx__states,
	.ton-wx__cities { max-height: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.ton-dot,
	.ton-match__live i { animation: none; }
	.ton-sw__more,
	.ton-sw__tab,
	.ton-wx__locate { transition: none; }
}
