/**
 * [opening_hours_calendar] styles.
 *
 * Neutral defaults; a theme overrides the custom properties on .toh-calendar
 * (accent, ink, line, heading font) to match its design. Layout switches from
 * a 7-column month grid to a day list when the calendar itself is narrower
 * than 48rem (container query), so it also works inside narrow columns.
 */

.toh-calendar {
	--toh-accent: #0b7285;
	--toh-accent-soft: rgba(11, 114, 133, 0.10);
	--toh-ink: #1b1f23;
	--toh-ink-soft: #3a3f45;
	--toh-muted: #6b7177;
	--toh-line: #e5e7eb;
	--toh-bg: #ffffff;
	--toh-bg-outside: #f6f7f8;
	--toh-holiday-bg: #fff7e6;
	--toh-holiday-ink: #8a5a00;
	--toh-holiday-line: #f2d9a6;
	--toh-closed: #8d939a;
	--toh-shop-1: var(--toh-accent);
	--toh-shop-2: #e08a3c;
	--toh-shop-3: #7b61ff;
	--toh-shop-4: #2f9e44;
	--toh-radius: 10px;
	--toh-font-heading: inherit;

	container-type: inline-size;
	color: var(--toh-ink);
	font-size: 0.95rem;
	line-height: 1.45;
	margin-block: 1.5rem 2.5rem;
}

.toh-calendar *,
.toh-calendar *::before,
.toh-calendar *::after { box-sizing: border-box; }

/* Author display rules would otherwise defeat the hidden attribute. */
.toh-calendar [hidden] { display: none !important; }

.toh-calendar .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
}

.toh-section-title {
	font-family: var(--toh-font-heading);
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.2;
	color: var(--toh-ink);
	margin: 0 0 0.9rem;
}

/* Shop dot: colour follows the shop's position (1-4) */
.toh-dot {
	display: inline-block;
	width: 0.6em;
	height: 0.6em;
	border-radius: 50%;
	background: var(--toh-shop-color, var(--toh-accent));
	margin-right: 0.4em;
	vertical-align: middle;
	position: relative;
	top: -0.05em;
	flex: 0 0 auto;
}
.toh-shop--1 { --toh-shop-color: var(--toh-shop-1); }
.toh-shop--2 { --toh-shop-color: var(--toh-shop-2); }
.toh-shop--3 { --toh-shop-color: var(--toh-shop-3); }
.toh-shop--4 { --toh-shop-color: var(--toh-shop-4); }

/* ---------------------------------------------------------------------- */
/* Regular weekly hours                                                   */
/* ---------------------------------------------------------------------- */

.toh-weekly { margin-bottom: 2.25rem; }

.toh-table-scroll { overflow-x: auto; }

.toh-weekly__table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	border: 1px solid var(--toh-line);
	border-radius: var(--toh-radius);
	overflow: hidden;
	background: var(--toh-bg);
	font-size: 0.95rem;
	margin: 0;
}
.toh-weekly__table th,
.toh-weekly__table td {
	padding: 0.6rem 0.9rem;
	text-align: left;
	border-top: 1px solid var(--toh-line);
	vertical-align: middle;
}
.toh-weekly__table thead th {
	border-top: 0;
	background: var(--toh-bg-outside);
	font-weight: 600;
	color: var(--toh-ink);
}
.toh-weekly__table tbody th {
	font-weight: 500;
	color: var(--toh-ink-soft);
	width: 11rem;
	white-space: nowrap;
}
.toh-weekly__table td { font-variant-numeric: tabular-nums; }
.toh-weekly__table td.is-closed { color: var(--toh-closed); }
.toh-weekly__table tr.is-today th,
.toh-weekly__table tr.is-today td {
	background: var(--toh-accent-soft);
	font-weight: 600;
	color: var(--toh-ink);
}
.toh-weekly__note {
	margin: 0.6rem 0 0;
	font-size: 0.85rem;
	color: var(--toh-muted);
}

/* ---------------------------------------------------------------------- */
/* Calendar header / navigation                                           */
/* ---------------------------------------------------------------------- */

.toh-cal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.9rem;
}
.toh-cal__heading {
	flex: 1 1 auto;
	text-align: center;
	min-width: 0;
}
.toh-cal__title {
	font-family: var(--toh-font-heading);
	font-size: clamp(1.25rem, 2.2vw, 1.6rem);
	font-weight: 700;
	line-height: 1.2;
	margin: 0;
	color: var(--toh-ink);
}
.toh-cal__today {
	display: inline-block;
	margin-top: 0.25rem;
	font-size: 0.8rem;
	color: var(--toh-accent);
	text-decoration: none;
}
.toh-cal__today:hover,
.toh-cal__today:focus { text-decoration: underline; }

