/*
 * Panchang Calendar — Phase 6/7 styles.
 * Every class is prefixed panchang-calendar- (UI_DESIGN.md §2.3) — never a
 * bare, generic name, per the IM-018/IM-022 lessons already documented in
 * RISK_ANALYSIS.md. Breakpoints reuse this theme's own values
 * (UI_DESIGN.md §13) rather than introducing new ones.
 */

.panchang-calendar {
	max-width: 420px;
	margin: 0 auto;
	font-size: 14px;
}

/* [panchang_calendar_full] (Phase 7) reuses every component unchanged
   (UI_DESIGN.md §4.3) -- only the outer width constraint differs. */
.panchang-calendar-full {
	max-width: 700px;
}

.panchang-calendar-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}

.panchang-calendar-label {
	font-weight: 600;
	font-size: 1.1em;
}

.panchang-calendar-prev,
.panchang-calendar-next {
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 4px;
	width: 32px;
	height: 32px;
	line-height: 1;
	font-size: 1.4em;
	cursor: pointer;
	color: #ff7e00;
}

.panchang-calendar-prev:hover,
.panchang-calendar-next:hover,
.panchang-calendar-prev:focus,
.panchang-calendar-next:focus {
	background: #ffebcc;
	outline: none;
}

.panchang-calendar-weekdays,
.panchang-calendar-days {
	display: grid;
	/* minmax(0, 1fr), not bare 1fr -- otherwise grid tracks refuse to shrink
	   below their content's natural width (e.g. "Chaturdashi", "Amavasya"),
	   and the whole grid overflows its container instead of the tithi
	   labels wrapping/truncating as .panchang-calendar-tithi's overflow
	   rules intend. Found on the real live homepage, 2026-08-02 (column
	   350px wide, grid content needed 411px). */
	grid-template-columns: repeat( 7, minmax( 0, 1fr ) );
	gap: 2px;
}

.panchang-calendar-weekday {
	text-align: center;
	font-weight: 600;
	font-size: 0.85em;
	color: #666;
	padding: 4px 0;
}

.panchang-calendar-weekday-short {
	display: none;
}

.panchang-calendar-day {
	position: relative;
	aspect-ratio: 1 / 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: #f9f9f9;
	border: 1px solid #f1f1f1;
	border-radius: 4px;
	padding: 2px;
}

button.panchang-calendar-day {
	cursor: pointer;
	font: inherit;
	color: inherit;
}

button.panchang-calendar-day:hover,
button.panchang-calendar-day:focus {
	background: #ffebcc;
	outline: 2px solid #ff7e00;
	outline-offset: -2px;
}

.panchang-calendar-day-empty {
	background: transparent;
	border-color: transparent;
}

.panchang-calendar-day-number {
	font-size: 0.95em;
}

/* "Today" and "has festival" both get a non-color cue as well as color,
   per UI_DESIGN.md §7 — a border shape and a dot shape respectively, not
   color alone. */
.panchang-calendar-today {
	border: 2px solid #ff7e00;
	font-weight: 700;
}

.panchang-calendar-festival-dot {
	position: absolute;
	top: 3px;
	right: 3px;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #ff7e00;
	border: 1px solid #a85a00;
}

/* Tithi/Paksha (2026-08-02): the moon-phase icon tried here was removed
   per direct user feedback ("clearly looking fake") -- back to plain text
   only, no icon, no color coding. Font sizes stay tight -- this column
   must not end up taller than its neighbors (a real, recurring bug on this
   page, see DESIGN_CHANGELOG.md). */
