/* FiClub holding page
   Brand blue #1B3BD0. Headings Tomorrow, body IBM Plex Sans, detail IBM Plex Mono.
   The page background is flat --blue on purpose: it is the exact colour the WebGL
   logo panel paints, so the edge of the canvas never shows. */

:root {
  --blue:      #1B3BD0;
  --blue-dark: #0e2688;
  --white:     #ffffff;
  --soft:      rgba(255, 255, 255, 0.72);
  --line:      rgba(255, 255, 255, 0.28);

  --head: "Tomorrow", "Arial Narrow", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --gutter: max(22px, env(safe-area-inset-left));
  --ease:   cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html { background: var(--blue); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--blue);
  color: var(--white);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }

/* A faint diagonal weave, under everything, for the areas the canvas does not cover. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 7px);
  mask-image: radial-gradient(85% 70% at 50% 40%, #000 25%, transparent 100%);
  -webkit-mask-image: radial-gradient(85% 70% at 50% 40%, #000 25%, transparent 100%);
}

/* ---- The logo panel ---- */

.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 32vh;
  height: 32dvh;
  min-height: 220px;
  max-height: 380px;
  touch-action: pan-y;        /* drag still scrolls the page on a phone */
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Shown until logo-gl.js confirms WebGL by adding .gl */
.stage .fallback {
  position: absolute;
  inset: 9% 0;
  left: 0;
  right: 0;
  margin: auto;
  height: 82%;
  width: auto;
  max-width: 72%;
}

.stage.gl .fallback { visibility: hidden; }

/* ---- Page ---- */

.side {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 22px var(--gutter) 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

h1 {
  margin: 0;
  font-family: var(--head);
  font-weight: 600;
  font-size: clamp(34px, 8.8vw, 54px);
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-wrap: balance;
  animation: rise 0.7s var(--ease) 0.08s both;
}

.lede {
  margin: 0;
  max-width: 36ch;
  font-size: 18px;
  color: var(--white);
  animation: rise 0.7s var(--ease) 0.16s both;
}

/* ---- Button ---- */

.btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  padding: 18px 20px;
  background: var(--white);
  color: var(--blue);
  font-family: var(--head);
  font-weight: 600;
  font-size: 19px;
  text-decoration: none;
  box-shadow: 6px 6px 0 var(--blue-dark);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  animation: rise 0.7s var(--ease) 0.24s both;
}

.btn:hover     { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--blue-dark); }
.btn:active    { transform: translate(4px, 4px);   box-shadow: 2px 2px 0 var(--blue-dark); }
.btn svg       { width: 22px; height: 22px; flex: none; transition: transform 0.12s ease; }
.btn:hover svg { transform: translateX(3px); }

/* Hover and keyboard focus break the label apart into pink and cyan for half a second,
   the same signal-drop idea as the logo panel. Carried over from the launch page. */
