/* CLAUDE #96: moved from fieldset/crew.php, where it was a <style> block, linked there now (filed by topic, #98). CLAUDE #171: only this
   layout's rules (the template form's rows use the shared styles alone) */

/* each role is one line: its name and Name box (the form's usual row), At Auditions, and + */
/* CLAUDE #195: the last two columns are a fixed width, so the summary's At Auditions heading lines up over them (was 1fr auto
// auto, which that heading sized when it was the group's first row) */
#crew_fs .group {
	display: grid;
	grid-template-columns: 1fr 2.5rem 2.5rem 2.5rem; /* CLAUDE #174: and Needed */
}

/* CLAUDE #195: a group's summary: a caret, its name, and the At Auditions heading (which shows only while the group is open) */
#crew_fs details > summary {
	display: flex;
	align-items: end;
	color: inherit;
	list-style: none;
}

#crew_fs details > summary::-webkit-details-marker {
	display: none;
}

/* CLAUDE #216: bold (owner) */
#crew_fs details > summary::before {
	content: "\f0da";
	align-self: center;
	width: 0.75rem;
	padding-left: 0.5rem;
	color: var(--accentColor);
	font-weight: bold;
}

#crew_fs details[open] > summary::before {
	content: "\f0d7";
}

#crew_fs details[open] + details {
	margin-top: 1rem;
}

/* CLAUDE #216: the link color again, now that the groups' titles open and close them, and font-weight 600 (owner); CLAUDE #171 made it the standard text color (it was var(--accentColor)) */
#crew_fs details > summary > h3 {
	flex: 1;
	margin: 0;
	padding: 0.5rem;
	font-size: inherit;
	color: var(--accentColor);
	font-weight: 600;
}

#crew_fs details > summary > span {
	width: 5rem;
	box-sizing: border-box;
	padding: 0.5rem 0.5rem 0.25rem;
	font-size: 0.75rem;
	text-align: start;
}

#crew_fs details:not([open]) > summary > span {
	visibility: hidden;
}

/* CLAUDE #174: the Needed column's heading, over its one column */
#crew_fs details > summary > span + span {
	width: 2.5rem;
	padding: 0.5rem 0 0.25rem;
	text-align: center;
}

/* a long role's name wraps only when the Name box would get too narrow */
#crew_fs .group > label > span {
	flex: 0 1 max-content;
	white-space: normal;
}

#crew_fs .group > label > input[name^=crewname] {
	flex: 1 1 6rem;
	min-width: min(6rem, 20vw); /* CLAUDE #639: 6rem as before, but a fifth of a phone's screen (75px at 375, 72 at 360): 6rem, with
	                               "Choreographer" (a word that can't wrap) and the three columns, made the row wider than the screen. Wider than
	                               480px it's 6rem, so the rows there are unchanged (Other Roles' Name box shrank to it beside the typed role) */
}

/* the typed role, in Other Roles */
#crew_fs .group > label > input[name^=crewlabel] {
	text-align: start;
	text-align-last: start;
}

/* At Auditions's text is for screen readers; the column's heading shows it */
#crew_fs .group > label:has(input[type=checkbox]) {
	justify-content: center;
}

#crew_fs .group > label:has(input[type=checkbox]) > span {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
}

#crew_fs .group > button {
	padding: 0 0.5rem;
	border: 0;
	border-bottom: 0.5px solid lightgray;
	border-radius: 0;
	background: none;
	font-size: 0;
}

#crew_fs .group > button::before {
	font-size: 1.2rem;
}

/* At Auditions and + wait for a name, as on breaklegs (their cells stay, keeping the row's line) */
#crew_fs .group > label:has(input[name^=crewname]:placeholder-shown) + label > input,
#crew_fs .group > label:has(input[name^=crewname]:placeholder-shown) + label + button::before {
	visibility: hidden;
}

#crew_fs .group > label:has(input[name^=crewname]:placeholder-shown) + label + button {
	pointer-events: none;
}

/* CLAUDE #174: and Needed is the other way round: only while the role has no name (as on breaklegs; a name makes it count for nothing) */
#crew_fs .group > label:has(input[name^=crewname]:not(:placeholder-shown)) + label + button + label > input {
	visibility: hidden;
}

/* CLAUDE #248: without At Auditions (Good Show's form), its column and heading are hidden; its checkboxes stay in the rows, so saved values
   are sent back. CLAUDE #96: a class on the fieldset (Crew()'s no_at_auditions), which was a <style> printed only then */
#crew_fs.no_at_auditions .group {
	grid-template-columns: 1fr 2.5rem 2.5rem;
}

#crew_fs.no_at_auditions .group > label:has(input[name^=crewauditions]),
#crew_fs.no_at_auditions details > summary > span:first-of-type {
	display: none;
}
