/**
 * core/table — teeman oletusilme + Aikataulu-tyyli.
 *
 * WP:n oma oletus on 1px musta ruudukko joka soluun. Tämä korvaa sen teeman
 * värimaailmalla: vaakahiusviivat, otsikkorivi warm-graylla, ei pystyviivoja.
 * Valitsimet ovat kaksitasoisia (.wp-block-table table td) jotta ne voittavat
 * WP:n block-library-tyylit ilman !importantia.
 */

.wp-block-table {
	margin-bottom: 25px;
}

.wp-block-table table {
	width: 100%;
	border-collapse: collapse;
	border: 0;
	background-color: var(--wp--preset--color--white);
}

.wp-block-table table th,
.wp-block-table table td {
	padding: 10px 15px;
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--sand-border);
	text-align: left;
	vertical-align: top;
	word-break: normal;
}

.wp-block-table table thead th {
	background-color: var(--wp--preset--color--warm-gray);
	border-bottom: 2px solid var(--wp--preset--color--sand-border);
	color: var(--wp--preset--color--dark-gray);
	font-weight: 700;
}

.wp-block-table table thead,
.wp-block-table table tfoot {
	border: 0;
}

.wp-block-table table tbody tr:last-child th,
.wp-block-table table tbody tr:last-child td {
	border-bottom: 0;
}

/* WP:n oma "Raidat"-tyyli: harmaa raita teeman sävyyn. */
.wp-block-table.is-style-stripes table {
	border: 0;
}

.wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background-color: var(--wp--preset--color--warm-gray-light);
}

.wp-block-table.is-style-stripes table th,
.wp-block-table.is-style-stripes table td {
	border-bottom: 0;
}

.wp-block-table figcaption {
	margin-top: 10px;
	color: var(--wp--preset--color--gold);
	font-size: var(--wp--preset--font-size--small);
	text-align: left;
}

/**
 * Aikataulu (is-style-dg-table-schedule)
 *
 * Vuorolistoille ja aukioloajoille: ensimmäinen sarake on kellonaika tai
 * viikonpäivä, joten se saa vain tarvitsemansa leveyden eikä katkea kahdelle
 * riville. Käsin tehdyissä aikatauluissa päivä on omalla rivillään lihavoituna
 * ja muut solut tyhjinä — tyyli tunnistaa sen ja korostaa rivin väliotsikoksi,
 * sekä piilottaa erottimeksi jätetyt kokonaan tyhjät rivit.
 */

.wp-block-table.is-style-dg-table-schedule table {
	table-layout: auto;
}

.wp-block-table.is-style-dg-table-schedule table th:first-child,
.wp-block-table.is-style-dg-table-schedule table td:first-child {
	width: 1%;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.wp-block-table.is-style-dg-table-schedule tbody tr:has(> td:first-child strong):has(> td:empty) > td {
	background-color: var(--wp--preset--color--light-pink-light);
	border-bottom: 0;
	padding-top: 15px;
	padding-bottom: 15px;
}

.wp-block-table.is-style-dg-table-schedule tbody tr:has(> td:first-child strong):has(> td:empty) > td:first-child {
	width: auto;
	white-space: normal;
	color: var(--wp--preset--color--primary);
}

.wp-block-table.is-style-dg-table-schedule tbody tr:not(:has(> td:not(:empty))) {
	display: none;
}

@media (max-width: 781px) {
	.wp-block-table table th,
	.wp-block-table table td {
		padding: 7.5px 10px;
		font-size: var(--wp--preset--font-size--small);
	}

	.wp-block-table.is-style-dg-table-schedule table th:first-child,
	.wp-block-table.is-style-dg-table-schedule table td:first-child {
		white-space: normal;
	}
}