.panchang-calendar-tithi,
.panchang-calendar-paksha {
	display: block;
	max-width: 100%;
	font-size: 0.62em;
	font-weight: 600;
	color: #666;
	line-height: 1.1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.panchang-calendar-tithi {
	margin-top: 2px;
}

.panchang-calendar-paksha {
	font-size: 0.54em;
	font-weight: 500;
}

.panchang-calendar-message {
	text-align: center;
	color: #666;
	font-style: italic;
	margin: 12px 0 0;
}

.panchang-calendar-loading .panchang-calendar-day-number {
	color: #999;
}

.panchang-calendar-festival-list-wrap {
	margin-top: 16px;
	border-top: 1px solid #f1f1f1;
	padding-top: 10px;
}

/* A single clickable summary line, not an always-visible list (changed
   2026-08-02 -- an inline list, even scroll-contained, was still making
   this column taller than its neighbors since the row equalizes every
   column to the tallest). The full list opens in the Popup on click
   instead -- see the .panchang-calendar-festival-list rules below, which
   now style that list *inside* the popup, not inline in the column. */
.panchang-calendar-festival-list-trigger {
	background: transparent;
	border: none;
	padding: 0;
	margin: 0;
	color: #ff7e00;
	font-weight: 600;
	font-size: 0.95em;
	text-decoration: underline;
	cursor: pointer;
}

.panchang-calendar-festival-list-trigger:hover,
.panchang-calendar-festival-list-trigger:focus {
	color: #a85a00;
	outline: none;
}

.panchang-calendar-festival-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.panchang-calendar-festival-list-item {
	display: flex;
	gap: 8px;
	padding: 3px 0;
	font-size: 0.9em;
}

.panchang-calendar-festival-list-date {
	font-weight: 600;
	min-width: 1.5em;
}

.panchang-calendar-festival-list-empty {
	color: #999;
	font-size: 0.9em;
	margin: 0;
}

@media ( max-width: 1024px ) {
	.panchang-calendar {
		max-width: 100%;
	}
}

@media ( max-width: 767px ) {
	.panchang-calendar-weekday-full {
		display: none;
	}

	.panchang-calendar-weekday-short {
		display: inline;
	}

	.panchang-calendar-day {
		padding: 1px;
	}

	.panchang-calendar-tithi,
	.panchang-calendar-paksha {
		font-size: 0.5em;
	}

	.panchang-calendar-popup-dialog {
		width: 100%;
		height: 100%;
		max-width: none;
		max-height: none;
		border-radius: 0;
	}

	.panchang-calendar-popup-date {
		border-radius: 0;
	}
}

/* Popup (Phase 7, UI_DESIGN.md §6) */

.panchang-calendar-popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba( 0, 0, 0, 0.5 );
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	padding: 20px;
}

.panchang-calendar-popup-dialog {
	position: relative;
	background: #fff;
	border-radius: 6px;
	max-width: 480px;
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	overflow-x: hidden;
	box-shadow: 0 4px 24px rgba( 0, 0, 0, 0.25 );
}

.panchang-calendar-popup-content {
	padding: 0 20px 20px;
}

.panchang-calendar-popup-close {
	position: absolute;
	top: 10px;
	right: 10px;
	background: transparent;
	border: none;
	font-size: 1.6em;
	line-height: 1;
	cursor: pointer;
	color: #fff;
	padding: 4px 8px;
	border-radius: 50%;
	z-index: 1;
}

.panchang-calendar-popup-close:hover,
.panchang-calendar-popup-close:focus {
	background: rgba( 255, 255, 255, 0.2 );
	outline: none;
}

/* Beautified date heading (2026-08-02, per direct user feedback + a
   mockup the user confirmed): bleeds to the dialog's edges as a solid
   brand-orange band rather than plain black text, since
   .panchang-calendar-popup-content carries the dialog's padding instead of
   the dialog itself now (see above) -- this is the one element both the
   day-detail and month-festival-list popup content share, so styling it
   this way covers both without any JS/template restructuring. */
.panchang-calendar-popup-date {
	margin: 0 -20px 14px;
	padding: 16px 44px 14px 20px;
	background: #ff7e00;
	color: #fff;
	font-size: 1.1em;
	border-radius: 6px 6px 0 0;
}

.panchang-calendar-popup-fields {
	margin: 0 0 12px;
}

.panchang-calendar-popup-field {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	padding: 6px 0;
	border-bottom: 1px solid #f5ebe0;
	font-size: 0.9em;
}

.panchang-calendar-popup-field dt {
	font-weight: 600;
	color: #8a4a1f;
}

.panchang-calendar-popup-field dd {
	margin: 0;
	text-align: right;
}

/* One rounded callout box made of two adjacent elements -- outer corners
   only on each, so the shared edge between them stays flat instead of
   pinching inward at the seam. */
.panchang-calendar-popup-festivals-heading {
	background: #fdf1e2;
	border-radius: 6px 6px 0 0;
	font-size: 0.8em;
	font-weight: 600;
	color: #a85a00;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	margin: 12px 0 0;
	padding: 10px 12px 2px;
}

.panchang-calendar-popup-festivals {
	background: #fdf1e2;
	border-radius: 0 0 6px 6px;
	list-style: none;
	margin: 0 0 12px;
	padding: 2px 12px 10px 12px;
	font-size: 0.9em;
}
