/* The coming-soon page */
/* Chakra Petch, served with the site (fonts/OFL.txt): Latin, and the extended Latin set for other European letters */
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/chakra-petch-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/chakra-petch-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/chakra-petch-latin-ext-500-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/chakra-petch-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/chakra-petch-latin-ext-600-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Chakra Petch";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/chakra-petch-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --brand: #0067b9;        /* the logo's compass blue */
  --brand-bright: #0b74e0;
  --highlight: #005bbc;    /* the 3D lettering's blue, for text on white */
  --ink: #0a2348;
  --ink-soft: #5a6f8f;
  --paper: #ffffff;
  --grid-minor: rgba(0, 103, 185, 0.05);
  --grid-major: rgba(0, 103, 185, 0.1);
  --toggle-border: rgba(0, 103, 185, 0.3);
  --show-moon: block;
  --show-sun: none;
  /* growing network, read by the script at the end of the page */
  --net-color: #0067b9;
  --net-core: #0067b9;
  --net-blend: normal;
  --net-line-alpha: 0.7;
  --net-glow: 0.35;
  --net-grid-alpha: 0.2;
  --net-rest: 0.5;         /* how strongly it shows once grown */
}

/* Dark mode: chosen with the toggle, or following the device setting */
:root[data-theme="dark"] {
  color-scheme: dark;
  --highlight: #1e8cf0;    /* the logo's highlight blue, for text on black */
  --ink: #f2f6ff;
  --ink-soft: #6f86a8;
  --paper: #000000;
  --grid-minor: rgba(0, 103, 185, 0.07);
  --grid-major: rgba(0, 103, 185, 0.16);
  --toggle-border: rgba(0, 103, 185, 0.55);
  --show-moon: none;
  --show-sun: block;
  --net-color: #1e8cf0;
  --net-core: #d6ecff;
  --net-blend: additive;
  --net-line-alpha: 0.85;
  --net-glow: 0.75;
  --net-grid-alpha: 0.32;
  --net-rest: 0.8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --highlight: #1e8cf0;
    --ink: #f2f6ff;
    --ink-soft: #6f86a8;
    --paper: #000000;
    --grid-minor: rgba(0, 103, 185, 0.07);
    --grid-major: rgba(0, 103, 185, 0.16);
    --toggle-border: rgba(0, 103, 185, 0.55);
    --show-moon: none;
    --show-sun: block;
    --net-color: #1e8cf0;
    --net-core: #d6ecff;
    --net-blend: additive;
    --net-line-alpha: 0.85;
    --net-glow: 0.75;
    --net-grid-alpha: 0.32;
    --net-rest: 0.8;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  color: var(--ink);
  font-family: "Chakra Petch", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body, h1, footer { transition: background-color .35s ease, color .35s ease; }

/* Blueprint grid, fading out toward the edges */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: center center;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
          mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
}

/* With the sphere running, its curved grid replaces the flat one */
.has-network body::before { display: none; }

/* Drag the background to turn the sphere; sideways swipes on touch screens turn it too */
.has-network body { cursor: grab; touch-action: pan-y pinch-zoom; }
.turning, .turning * { cursor: grabbing !important; user-select: none; }

/* Network on the inside of a sphere around the viewer, drawn with three.js */
.network {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 16px;
  gap: clamp(28px, 5vh, 44px);
}

.logo {
  display: block;
  width: min(560px, 100%);
  height: auto;
}

h1 {
  margin: 0;
  max-width: 24ch;
  font-weight: 600;
  font-size: clamp(1.7rem, 5.2vw, 3.25rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}
h1 .accent { color: var(--highlight); }

.cta {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 18px 30px;
  border: 0;
  background: none;
  color: #fff;
  font: 500 clamp(1rem, 2.4vw, 1.125rem)/1.3 "Chakra Petch", system-ui, sans-serif;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s ease;
}
/* Chamfered corners, echoing the cut corners of the C and N in the wordmark */
.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--brand);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  box-shadow: 0 10px 30px -12px rgba(0, 103, 185, 0.6);
  transition: background-color .2s ease;
}
.cta:hover::before { background: var(--brand-bright); }
.cta:hover { transform: translateY(-2px); }
.cta:active { transform: translateY(0); }
.cta:focus-visible { outline: 2px solid var(--highlight); outline-offset: 5px; }
.cta svg { flex: none; transition: transform .2s ease; }
.cta:hover svg { transform: translateX(4px); }

/* Sign-up form, like a newsletter: an email field and a send button in one chamfered outline,
   with "Sign up and help us build the future" set into its top edge */
