/* CyberQuest, over CTFd's core theme.
 *
 * CTFd's core theme is Bootstrap 5.3. This file is loaded after it, from
 * <link> tags injected through the theme_header config, and it does two
 * things: it repoints Bootstrap's own custom properties at the event
 * palette, and it restyles the handful of components players actually look
 * at. Nothing in CTFd is forked, so a CTFd upgrade cannot break a template
 * that no longer exists.
 *
 * Caddy serves this file, and everything beside it, from /opt/cyberquest-ctfd/brand
 * on the instance. That means it can be edited in place during an event and
 * takes effect on the next reload, with no container restart and no database
 * write. The next terraform apply puts it back.
 *
 * The look is the ZeroDays poster aesthetic: skewed accent bars, hexagon
 * markers, a four-pixel accent edge on a raised surface, square corners
 * everywhere. There is no second site to stay in step with, so this file is
 * the whole of the look and can be changed freely.
 */

/* ------------------------------------------------------------------ fonts */
/* Chakra Petch and IBM Plex Sans, both SIL Open Font License. The files sit
   in infra/stack/brand/fonts and are copied onto the box with this
   stylesheet, so the site does not depend on Google Fonts being reachable
   from a school network. */
@font-face {
  font-family: 'Chakra Petch';
  src: url('/brand/fonts/chakra-petch-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Chakra Petch';
  src: url('/brand/fonts/chakra-petch-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/brand/fonts/ibm-plex-sans-var.woff2') format('woff2');
  font-weight: 100 700; font-style: normal; font-display: swap;
}

/* ----------------------------------------------------------------- tokens */
/* Declared for light as well as dark. CTFd ships a theme switch, and a half
   converted light mode looks broken rather than light, so there is one
   palette and the switch is hidden below. */
:root,
[data-bs-theme=light],
[data-bs-theme=dark] {
  color-scheme: dark;

  --cq-ink:#0A0E15;
  --cq-raise:#121926;
  --cq-raise-hi:#18212F;
  --cq-rule:#1E2736;
  --cq-paper:#E9EEF5;
  --cq-mute:#8C9AAE;

  --cq-cyan:#60C6DE;
  --cq-violet:#A06BC8;
  --cq-lime:#AECC48;
  --cq-amber:#F6DE42;
  --cq-magenta:#E44896;
  --cq-azure:#5B9BE0;

  /* Every accented component reads this. Category sections reassign it. */
  --accent:var(--cq-cyan);

  --cq-display:'Chakra Petch',system-ui,sans-serif;
  --cq-text:'IBM Plex Sans',system-ui,sans-serif;

  /* Bootstrap, repointed. The -rgb pairs matter: Bootstrap composes several
     of its own colours as rgba(var(--bs-...-rgb), opacity). */
  --bs-body-bg:#0A0E15;
  --bs-body-bg-rgb:10,14,21;
  --bs-body-color:#E9EEF5;
  --bs-body-color-rgb:233,238,245;
  --bs-body-font-family:var(--cq-text);
  --bs-body-font-size:1.0625rem;
  --bs-body-line-height:1.65;

  --bs-emphasis-color:#FFFFFF;
  --bs-emphasis-color-rgb:255,255,255;
  --bs-heading-color:#E9EEF5;

  --bs-secondary-color:#8C9AAE;
  --bs-secondary-color-rgb:140,154,174;
  --bs-secondary-bg:#121926;
  --bs-secondary-bg-rgb:18,25,38;
  --bs-tertiary-color:#8C9AAE;
  --bs-tertiary-color-rgb:140,154,174;
  --bs-tertiary-bg:#121926;
  --bs-tertiary-bg-rgb:18,25,38;

  --bs-border-color:#1E2736;
  --bs-border-color-translucent:rgba(233,238,245,.12);
  /* Not one rounded corner anywhere on the site. */
  --bs-border-radius:0;
  --bs-border-radius-sm:0;
  --bs-border-radius-lg:0;
  --bs-border-radius-xl:0;
  --bs-border-radius-2xl:0;
  --bs-border-radius-pill:999px;

  --bs-link-color:#60C6DE;
  --bs-link-color-rgb:96,198,222;
  --bs-link-hover-color:#8FDAEC;
  --bs-link-hover-color-rgb:143,218,236;

  --bs-primary:#60C6DE;
  --bs-primary-rgb:96,198,222;
  --bs-success:#AECC48;
  --bs-success-rgb:174,204,72;
  --bs-info:#5B9BE0;
  --bs-info-rgb:91,155,224;
  --bs-warning:#F6DE42;
  --bs-warning-rgb:246,222,66;
  --bs-danger:#E44896;
  --bs-danger-rgb:228,72,150;
  --bs-secondary:#8C9AAE;
  --bs-secondary-rgb:140,154,174;
  /* .bg-dark is what paints the navbar. */
  --bs-dark:#0A0E15;
  --bs-dark-rgb:10,14,21;
  --bs-light:#E9EEF5;
  --bs-light-rgb:233,238,245;

  --bs-code-color:#AECC48;
  --bs-highlight-bg:#1E2736;
  --bs-highlight-color:#E9EEF5;
}

/* Accent utilities, so page content can pick a colour without a style
   attribute. */
.a-cyan{--accent:var(--cq-cyan)}
.a-violet{--accent:var(--cq-violet)}
.a-lime{--accent:var(--cq-lime)}
.a-amber{--accent:var(--cq-amber)}
.a-magenta{--accent:var(--cq-magenta)}
.a-azure{--accent:var(--cq-azure)}

/* ------------------------------------------------------------------- base */
/* The core theme sets Lato on `.container` as well as on body, so overriding
   body alone leaves most of the page in Lato. */
html, body, .container, .container-fluid {
  font-family:var(--cq-text);
}

body {
  background-color:var(--cq-ink);
  /* A faint signal grid, so a mostly empty page is not a void. */
  background-image:
    linear-gradient(transparent 95%, rgba(96,198,222,.045) 95%),
    linear-gradient(90deg, transparent 95%, rgba(96,198,222,.045) 95%);
  background-size:52px 52px;
  background-attachment:fixed;
}

h1, h2, h3, h4, h5, h6 {
  font-family:var(--cq-display);
  font-weight:700;
  letter-spacing:-.005em;
  color:var(--cq-paper);
}
/* The core theme tracks h1 and h2 out by 2px, which Chakra Petch does not
   need and which makes a long challenge name wrap early. */
h1, h2 { letter-spacing:-.01em; }

code, pre, kbd, samp { font-family:ui-monospace,'SFMono-Regular',Menlo,Consolas,monospace; }
code { color:var(--cq-lime); }

hr { border-color:var(--cq-rule); opacity:1; }

blockquote {
  border-left:4px solid var(--accent);
  padding-left:1rem;
  color:#C3CDDA;
}

:where(a, button, input, select, textarea, .btn, [tabindex]):focus-visible {
  outline:3px solid var(--cq-lime);
  outline-offset:2px;
  box-shadow:none;
}

/* ---------------------------------------------------------------- navbar */
.navbar.bg-dark {
  background-color:var(--cq-ink) !important;
  border-bottom:1px solid var(--cq-rule);
  --bs-navbar-color:#8C9AAE;
  --bs-navbar-hover-color:#E9EEF5;
  --bs-navbar-active-color:#E9EEF5;
  --bs-navbar-brand-color:#E9EEF5;
  --bs-navbar-brand-hover-color:#E9EEF5;
  --bs-navbar-toggler-border-color:var(--cq-rule);
}

/* CTFd pins the navbar and then pushes the page down by a fixed 3.5rem. On
   a narrow screen the bar is taller than that, because the event name and
   the menu button stop fitting on one line, and the top of the page ends up
   underneath it. Sticky instead of fixed keeps the bar pinned while leaving
   it in the flow, so whatever height it takes is height the page has
   accounted for, at any width and any length of event name. */
.navbar.fixed-top { position:sticky; }
main { padding-top:0; }
/* A page with no title block (the front page, the rules) would otherwise
   start hard against the bar. Pages that do have one get their space from
   .jumbotron below. */
main > .container:first-child { padding-top:2.5rem; }

.navbar-brand {
  font-family:var(--cq-display);
  font-weight:700;
  font-size:.95rem;
  letter-spacing:.12em;
  text-transform:uppercase;
}
/* The event name sits in the navbar on every page. Set small enough on a
   phone that it still shares a line with the menu button. */
@media (max-width:575.98px) {
  .navbar-brand { font-size:.7rem; letter-spacing:.06em; }
}

.navbar .nav-link {
  border-bottom:1px solid transparent;
  transition:color .12s ease, border-color .12s ease;
}
.navbar .nav-link:hover,
.navbar .nav-link:focus-visible {
  border-bottom-color:var(--cq-cyan);
}

.navbar .dropdown-menu {
  --bs-dropdown-bg:var(--cq-raise);
  --bs-dropdown-border-color:var(--cq-rule);
  --bs-dropdown-link-color:var(--cq-paper);
  --bs-dropdown-link-hover-bg:var(--cq-raise-hi);
  --bs-dropdown-link-hover-color:var(--cq-paper);
  --bs-dropdown-link-active-bg:var(--cq-cyan);
  --bs-dropdown-link-active-color:var(--cq-ink);
}

/* One palette, so the light/dark switch has nothing to switch. */
.theme-switch { display:none !important; }

/* ------------------------------------------------------- page title block */
/* CTFd puts every page title in a centred dark slab. Emptied out: the title
   carries itself, under a short skewed rule matching the date
   chips. */
.jumbotron {
  background-color:transparent;
  color:var(--cq-paper);
  text-align:left;
  padding:2.5rem 0 0;
  margin-bottom:2rem;
  border-bottom:1px solid var(--cq-rule);
}
@media (min-width:576px) { .jumbotron { padding:3.25rem 0 0; } }

.jumbotron .container { font-family:var(--cq-text); }

.jumbotron h1 {
  font-family:var(--cq-display);
  font-weight:700;
  font-size:clamp(2.1rem,5.5vw,3.25rem);
  line-height:1;
  margin:0 0 1.75rem;
}
.jumbotron h1::after {
  content:"";
  display:block;
  width:3.25rem;
  height:4px;
  margin-top:1.1rem;
  background:var(--cq-cyan);
  transform:skewX(-20deg);
}

/* --------------------------------------------------------------- buttons */
.btn {
  font-family:var(--cq-display);
  font-weight:600;
  letter-spacing:.02em;
  --bs-btn-border-radius:0;
}

.btn-primary {
  --bs-btn-bg:#60C6DE;
  --bs-btn-border-color:#60C6DE;
  --bs-btn-color:#0A0E15;
  --bs-btn-hover-bg:#8FDAEC;
  --bs-btn-hover-border-color:#8FDAEC;
  --bs-btn-hover-color:#0A0E15;
  --bs-btn-active-bg:#4FB4CC;
  --bs-btn-active-border-color:#4FB4CC;
  --bs-btn-active-color:#0A0E15;
  --bs-btn-disabled-bg:#3A5E68;
  --bs-btn-disabled-border-color:#3A5E68;
  --bs-btn-disabled-color:#0A0E15;
}

.btn-success {
  --bs-btn-bg:#AECC48;
  --bs-btn-border-color:#AECC48;
  --bs-btn-color:#0A0E15;
  --bs-btn-hover-bg:#BCD95A;
  --bs-btn-hover-border-color:#BCD95A;
  --bs-btn-hover-color:#0A0E15;
}

.btn-secondary, .btn-dark {
  --bs-btn-bg:#121926;
  --bs-btn-border-color:#1E2736;
  --bs-btn-color:#E9EEF5;
  --bs-btn-hover-bg:#18212F;
  --bs-btn-hover-border-color:#2A3547;
  --bs-btn-hover-color:#E9EEF5;
}

.btn-outline-secondary {
  --bs-btn-color:#E9EEF5;
  --bs-btn-border-color:#1E2736;
  --bs-btn-hover-bg:#18212F;
  --bs-btn-hover-border-color:#60C6DE;
  --bs-btn-hover-color:#E9EEF5;
}

/* ----------------------------------------------------------------- forms */
.form-control, .form-select {
  background-color:var(--cq-raise);
  border-color:var(--cq-rule);
  color:var(--cq-paper);
  border-radius:0;
}
.form-control:focus, .form-select:focus {
  background-color:var(--cq-raise);
  border-color:var(--cq-cyan);
  color:var(--cq-paper);
  box-shadow:none;
}
.form-control::placeholder { color:#5C6A7D; }
.form-label, .col-form-label {
  font-family:var(--cq-display);
  font-weight:600;
  letter-spacing:.02em;
  color:var(--cq-paper);
}
.form-text { color:var(--cq-mute); }
.input-group-text {
  background-color:var(--cq-raise);
  border-color:var(--cq-rule);
  color:var(--cq-mute);
}
.form-check-input { background-color:var(--cq-raise); border-color:var(--cq-rule); }
.form-check-input:checked { background-color:var(--cq-cyan); border-color:var(--cq-cyan); }

/* ------------------------------------------------- panels, modals, alerts */
.card, .modal-content, .list-group-item {
  background-color:var(--cq-raise);
  border-color:var(--cq-rule);
  color:var(--cq-paper);
}
.modal-content { border-left:4px solid var(--accent); }
.modal-header, .modal-footer { border-color:var(--cq-rule); }

.alert { border-radius:0; border-width:0 0 0 4px; }
.alert-danger  { background-color:rgba(228,72,150,.12); border-color:var(--cq-magenta); color:#F3B6D2; }
.alert-success { background-color:rgba(174,204,72,.12); border-color:var(--cq-lime);    color:#D6E79A; }
.alert-info    { background-color:rgba(91,155,224,.12); border-color:var(--cq-azure);   color:#B6D0F0; }
.alert-warning { background-color:rgba(246,222,66,.12); border-color:var(--cq-amber);   color:#F2E79B; }

.badge { border-radius:0; font-family:var(--cq-display); font-weight:600; letter-spacing:.03em; }
.badge.rounded-pill { border-radius:999px; }

.nav-tabs {
  --bs-nav-tabs-border-color:var(--cq-rule);
  --bs-nav-tabs-link-active-bg:var(--cq-raise);
  --bs-nav-tabs-link-active-color:var(--cq-paper);
  --bs-nav-tabs-link-active-border-color:var(--cq-rule) var(--cq-rule) var(--cq-raise);
}
.nav-tabs .nav-link { color:var(--cq-mute); font-family:var(--cq-display); font-weight:600; }

.pagination {
  --bs-pagination-bg:var(--cq-raise);
  --bs-pagination-border-color:var(--cq-rule);
  --bs-pagination-color:var(--cq-paper);
  --bs-pagination-hover-bg:var(--cq-raise-hi);
  --bs-pagination-hover-border-color:var(--cq-rule);
  --bs-pagination-hover-color:var(--cq-paper);
  --bs-pagination-active-bg:var(--cq-cyan);
  --bs-pagination-active-border-color:var(--cq-cyan);
  --bs-pagination-active-color:var(--cq-ink);
  --bs-pagination-disabled-bg:var(--cq-raise);
  --bs-pagination-disabled-border-color:var(--cq-rule);
  --bs-pagination-border-radius:0;
}

/* ---------------------------------------------------------------- tables */
/* The scoreboard is the table people stare at, so it gets the treatment and
   the rest inherit it. */
.table {
  --bs-table-bg:#121926;
  --bs-table-color:var(--cq-paper);
  --bs-table-border-color:var(--cq-rule);
  --bs-table-striped-bg:rgba(233,238,245,.03);
  --bs-table-striped-color:var(--cq-paper);
  --bs-table-hover-bg:rgba(96,198,222,.07);
  --bs-table-hover-color:var(--cq-paper);
}
.table > thead th,
.table > thead > tr > :first-child {
  font-family:var(--cq-display);
  font-weight:600;
  font-size:.8rem;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--cq-cyan);
  border-bottom-color:var(--cq-rule);
}
.table > tbody > tr > td { border-color:var(--cq-rule); }

/* ------------------------------------------------------- challenge board */
/* Six categories, six accents. Alpine renders each
   category as a sibling div after the <template> it came from, so counting
   divs inside the board is how a category finds its colour. A category
   beyond the sixth starts the cycle again. */
[x-data="ChallengeBoard"] [x-show] > div:nth-of-type(6n+1) { --accent:var(--cq-cyan); }
[x-data="ChallengeBoard"] [x-show] > div:nth-of-type(6n+2) { --accent:var(--cq-violet); }
[x-data="ChallengeBoard"] [x-show] > div:nth-of-type(6n+3) { --accent:var(--cq-lime); }
[x-data="ChallengeBoard"] [x-show] > div:nth-of-type(6n+4) { --accent:var(--cq-amber); }
[x-data="ChallengeBoard"] [x-show] > div:nth-of-type(6n+5) { --accent:var(--cq-magenta); }
[x-data="ChallengeBoard"] [x-show] > div:nth-of-type(6n+6) { --accent:var(--cq-azure); }

.category-header {
  display:flex;
  align-items:center;
  gap:.85rem;
  padding-bottom:.7rem;
  border-bottom:1px solid var(--cq-rule);
}
/* A hexagon badge, one per category. */
.category-header::before {
  content:"";
  flex:none;
  width:24px;
  height:27px;
  background:var(--accent);
  clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
}
.category-header h3 {
  margin:0;
  font-size:clamp(1.15rem,2.6vw,1.5rem);
  letter-spacing:.01em;
  color:var(--cq-paper);
}

/* A raised square with an accent edge, which is the one card device this
   site uses. The core theme's glow is dropped: nine of them in a row is a
   lot of glow. */
[data-bs-theme] .challenge-button {
  background-color:var(--cq-raise);
  border:1px solid var(--cq-rule);
  border-left:4px solid var(--accent);
  border-radius:0;
  box-shadow:none;
  color:var(--cq-paper);
  transition:background-color .14s ease, border-color .14s ease;
}
[data-bs-theme] .challenge-button:hover {
  background-color:var(--cq-raise-hi);
  border-color:var(--cq-rule);
  border-left-color:var(--accent);
}

.challenge-button .challenge-inner p {
  font-family:var(--cq-display);
  font-weight:600;
  font-size:1.15rem;
  line-height:1.2;
  margin:0 0 .45rem;
}
.challenge-button .challenge-inner span {
  font-family:var(--cq-display);
  font-weight:700;
  font-size:1.45rem;
  color:var(--accent);
}

/* Solved. CTFd's stock green is the one colour on the page that is not from
   the palette, so it becomes the palette's lime with ink on top. */
.challenge-solved,
[data-bs-theme] .challenge-button.challenge-solved {
  background-color:var(--cq-lime);
  border-color:var(--cq-lime);
  color:var(--cq-ink);
}
[data-bs-theme] .challenge-button.challenge-solved:hover {
  background-color:#BCD95A;
  border-color:#BCD95A;
}
[data-bs-theme] .challenge-button.challenge-solved .challenge-inner span { color:var(--cq-ink); }

/* Locked: a category's bonus challenge before the rest of the category is
   solved. Dashed and dimmed so it reads as not yet open, with the reason
   written on it; the click does nothing (see ctfd/CQ-CHANGES.md). */
[data-bs-theme] .challenge-button.challenge-locked {
  background-color:transparent;
  border:1px dashed var(--cq-rule);
  border-left:4px dashed var(--accent);
  cursor:not-allowed;
}
[data-bs-theme] .challenge-button.challenge-locked:hover { background-color:transparent; }
.challenge-button.challenge-locked .challenge-inner p,
.challenge-button.challenge-locked .challenge-inner > span { opacity:.6; }
.challenge-button .challenge-lock {
  /* Not Bootstrap's d-block: that is !important, and would beat the inline
     display:none Alpine's x-show uses to hide this on unlocked tiles. */
  display:block;
  font-size:.8rem;
  line-height:1.35;
  color:var(--cq-paper);
  opacity:.85;
}
.challenge-button .challenge-inner .challenge-lock span {
  font:inherit;
  color:inherit;
}

/* ------------------------------------------------- the challenge dialog */
/* Where a player spends the day: read, download, type a flag, submit. */
.challenge-name {
  font-family:var(--cq-display);
  font-weight:700;
  font-size:clamp(1.5rem,4vw,2.1rem);
  line-height:1.05;
}
.challenge-value {
  font-family:var(--cq-display);
  font-weight:700;
  color:var(--accent);
}
.challenge-desc { color:#C3CDDA; }
.challenge-desc a { color:var(--cq-cyan); text-decoration:underline !important; }
.challenge-desc code,
.challenge-connection-info code {
  background:var(--cq-ink);
  border:1px solid var(--cq-rule);
  padding:.1rem .4rem;
  color:var(--cq-lime);
}
.challenge-desc img { border:1px solid var(--cq-rule); }

/* Code blocks in a description (Flip The Switch, Repeat After Me). The inline
   code rule above must not reach inside a block, or every line becomes its
   own little box; and CTFd's highlighter (lolight) colours tokens for a white
   page, so plain text came out dark grey on the dark panel, which is
   unreadable. Tokens take the poster's accents instead. */
.challenge-desc pre {
  background:var(--cq-ink);
  border:1px solid var(--cq-rule);
  border-left:4px solid var(--accent);
  padding:.8rem 1rem;
  overflow-x:auto;
}
[data-bs-theme] .challenge-desc pre code {
  display:block;
  background:transparent;
  border:0;
  padding:0;
  color:var(--cq-paper);
  /* Wrapped, not scrolled: a student copying by dragging must not miss the
     end of a long line hidden off to the right. Wrapping adds no real line
     breaks, so what they copy still runs. */
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
/* CTFd highlights with lolight, whose tokens are ll-<kind>. */
[data-bs-theme] .challenge-desc pre .ll-key { color:var(--cq-violet); font-weight:600; }
[data-bs-theme] .challenge-desc pre .ll-num { color:var(--cq-amber); }
[data-bs-theme] .challenge-desc pre .ll-str,
[data-bs-theme] .challenge-desc pre .ll-rex { color:var(--cq-lime); }
[data-bs-theme] .challenge-desc pre .ll-com { color:var(--cq-mute); font-style:italic; }
[data-bs-theme] .challenge-desc pre .ll-nam,
[data-bs-theme] .challenge-desc pre .ll-pct,
[data-bs-theme] .challenge-desc pre .ll-unk { color:var(--cq-paper); }

/* A flag is a string to be typed exactly, so it is set in a monospace face
   where l, 1 and I are different shapes. */
.challenge-input.form-control {
  font-family:ui-monospace,'SFMono-Regular',Menlo,Consolas,monospace;
  font-size:1rem;
  letter-spacing:.01em;
}

/* Submitting is the one thing this dialog is for, so it is not an outline
   button. */
.challenge-submit.btn {
  --bs-btn-bg:#60C6DE;
  --bs-btn-border-color:#60C6DE;
  --bs-btn-color:#0A0E15;
  --bs-btn-hover-bg:#8FDAEC;
  --bs-btn-hover-border-color:#8FDAEC;
  --bs-btn-hover-color:#0A0E15;
  --bs-btn-active-bg:#4FB4CC;
  --bs-btn-active-border-color:#4FB4CC;
  --bs-btn-active-color:#0A0E15;
}

.btn-file.btn {
  --bs-btn-bg:transparent;
  --bs-btn-border-color:var(--cq-azure);
  --bs-btn-color:#B6D0F0;
  --bs-btn-hover-bg:var(--cq-azure);
  --bs-btn-hover-border-color:var(--cq-azure);
  --bs-btn-hover-color:#0A0E15;
}

/* Hints are free but collapsed, so a student tries first and opens one
   when stuck; the summary has to look like something you can open. */
.challenge-hints details {
  background:var(--cq-ink);
  border:1px solid var(--cq-rule);
  border-left:4px solid var(--cq-amber);
  padding:.7rem 1rem;
  margin-bottom:.6rem;
}
.challenge-hints summary {
  cursor:pointer;
  font-family:var(--cq-display);
  font-weight:600;
  color:var(--cq-amber);
}
.challenge-hints details[open] summary { margin-bottom:.6rem; }

.challenge-tag.badge { background-color:var(--cq-azure) !important; color:var(--cq-ink); }
.challenge-attribution, .challenge-ratings { color:var(--cq-mute) !important; }

/* ---------------------------------------------------------------- graphs */
/* The score graphs are drawn to a canvas by ECharts, with its default light
   text colours, so CSS cannot recolour their labels. They get a paper panel
   to sit on instead. */
#score-graph, #solves-graph, #keys-pie-graph, #categories-pie-graph {
  background:var(--cq-paper);
  border-left:4px solid var(--cq-cyan);
  padding:.75rem;
}

/* ---------------------------------------------------------------- footer */
/* CTFd's theme ends every page with a "Powered by CTFd" link. This is a
   self-hosted install on our own domain, not a hosted account, so the badge
   is hidden. CTFd is Apache 2.0 with no NOTICE file, and its attribution
   clauses cover redistributing the source rather than a badge on a site you
   run, so nothing here depends on it. The software and its version are
   credited in infra/README.md, which is where someone looking for them would
   actually look.

   The theme reserves 100px under main for a footer that is now not there,
   so that comes back too. */
.footer { display:none; }
main { margin-bottom:0; }

/* ============================================================ front page */
/* Classes used by the page at /, written by infra/scripts/bootstrap-ctfd.py.
   They are prefixed cq- so a CTFd upgrade cannot collide with them. */

/* Two columns: the sign on the left, and on the right the answer to the
   only other question a player has, which is where to go next. Two
   half-full columns read as composed; one third-full column reads as a page
   that failed to load. */
.cq-hero {
  display:grid;
  gap:clamp(2.5rem,6vw,5rem);
  grid-template-columns:1fr;
  align-items:center;
  padding:clamp(1rem,4vw,3rem) 0 clamp(2.5rem,6vw,4.5rem);
}
@media (min-width:62rem) {
  .cq-hero { grid-template-columns:1.1fr .9fr; }
}

/* The date chip: a skewed solid block, with the text skewed back so
   it stays upright. */
.cq-chip {
  display:inline-block;
  margin:0 0 1.5rem;
  padding:.35rem 1rem;
  background:var(--cq-cyan);
  color:var(--cq-ink);
  font-family:var(--cq-display);
  font-weight:700;
  font-size:clamp(1rem,2.2vw,1.3rem);
  transform:skewX(-9deg);
}
.cq-chip > span { display:inline-block; transform:skewX(9deg); }

/* The headline carries the page almost on its own now, so it is set larger
   than it was when there were paragraphs under it. */
.cq-sign h1 {
  font-size:clamp(2.9rem,7.5vw,5rem);
  line-height:.93;
  letter-spacing:-.025em;
  margin:0;
  text-wrap:balance;
}

.cq-actions { margin:2.5rem 0 0; display:flex; flex-wrap:wrap; gap:.85rem; }
.cq-btn {
  display:inline-block;
  padding:.8rem 1.5rem;
  background:var(--cq-cyan);
  color:var(--cq-ink) !important;
  font-family:var(--cq-display);
  font-weight:700;
  letter-spacing:.03em;
}
.cq-btn:hover { background:#8FDAEC; }
.cq-btn--quiet {
  background:transparent;
  color:var(--cq-paper) !important;
  border:1px solid var(--cq-rule);
}
.cq-btn--quiet:hover { background:var(--cq-raise); border-color:var(--cq-cyan); }
/* Stacked on a phone, so two buttons of different word lengths do not leave
   a ragged edge down the left of the screen. */
@media (max-width:36rem) {
  .cq-actions { display:grid; gap:.7rem; }
  .cq-btn { text-align:center; }
}

/* The click path, drawn as a path. The line encodes the order, so the steps
   are not numbered: a number on top of a connecting rule says the same thing
   twice. Each marker is a ring with a glowing dot inside it. */
.cq-path { list-style:none; margin:0; padding:0; }

.cq-step { position:relative; padding:0 0 2.5rem 2.75rem; }
.cq-step:last-child { padding-bottom:0; }

.cq-step::before {
  content:"";
  position:absolute;
  left:0; top:.45rem;
  width:17px; height:17px;
  border:1.6px solid var(--accent);
  border-radius:50%;
  background:radial-gradient(circle at center, var(--accent) 0 3.2px, transparent 3.2px);
  filter:drop-shadow(0 0 5px var(--accent));
}

.cq-step:not(:last-child)::after {
  content:"";
  position:absolute;
  left:8px; top:1.9rem;
  width:1px; height:calc(100% - 1.9rem);
  /* Bright where it leaves the marker, fading as it travels, so the eye is
     pulled down the path rather than along a flat rule. */
  background:linear-gradient(var(--accent) 0, #38465C 55%, #38465C 100%);
}

.cq-step__name {
  display:block;
  font-family:var(--cq-display);
  font-weight:700;
  font-size:1.5rem;
  line-height:1.1;
  color:var(--accent);
}
.cq-step__note { display:block; color:var(--cq-mute); margin-top:.2rem; }
