/*
 * Same direction as the game: the black of space, cool gray surfaces clearly
 * separated from the black, one rare amber accent. Nothing is loaded from
 * outside: the fonts are the game's own, served from /fonts.
 */

@font-face {
  font-family: "Geist";
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  src: url("fonts/geist-latin-wght-normal.woff2") format("woff2-variations");
}

@font-face {
  font-family: "Geist Mono";
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  src: url("fonts/geist-mono-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  --bg: #000;
  --surface: #12151c;
  --raised: #1e222c;
  --hover: #2a2f3b;
  --line: rgb(238 240 245 / 0.16);
  --line-strong: rgb(238 240 245 / 0.32);
  --text: #f4f5f8;
  --secondary: #bdc2ce;
  --muted: #979eae;
  --accent: #f5a524;

  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --inset: clamp(24px, 9vw, 144px);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  background: var(--bg);
}

/*
 * The page fits the screen: it is exactly one screen tall and never scrolls.
 * The content shrinks by height thresholds (see the end of this file). The
 * vertical overflow stays automatic only as a safety net (very large text
 * size or zoom), so that the form can never be cut off and unreachable.
 */
body {
  position: relative;
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* Decoration: a few orbits, very quiet, behind the content. */

.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.orbits {
  position: absolute;
  right: -12vmin;
  bottom: -18vmin;
  width: min(110vmin, 980px);
  height: auto;
}

.ring {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
}

.planet {
  fill: var(--raised);
  stroke: var(--line-strong);
  stroke-width: 2;
}

.moon {
  fill: var(--secondary);
}

.moon-accent {
  fill: var(--accent);
}

.spin {
  transform-origin: 50% 50%;
  animation: spin linear infinite;
}

.spin-1 { animation-duration: 160s; }
.spin-2 { animation-duration: 240s; animation-direction: reverse; }
.spin-3 { animation-duration: 340s; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spin { animation: none; }
}

/* Header */

.top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px var(--inset);
}

.wordmark {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.lang {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.lang button {
  min-width: 44px;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--secondary);
  font: 500 13px/1 var(--font);
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lang button + button {
  border-left: 1px solid var(--line-strong);
}

.lang button:hover {
  background: var(--hover);
  color: var(--text);
}

.lang button[aria-pressed="true"] {
  background: var(--raised);
  color: var(--text);
}

/* Content */

.main {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: calc(560px + var(--inset));
  padding: 0 var(--inset) 64px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: var(--secondary);
  font: 500 13px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

h1 {
  margin: 0 0 16px;
  font-weight: 600;
  font-size: clamp(32px, 5.2vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lead {
  margin: 0 0 40px;
  color: var(--secondary);
  font-size: 18px;
  text-wrap: pretty;
}

/* Access form */

.access label {
  display: block;
  margin-bottom: 8px;
  color: var(--secondary);
  font-size: 14px;
  font-weight: 500;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

input {
  flex: 1 1 240px;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 400 16px/1 var(--font-mono);
  letter-spacing: 0.04em;
}

input::placeholder {
  color: var(--muted);
}

#key {
  text-transform: uppercase;
}

#step-password input {
  display: block;
  width: 100%;
  margin-bottom: 8px;
}

.row button,
.row .button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--raised);
  color: var(--text);
  font: 500 16px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
}

.row button:hover,
.row .button:hover {
  background: var(--hover);
}

.row .secondary {
  background: var(--surface);
  color: var(--secondary);
}

/* Second step and signed-in view: only what is needed, so the page never scrolls. */
.is-step2 .hint,
.is-step2 .discord {
  display: none;
}

input:focus-visible,
.row button:focus-visible,
.row .button:focus-visible,
.lang button:focus-visible,
.discord a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.status {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--accent);
  font-size: 14px;
}

.hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.discord {
  margin: 16px 0 0;
  font-size: 14px;
}

.discord a {
  color: var(--text);
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
}

.discord a:hover {
  text-decoration-color: var(--text);
}

/*
 * One screen, no scroll. Worst case counted by hand at 320 px wide in French:
 * header 68 + eyebrow 27 + title 98 + lead 96 + label 29 + field and button
 * 104 + status 32 + hint 67 + Discord link 37 + bottom margin 24 = 582 px.
 * Each threshold below removes what is least needed until it fits.
 */

@media (max-width: 480px) {
  :root {
    --inset: 24px;
  }

  .top {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .main {
    padding-bottom: 24px;
  }

  h1 {
    font-size: 28px;
    margin-bottom: 12px;
  }

  .lead {
    margin-bottom: 24px;
    font-size: 16px;
  }

  .row button,
  .row .button {
    flex: 1 1 100%;
  }
}

/* Short screens (small phones, laptops with a lot of browser chrome). */
@media (max-height: 700px) {
  .top {
    padding-top: 16px;
    padding-bottom: 8px;
  }

  .main {
    padding-bottom: 24px;
  }

  .eyebrow {
    margin-bottom: 12px;
  }

  h1 {
    font-size: clamp(26px, 6.4vh, 44px);
    margin-bottom: 12px;
  }

  .lead {
    margin-bottom: 24px;
  }
}

/* Very short screens: the sentence under the title goes. */
@media (max-height: 620px) {
  .lead {
    display: none;
  }

  h1 {
    margin-bottom: 24px;
  }
}

/* Phones in landscape and keyboards open: the bare minimum, on one line. */
@media (max-height: 500px) {
  .note {
    display: none;
  }

  .top {
    padding-top: 12px;
    padding-bottom: 4px;
  }

  .main {
    padding-bottom: 12px;
  }

  .eyebrow {
    display: none;
  }

  h1 {
    font-size: 24px;
    margin-bottom: 12px;
  }

  /* The label stays for screen readers, out of sight. */
  .access label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .row button,
  .row .button {
    flex: 0 0 auto;
  }

  .status {
    min-height: 20px;
    margin-top: 8px;
  }

  .hint {
    font-size: 13px;
    line-height: 18px;
  }
}