.toh-cal__nav {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	border: 1px solid var(--toh-line);
	border-radius: 50%;
	background: var(--toh-bg);
	color: var(--toh-ink);
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.toh-cal__nav:hover,
.toh-cal__nav:focus-visible {
	background: var(--toh-accent);
	border-color: var(--toh-accent);
	color: #fff;
	text-decoration: none;
	outline: none;
}
.toh-cal__nav:focus-visible { box-shadow: 0 0 0 3px var(--toh-accent-soft); }
.toh-cal__nav.is-disabled {
	opacity: 0.35;
	pointer-events: none;
}

/* Legend */
.toh-legend {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1.25rem;
	margin: 0 0 0.75rem;
	padding: 0;
	font-size: 0.85rem;
	color: var(--toh-ink-soft);
}
.toh-legend__item {
	display: inline-flex;
	align-items: center;
	margin: 0;
}
.toh-swatch {
	display: inline-block;
	width: 0.9em;
	height: 0.9em;
	border-radius: 3px;
	background: var(--toh-holiday-bg);
	border: 1px solid var(--toh-holiday-line);
	margin-right: 0.4em;
}

/* ---------------------------------------------------------------------- */
/* Month grid                                                             */
/* ---------------------------------------------------------------------- */

.toh-cal__body { position: relative; }
.toh-calendar.is-loading .toh-cal__body { opacity: 0.55; transition: opacity 0.15s ease; }

.toh-grid {
	width: 100%;
	table-layout: fixed;
	border-collapse: separate;
	border-spacing: 0;
	border: 1px solid var(--toh-line);
	border-radius: var(--toh-radius);
	overflow: hidden;
	background: var(--toh-bg);
	margin: 0;
}
.toh-grid thead th {
	padding: 0.55rem 0.5rem;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--toh-muted);
	text-align: left;
	background: var(--toh-bg-outside);
	border-bottom: 1px solid var(--toh-line);
}
.toh-grid thead abbr { text-decoration: none; border: 0; }

.toh-day {
	vertical-align: top;
	padding: 0.5rem 0.55rem 0.6rem;
	min-height: 6.25rem;
	height: 6.25rem;
	border-top: 1px solid var(--toh-line);
	border-left: 1px solid var(--toh-line);
	font-size: 0.85rem;
	line-height: 1.35;
}
.toh-grid tbody tr:first-child .toh-day { border-top: 0; }
.toh-grid tbody .toh-day:first-child { border-left: 0; }

.toh-day--outside { background: var(--toh-bg-outside); }
.toh-day--past .toh-day__num,
.toh-day--past .toh-day__hours,
.toh-day--past .toh-line__hours { color: var(--toh-muted); }

.toh-day__head {
	display: flex;
	align-items: baseline;
	gap: 0.4rem;
	margin-bottom: 0.3rem;
}
.toh-day__num {
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--toh-ink);
	font-variant-numeric: tabular-nums;
}
.toh-day__weekday { display: none; }
.toh-day__today {
	font-size: 0.7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--toh-accent);
}

.toh-day--today {
	box-shadow: inset 0 0 0 2px var(--toh-accent);
}
.toh-day--today .toh-day__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.6rem;
	height: 1.6rem;
	padding: 0 0.3rem;
	border-radius: 999px;
	background: var(--toh-accent);
	color: #fff;
}

.toh-day--holiday {
	background: var(--toh-holiday-bg);
}
.toh-day__holiday {
	display: block;
	font-size: 0.78rem;
	font-weight: 700;
	color: var(--toh-holiday-ink);
	margin-bottom: 0.25rem;
	overflow-wrap: anywhere;
}

.toh-day__hours {
	display: block;
	font-variant-numeric: tabular-nums;
	color: var(--toh-ink);
	font-weight: 500;
}
.toh-day__hours.is-closed,
.toh-line.is-closed .toh-line__hours,
.toh-exception__hours.is-closed { color: var(--toh-closed); font-weight: 400; }

.toh-day__shops,
.toh-exception__shops {
	list-style: none;
	margin: 0;
	padding: 0;
}
.toh-line {
	display: flex;
	align-items: center;
	gap: 0.3rem;
	margin: 0 0 0.15rem;
	padding: 0;
	white-space: nowrap;
}
.toh-line .toh-dot { margin-right: 0.1rem; }
.toh-line__hours { font-variant-numeric: tabular-nums; }

/* In the grid the shop name is carried by the dot colour (see legend); keep
   the name for screen readers only. The list layout and the exceptions list
   show it. */
