/* Look and feel follows TCON / Hack the North (tcon.hackthenorth.ph):
   near-black granite, neon mint runes with a glow, gold accents, Cinzel capitals, Inter text. */
:root {
  --night: #040404;
  --night-2: #0a0a0a;
  --night-3: #111111;
  --bone: #e0e0e0;
  --bone-dim: #8f8f8f;
  --paint-rgb: 0, 255, 180;
  --paint: #00ffb4;
  --paint-glow: #00ffb4;
  --paint-dim: #00cc90;
  --gold: #c9a84c;
  --gold-rgb: 201, 168, 76;
  --head: #ffffff;
  --gold-dim: #8a6d2b;
  --glow-1: rgba(var(--paint-rgb), .07);
  --glow-2: rgba(var(--paint-rgb), .04);
  --edge: #1a1a1a;
  --edge-lit: rgba(var(--paint-rgb), .35);
  --moss: #0f3b30;
  --on-paint: #040404;
  --bad: #ff5c6c;
  --rune-font: "Noto Sans Runic", "Segoe UI Historic", "Segoe UI Symbol", serif;
  --title-font: "Cinzel", Georgia, "Times New Roman", serif;
  --body-font: "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  padding: 3.5rem 1.25rem 5rem;
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, var(--glow-1) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 100%, var(--glow-2) 0%, transparent 70%),
    var(--night);
  color: var(--bone);
  font: 16px/1.7 var(--body-font);
  overflow-x: hidden;
}
/* granite grain over the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .55 0 0 0 0 .55 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* faint runes drifting in the dark, like the TCON hero */
body::after {
  content: "ᚠ        ᚱ             ᛗ\A\A   ᚢ                    ᛉ\A\A\A        ᚦ           ᛊ\A\A ᚨ                         ᛞ\A\A\A          ᚲ        ᛟ\A\A    ᚷ                  ᚹ";
  white-space: pre;
  position: fixed;
  inset: 8vh 4vw auto;
  z-index: -1;
  pointer-events: none;
  font: 1.1rem/2.2 var(--rune-font);
  letter-spacing: 1.6rem;
  color: var(--paint);
  opacity: .12;
  text-align: center;
}
main { position: relative; max-width: 880px; margin: 0 auto; }
a { color: var(--paint); text-decoration-color: rgba(var(--paint-rgb), .4); text-underline-offset: 3px; transition: color .3s, text-shadow .3s; }
a:hover { text-shadow: 0 0 10px rgba(var(--paint-rgb), .7); }
:focus-visible { outline: 2px solid var(--paint); outline-offset: 3px; }
code { font-family: ui-monospace, Consolas, monospace; color: var(--paint); }

header { text-align: center; margin-bottom: 2.6rem; }
.kicker {
  font-family: var(--rune-font);
  color: var(--paint);
  letter-spacing: .5em;
  font-size: 1.05rem;
  text-shadow: 0 0 12px rgba(var(--paint-rgb), .55);
}
h1 {
  font-family: var(--title-font);
  font-weight: 700;
  font-size: clamp(1.9rem, 5.4vw, 3.3rem);
  line-height: 1.15;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: .5rem 0 1.1rem;
  color: var(--head);
  text-shadow: 0 0 28px rgba(var(--paint-rgb), .25);
}
.lore {
  max-width: 40rem;
  margin: 0 auto;
  color: var(--bone-dim);
  font-size: 1rem;
}
.topnav {
  text-align: center;
  margin: -1.4rem 0 2.4rem;
  font: 600 .75rem var(--title-font);
  letter-spacing: .2em;
  text-transform: uppercase;
}
.topnav a { color: var(--bone); text-decoration: none; }
.topnav a:hover { color: var(--paint); }

/* The wizard speaks */
.wizard {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  max-width: 40rem;
  margin: 0 auto 3rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--edge);
  border-left: 2px solid var(--gold);
  background: linear-gradient(90deg, rgba(var(--gold-rgb), .06), transparent 40%), var(--night-2);
}
.wizard .face {
  flex: none;
  width: 3rem; height: 3rem;
  display: grid; place-items: center;
  border: 1px solid var(--gold);
  color: var(--gold);
  font: 1.5rem var(--rune-font);
  box-shadow: inset 0 0 12px rgba(var(--gold-rgb), .15);
}
.wizard .who {
  font: 700 .72rem var(--title-font);
  color: var(--gold);
  letter-spacing: .3em;
  text-transform: uppercase;
  margin: 0 0 .45rem;
}
.wizard p { margin: 0 0 .7rem; }
.wizard p:last-child { margin-bottom: 0; }

