/* ------------------------------------------------------------------
 * Shared chrome for every page: colour palette, header (burger + brand),
 * navigation menu and the cookie consent banner.
 * The palette lives here because canvas.js reads these custom properties
 * off the document root to keep its canvas drawing in sync with the CSS.
 * ------------------------------------------------------------------ */
:root {
  --color-canvas-bg: #ffffff;
  --color-primary: #84ad84;   /* magenta */
  --color-secondary: #cfcf78; /* yellow */
  --color-tertiary: #000000;  /* black */

  /* ---------------------------------------------------------------
   * The canvas background, drawn into #bg-canvas by canvas.js.
   *
   * It cannot be styled with ordinary CSS - it is painted pixel by
   * pixel - so these five properties are the whole control panel for
   * it. Change them here and the canvas follows on the next frame; no
   * JavaScript needs touching.
   *
   * Painted back to front: the flat colour, then the coloured dots,
   * then the grid. The images sit above all three.
   * --------------------------------------------------------------- */
  --canvas-bg: #ffffff;         /* the flat colour behind everything */
  --canvas-dot-a: #84ad84;      /* the two dot colours; they alternate */
  --canvas-dot-b: #cfcf78;      /*   deterministically per grid cell   */
  --canvas-grid: #cccccc;       /* the grid drawn over the dots        */
  --canvas-grid-size: 300;      /* grid spacing, in world units        */
  --canvas-grid-width: 1;       /* grid line thickness, in screen px   */
}

#site-header {
  position: fixed;
  top: 14px;
  right: 26px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 14px;
}

#site-header .brand {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 2px;
  color: var(--color-tertiary);
  text-decoration: none;
  user-select: none;
}

#menu-toggle {
  width: 38px;
  height: 34px;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#menu-toggle span {
  display: block;
  width: 26px;
  height: 3px;
  background: var(--color-tertiary);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

#menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

#menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

#menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

#site-menu {
  position: fixed;
  top: 60px;
  right: 26px;
  z-index: 1200;
  min-width: 200px;
  display: none;
  flex-direction: column;
  background: #ffffff;
  border: 3px solid var(--color-tertiary);
  box-shadow: 8px 8px 0px 0px var(--color-primary);
}

#site-menu.open {
  display: flex;
}

#site-menu a {
  padding: 13px 18px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-tertiary);
  text-decoration: none;
}

#site-menu a + a {
  border-top: 1px solid #eeeeee;
}

#site-menu a:hover,
#site-menu a:focus {
  background: var(--color-secondary);
}

@media (max-width: 600px) {
  #site-header { top: 10px; right: 16px; gap: 10px; }
  #site-header .brand { font-size: 22px; }
  #site-menu { top: 52px; right: 16px; left: 16px; min-width: 0; }
}

/* ------------------------------------------------------------------
 * Cookie consent banner (see static/js/cookiebanner.js)
 * ------------------------------------------------------------------ */
#cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: none;
  background: #ffffff;
  border-top: 3px solid var(--color-tertiary);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #111111;
}

#cookie-banner.open {
  display: block;
}

#cookie-banner .cookie-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 24px 22px;
}

#cookie-banner h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#cookie-banner p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.6;
}

#cookie-banner a {
  color: #111111;
}

#cookie-banner .cookie-options {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.6;
}

#cookie-banner .cookie-options li {
  margin-bottom: 6px;
}

#cookie-banner .cookie-options input[type="checkbox"] {
  margin-right: 8px;
}

#cookie-banner .cookie-details {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
}

#cookie-banner .cookie-details summary {
  cursor: pointer;
  font-weight: 700;
}

#cookie-banner .cookie-details table {
  width: 100%;
  min-width: 560px;
  margin-top: 10px;
  border-collapse: collapse;
}

#cookie-banner .cookie-details th,
#cookie-banner .cookie-details td {
  border: 1px solid #eeeeee;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

#cookie-banner .cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#cookie-banner button {
  flex: 1 1 200px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 2px solid var(--color-tertiary);
  background: #ffffff;
  color: #111111;
  cursor: pointer;
}

#cookie-banner button.primary {
  background: var(--color-primary);
}

#cookie-banner button:hover {
  background: var(--color-secondary);
}

@media (max-width: 600px) {
  #cookie-banner .cookie-inner { padding: 16px 16px 18px; }
  #cookie-banner button { flex: 1 1 100%; }
}


/* ------------------------------------------------------------------
 * Legal footer
 *
 * Every page carries these three links, so they are reachable without
 * going through the burger menu. This is the scrolling-page version; on
 * the canvas, style.css pins the same element to the corner of a
 * viewport that never scrolls, and on the mobile feed, feed.css puts it
 * back into the flow at the end.
 * ------------------------------------------------------------------ */
#footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 20px;
  margin: 0;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--color-tertiary, #000);
  background: #fff;
}

#footer-links a {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #111111;
  text-decoration: none;
}

#footer-links a:hover {
  text-decoration: underline;
}
