/* elbro.fun - "nervous system" look
   Loaded after custom.css (bootstrap) and elbrocustom.css.

   nginx tells browsers to cache /static/ forever, so after editing this file
   raise the ?v= number where base.html links it. */

@font-face { font-family: "Unbounded"; src: url("unbounded-latin.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Unbounded"; src: url("unbounded-latin-ext.woff2") format("woff2"); font-weight: 200 900; font-display: swap; unicode-range: U+0100-02BA, U+1E00-1E9F, U+1EF2-1EFF; }
@font-face { font-family: "Atkinson"; src: url("atkinson-latin.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("atkinson-latin-ext.woff2") format("woff2"); font-weight: 200 800; font-display: swap; unicode-range: U+0100-02BA, U+1E00-1E9F, U+1EF2-1EFF; }
@font-face { font-family: "Atkinson"; src: url("atkinson-italic-latin.woff2") format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; }

/* colours are picked from the logo and the neuron background */
:root {
  --slate: #0e1a24;
  --deep: #08121a;
  --steel: #304a59;
  --haze: #9db3be;
  --mist: #d5e2e7;
  --cyan: #74d3e2;   /* ELBRO: things you can click */
  --signal: #ff5468; /* .fun: where you are */
  --display: "Unbounded", system-ui, sans-serif;
  --text: "Atkinson", system-ui, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

/* ---------- page ---------- */
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--slate);
  color: var(--mist);
  font: 400 1.0625rem/1.65 var(--text);
}
body::before { /* the neuron; a fixed layer also works on phones */
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgb(14 26 36 / .93), rgb(14 26 36 / .72) 45%, rgb(14 26 36 / .3)),
    url("/media/elbro-background.png") center / cover no-repeat;
}
a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { color: #fff; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; color: #fff; text-wrap: balance; overflow-wrap: break-word; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem); line-height: 1.25; margin: 0 0 1.5rem; }
h2 { font-size: 1.15rem; line-height: 1.4; margin: 3rem 0 1rem; }
h3 { font-size: .95rem; line-height: 1.4; margin: 2.25rem 0 .75rem; }
img { max-width: 100%; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 5; padding: .5rem 1rem; background: var(--deep); }

.frame {
  display: grid;
  grid-template-columns: 250px minmax(0, 860px);
  justify-content: center;
  gap: 0 clamp(1.5rem, 4vw, 4rem);
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 0;
}
.page { padding: 2.5rem 0 3rem; min-width: 0; }
.page.sheet {
  align-self: start;
  padding: clamp(1.5rem, 4vw, 3.25rem);
  background: rgb(8 18 26 / .86);
  border-radius: 4px 40px 4px 40px;
}
.quiet { color: var(--haze); }

/* ---------- the nerve (menu) ---------- */
.spine { align-self: start; }
@media (min-width: 900px) and (min-height: 750px) { .spine { position: sticky; top: 1.5rem; } }
.spine-logo { display: block; }
.spine-logo img { display: block; width: 100%; height: auto; }
.nerve { list-style: none; margin: 0; padding: 20px 0 0; }
.synapse { --step: 56px; position: relative; height: var(--step); display: flex; align-items: center; }
.synapse::before, .synapse::after { /* piece of nerve coming from the synapse above */
  content: "";
  position: absolute;
  top: calc(var(--step) / -2);
  left: 34px;
  width: 44px;
  height: var(--step);
  background: var(--steel);
  -webkit-mask: var(--fibre) center / 100% 100%;
  mask: var(--fibre) center / 100% 100%;
  --fibre: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 56' preserveAspectRatio='none'%3E%3Cpath d='M5 0C5 30 39 26 39 56' fill='none' stroke='%23000' stroke-width='3.5'/%3E%3C/svg%3E");
}
.synapse:nth-child(odd)::before, .synapse:nth-child(odd)::after { transform: scaleX(-1); }
.synapse::after { /* the same piece, carrying a signal */
  background: var(--signal);
  clip-path: inset(0 0 100% 0);
  transition: clip-path .1s linear;
}
.synapse > a, .synapse > span, .synapse button {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 44px;
  padding: 0;
  margin-left: 20px;
  border: 0;
  background: none;
  color: var(--mist);
  font: inherit;
  text-decoration: none;
}
.synapse:nth-child(even) > a, .synapse:nth-child(even) > span, .synapse:nth-child(even) button { margin-left: 54px; }
.soma {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border: 2px solid var(--steel);
  border-radius: 56% 44% 48% 52% / 48% 56% 44% 52%;
  background: var(--slate);
  color: var(--cyan);
  transition: border-color .15s, background-color .15s, color .15s;
}
.synapse:nth-child(even) .soma { border-radius: 44% 56% 54% 46% / 55% 45% 55% 45%; }
.synapse > span { color: var(--haze); }
.synapse > span .soma { color: var(--haze); }
.synapse a:hover, .synapse button:hover { color: #fff; }
.synapse a:hover .soma, .synapse button:hover .soma { border-color: var(--signal); color: #fff; }
.synapse .is-here { color: #fff; font-weight: 700; }
.synapse .is-here .soma { background: var(--signal); border-color: var(--signal); color: var(--deep); box-shadow: 0 0 22px rgb(255 84 104 / .55); }
.synapse form { margin: 0; display: contents; }

/* signal runs from the logo down to the page you are on, or point at */
.synapse:has(.is-here)::after,
.synapse:has(~ .synapse .is-here)::after { animation: fire .09s linear calc(var(--i) * 90ms) forwards; }
.synapse:has(a:hover, button:hover)::after,
.synapse:has(~ .synapse a:hover, ~ .synapse button:hover)::after { clip-path: inset(0); transition-delay: calc(var(--i) * 25ms); }
@keyframes fire { to { clip-path: inset(0); } }

/* ---------- home ---------- */
.hello { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 330px); gap: 2rem; align-items: center; }
.hello h1 { font-size: clamp(2.1rem, 1.2rem + 3.2vw, 3.6rem); font-weight: 600; line-height: 1.08; margin-bottom: 1.5rem; }
.hello p { font-size: 1.2rem; line-height: 1.6; max-width: 34ch; }
.cell img {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 75% 20%;
  border: 5px solid var(--steel);
  box-shadow: 0 0 70px rgb(116 211 226 / .18);
  border-radius: 58% 42% 47% 53% / 46% 55% 45% 54%;
}
.latest { margin-top: 3.5rem; }
.latest p { margin: 0 0 .35rem; color: var(--haze); }
.latest h2 { margin: 0; font-size: clamp(1.15rem, 1rem + .8vw, 1.55rem); }
.works { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem 2rem; margin-top: 4rem; }
.works p { margin: 0; }

/* ---------- blog ---------- */
.posts { list-style: none; margin: 0; padding: 0; }
.posts li + li { margin-top: 2.75rem; }
.posts h2 { margin: 0 0 .4rem; }
.posts h2 a, .latest h2 a { text-decoration: none; }
.posts h2 a:hover, .latest h2 a:hover { text-decoration: underline; text-decoration-color: var(--signal); text-decoration-thickness: 2px; }
.posts p { margin: .6rem 0 0; max-width: 68ch; }
.when { color: var(--haze); font-size: .95rem; }
.flag { color: var(--signal); }

.post-lead { font-size: 1.2rem; line-height: 1.55; margin: 1.5rem 0; max-width: 60ch; }
.post-cover { display: block; max-height: 340px; margin: 2rem 0; border-radius: 4px 24px 4px 24px; }
.post-body { max-width: 70ch; overflow-wrap: break-word; }
.post-body h1 { font-size: 1.3rem; margin: 2rem 0 .75rem; }
.post-body img { border-radius: 4px; height: auto; }
.post-body table { display: block; overflow-x: auto; }
.post-body blockquote { margin: 1.5rem 0; padding-left: 1.25rem; border-left: 3px solid var(--signal); }

/* ---------- code ---------- */
code, pre { font-family: var(--mono); font-size: .9em; }
code { color: #a6e5ee; overflow-wrap: anywhere; }
pre { color: #a6e5ee; background: rgb(48 74 89 / .32); padding: .9rem; border-radius: 6px; overflow-x: auto; line-height: 1.6; }
pre code { overflow-wrap: normal; }
.codehilite { background: none; padding: 0; margin: 1.25rem 0; border-radius: 6px; }
.codehilite pre { margin: 0; color: var(--mist); }
/* hilite-styles.css is made for white paper; these are readable on dark */
.codehilite :is(.k, .kc, .kd, .kn, .kr, .kt, .ow, .nt, .sa) { color: #ff8c9a; }
.codehilite :is(.s, .s1, .s2, .sb, .sc, .sd, .se, .sh, .si, .sx, .sr, .ss, .dl) { color: #b9e08a; }
.codehilite :is(.c, .c1, .cm, .cs, .ch, .cp, .cpf) { color: #8aa3af; }
.codehilite :is(.nb, .nf, .nc, .nn, .nd, .fm, .bp) { color: var(--cyan); }
.codehilite :is(.m, .mi, .mf, .mh, .mo, .il, .no) { color: #f3c27a; }
.codehilite :is(.na, .nv, .vc, .vg, .vi, .vm, .nl, .o, .p, .w) { color: var(--mist); }
.codehilite .err { border: 0; }

.snips > code { display: block; padding: .3rem .9rem; margin-bottom: 4px; background: rgb(48 74 89 / .32); border-radius: 4px; white-space: pre-wrap; }
.snips > pre { margin: .75rem 0 1rem; }
.snips > p { margin: 1rem 0 .4rem; }
.snips h3 { scroll-margin-top: 1.5rem; }

/* ---------- links ---------- */
.switch { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 0 0 2rem; padding: 0; }
.switch a { display: inline-flex; align-items: center; gap: .5rem; min-height: 42px; padding: 0 1rem; border: 2px solid var(--steel); border-radius: 21px; color: var(--mist); text-decoration: none; }
.switch svg { color: var(--cyan); }
.switch a:hover { border-color: var(--cyan); color: #fff; }
.switch .is-here { background: var(--signal); border-color: var(--signal); color: var(--deep); font-weight: 700; }
.switch .is-here svg { color: inherit; }
.switch .is-here:hover { color: var(--deep); }
.rows { margin: 0; padding: 0; list-style: none; }
.rows h2 { margin: 2.25rem 0 .5rem; }
.rows .row-link { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto; gap: .1rem 1.5rem; padding: .6rem 0; }
.row-link > * { min-width: 0; overflow-wrap: anywhere; }
.row-link .when { white-space: nowrap; }

/* ---------- pictures and videos ---------- */
.photos { columns: 3 200px; column-gap: 14px; }
.photos a { display: block; break-inside: avoid; margin-bottom: 14px; }
.photos img, .tiles img { display: block; width: 100%; border-radius: 4px; transition: filter .15s; }
.photos a:hover img, .tiles a:hover img { filter: brightness(1.18); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.75rem 1.1rem; list-style: none; margin: 1.5rem 0 0; padding: 0; }
.tiles a { display: block; color: var(--mist); text-decoration: none; line-height: 1.4; }
.tiles a:hover { color: #fff; }
.tiles img { aspect-ratio: 16 / 9; object-fit: cover; margin-bottom: .6rem; }

/* ---------- beammp ---------- */
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: .35rem 0; overflow-wrap: anywhere; }
.servers li { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 0 1.5rem; }

/* ---------- forms ---------- */
.key { max-width: 22rem; }
.key label { display: block; margin: 1.25rem 0 .35rem; }
.key input:not([type=hidden]) { width: 100%; min-height: 48px; padding: 0 .9rem; border: 2px solid var(--steel); border-radius: 6px; background: var(--deep); color: #fff; font: inherit; }
.key input:focus { outline: 0; border-color: var(--cyan); }
.act { display: inline-flex; align-items: center; min-height: 48px; padding: 0 1.75rem; border: 0; border-radius: 24px; background: var(--cyan); color: var(--deep); font: 700 1.0625rem var(--text); text-decoration: none; }
.act:hover { background: #fff; color: var(--deep); }
.key .act { margin-top: 1.75rem; }
.oops { color: #ff9aa6; }

/* ---------- footer ---------- */
.ground { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; padding: 1.5rem 0 2rem; color: var(--haze); font-size: .95rem; }
.ground p { margin: 0; overflow-wrap: anywhere; }
.ground .who { flex: 1 1 11rem; min-width: 0; }
.ground .up { display: grid; place-items: center; width: 44px; height: 44px; }

/* ---------- phones and small windows ---------- */
@media (max-width: 899px) {
  .frame { grid-template-columns: minmax(0, 1fr); padding-top: .75rem; }
  .spine-logo img { width: min(300px, 78vw); margin: 0 auto; }
  .nerve { display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 2px 12px; padding: .75rem 0 1.25rem; }
  .synapse { height: auto; }
  .synapse::before, .synapse::after { content: none; }
  .synapse > a, .synapse > span, .synapse button,
  .synapse:nth-child(even) > a, .synapse:nth-child(even) > span, .synapse:nth-child(even) button { margin: 0; gap: .5rem; font-size: .95rem; line-height: 1.2; text-align: left; }
  .soma { width: 34px; height: 34px; }
  .page { padding: 1rem 0 2rem; }
  .ground { grid-column: 1; }
}
@media (max-width: 640px) {
  .hello { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .cell { width: min(300px, 80vw); margin: 0 auto; }
  .rows .row-link { grid-template-columns: minmax(0, 1fr); padding: .75rem 0; }
  .servers li { grid-template-columns: minmax(0, 1fr); padding: .6rem 0; }
  .photos { columns: 2; column-gap: 10px; }
  .photos a { margin-bottom: 10px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 375px) { .nerve { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .synapse::after { transition: none; transition-delay: 0s !important; animation-duration: 1ms !important; animation-delay: 0s !important; }
}
