/* Cultural Portal — Madison Financial Services brand theme */

:root {
  --navy: #2b3990;
  --indigo: #2d2565;
  --blue: #176db4;
  --green: #009640;
  --green-2: #35ab51;
  --lime: #8bc53f;
  --gold: #b8963e;

  --bg: #edebe6;
  --bg-2: #e2dfd7;
  --surface: #ffffff;
  --text: #2d2565;
  --text-muted: #5b5878;
  --border: #d6d2c8;
  --danger: #b3261e;
  --danger-bg: #fbeae9;
  --success-bg: #e6f4ea;
  --info-bg: #e8ecf8;

  --band: linear-gradient(90deg, var(--navy) 0%, #264a8d 55%, var(--green-2) 100%);
  --pebble: 30px 16px 30px 16px;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(45 37 101 / 0.06), 0 6px 20px rgb(45 37 101 / 0.07);
  --font: "Segoe UI", "Myriad Pro", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-brand: "Times New Roman", Times, Georgia, serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
}

a { color: var(--blue); }
a:hover { color: var(--navy); }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--surface); padding: 8px 12px; z-index: 10;
}
.skip-link:focus { left: 8px; top: 8px; }

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

/* ---------- Header band ---------- */

.site-header { background: var(--band); color: #fff; }

.site-header__inner {
  max-width: 1120px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }

/* The official logo is navy on white, so it sits on a white pebble-shaped badge. */
.brand__badge {
  display: inline-flex; align-items: center;
  background: #fff; padding: 6px 12px;
  border-radius: 14px 6px 14px 6px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.15);
}
.brand__badge img { display: block; height: 38px; width: auto; }
.brand__sub {
  font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  padding-left: 14px; border-left: 2px solid rgb(255 255 255 / 0.45); line-height: 1.2;
}

.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.site-nav a,
.site-nav button {
  display: inline-block; padding: 8px 12px; border-radius: 999px;
  color: #fff; text-decoration: none; font: inherit; font-size: 15px;
  background: none; border: 0; cursor: pointer;
}
.site-nav a:hover,
.site-nav button:hover,
.site-nav a[aria-current="page"] { background: rgb(255 255 255 / 0.16); color: #fff; }
.site-nav form { margin: 0; }

.band-accent { height: 4px; background: linear-gradient(90deg, var(--lime), var(--green-2)); }

/* ---------- Layout ---------- */

main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 16px 48px; }

.site-footer { background: var(--indigo); color: rgb(255 255 255 / 0.85); font-size: 14px; }
.site-footer__inner { max-width: 1120px; margin: 0 auto; padding: 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }

h1, h2, h3 { color: var(--indigo); line-height: 1.2; }
h1 { font-size: clamp(26px, 4vw, 34px); margin: 0 0 8px; }
h2 { font-size: 22px; margin: 28px 0 12px; }
h3 { font-size: 18px; margin: 0 0 8px; }

.eyebrow { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 4px; }
.lead { font-size: 18px; color: var(--text-muted); margin: 0; }
.muted { color: var(--text-muted); }
.thrive { color: var(--green); font-weight: 800; }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ---------- Cards (pebble shapes) ---------- */

