/*
	MMEA Fest site styles (loaded after Pico + compat.css)

	ink    #16243a  header band, headings
	teal   #1597b8  links and primary actions (from the MMEA logo)
	paper  #ffffff  content
	page   #eef1f4  background
	gold   #c8962e  awards
*/

:root {
	--fest-ink: #16243a;
	--fest-teal: #1597b8;
	--fest-teal-dark: #0f7591;
	--fest-page: #eef1f4;
	--fest-line: #dde3ea;
	--fest-muted: #5b6b7d;
	--fest-gold: #c8962e;
	--pico-font-family-sans-serif: "Archivo", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--pico-font-family: var(--pico-font-family-sans-serif);
	--pico-color: #1d2a3a;
	--pico-muted-color: var(--fest-muted);
	--pico-h1-color: var(--fest-ink);
	--pico-h2-color: var(--fest-ink);
	--pico-h3-color: var(--fest-ink);
	--pico-h4-color: var(--fest-ink);
	--pico-h5-color: var(--fest-ink);
	--pico-h6-color: var(--fest-ink);
	--pico-primary: var(--fest-teal-dark);
	--pico-primary-background: var(--fest-teal);
	--pico-primary-border: var(--fest-teal);
	--pico-primary-hover: var(--fest-ink);
	--pico-primary-hover-background: var(--fest-teal-dark);
	--pico-primary-hover-border: var(--fest-teal-dark);
	--pico-primary-focus: rgba(21, 151, 184, 0.3);
	--pico-primary-underline: rgba(15, 117, 145, 0.45);
	--fest-blue: var(--fest-teal);
}

html, body {
	background: var(--fest-page);
	min-height: 100%;
}
body { font-variation-settings: "wdth" 100; }