.glitch { position: relative; display: inline-block; }
.glitch::before,
.glitch::after { content: attr(data-text); position: absolute; left: 0; top: 0; width: 100%; opacity: 0; pointer-events: none; }
.glitch::before { color: #ff2bd6; }
.glitch::after  { color: #00d5ff; }

.btn:hover,                 .btn:focus-visible                 { animation: btn-box  0.5s steps(1) 1; }
.btn:hover .glitch,         .btn:focus-visible .glitch         { animation: btn-text 0.5s steps(1) 1; }
.btn:hover .glitch::before, .btn:focus-visible .glitch::before { animation: btn-a    0.5s steps(1) 1; }
.btn:hover .glitch::after,  .btn:focus-visible .glitch::after  { animation: btn-b    0.5s steps(1) 1; }

@keyframes btn-a {
  0%        { opacity: 1; clip-path: inset(8% 0 58% 0);  transform: translate(-5px, 0); }
  18%       { clip-path: inset(56% 0 12% 0); transform: translate(6px, 0); }
  36%       { clip-path: inset(28% 0 42% 0); transform: translate(-8px, 0); }
  54%       { clip-path: inset(70% 0 4% 0);  transform: translate(4px, 0); }
  72%       { clip-path: inset(2% 0 76% 0);  transform: translate(-3px, 0); }
  90%, 100% { opacity: 0; }
}

@keyframes btn-b {
  0%        { opacity: 1; clip-path: inset(62% 0 10% 0); transform: translate(5px, 0); }
  18%       { clip-path: inset(12% 0 60% 0); transform: translate(-6px, 0); }
  36%       { clip-path: inset(44% 0 30% 0); transform: translate(7px, 0); }
  54%       { clip-path: inset(4% 0 72% 0);  transform: translate(-4px, 0); }
  72%       { clip-path: inset(74% 0 2% 0);  transform: translate(3px, 0); }
  90%, 100% { opacity: 0; }
}

@keyframes btn-text {
  0%        { transform: translate(2px, 0) skewX(-8deg); }
  18%       { transform: translate(-3px, 0); }
  36%       { transform: translate(3px, 0) skewX(6deg); }
  54%       { transform: translate(-1px, 0); }
  72%, 100% { transform: none; }
}

@keyframes btn-box {
  0%        { box-shadow: -5px 0 0 #ff2bd6,  5px 0 0 #00d5ff, 8px 8px 0 var(--blue-dark); }
  18%       { box-shadow:  4px 0 0 #ff2bd6, -4px 0 0 #00d5ff, 8px 8px 0 var(--blue-dark); }
  36%       { box-shadow: -7px 0 0 #00d5ff,  7px 0 0 #ff2bd6, 8px 8px 0 var(--blue-dark); }
  54%       { box-shadow:  2px 0 0 #ff2bd6, -2px 0 0 #00d5ff, 8px 8px 0 var(--blue-dark); }
  72%, 100% { box-shadow: 8px 8px 0 var(--blue-dark); }
}

.fine {
  margin: 0;
  width: 100%;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--soft);
  animation: rise 0.7s var(--ease) 0.32s both;
}

/* ---- Footer ---- */

footer {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px var(--gutter) max(26px, env(safe-area-inset-bottom));
  font-family: var(--mono);
  font-size: 12px;
  color: var(--soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: rise 0.7s var(--ease) 0.4s both;
}

.links { display: flex; flex-direction: column; gap: 6px; }

.links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
}

/* Hyphen separators between the links in a row. */
.links li + li::before {
  content: "–";
  margin: 0 8px;
  color: var(--line);
}

footer a { text-decoration: none; }
footer a:hover { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }

footer p { margin: 0; }
.aside { color: rgba(255, 255, 255, 0.5); }

/* A bar of soap, for those who know. */
.soap {
  font-size: 14px;
  line-height: 1;
  display: inline-block;
  transform: translateY(1px);
}

/* ---- Wide screens: the panel takes the left, the words sit beside it ---- */

@media (min-width: 900px) {
  body {
    flex-direction: row;
    align-items: stretch;
  }

  .stage {
    flex: 1 1 46%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    position: sticky;
    top: 0;
  }

  .side {
    flex: 1 1 54%;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .page {
    flex: 0;
    margin: 0;
    padding: 40px clamp(28px, 4vw, 56px) 18px;
    max-width: 560px;
  }

  footer {
    margin: 0;
    max-width: 560px;
    padding-left: clamp(28px, 4vw, 56px);
    padding-right: clamp(28px, 4vw, 56px);
  }

  h1 { font-size: 56px; }
}

/* Very narrow phones (320px and the like): keep the button label on one line. */
@media (max-width: 359px) {
  .btn { font-size: 16px; padding: 16px; }
}

/* ---- 404 page (404.html, which has no logo panel) ---- */

body.plain .side { justify-content: center; }

body.plain .page {
  max-width: 520px;
  padding-top: clamp(40px, 10vh, 90px);
  gap: 18px;
}

.mark {
  width: clamp(92px, 22vw, 116px);
  height: auto;
  margin-bottom: 2px;
  animation: rise 0.7s var(--ease) both;
}

.kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
  animation: rise 0.7s var(--ease) 0.04s both;
}

@media (min-width: 900px) {
  body.plain { flex-direction: column; }
  body.plain .side { flex: 1; min-height: 100vh; min-height: 100dvh; }
  body.plain .page,
  body.plain footer { max-width: 560px; margin: 0 auto; }
}

/* ---- Motion and contrast preferences ---- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-contrast: more) {
  :root { --soft: #ffffff; --line: rgba(255, 255, 255, 0.6); }
  .grain { display: none; }
}
