/* The Calendar Widget: public events calendar + event detail (light theme, workspace accent). */

:root {
	--ink: #111317;
	--text: #2a2e35;
	--muted: #5b616e;
	--line: #e3e6eb;
	--line-strong: #c4c9d1;
	--surface: #ffffff;
	--page: #eef0f3;
	--soft: #f6f7f9;
	--danger: #b3372f;
	--radius: 14px;
	--radius-sm: 10px;
	--ease: 160ms ease-out;
	--accent: #111317;
	--accent-ink: #ffffff;
	--accent-text: #111317;
	--accent-soft: #e7e7e8;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	padding: 32px 16px 24px;
	min-height: 100vh;
	background: var(--page);
	color: var(--text);
	font: 400 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.tcw-is-embed, .tcw-is-embed body { background: transparent; min-height: 0; }
.tcw-is-embed body { padding: 0; }

h1, h2, h3 {
	font-family: "Sora", "Inter", system-ui, sans-serif;
	color: var(--ink);
	letter-spacing: 0.01em;
	line-height: 1.25;
	margin: 0;
}
p { margin: 0; }
a { color: var(--accent-text); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tcw-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.tcw-card {
	width: 100%;
	max-width: 1080px;
	margin: 0 auto;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: 0 1px 2px rgba(17, 19, 23, 0.04), 0 12px 32px rgba(17, 19, 23, 0.06);
	overflow: hidden;
}
.tcw-is-embed .tcw-card { max-width: none; box-shadow: none; }

.tcw-card__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--line);
}
.tcw-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; flex: none; }
.tcw-title { font-size: 1.15rem; font-weight: 600; flex: 1; min-width: 0; }
.tcw-head-name { margin-left: auto; color: var(--muted); font-size: 0.9rem; text-align: right; }
.tcw-backlink {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 600;
	text-decoration: none;
	min-height: 40px;
}
.tcw-backlink:hover { text-decoration: underline; }

.tcw-view { padding: 20px; }
@media (min-width: 640px) {
	.tcw-view { padding: 24px 28px 28px; }
	.tcw-card__head { padding: 18px 28px; }
}

.tcw-powered { text-align: center; font-size: 0.8rem; color: var(--muted); margin-top: 16px; }
.tcw-powered a { color: var(--muted); }

.tcw-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 16px 0; }
.tcw-spinner {
	width: 18px; height: 18px;
	border: 2px solid var(--line);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: tcw-spin 800ms linear infinite;
}
@keyframes tcw-spin { to { transform: rotate(360deg); } }

/* Toolbar ------------------------------------------------------------------ */

.tcw-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 16px;
	margin-bottom: 18px;
}
.tcw-toolbar__month {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-right: auto;
}
.tcw-toolbar__month h2 { font-size: 1.1rem; font-weight: 600; min-width: 9.5em; margin: 0 6px; }
.tcw-toolbar__filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.tcw-icon-btn {
	display: inline-grid;
	place-items: center;
	width: 36px; height: 36px;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: var(--surface);
	color: var(--ink);
	cursor: pointer;
}
.tcw-icon-btn:hover { background: var(--soft); }

.tcw-seg {
	display: inline-flex;
	padding: 3px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--soft);
}
.tcw-seg button {
	border: 0;
	background: transparent;
	padding: 6px 14px;
	border-radius: 999px;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--muted);
	cursor: pointer;
	min-height: 32px;
}
.tcw-seg button[aria-pressed="true"] {
	background: var(--surface);
	color: var(--ink);
	box-shadow: 0 1px 3px rgba(17, 19, 23, 0.12);
}

.tcw-select {
	font: inherit;
	font-size: 0.9rem;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	padding: 7px 12px;
	min-height: 36px;
	max-width: 100%;
}

.tcw-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 40px;
	padding: 8px 18px;
	border-radius: 999px;
	border: 1px solid var(--accent);
	background: var(--accent);
	color: var(--accent-ink);
	font: inherit;
	font-weight: 600;
	font-size: 0.95rem;
	text-decoration: none;
	cursor: pointer;
	transition: filter var(--ease);
}
.tcw-btn:hover { filter: brightness(0.94); }
.tcw-btn:disabled { opacity: 0.6; cursor: progress; }
.tcw-btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.tcw-btn--ghost:hover { background: var(--soft); filter: none; }
.tcw-btn--sm { min-height: 34px; padding: 6px 14px; font-size: 0.875rem; }

.tcw-tznote { font-size: 0.8rem; color: var(--muted); margin-top: 14px; }

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