/* The stones */
.stone-wrap { display: flex; justify-content: center; margin: 2rem 0 1.2rem; }
.runestone {
  position: relative;
  width: min(560px, 100%);
  padding: 4.2rem clamp(2.4rem, 8vw, 3.6rem) 4.4rem;
  filter: drop-shadow(0 26px 24px rgba(0, 0, 0, .9));
}
.runestone svg.rock {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0;
  filter: brightness(.42) contrast(1.15) saturate(.4);
}
.carving {
  position: relative;
  z-index: 1;
  font-family: var(--rune-font);
  font-size: clamp(1.45rem, 5.2vw, 2.05rem);
  line-height: 1.75;
  letter-spacing: .05em;
  text-align: center;
  color: var(--paint);
  text-shadow: 0 0 6px rgba(var(--paint-rgb), .8), 0 0 18px rgba(var(--paint-rgb), .45);
  overflow-wrap: anywhere;
}
.carving p { margin: 0; }
.carving .cut {
  height: 1px;
  margin: 1.4rem auto;
  width: 72%;
  background: linear-gradient(90deg, transparent, rgba(var(--paint-rgb), .55), transparent);
}
.stone-img {
  display: block;
  width: min(780px, 100%);
  height: auto;
  border: 1px solid var(--edge);
  box-shadow: 0 0 40px rgba(var(--paint-rgb), .08), 0 28px 30px -18px rgba(0, 0, 0, .9);
}
.caption { max-width: 34rem; margin: 0 auto 3.5rem; text-align: center; color: var(--bone-dim); font-size: .9rem; }

/* Sections */
section { margin-bottom: 3.4rem; }
section h2 {
  font-family: var(--title-font);
  font-weight: 700;
  font-size: clamp(1.3rem, 3.4vw, 1.8rem);
  text-align: center;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--head);
  margin: 0 0 .5rem;
}
section h2::before {
  content: "ᛟ";
  display: block;
  margin-bottom: .5rem;
  font: 1rem var(--rune-font);
  letter-spacing: 0;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(var(--gold-rgb), .5);
}
section .sub { text-align: center; color: var(--bone-dim); margin: 0 0 1.6rem; }
.names {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
}
.names li {
  padding: .35rem .9rem;
  border: 1px solid var(--edge);
  background: var(--night-2);
  font: 500 .78rem var(--title-font);
  letter-spacing: .16em;
  text-transform: uppercase;
  transition: border-color .3s, color .3s;
}
.names li:hover { border-color: var(--edge-lit); color: var(--paint); }