/* ---------- Header band ---------- */
.site-bar {
	background: var(--fest-ink);
	color: #fff;
	position: relative;
	padding-bottom: 12px;
}
/* film-strip edge: the one decorative touch */
.site-bar::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: 3px;
	height: 6px;
	background: radial-gradient(circle at 7px 3px, rgba(255,255,255,0.28) 2.2px, transparent 2.6px) 0 0 / 14px 6px repeat-x;
}
.site-bar-inner {
	max-width: 1100px;
	margin: 0 auto;
	padding: 0.6rem 1rem;
	display: flex;
	align-items: center;
	gap: 1.25rem;
	flex-wrap: wrap;
}
.site-brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; text-decoration: none; }
.site-brand img { background: #fff; border-radius: 50%; padding: 2px; }
.site-name {
	font-size: 1.45rem;
	font-weight: 800;
	font-variation-settings: "wdth" 70;
	letter-spacing: 0.01em;
	line-height: 1;
}
.site-nav { display: flex; justify-content: flex-start; gap: 0.25rem; flex-wrap: wrap; flex: 1; }
.site-nav a { margin: 0; }
.site-nav a {
	color: #cfe0ee;
	text-decoration: none;
	padding: 0.35rem 0.7rem;
	border-radius: 4px;
	font-weight: 500;
}
.site-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.site-nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--fest-teal); border-radius: 0; }
.site-user { display: flex; align-items: center; gap: 0.9rem; margin-left: auto; }
.site-user-name { font-weight: 600; line-height: 1.15; text-align: right; }
.site-user-name small { display: block; font-weight: 400; color: #a9bccd; font-size: 0.8em; }
.site-logout {
	color: #fff;
	border: 1px solid rgba(255,255,255,0.35);
	padding: 0.3rem 0.75rem;
	border-radius: 4px;
	text-decoration: none;
	font-size: 0.9em;
}
.site-logout:hover { background: #fff; color: var(--fest-ink); }
@media (max-width: 700px) {
	.site-nav { order: 3; flex-basis: 100%; }
	.site-user-name small { display: none; }
}

/* ---------- Page frame ---------- */
#wrap { margin-top: 1.25rem; border-radius: 6px; box-shadow: none; }
.page-title {
	font-size: 2.1rem;
	font-weight: 800;
	font-variation-settings: "wdth" 72;
	line-height: 1.05;
	margin: 0.5rem 0 1.25rem;
	color: var(--fest-ink);
}
h1, h2, h3, h4, h5 { font-variation-settings: "wdth" 88; }
p { color: #33414f; }

/* ---------- Category chips ---------- */
.chips { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 0.4rem; margin: 0 0 1.25rem; padding: 0; }
.chips a { margin: 0; }
.chips a {
	display: inline-flex;
	align-items: baseline;
	gap: 0.4rem;
	padding: 0.35rem 0.75rem;
	border: 1px solid var(--fest-line);
	border-radius: 999px;
	text-decoration: none;
	color: var(--fest-ink);
	background: #fff;
	font-size: 0.92em;
}
.chips a span { color: var(--fest-muted); font-size: 0.85em; }
.chips a:hover { border-color: var(--fest-teal); }
.chips a[aria-current="page"] { background: var(--fest-ink); border-color: var(--fest-ink); color: #fff; }
.chips a[aria-current="page"] span { color: #a9bccd; }

/* ---------- Video grid ---------- */
.video-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 1.5rem 1.1rem;
	margin: 0 0 2rem;
	clear: both;
}
.video-tile { margin: 0; }
.video-tile a { text-decoration: none; color: var(--fest-ink); display: block; }
.video-tile .thumb {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	background: #dfe6ee;
	border-radius: 4px;
}
.video-tile a:hover .thumb { outline: 3px solid var(--fest-teal); outline-offset: 2px; }
.video-tile .tile-title { display: block; font-weight: 600; margin-top: 0.45rem; line-height: 1.25; }
.video-tile .tile-meta { display: block; color: var(--fest-muted); font-size: 0.82em; margin-top: 0.15rem; }
.award { color: var(--fest-gold); font-weight: 700; }
.section-title { font-size: 1.35rem; margin: 1.5rem 0 0.75rem; }

/* thumbnails inside tables */
table .thumb { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 3px; background: #dfe6ee; display: block; }
.videolist .videothumb { width: 130px; }
.videolist .edit { width: 90px; }
.videolist td { vertical-align: middle; }
.videolist h5 { margin: 0; font-size: 1rem; }

/* ---------- Status labels ---------- */
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.8em; font-weight: 600; white-space: nowrap; }
.badge.ok { background: #e3f3e8; color: #1e6b3a; }
.badge.todo { background: #fff2d6; color: #7a5300; }
.badge.bad { background: #fde6e4; color: #9b1c1c; }
.badge.wait { background: #eef1f4; color: var(--fest-muted); }

/* ---------- Link checker on the entry form ---------- */
.link-status { margin: -0.4rem 0 1rem; padding: 0.6rem 0.8rem; border-radius: 4px; font-size: 0.92em; display: none; }
.link-status.ok { display: block; background: #e3f3e8; color: #1e6b3a; }
.link-status.warn { display: block; background: #fff2d6; color: #7a5300; }
.link-status.error { display: block; background: #fde6e4; color: #9b1c1c; }
.link-status.busy { display: block; background: #eef1f4; color: var(--fest-muted); }
.link-preview { margin: 0 0 1rem; }
.link-preview .video-wrap { max-width: 100%; }
.help { color: var(--fest-muted); font-size: 0.85em; margin: -0.5rem 0 1rem; }
.cat-info { background: #f4f7fa; border-left: 3px solid var(--fest-teal); padding: 0.5rem 0.8rem; margin: -0.4rem 0 1rem; font-size: 0.9em; }
.cat-info h4 { display: none; }
.cat-info p, .cat-info ul { margin: 0.2rem 0; }

/* ---------- Home page ---------- */
.home { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2.5rem; align-items: start; padding: 1rem 0.5rem; clear: both; }
.home-intro h1 { font-size: 2.6rem; font-weight: 800; font-variation-settings: "wdth" 70; line-height: 1; margin: 0.25rem 0 0.75rem; }
.home-intro .lede { font-size: 1.08rem; max-width: 34em; }
.home-login { background: #f6f8fa; border: 1px solid var(--fest-line); border-radius: 6px; padding: 1.25rem 1.25rem 0.5rem; }
.home-login h2 { font-size: 1.2rem; margin-top: 0; }
.archive-years { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; margin: 0.25rem 0 0; padding: 0; }
.archive-years a { text-decoration: none; font-weight: 600; }
@media (max-width: 767px) { .home { grid-template-columns: 1fr; gap: 1.5rem; } }

/* ---------- Judge score boxes ---------- */
.col_2 .judge-box {
	background-color: #f2f5fc;
	min-height: 225px;
	padding: 0.5rem;
	border-radius: 6px;
	border: 1px solid var(--fest-line);
}

/* ---------- Accessibility ---------- */
:focus-visible { outline: 3px solid var(--fest-teal); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Clickable table rows (dashboard) ---------- */
tr[url] { cursor: pointer; }
tr[url]:hover td { background: #fff5ab !important; }

/* ---------- Confirm dialogs ---------- */
dialog article { max-width: 30rem; }
dialog article footer { display: flex; justify-content: flex-end; gap: 0.5rem; align-items: center; }
dialog article footer .button, dialog article footer button { margin: 0; width: auto; }

/* ---------- Notification bars ---------- */
.flash { margin: 0.25rem 0 0.5rem; }
.notice {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	position: relative;
	margin: 0.6rem 0;
	padding: 0.7rem 0.75rem 0.7rem 1rem;
	border: 0;
	border-left: 4px solid var(--fest-teal);
	border-radius: 4px;
	background: #eaf4f8;
	color: var(--fest-ink);
	box-shadow: 0 1px 0 rgba(22, 36, 58, 0.06);
}
.notice p { margin: 0; flex: 1; color: inherit; line-height: 1.45; }
.notice.success { border-left-color: #2e8b57; background: #e8f5ec; color: #16402a; }
.notice.error   { border-left-color: #c0392b; background: #fdecea; color: #6b1a12; }
.notice.info, .notice.information { border-left-color: var(--fest-teal); background: #eaf4f8; color: var(--fest-ink); }
.notice-close {
	flex: none;
	width: 1.75rem; height: 1.75rem;
	margin: -0.15rem -0.15rem 0 0;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	font-size: 1.25rem;
	line-height: 1;
	opacity: 0.6;
	cursor: pointer;
}
.notice-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }
.flash .notice { animation: notice-in 0.25s ease-out; }
@keyframes notice-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- One-button action forms (postButton) ---------- */
form.post-inline { display: inline; margin: 0; }
form.post-inline button { width: auto; margin: 0; }
button.link-button { background: none; border: 0; padding: 0; color: var(--fest-teal-dark); text-decoration: underline; font: inherit; cursor: pointer; }
dialog article footer form.post-inline button { margin: 0; }
.home-account .button { margin: 0; }
.home-account p { margin: 0.5rem 0 0.75rem; }

/* ---------- Settings ---------- */
.season-status { background: #f6f8fa; border: 1px solid var(--fest-line); border-radius: 6px; padding: 0.6rem 1rem; margin: 0 0 1.25rem; }
.season-status p { margin: 0.35rem 0; }
.season-form { max-width: 46rem; }
.season-form fieldset { margin: 0 0 1.25rem; }
.season-form legend { font-weight: 700; color: var(--fest-ink); margin-bottom: 0.4rem; }
.season-form label small { display: block; color: var(--fest-muted); font-weight: 400; margin-top: -0.4rem; }
.season-form .opt { font-weight: 400; font-size: 0.85em; color: var(--fest-muted); }

/* ---------- Teacher comments ---------- */
ul.comments { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.comments li.comment { list-style: none; padding: 0.55rem 0; border-bottom: 1px solid var(--fest-line); line-height: 1.45; }
.comment-date { display: block; font-size: 0.8em; color: var(--fest-muted); }
button.link-button.comment-remove { font-size: 0.82em; color: #9b1c1c; margin-left: 0.25rem; }

/* ---------- Judging rubrics (/settings/rubrics) ---------- */
.crumbs { font-size: 0.9em; margin: -0.5rem 0 1rem; }
.points-bar { display: flex; gap: 2px; height: 0.7rem; border-radius: 3px; overflow: hidden; min-width: 8rem; background: var(--fest-line); }
.points-bar .seg { min-width: 2px; }
.points-bar .s0 { background: #16243a; } .points-bar .s1 { background: #1597b8; } .points-bar .s2 { background: #5b6b7d; }
.points-bar .s3 { background: #0f7591; } .points-bar .s4 { background: #8fb9cc; } .points-bar .s5 { background: #c8962e; }
.points-bar.big { height: auto; min-height: 3rem; border-radius: 6px; gap: 3px; }
.points-bar.big .seg { display: flex; flex-direction: column; justify-content: center; padding: 0.35rem 0.55rem; color: #fff; font-size: 0.85rem; line-height: 1.2; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.points-bar.big .seg b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.points-bar.big .s4 { color: #16243a; }
.rubric-summary { margin: 0 0 1.25rem; }
.rubric-summary .help { margin: 0.5rem 0 0; }
table.rubric-list td { vertical-align: middle; }
table.rubric-list td:nth-child(2) { width: 50%; }
table.rubric-list .crit-names { display: block; font-size: 0.8em; color: var(--fest-muted); margin-top: 0.25rem; }
table.rubric-list .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.rubric-list tr[url] { cursor: pointer; }
.rubric-form { max-width: 52rem; }
ol.criteria { list-style: none; padding: 0; margin: 1rem 0; counter-reset: crit; }
ol.criteria li.criterion { list-style: none; border-left: 4px solid var(--fest-teal); background: #f6f8fa; border-radius: 0 6px 6px 0; padding: 0.85rem 1rem 0.4rem; margin: 0 0 0.9rem; counter-increment: crit; }
li.criterion:nth-child(6n+1) { border-left-color: #16243a; } li.criterion:nth-child(6n+2) { border-left-color: #1597b8; }
li.criterion:nth-child(6n+3) { border-left-color: #5b6b7d; } li.criterion:nth-child(6n+4) { border-left-color: #0f7591; }
li.criterion:nth-child(6n+5) { border-left-color: #8fb9cc; } li.criterion:nth-child(6n+6) { border-left-color: #c8962e; }
.criterion-head { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.criterion-title { flex: 1 1 16rem; }
.criterion-title::before { content: counter(crit) ". "; font-weight: 700; color: var(--fest-ink); }
.criterion-tools { display: flex; gap: 0.35rem; margin-bottom: var(--pico-spacing); }
.criterion-tools button { width: auto; margin: 0; padding: 0.3rem 0.6rem; }
.criterion-tools button.remove { color: #9b1c1c; border-color: #e7b9b5; }
.choice-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 0.75rem; }
@media (max-width: 640px) { .choice-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice-summary { font-size: 0.9em; margin: -0.35rem 0 0.6rem; color: var(--fest-ink); }
.choice-summary.problem { color: #9b1c1c; font-weight: 600; }
.criterion .field-name { margin: -0.25rem 0 0.4rem; font-size: 0.78em; }
.rubric-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.rubric-actions button { width: auto; margin: 0; }
.rubric-actions .help { margin: 0; }
.rubric-preview { margin-top: 2rem; border-top: 1px solid var(--fest-line); padding-top: 1rem; }
.rubric-preview summary { font-weight: 600; color: var(--fest-teal-dark); }
.rubric-preview [inert] { opacity: 0.92; }
.rubric-note { background: #fff8e8; border-left: 4px solid var(--fest-gold); padding: 0.5rem 0.9rem; margin-bottom: 1rem; border-radius: 0 6px 6px 0; }
.rubric-note p { margin: 0.25rem 0; }
.rubric-criterion { border-bottom: 1px solid var(--fest-line); padding-bottom: 0.4rem; margin-bottom: 0.9rem; }