.signup-box { display: flex; flex-direction: column; align-items: center; max-width: 100%; }
.signup {
  position: relative;
  isolation: isolate;
  display: flex;
  width: 30rem;
  max-width: 100%;
  margin-top: 10px; /* room for the words sticking up above the edge */
  padding: 5px;
}
.signup[hidden] { display: none; }
.signup::before,
.signup::after {
  content: "";
  position: absolute;
  z-index: -1;
  transition: background-color .2s ease;
}
.signup::before { inset: 0; background: var(--toggle-border); clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
.signup::after { inset: 1px; background: var(--paper); clip-path: polygon(13.4px 0, 100% 0, 100% calc(100% - 13.4px), calc(100% - 13.4px) 100%, 0 100%, 0 13.4px); }
.signup:hover::before { background: var(--brand); }
/* Typing in it: the outline turns blue and thicker, in place of a focus ring */
.signup:focus-within::before { background: var(--brand); }
.signup:focus-within::after { inset: 2px; clip-path: polygon(12.8px 0, 100% 0, 100% calc(100% - 12.8px), calc(100% - 12.8px) 100%, 0 100%, 0 12.8px); }
/* The words sit on the top edge like a label on a drawing. Their background hides the edge behind
   them, but only from the edge down, so the network still shows above it. */
.signup-label {
  position: absolute;
  top: 0;
  left: 22px;
  max-width: calc(100% - 44px);
  padding: 0 8px;
  transform: translateY(-50%);
  background: linear-gradient(transparent calc(50% - 1px), var(--paper) calc(50% - 1px));
  color: var(--highlight);
  font-size: clamp(.9rem, 2.1vw, 1rem);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}
.signup input {
  flex: 1;
  min-width: 0;
  padding: 0 12px 0 18px;
  border: 0;
  background: none;
  color: var(--ink);
  font: 500 clamp(1rem, 2.4vw, 1.125rem)/1.3 "Chakra Petch", system-ui, sans-serif;
  letter-spacing: 0.01em;
}
.signup input:focus { outline: none; }
.signup input::placeholder { color: var(--ink-soft); opacity: 1; }
.signup input:-webkit-autofill { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 40px var(--paper) inset; }
.signup .send { flex: none; padding: 13px 20px; gap: 10px; }
.signup .send:focus-visible { outline-offset: 3px; }
.signup[aria-busy="true"] .send { cursor: progress; opacity: .7; }
.signup .trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; } /* for bots only */
.signup-note { margin: 0; max-width: 30rem; font-size: .95rem; line-height: 1.4; color: var(--ink); text-wrap: balance; }
.signup-note:not(:empty) { margin-top: 12px; }
.signup-note.done {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px; /* the same as the form's, so nothing moves */
  color: var(--highlight);
  font-size: clamp(1rem, 2.4vw, 1.125rem);
  font-weight: 500;
  text-align: left;
  animation: games-in .45s cubic-bezier(.2, .7, .2, 1) both;
}
.signup-note.done svg { flex: none; }

