/* ICAIC portal, styled after icaic.sg (css/styles.css there): its palette,
   subpage banner and programme table (the nav bar is nav.css), and its Geom font,
   self-hosted (OFL, fonts/OFL.txt) because contestant laptops can't reach
   Google Fonts. Every url() is relative to this file. */
@font-face {
  font-family: "Geom";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url(fonts/geom.woff2) format("woff2");
}
@font-face {
  font-family: "Geom";
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
  src: url(fonts/geom-italic.woff2) format("woff2");
}

:root {
  --primary: #1c3882;
  --primary-dark: #10245b;
  --primary-light: #0064ff;
  --secondary: #e77e30;
  --secondary-light: #f7931e;
  --text: #2d2a2d;
  --muted: #4b5563;
  --line: #dfe5ee;
  --tint: #f9fafd;
  --p-blue-header: #0050a5;
  --p-orange-tab: #eb7517;
  --p-gray: #e0e7f1;
  --tab-background: #edf2f7;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: "Geom", system-ui, sans-serif;
  font-weight: 300;
  line-height: 1.6;
  color: var(--text);
  background: #fff;
}

a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; }
strong, b { font-weight: 700; }

.container { width: 100%; max-width: 70rem; margin: 0 auto; padding: 0 1.5rem; }

/* --- home hero ------------------------------------------------------------ */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 34rem;
  padding: calc(var(--icaic-nav-height, 4.6rem) + 2rem) 1.5rem 3rem;
  text-align: center;
  color: #fff;
  background: linear-gradient(rgba(7, 7, 45, .35), rgba(7, 7, 45, .55)), #07072d url(hero.jpg) center / cover no-repeat;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}
.hero-logo {
  width: 11rem;
  height: auto;
  filter: drop-shadow(0 0 1.5rem rgba(255, 255, 255, .35));
}
.hero-title { margin: 1.25rem 0 0; font-size: 1.6rem; font-weight: 600; line-height: 1.3; }
.hero-date { margin: .75rem 0 0; font-size: 1.4rem; font-weight: 600; }
.hero-tagline { margin: .5rem 0 0; font-size: 1.1rem; font-weight: 400; letter-spacing: .02em; color: rgba(255, 255, 255, .85); }

/* --- subpage banner with breadcrumbs ------------------------------------- */
.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 20rem;
  padding: calc(var(--icaic-nav-height, 4.6rem) + 2rem) 1.5rem 3rem;
  text-align: center;
  color: #fff;
  background: var(--primary-dark) url(banner.jpg) top center / cover no-repeat;
}
.breadcrumbs {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
}
.breadcrumbs li { display: inline-block; }
.breadcrumbs li + li::before { content: "-"; margin: 0 .9rem; }
.breadcrumbs a { color: var(--secondary-light); }
.banner-title {
  margin: 1rem 0 0;
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .1rem;
  text-transform: uppercase;
}

.banner-date { margin: .5rem 0 0; font-size: 1.1rem; font-weight: 400; color: rgba(255, 255, 255, .85); }

/* --- page body ------------------------------------------------------------- */
main { flex: 1; padding: 3rem 0 4rem; }
.intro { text-align: center; margin: 0 auto 2.5rem; max-width: 48rem; }