.tcw-month {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
}
.tcw-month th {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--muted);
	padding: 0 6px 8px;
	text-align: left;
}
.tcw-month td {
	vertical-align: top;
	border: 1px solid var(--line);
	height: 108px;
	padding: 4px;
	background: var(--surface);
}
.tcw-month td.is-other { background: var(--soft); }
.tcw-month td.is-other .tcw-daynum { color: #8a909b; }
.tcw-daynum {
	display: inline-grid;
	place-items: center;
	min-width: 30px; height: 30px;
	padding: 0 6px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--ink);
	font: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
}
.tcw-daynum:hover { background: var(--soft); }
.is-today .tcw-daynum { box-shadow: inset 0 0 0 2px var(--accent); }
.tcw-daynum[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.tcw-chips { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.tcw-chips > li { min-width: 0; }
.tcw-chip {
	display: block;
	padding: 3px 6px;
	border-radius: 6px;
	background: var(--accent-soft);
	color: var(--accent-text);
	font-size: 0.75rem;
	line-height: 1.3;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tcw-chip:hover { text-decoration: underline; }
.tcw-chip b { font-weight: 600; }
.tcw-more {
	border: 0;
	background: none;
	padding: 2px 6px;
	font: inherit;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--accent-text);
	cursor: pointer;
	text-align: left;
}
.tcw-dots { display: none; gap: 3px; justify-content: center; margin-top: 2px; }
.tcw-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

@media (max-width: 640px) {
	.tcw-month td { height: 52px; text-align: center; padding: 2px; }
	.tcw-month th { text-align: center; padding: 0 0 6px; }
	.tcw-chips, .tcw-more { display: none; }
	.tcw-dots { display: flex; }
	.tcw-toolbar__month h2 { min-width: 0; }
}

.tcw-day-panel { margin-top: 20px; }
.tcw-day-panel h3 { font-size: 1rem; margin-bottom: 10px; }

/* List --------------------------------------------------------------------- */

.tcw-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tcw-list__day { font-family: "Sora", "Inter", sans-serif; font-weight: 600; color: var(--ink); font-size: 0.95rem; margin: 18px 0 8px; }
.tcw-list__day:first-child { margin-top: 0; }
.tcw-item {
	display: grid;
	grid-template-columns: 76px 1fr;
	gap: 14px;
	align-items: center;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	color: inherit;
	text-decoration: none;
	transition: border-color var(--ease), box-shadow var(--ease);
}
.tcw-item:hover { border-color: var(--line-strong); box-shadow: 0 6px 18px rgba(17, 19, 23, 0.07); }
.tcw-item__img {
	width: 76px; height: 76px;
	border-radius: var(--radius-sm);
	object-fit: cover;
	background: var(--accent-soft);
	display: grid;
	place-items: center;
	color: var(--accent-text);
	font-family: "Sora", "Inter", sans-serif;
	text-align: center;
	line-height: 1.1;
}
.tcw-item__img b { display: block; font-size: 1.3rem; }
.tcw-item__img small { font-size: 0.7rem; font-weight: 600; }
.tcw-item__title { font-weight: 600; color: var(--ink); font-size: 1rem; }
.tcw-item__meta { color: var(--muted); font-size: 0.875rem; display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; }
.tcw-badge {
	display: inline-block;
	padding: 1px 8px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 600;
	border: 1px solid var(--line);
	color: var(--ink);
	background: var(--soft);
}
.tcw-badge--full { color: var(--danger); border-color: #f1c6c2; background: #fdf0ef; }

.tcw-empty {
	padding: 24px;
	border: 1px dashed var(--line-strong);
	border-radius: var(--radius-sm);
	color: var(--muted);
	text-align: center;
}
.tcw-alert {
	padding: 12px 14px;
	border-radius: var(--radius-sm);
	background: #fdf0ef;
	border: 1px solid #f1c6c2;
	color: var(--danger);
	margin-bottom: 14px;
}
.tcw-alert--ok { background: #eef8f2; border-color: #bfe3cf; color: #23663f; }

.tcw-foot-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; align-items: center; }

/* Event detail ------------------------------------------------------------- */

.tcw-event__img { display: block; width: 100%; max-height: 360px; object-fit: cover; }
.tcw-event__body { padding: 22px 20px 28px; display: grid; gap: 18px; }
@media (min-width: 640px) { .tcw-event__body { padding: 28px 28px 32px; } }
.tcw-event__title { font-size: 1.6rem; font-weight: 700; }
.tcw-event__desc { color: var(--text); }
.tcw-event__desc:empty { display: none; }
.tcw-event__desc > * + * { margin-top: 0.8em; }
.tcw-event__desc img { max-width: 100%; height: auto; }

.tcw-facts { display: grid; gap: 10px; margin: 0; }
.tcw-facts div { display: flex; gap: 10px; align-items: flex-start; }
.tcw-facts dt { flex: none; color: var(--muted); padding-top: 2px; }
.tcw-facts dd { margin: 0; color: var(--ink); font-weight: 500; }
.tcw-facts dd small { display: block; color: var(--muted); font-weight: 400; }

.tcw-occ { border: 0; margin: 20px 0 0; padding: 0; }
.tcw-occ legend { font-weight: 600; color: var(--ink); margin-bottom: 8px; padding: 0; }
.tcw-occ__list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.tcw-occ label {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-size: 0.9rem;
}
.tcw-occ label small { display: block; color: var(--muted); }
.tcw-occ input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.tcw-occ label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.tcw-occ label:has(input:disabled) { opacity: 0.6; cursor: not-allowed; }

.tcw-rsvp { border-top: 1px solid var(--line); padding-top: 20px; }
.tcw-rsvp:empty { display: none; }
.tcw-rsvp h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 4px; }
.tcw-rsvp > p { color: var(--muted); margin-bottom: 14px; }

.tcw-form { display: grid; gap: 14px; }
@media (min-width: 640px) {
	.tcw-form { grid-template-columns: 1fr 1fr 120px; align-items: start; }
	.tcw-form .tcw-span { grid-column: 1 / -1; }
}
.tcw-field { display: grid; gap: 6px; }
.tcw-field label { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.tcw-field input, .tcw-field select {
	width: 100%;
	font: inherit;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-sm);
	padding: 10px 12px;
}
.tcw-field input:focus, .tcw-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tcw-field [aria-invalid="true"] { border-color: var(--danger); }
.tcw-err { font-size: 0.85rem; color: var(--danger); font-weight: 500; }
.tcw-hint { font-size: 0.8rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation-duration: 1ms !important; }
}

.tcw-preview-note {
	margin: 0;
	padding: 10px 20px;
	background: #fff7e6;
	border-bottom: 1px solid #f0d9a8;
	color: #6b4e12;
	font-size: 0.9rem;
}

/* Headings get focus programmatically so screen readers announce each step; no ring needed. */
[tabindex="-1"]:focus { outline: none; }
