@font-face { font-family: 'Fira Code'; font-weight: 400; src: url('/fonts/firacode-400.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Fira Code'; font-weight: 700; src: url('/fonts/firacode-700.woff2') format('woff2'); font-display: swap; }

/* The two colours come from palette.js (--pal-primary/-secondary, plus the derived --pal-bg/-text/...). Everything else here is derived from them. */
:root {
  --p: var(--pal-primary, #d6407f);
  --s: var(--pal-secondary, #7b6cff);
  --bg: oklch(from var(--s) 0.955 0.035 h);
  --fg: var(--pal-text, #3a2e5d);
  --edge: var(--fg);
  --shadow: oklch(from var(--s) 0.8 0.12 h);
  --tile-l: 0.92; --tile-c: 0.07;
}
html.dark {
  --bg: oklch(from var(--s) 0.24 0.07 h);
  --shadow: oklch(from var(--s) 0.38 0.1 h);
  --tile-l: 0.4; --tile-c: 0.09;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.4 "Fira Code", ui-monospace, monospace;
  transition: background .3s, color .3s;
}
main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 3.5rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
}
header { text-align: center; display: grid; justify-items: center; gap: .15rem; }
.logo-btn { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 16px; }
.logo-btn:focus-visible { outline: 3px solid var(--edge); outline-offset: 4px; }
.logo-btn:active .logo { transform: translateY(3px); }
.logo { display: block; width: 72px; height: 72px; image-rendering: pixelated; border-radius: 16px; border: 3px solid var(--edge); box-shadow: 0 4px 0 var(--edge); transition: transform .08s; }
h1 { margin: .2rem 0 0; font-size: 2rem; letter-spacing: -.02em; }
header p { margin: 0; font-size: .85rem; opacity: .75; }
.hero {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  border: 4px solid var(--edge);
  border-radius: 18px;
  box-shadow: 8px 8px 0 var(--shadow);
}
.night, html.dark .day { display: none; }
html.dark .night { display: block; }

section { width: 100%; }
h2 { display: flex; align-items: center; gap: .8rem; margin: 0 0 .9rem; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h2::before, h2::after { content: ''; flex: 1; border-top: 4px solid var(--edge); }
h2 span { padding: .25rem .9rem; border: 3px solid var(--edge); border-radius: 999px; background: #fff3a8; color: #2b2140; box-shadow: 0 3px 0 var(--edge); }
ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
ul.social { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: .6rem; }
ul.social a { flex-direction: row; padding: .35rem .8rem .35rem .4rem; gap: .5rem; border-radius: 14px; box-shadow: 0 4px 0 var(--edge); }
ul.social .ico { width: 1.9rem; height: 1.9rem; margin: 0; border-width: 2px; border-radius: 9px; }
ul.social .ico svg { width: 1rem; height: 1rem; }
ul.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; width: 100%; }
.hero { max-width: 100%; display: block; }
.hero-btn { padding: 0; border: 0; background: none; cursor: pointer; width: 100%; border-radius: 18px; }
.hero { transition: transform .08s, box-shadow .08s; }
.hero-btn:hover .hero { transform: translate(2px, 2px); box-shadow: 6px 6px 0 var(--shadow); }
.hero-btn:active .hero { transform: translate(8px, 8px); box-shadow: 0 0 0 var(--shadow); }
.hero-btn:focus-visible { outline: 3px solid var(--edge); outline-offset: 4px; }
.ico { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; margin-bottom: .2rem; border: 3px solid var(--edge); border-radius: 12px; background: var(--bg); }
.ico svg { width: 1.3rem; height: 1.3rem; }
li { margin: 0; }
a {
  height: 100%;
  justify-content: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .15rem;
  padding: .75rem .9rem;
  color: var(--fg);
  text-decoration: none;
  background: oklch(from var(--p) var(--tile-l) var(--tile-c) calc(h + var(--turn, 0)));
  border: 3px solid var(--edge);
  border-radius: 16px;
  box-shadow: 0 6px 0 var(--edge);
  transition: transform .08s, box-shadow .08s;
}
a b { font-weight: 700; overflow-wrap: anywhere; }
a small { font-size: .74rem; opacity: .8; }
a.k0 { --turn: 0; }
a.k1 { --turn: 72; }
a.k2 { --turn: 144; }
a.k3 { --turn: 216; }
a.k4 { --turn: 288; }
a:hover, a:focus-visible { transform: translateY(2px); box-shadow: 0 4px 0 var(--edge); outline: none; }
a:focus-visible { outline: 3px solid var(--edge); outline-offset: 3px; }
a:active { transform: translateY(6px); box-shadow: 0 0 0 var(--edge); }

.tools { position: absolute; top: 1rem; right: max(1rem, calc(50% - 19rem)); display: flex; gap: .5rem; z-index: 5; }
.tool {
  width: 38px; height: 38px; padding: 7px;
  display: grid; place-items: center;
  color: var(--fg);
  background: var(--bg);
  border: 3px solid var(--edge);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--edge);
  cursor: pointer;
}
.tool:hover { transform: translateY(1px); box-shadow: 0 2px 0 var(--edge); }
.tool:focus-visible { outline: 3px solid var(--edge); outline-offset: 3px; }
.tool svg { width: 100%; height: 100%; }
.tool .p1 { fill: var(--p); }
.tool .p2 { fill: var(--s); }
.palette-popup {
  display: none;
  position: absolute;
  top: calc(100% + .7rem);
  right: 0;
  width: min(20rem, calc(100vw - 2rem));
  padding: 1rem;
  background: var(--bg);
  color: var(--fg);
  border: 3px solid var(--edge);
  border-radius: 16px;
  box-shadow: 6px 6px 0 var(--shadow);
}
.palette-popup.open { display: block; }
@media (max-width: 560px) { ul.grid { grid-template-columns: 1fr; } main { max-width: 26rem; } .tools { right: 1rem; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