/* Challenge cards on the home page */
.cards { display: grid; gap: 1rem; max-width: 40rem; margin: 0 auto; }
.card {
  position: relative;
  display: block;
  padding: 1.3rem 1.5rem;
  border: 1px solid var(--edge);
  background: var(--night-2);
  color: var(--bone);
  text-decoration: none;
  transition: border-color .3s, box-shadow .3s;
}
.card::before {                       /* a thin mint line along the top, lit on hover */
  content: "";
  position: absolute;
  left: 0; right: 0; top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--paint), transparent);
  opacity: .35;
  transition: opacity .3s;
}
.card h3 {
  margin: 0 0 .35rem;
  font: 700 1.15rem var(--title-font);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--head);
}
.card p { margin: 0; color: var(--bone-dim); font-size: .95rem; }
.card .meta {
  font: 600 .68rem var(--title-font);
  color: var(--paint);
  letter-spacing: .25em;
  text-transform: uppercase;
  margin-bottom: .5rem;
}
a.card:hover { border-color: var(--edge-lit); box-shadow: 0 0 30px rgba(var(--paint-rgb), .08); text-shadow: none; }
a.card:hover::before { opacity: 1; }
.card.locked { opacity: .7; border-style: dashed; }
.card.locked::before { background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.card.locked .meta { color: var(--gold); }

/* The forms */
.gate { max-width: 40rem; margin: 0 auto; text-align: center; }
.gate form { display: flex; gap: .6rem; margin-top: 1.1rem; }
.gate input {
  flex: 1;
  min-width: 0;
  padding: .75rem .95rem;
  border: 1px solid var(--edge);
  background: var(--night-2);
  color: var(--bone);
  font: 1rem ui-monospace, Consolas, monospace;
  transition: border-color .3s, box-shadow .3s;
}
.gate input:focus { outline: none; border-color: var(--paint); box-shadow: 0 0 0 1px var(--paint), 0 0 18px rgba(var(--paint-rgb), .15); }
.gate button {
  padding: .75rem 1.5rem;
  border: 0;
  background: var(--paint);
  color: var(--on-paint);
  font: 700 .8rem var(--title-font);
  letter-spacing: .18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: box-shadow .3s, background .3s;
}
.gate button:hover { box-shadow: 0 0 24px rgba(var(--paint-rgb), .55); }
@media (max-width: 520px) { .gate form { flex-direction: column; } }
.gate .msg { min-height: 1.7rem; margin-top: .9rem; }
.gate .msg.bad { color: var(--bad); }
.gate .msg.good { color: var(--paint); }

.task {
  max-width: 40rem;
  margin: 0 auto 1rem;
  color: var(--bone-dim);
}
.task code { color: var(--bone); }

#unlocked .lore { margin: 0 auto 1.6rem; text-align: center; }
.flag-frame {
  max-width: 1000px;
  margin: 0 auto;
  border: 1px solid var(--edge-lit);   /* on the wrapper, so the red tint on the picture can't recolour it */
  box-shadow: 0 0 40px rgba(var(--paint-rgb), .1);
  overflow: hidden;
}
/* on phones the picture keeps a readable size and scrolls sideways */
@media (max-width: 640px) {
  .flag-frame { overflow-x: auto; }
  .flag-frame .flag-img { width: 760px; max-width: none; }   /* .flag-frame wins over the plain .flag-img rule below */
}
.flag-img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.hall-link { text-align: center; margin: 2.4rem 0 0; }
.hall-link a {
  display: inline-block;
  padding: .8rem 1.8rem;
  background: var(--paint);
  color: var(--on-paint);
  font: 700 .82rem var(--title-font);
  letter-spacing: .2em;
  text-transform: uppercase;
  text-decoration: none;
}
.hall-link a:hover { box-shadow: 0 0 24px rgba(var(--paint-rgb), .55); text-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* The red theme: switched on by the correct password in the Hall of Mímir (theme.js).
   Every page reads these variables, so the whole site changes together. */
html[data-theme="red"] {
  --night: #050303;
  --night-2: #0c0707;
  --night-3: #140a0a;
  --bone: #e0e0e0;
  --bone-dim: #8f8f8f;
  --head: #ffffff;
  --paint-rgb: 212, 20, 20;
  --paint: #d41414;
  --paint-glow: #d41414;
  --paint-dim: #a50f0f;
  --light-red: #ff6a5e;
  --gold: #c9a84c;
  --gold-dim: #8a6d2b;
  --gold-rgb: 201, 168, 76;
  --glow-1: rgba(212, 20, 20, .13);
  --glow-2: rgba(212, 20, 20, .07);
  --edge: #2a1212;
  --edge-lit: rgba(212, 20, 20, .5);
  --moss: #3d0a0a;
  --on-paint: #f2f2f2;
  --bad: #ff6a5e;
}
html[data-theme="red"] a { color: var(--light-red); text-decoration-color: rgba(255, 106, 94, .45); }
html[data-theme="red"] .topnav a { color: var(--bone); }
html[data-theme="red"] .hall-link a { color: var(--on-paint); }
html[data-theme="red"] .card .meta,
html[data-theme="red"] .kicker { color: var(--light-red); }
html[data-theme="red"] a:hover,
html[data-theme="red"] .gate button:hover,
html[data-theme="red"] .hall-link a:hover { text-shadow: none; box-shadow: 0 0 24px rgba(212, 20, 20, .6); }
html[data-theme="red"] .kicker,
html[data-theme="red"] .carving { text-shadow: 0 0 6px rgba(212, 20, 20, .85), 0 0 18px rgba(212, 20, 20, .5); }
html[data-theme="red"] h1 { text-shadow: 0 0 28px rgba(212, 20, 20, .35); }
html[data-theme="red"] code { color: var(--light-red); }
html[data-theme="red"] .gate .msg.good { color: var(--bone); }
html[data-theme="red"] .card:hover,
html[data-theme="red"] .flag-frame { box-shadow: 0 0 30px rgba(212, 20, 20, .15); }
html[data-theme="red"] .gate input:focus { box-shadow: 0 0 0 1px var(--paint), 0 0 18px rgba(212, 20, 20, .2); }
/* the pictures come in two drawings: mint, and the same in red */
.tone-red { display: none; }
html[data-theme="red"] .tone-green { display: none; }
html[data-theme="red"] .tone-red { display: block; }
html[data-theme="red"] .runestone svg.rock { filter: brightness(.42) sepia(.5) hue-rotate(-35deg) saturate(1.2) contrast(1.15); }
.moss { fill: var(--moss); }

/* The moment the site turns red: one flash that covers the page while the theme swaps */
.ignite {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 40%, #d41414 0%, #6b0707 45%, #100101 100%);
  animation: ignite 1.8s ease-in-out forwards;
}
@keyframes ignite {
  0%   { opacity: 0; }
  25%  { opacity: .96; }
  45%  { opacity: .96; }
  100% { opacity: 0; }
}