.card {
  background: var(--surface);
  border-radius: var(--pebble);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card--narrow { max-width: 560px; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.stat { border-left: 6px solid var(--navy); }
.stat:nth-child(2) { border-left-color: var(--blue); }
.stat:nth-child(3) { border-left-color: var(--green); }
.stat:nth-child(4) { border-left-color: var(--lime); }
.stat__value { font-size: 34px; font-weight: 800; color: var(--indigo); line-height: 1; }
.stat__label { color: var(--text-muted); font-size: 14px; margin-top: 6px; }

.hero {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: center;
  margin-bottom: 28px;
}
.hero h1 { font-size: clamp(30px, 5vw, 44px); }

/* Decorative pebble collage, echoing the report cover */
.pebbles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pebbles span { aspect-ratio: 4 / 3; border-radius: 22px 10px 22px 10px; }
.pebbles span:nth-child(1) { background: linear-gradient(135deg, var(--blue), var(--navy)); transform: rotate(-4deg); }
.pebbles span:nth-child(2) { background: linear-gradient(135deg, var(--lime), var(--green)); transform: translateY(-10px); }
.pebbles span:nth-child(3) { background: linear-gradient(135deg, var(--navy), var(--indigo)); transform: rotate(5deg); }
.pebbles span:nth-child(4) { background: linear-gradient(135deg, var(--green-2), var(--blue)); transform: rotate(3deg); }
.pebbles span:nth-child(5) { background: linear-gradient(135deg, #cfcabd, #b9b3a3); transform: translateY(8px); }
.pebbles span:nth-child(6) { background: linear-gradient(135deg, var(--blue), var(--green-2)); transform: rotate(-5deg); }

.empty-state { text-align: center; padding: 40px 22px; }
.empty-state__icon {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px 8px 20px 8px;
  background: linear-gradient(135deg, var(--navy), var(--green-2));
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  border-radius: 999px; border: 2px solid transparent;
  font: 600 15px/1.2 var(--font); text-decoration: none; cursor: pointer;
  background: var(--navy); color: #fff;
}
.btn:hover { background: var(--blue); color: #fff; }
.btn--green { background: var(--green); }
.btn--green:hover { background: #007a34; }
.btn--ghost { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn--ghost:hover { background: var(--navy); color: #fff; }
.btn--small { min-height: 34px; padding: 6px 14px; font-size: 14px; }
.btn--block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.btn-microsoft { background: #fff; color: #1f1f1f; border-color: #8c8c8c; font-weight: 600; }
.btn-microsoft:hover { background: #f3f3f3; color: #1f1f1f; }
.ms-logo { display: grid; grid-template-columns: 9px 9px; gap: 2px; }
.ms-logo i { width: 9px; height: 9px; display: block; }
.ms-logo i:nth-child(1) { background: #f25022; }
.ms-logo i:nth-child(2) { background: #7fba00; }
.ms-logo i:nth-child(3) { background: #00a4ef; }
.ms-logo i:nth-child(4) { background: #ffb900; }

/* ---------- Forms ---------- */

form > div,
.field { margin-bottom: 16px; }

label { display: block; font-weight: 600; margin-bottom: 6px; }

input[type="text"],
input[type="email"],
input[type="search"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font: inherit; color: var(--text); background: #fff;
}
input:focus,
select:focus,
textarea:focus { border-color: var(--blue); outline: 3px solid rgb(23 109 180 / 0.25); outline-offset: 0; }

input[type="file"] { font: inherit; max-width: 100%; padding: 8px 0; }

input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--green); vertical-align: middle; }
div:has(> input[type="checkbox"]) { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
div:has(> input[type="checkbox"]) label { margin: 0; order: 2; }
div:has(> input[type="checkbox"]) input { order: 1; }
div:has(> input[type="checkbox"]) .helptext { order: 3; flex-basis: 100%; }

.helptext { display: block; font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.errorlist { list-style: none; margin: 0 0 6px; padding: 0; color: var(--danger); font-size: 14px; font-weight: 600; }
.errorlist.nonfield { background: var(--danger-bg); padding: 10px 12px; border-radius: 10px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters > div { margin: 0; flex: 1 1 160px; }
.filters label { font-size: 13px; }
.inline-form { display: flex; gap: 8px; align-items: flex-start; }
.inline-form > div { flex: 1; margin: 0; }
.inline-form label { position: absolute; left: -999px; }

/* ---------- Messages ---------- */

.messages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.messages li { padding: 12px 16px; border-radius: 12px; background: var(--info-bg); border-left: 5px solid var(--navy); }
.messages .success { background: var(--success-bg); border-left-color: var(--green); }
.messages .error { background: var(--danger-bg); border-left-color: var(--danger); }
.messages .warning { background: #fdf4e3; border-left-color: var(--gold); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid #ece9e2; vertical-align: top; }
th { background: #f6f4ef; color: var(--indigo); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
  background: #eceaf5; color: var(--indigo);
}
.badge--admin { background: var(--navy); color: #fff; }
.badge--judge { background: var(--blue); color: #fff; }
.badge--ok { background: var(--success-bg); color: #0b5d2a; }
.badge--warn { background: #fdf4e3; color: #7a5a10; }
.badge--off { background: #eeeeee; color: #555; }

/* ---------- Company structure ---------- */

.branch { border-top: 1px solid #ece9e2; padding: 16px 0; }
.branch:first-of-type { border-top: 0; }
.branch__head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.dept-list { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.dept-list a {
  display: inline-block; padding: 6px 12px; border-radius: 14px 6px 14px 6px;
  background: #f1efe9; color: var(--indigo); text-decoration: none; font-size: 14px;
}
.dept-list a:hover { background: var(--info-bg); }
.dept-list .inactive { opacity: 0.6; text-decoration: line-through; }

/* ---------- Sign-in page ---------- */

.entrance { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; min-height: 60vh; }
.entrance .card { padding: 32px; }

.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 22px; padding: 0; list-style: none; }
.subnav a {
  display: inline-block; padding: 8px 14px; border-radius: 999px;
  background: var(--surface); color: var(--indigo); text-decoration: none; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow);
}
.subnav a[aria-current="page"] { background: var(--indigo); color: #fff; }

.pagination { display: flex; gap: 12px; align-items: center; margin-top: 16px; }

@media (max-width: 760px) {
  .hero, .entrance { grid-template-columns: 1fr; }
  .pebbles { max-width: 360px; }
  .site-nav { margin-left: 0; width: 100%; }
  .brand__badge img { height: 30px; }
  .brand__sub { font-size: 11px; padding-left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Competitions and photos ---------- */

.comp-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.comp-card {
  background: var(--surface); border-radius: var(--pebble); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
}
.comp-card__cover {
  display: block; aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--navy), var(--blue) 55%, var(--green-2));
}
.comp-card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.comp-card__body { padding: 16px 18px 18px; }
.comp-card__body h3 { margin: 0 0 4px; }
.comp-card__body h3 a { color: var(--indigo); text-decoration: none; }
.comp-card__body h3 a:hover { text-decoration: underline; }
.comp-card__scope { font-size: 14px; margin: 0 0 8px; }
.deadline { margin: 0; font-size: 14px; }
.deadline strong { color: var(--green); }

.comp-detail__cover {
  width: 100%; max-height: 320px; object-fit: cover; display: block;
  border-radius: var(--pebble); margin-bottom: 20px; box-shadow: var(--shadow);
}

.photo-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.photo-card { margin: 0; background: var(--surface); border-radius: var(--pebble); box-shadow: var(--shadow); overflow: hidden; }
.photo-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--bg-2); }
.photo-card figcaption { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.photo-card .btn-row { margin-top: 6px; }

.entry-preview {
  display: block; max-width: 100%; max-height: 280px; margin: 8px 0 16px;
  border-radius: 22px 10px 22px 10px; box-shadow: var(--shadow);
}

.rules-box { margin-top: 20px; padding: 12px 16px; background: #f6f4ef; border-radius: 12px; }
.rules-box summary { cursor: pointer; font-weight: 600; }

.comp-form fieldset { border: 0; margin: 0 0 16px; }
.comp-form legend { font-size: 20px; font-weight: 700; color: var(--indigo); padding: 0; margin-bottom: 12px; float: left; width: 100%; }
.comp-form legend + * { clear: both; }
.comp-form fieldset fieldset { padding: 0; margin: 0 0 16px; box-shadow: none; }
.comp-form fieldset fieldset legend { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.comp-form select[multiple] { min-height: 140px; }
.comp-form [hidden] { display: none; }

#id_allowed_file_types { display: flex; gap: 18px; flex-wrap: wrap; }
#id_allowed_file_types label { font-weight: 400; display: flex; gap: 8px; align-items: center; }

.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #8c1d17; }

.badge--status-draft { background: #eeeeee; color: #444; }
.badge--status-scheduled { background: var(--info-bg); color: var(--navy); }
.badge--status-open { background: var(--green); color: #fff; }
.badge--status-judging { background: #fdf4e3; color: #7a5a10; }
.badge--status-results { background: var(--indigo); color: #fff; }
.badge--status-cancelled { background: var(--danger-bg); color: var(--danger); }

/* ---------- Judging, voting and results ---------- */

.grid--3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.callout { border-left: 6px solid var(--green); margin: 0 0 20px; }
.callout h2 { margin-top: 0; }
.link-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

.entry-number {
  align-self: flex-start; font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 10px; border-radius: 999px; background: var(--info-bg); color: var(--navy);
}

.vote-grid { border: 0; padding: 0; margin: 0 0 16px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.vote-option { position: relative; cursor: pointer; display: flex; flex-direction: column; margin: 0; font-weight: 400; outline: 3px solid transparent; }
.vote-option input { position: absolute; top: 12px; left: 12px; width: 24px; height: 24px; z-index: 1; }
.vote-option__text { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.vote-option:has(input:checked) { outline-color: var(--green); box-shadow: 0 0 0 6px rgb(0 150 64 / 0.15); }
.vote-option:has(input:focus-visible) { outline-color: var(--blue); }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }

.photo-card--dq img { filter: grayscale(1); opacity: 0.6; }

.photo-grid--awards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.award-badge {
  align-self: flex-start; font-size: 13px; font-weight: 800; letter-spacing: 0.03em;
  padding: 3px 12px; border-radius: 999px; background: var(--indigo); color: #fff;
}
.award-card--1 { box-shadow: 0 0 0 3px var(--gold), var(--shadow); }
.award-card--1 .award-badge { background: var(--gold); color: #2d2565; }
.award-card--2 .award-badge { background: #8a8d99; }
.award-card--3 .award-badge { background: #9a6a3c; }
.award-card--pc .award-badge { background: var(--green); }
.award-card--hc .award-badge { background: var(--info-bg); color: var(--navy); }
.results-section { margin-bottom: 28px; }
.card fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.card fieldset legend { font-weight: 600; padding: 0; margin-bottom: 6px; }

/* ---------- Reports ---------- */
.export-box h3 { margin-top: 0; }
.breakdown { margin-top: 16px; }
.breakdown summary { cursor: pointer; font-weight: 600; color: var(--indigo); margin-bottom: 10px; }