.toh-grid .toh-line__shop {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	white-space: nowrap;
}

.toh-cal__status {
	margin: 0.75rem 0 0;
	padding: 0.6rem 0.9rem;
	border-radius: 6px;
	background: #fdecec;
	color: #8a1c1c;
	font-size: 0.9rem;
}

/* ---------------------------------------------------------------------- */
/* Upcoming holidays / exceptions                                         */
/* ---------------------------------------------------------------------- */

.toh-exceptions { margin-top: 2.25rem; }

.toh-exceptions__empty {
	margin: 0;
	color: var(--toh-muted);
}
.toh-exceptions__list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--toh-line);
	border-radius: var(--toh-radius);
	overflow: hidden;
	background: var(--toh-bg);
}
.toh-exception {
	display: grid;
	grid-template-columns: minmax(9rem, 13rem) 1fr auto;
	gap: 0.5rem 1.25rem;
	align-items: start;
	padding: 0.7rem 0.9rem;
	margin: 0;
	border-top: 1px solid var(--toh-line);
}
.toh-exception:first-child { border-top: 0; }
.toh-exception:nth-child(even) { background: color-mix(in srgb, var(--toh-bg-outside) 55%, var(--toh-bg)); }
.toh-exception__date {
	font-weight: 600;
	color: var(--toh-ink);
	font-variant-numeric: tabular-nums;
}
.toh-exception__date span { font-weight: 400; color: var(--toh-ink-soft); }
.toh-exception__name {
	font-weight: 600;
	color: var(--toh-holiday-ink);
}
.toh-exception__hours {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	color: var(--toh-ink);
}
.toh-exception__shops .toh-line { justify-content: flex-end; }
.toh-exception__shops .toh-line__shop { color: var(--toh-ink-soft); }
.toh-exception__shops .toh-line__shop::after { content: ':'; }
.toh-exception.is-past > * { opacity: 0.55; }

/* ---------------------------------------------------------------------- */
/* Narrow layout: the month becomes a day list                            */
/* ---------------------------------------------------------------------- */

@container (max-width: 47.99rem) {
	.toh-grid,
	.toh-grid tbody,
	.toh-grid tr,
	.toh-grid td { display: block; }
	.toh-grid thead { display: none; }
	.toh-grid tr { border: 0; }

	.toh-day {
		height: auto;
		min-height: 0;
		border-left: 0;
		border-top: 1px solid var(--toh-line);
		padding: 0.6rem 0.9rem;
		display: grid;
		grid-template-columns: 6.5rem 1fr;
		grid-template-areas: "head holiday" "head hours";
		column-gap: 0.75rem;
		align-items: start;
		font-size: 0.9rem;
	}
	/* The grid drops the top border on the whole first week; as a list every
	   visible day needs its separator except the very first one, which may
	   sit behind hidden leading cells. */
	.toh-grid tbody tr:first-child .toh-day { border-top: 1px solid var(--toh-line); }
	.toh-grid tbody tr:first-child .toh-day:first-child,
	.toh-grid tbody tr:first-child .toh-day--outside + .toh-day { border-top: 0; }
	.toh-day--outside { display: none; }

	.toh-day__head {
		grid-area: head;
		flex-direction: column;
		align-items: flex-start;
		gap: 0;
		margin: 0;
	}
	.toh-day__weekday {
		display: block;
		font-size: 0.75rem;
		color: var(--toh-muted);
	}
	.toh-day__today { margin-top: 0.15rem; }
	.toh-day--today { box-shadow: inset 3px 0 0 var(--toh-accent); }

	.toh-day__holiday { grid-area: holiday; margin-bottom: 0.15rem; }
	.toh-day__hours,
	.toh-day__shops { grid-area: hours; }
	.toh-day:not(.toh-day--holiday) .toh-day__hours,
	.toh-day:not(.toh-day--holiday) .toh-day__shops { grid-row: 1 / span 2; }

	.toh-grid .toh-line__shop {
		position: static !important;
		width: auto;
		height: auto;
		margin: 0;
		clip: auto;
		clip-path: none;
		color: var(--toh-ink-soft);
	}
	.toh-grid .toh-line__shop::after { content: ':'; }
	.toh-line { white-space: normal; }

	.toh-exception {
		grid-template-columns: 1fr;
		gap: 0.2rem;
	}
	.toh-exception__shops .toh-line { justify-content: flex-start; }
}

@media print {
	.toh-cal__nav,
	.toh-cal__today,
	.toh-cal__status { display: none !important; }
	.toh-day--today { box-shadow: none; }
}