/* --- the five contests, as icaic.sg's programme day cards ------------------ */
.section-title {
  margin: 0 0 1.5rem;
  text-align: center;
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--primary);
}
.contests {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin: 0 0 3.5rem;
  padding: 0;
}
.contest {
  border: 1px solid var(--line);
  border-left: 6px solid var(--p-blue-header);
  border-radius: 8px;
  background: var(--tint);
  overflow: hidden;
}
.contest-huawei { border-left-color: var(--p-orange-tab); }
/* The header bar hides and shows the contest's links (<details>). */
.contest-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: .25rem 1rem;
  padding: .85rem 1.25rem;
  background: var(--tab-background);
  cursor: pointer;
  list-style: none;
}
.contest-head::-webkit-details-marker { display: none; }
.contest-head::after {
  content: "\25BE";
  color: var(--primary);
  transition: transform .2s;
}
details:not([open]) > .contest-head::after { transform: rotate(-90deg); }
details[open] > .contest-head { border-bottom: 1px solid var(--line); }
.contest-head:hover { background: #e3eaf3; }
.contest-head:focus-visible { outline-offset: -2px; }
.contest-day { font-size: 14px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.contest-name { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; color: var(--primary-dark); }
.contest-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: .75rem;
  margin: 0;
  padding: 1rem 1.25rem;
}
.contest-links a {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  min-width: 11rem;
  min-height: 3.6rem;
  padding: .55rem 1rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: border-color .2s, background .2s;
}
.contest-links a:hover { border-color: var(--p-blue-header); background: #eef4fb; }
.contest-links a[target="_blank"] .contest-label::after { content: " \2197"; font-size: 12px; }
.contest-host { display: block; font-size: 12px; font-weight: 300; color: var(--muted); }
@media (max-width: 48rem) {
  .contest-links { padding: .85rem 1rem; }
  .contest-links li { flex: 1 1 0; min-width: 0; }
  .contest-links a { min-width: 0; }
  /* The date drops under the name; the toggle stays on the right. */
  .contest-head { grid-template-columns: 1fr auto; padding: .75rem 1rem; }
  .contest-head::after { grid-column: 2; grid-row: 1 / span 2; }
  .contest-day { grid-row: 2; }
}

.status { color: var(--muted); font-size: .875rem; margin: 0 0 .75rem; text-align: right; font-variant-numeric: tabular-nums; }
.notice {
  padding: .75rem 1rem;
  border-left: 4px solid var(--p-orange-tab);
  border-radius: 4px;
  background: #fde1cb;
  margin: 0 0 1.25rem;
}

/* --- problem set tabs: icaic.sg's programme day tabs ---------------------- */
.tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.25rem; }
.tab {
  flex: 0 1 9rem;
  padding: .7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  line-height: 1.4;
  color: var(--muted);
  background: var(--tab-background);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.tab-label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03rem;
  color: var(--primary);
}
.tab:hover { border-color: var(--p-blue-header); }
.tab:focus-visible { outline: 2px solid var(--p-blue-header); outline-offset: 2px; }
.tab[aria-selected="true"] { background: var(--p-orange-tab); border-color: var(--p-orange-tab); color: #fff; }
.tab[aria-selected="true"] .tab-label { color: #fff; }

/* --- ranking table: icaic.sg's programme table --------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--tint);
}
table.ranking { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ranking th, .ranking td { padding: .8rem 1rem; text-align: left; }
.ranking th { font-weight: 600; color: #fff; background: var(--p-blue-header); }
.ranking th:first-child { width: 7rem; text-align: center; color: #000; background: var(--p-gray); }
.ranking td { border-top: 1px solid var(--line); }
.ranking td:first-child { text-align: center; font-weight: 600; background: #fff; }
.ranking td.num, .ranking th.num { text-align: right; }
.ranking td.podium { color: var(--p-orange-tab); font-weight: 700; }
.ranking .empty td { text-align: center; color: var(--muted); padding: 2rem; background: transparent; }

/* --- footer: icaic.sg's sticky footer ------------------------------------- */
.footer { background: var(--primary-dark); color: #fff; font-size: .875rem; }
.footer .container { padding-top: 1rem; padding-bottom: 1rem; text-align: center; }

@media (max-width: 48rem) {
  .section-title { font-size: 1.75rem; }
  .ranking th, .ranking td { padding: .65rem .75rem; }
  .ranking th:first-child { width: 4rem; }
  .banner-title { font-size: 1.75rem; }
  .hero-logo { width: 8rem; }
  .hero-title { font-size: 1.25rem; }
}