.actions { display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 100%; }
.pastime { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 100%; }
.games { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.games[hidden] { display: none; }
.games .play { animation: games-in .45s cubic-bezier(.2, .7, .2, 1) both; } /* replays each time they're shown */
.games .play + .play { animation-delay: .08s; }
@keyframes games-in { from { opacity: 0; transform: translateY(-8px); } }

/* The game buttons, and the "While we are waiting…" button that shows them:
   a chamfered outline, the quieter sibling of the sign-up button */
.play {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border: 0;
  background: none;
  color: var(--highlight);
  font: 500 clamp(.95rem, 2.2vw, 1rem)/1.3 "Chakra Petch", system-ui, sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.play::before,
.play::after {
  content: "";
  position: absolute;
  z-index: -1;
  transition: background-color .2s ease;
}
.play::before { inset: 0; background: var(--toggle-border); clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.play::after { inset: 1px; background: var(--paper); clip-path: polygon(9.4px 0, 100% 0, 100% calc(100% - 9.4px), calc(100% - 9.4px) 100%, 0 100%, 0 9.4px); }
.play:hover::before { background: var(--brand); }
.play:hover::after { background: color-mix(in srgb, var(--brand) 7%, var(--paper)); }
.play:focus-visible { outline: 2px solid var(--highlight); outline-offset: 5px; }
.play svg { flex: none; }
.play[aria-busy="true"] { cursor: progress; opacity: .7; }
.wonder { max-width: 100%; text-wrap: balance; }
.wonder[aria-expanded="true"]::before { background: var(--brand); }
/* Closed it says "While we are waiting…"; opened, it asks "Ever wondered…" above the games */
.wonder[aria-expanded="false"] .wonder-ask,
.wonder[aria-expanded="true"] .wonder-wait { display: none; }
.wonder[aria-expanded="true"] .wonder-ask { animation: wonder-in .5s ease both; }
@keyframes wonder-in { from { opacity: 0; } }
.wonder .chevron { transition: transform .25s ease; }
.wonder[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--toggle-border);
  border-radius: 50%;
  background: var(--paper);
  color: var(--brand);
  cursor: pointer;
  transition: background-color .35s ease, border-color .2s ease, color .2s ease;
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand-bright); }
.theme-toggle:focus-visible { outline: 2px solid var(--highlight); outline-offset: 3px; }
.theme-toggle .moon { display: var(--show-moon); }
.theme-toggle .sun { display: var(--show-sun); }

/* Launch circle: one thin line runs around the centre, like a compass drawing a circle behind the
   content, then the click goes through. The timings add up to DRAW_MS in the script. */
.launch {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: -1;
  width: min(92vmin, 860px);
  height: min(92vmin, 860px);
  overflow: visible;
  transform: translate(-50%, -50%) rotate(-90deg); /* start drawing from the top, like a compass */
  pointer-events: none;
  transition: opacity .35s ease;
}
.launch.run { display: block; } /* showing it restarts the drawing */
.launch.fade { opacity: 0; }
.launch circle { fill: none; stroke: var(--highlight); }
.launch-line {
  stroke-width: 1.5px;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  animation: launch-draw 1.7s cubic-bezier(.65, 0, .35, 1) .2s forwards;
}
.launch-ticks {
  stroke-width: 7px;
  stroke-opacity: .5;
  stroke-dasharray: 0.0016 0.012289; /* 72 ticks, one every 5° */
  opacity: 0;
  animation: launch-fade .6s ease 1.3s forwards;
}
.launch .launch-pivot { fill: var(--highlight); stroke: none; opacity: 0; animation: launch-fade .2s ease forwards; }
@keyframes launch-draw { to { stroke-dashoffset: 0; } }
@keyframes launch-fade { to { opacity: 1; } }

footer {
  padding: 20px 16px 28px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}
footer .credit { white-space: nowrap; } /* on narrow phones the line breaks between the two parts, not inside them */

/* Entrance: the content rises in as the network finishes growing */
.rise { opacity: 0; transform: translateY(14px); animation: rise .9s cubic-bezier(.2, .7, .2, 1) forwards; }
.rise:nth-child(1) { animation-delay: 1.4s; }
.rise:nth-child(2) { animation-delay: 1.7s; }
.rise:nth-child(3) { animation-delay: 1.95s; }
@keyframes rise { to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
  .cta { padding: 16px 22px; text-align: left; }
  .wonder { padding-inline: 14px; } /* room for the question on two lines */
}
/* The narrowest phones: the words on the sign-up box move toward the corner and shrink a little to fit */
@media (max-width: 359px) {
  .signup-label { left: 14px; max-width: calc(100% - 28px); padding: 0 6px; font-size: .85rem; }
}
/* Too narrow for "Ever wondered…" on one line: wrap it into a compact box rather than the full width */
@media (max-width: 680px) {
  .wonder { max-width: min(100%, 25rem); }
}

/* Short screens, like a phone held sideways: size the logo by the height and tighten the spacing
   so the headline and buttons fit on one screen. svh is the height with the browser bars showing. */
@media (max-height: 520px) and (orientation: landscape) {
  main { padding: 20px 16px 8px; gap: clamp(10px, 3.5vh, 20px); gap: clamp(10px, 3.5svh, 20px); }
  .logo { width: min(560px, 100%, 95vh); width: min(560px, 100%, 95svh); }
  h1 { max-width: none; font-size: clamp(1.25rem, min(5.2vw, 7vh), 2.25rem); font-size: clamp(1.25rem, min(5.2vw, 7svh), 2.25rem); }
  .actions { gap: 10px; }
  .cta { padding: 12px 24px; }
  .signup { padding: 4px; }
  .signup .send { padding: 8px 18px; }
  .play { padding: 8px 16px; }
  footer { padding: 4px 16px 10px; font-size: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; opacity: 1; transform: none; }
  .cta, .cta svg, .cta::before, .play::before, .play::after, .signup::before, .signup::after, .wonder .chevron, .theme-toggle, body, h1, footer { transition: none; }
  .games .play, .wonder .wonder-ask, .signup-note.done { animation: none; }
}
