/* ==========================================================================
   ewony.de — landing page
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts (self-hosted — no third-party requests)
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/space-grotesk-latin.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: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/space-grotesk-latin-ext.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: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin.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;
}

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

:root {
  --bg: #010506;
  --text: #aac6c4;
  --text-strong: #dcecea;
  --text-muted: #9dbab8;
  --text-faint: #6e9391;
  --accent: #14b8a6;
  --accent-bright: #2dd4bf;
  --toast: #7fb3ac;

  --tile-bg: #041213;
  --tile-border: #0f2526;
  --icon-idle: #7f9d9c;

  --brand-discord: #5865f2;
  --brand-github: #ffffff;
  --brand-youtube: #ff0033;
  --brand-steam: #ffffff;

  --font-sans: 'Space Grotesk', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);

  /* Fluid scale — everything shrinks with the viewport instead of snapping at
     breakpoints. Lower bounds are sized for a 320px-wide screen. */
  --pad-y: clamp(28px, 7vw, 56px);
  --pad-x: clamp(16px, 5vw, 24px);
  --card-gap: clamp(24px, 6vw, 34px);
  --tile-size: clamp(52px, 14vw, 62px);
  --tile-gap: clamp(10px, 3vw, 14px);
  --icon-size: clamp(20px, 5.5vw, 24px);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;

  /* Stop iOS inflating text when a phone is turned to landscape. */
  -webkit-text-size-adjust: 100%;
          text-size-adjust: 100%;

  /* No grey flash when a tile is tapped — the tile has its own press state. */
  -webkit-tap-highlight-color: transparent;
}

/* --------------------------------------------------------------------------
   Stage — full-viewport backdrop + cursor glow
   -------------------------------------------------------------------------- */

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;

  /* Fallback first: browsers without padding-block would otherwise get none. */
  padding: var(--pad-y) var(--pad-x);

  /* Fluid gutters, plus the notch / home-indicator insets — index.html opts in
     to the full screen with viewport-fit=cover, so this has to be paid back. */
  padding-block: calc(var(--pad-y) + env(safe-area-inset-top, 0px))
                 calc(var(--pad-y) + env(safe-area-inset-bottom, 0px));
  padding-inline: calc(var(--pad-x) + env(safe-area-inset-left, 0px))
                  calc(var(--pad-x) + env(safe-area-inset-right, 0px));

  /* Height is min-height, so the box grows past the viewport rather than
     clipping the card; this only ever clips the glow. */
  overflow: hidden;
  background: radial-gradient(110% 80% at 50% 0%, #04181a 0%, #020c0d 55%, #010506 100%);
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 620px;
  height: 620px;
  margin: -310px 0 0 -310px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(circle,
    rgba(20, 184, 166, .16) 0%,
    rgba(20, 184, 166, .05) 40%,
    rgba(20, 184, 166, 0) 70%);
  transition: opacity 500ms ease;
  will-change: transform;
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--card-gap);
  width: 100%;
  max-width: 520px;
  text-align: center;
}

.intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* --------------------------------------------------------------------------
   Wordmark
   -------------------------------------------------------------------------- */

.wordmark {
  display: flex;
  margin: 0;
  /* 10vw bottomed out at the 44px floor on every phone, leaving the wordmark
     looking undersized; 15vw keeps it scaling down to ~320px wide. */
  font-size: clamp(46px, 15vw, 76px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.035em;
  color: var(--text-strong);
  cursor: pointer;
}

/* Outer span owns the entrance animation, inner span owns the hover lift,
   so the animation's fill state never overrides the hover transform. */
.wordmark__letter {
  display: inline-block;
  animation: drop-in 620ms var(--ease-back) backwards;
}

.wordmark__letter > span {
  display: inline-block;
  transition: transform 520ms var(--ease-out), color 520ms var(--ease-out);
}

.wordmark__letter:nth-child(2) { animation-delay:  70ms; }
.wordmark__letter:nth-child(3) { animation-delay: 140ms; }
.wordmark__letter:nth-child(4) { animation-delay: 210ms; }
.wordmark__letter:nth-child(5) { animation-delay: 280ms; }

/* Pointer only — the per-letter lift latches on touch and has nothing to do
   on a phone, where there is no cursor to follow it. */
@media (hover: hover) and (pointer: fine) {
  .wordmark__letter:hover > span {
    transform: translateY(-9px);
    color: var(--accent-bright);
  }
}

/* --------------------------------------------------------------------------
   Quote
   -------------------------------------------------------------------------- */

.quote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 4px 0 0;
}

.quote__text {
  max-width: 34ch;
  margin: 0;
  font-size: clamp(15px, 4.2vw, 17px);
  font-style: italic;
  line-height: 1.6;
  color: var(--text-muted);
  animation: float-up 700ms 300ms ease backwards;
}

.quote__author {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-faint);
  animation: float-up 700ms 420ms ease backwards;
}

/* --------------------------------------------------------------------------
   Link tiles
   -------------------------------------------------------------------------- */

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--tile-gap);
  animation: float-up 700ms 380ms ease backwards;
}

.link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--tile-size);
  height: var(--tile-size);
  padding: 0;
  -webkit-appearance: none;
          appearance: none;
  border: 1px solid var(--tile-border);
  border-radius: 14px;
  background: var(--tile-bg);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 220ms ease,
              background 220ms ease,
              transform 300ms var(--ease-back),
              box-shadow 300ms ease;
}

/* Keyboard focus — on every device. */
.link:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 14px 28px -12px rgba(20, 184, 166, .45);
  outline: none;
}

.link:nth-child(odd):focus-visible  { transform: translateY(-8px) rotate(-5deg) scale(1.07); }
.link:nth-child(even):focus-visible { transform: translateY(-8px) rotate(5deg) scale(1.07); }

/* Hover lift — pointer devices only. On a touchscreen :hover latches on tap and
   the tile stays lifted and tinted until you tap somewhere else. */
@media (hover: hover) and (pointer: fine) {
  .link:hover {
    border-color: var(--accent);
    box-shadow: 0 14px 28px -12px rgba(20, 184, 166, .45);
  }

  /* Tiles tilt in alternating directions. */
  .link:nth-child(odd):hover  { transform: translateY(-8px) rotate(-5deg) scale(1.07); }
  .link:nth-child(even):hover { transform: translateY(-8px) rotate(5deg) scale(1.07); }
}

/* Press feedback — this is what a touch device gets instead of hover. */
.link:nth-child(n):active {
  transform: scale(.94);
  transition-duration: 120ms;
}

.link__icon {
  width: var(--icon-size);
  height: var(--icon-size);
  background-color: var(--icon-idle);
  transition: background-color 220ms ease;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
}

.link__icon--discord {
  -webkit-mask-image: url('/assets/icons/discord.svg');
          mask-image: url('/assets/icons/discord.svg');
}
.link__icon--github {
  -webkit-mask-image: url('/assets/icons/github.svg');
          mask-image: url('/assets/icons/github.svg');
}
.link__icon--youtube {
  -webkit-mask-image: url('/assets/icons/youtube.svg');
          mask-image: url('/assets/icons/youtube.svg');
}
.link__icon--steam {
  -webkit-mask-image: url('/assets/icons/steam.svg');
          mask-image: url('/assets/icons/steam.svg');
}

/* Brand colour on focus and on press — press is how a touch device gets it. */
.link:focus-visible .link__icon--discord,
.link:active        .link__icon--discord { background-color: var(--brand-discord); }
.link:focus-visible .link__icon--github,
.link:active        .link__icon--github  { background-color: var(--brand-github); }
.link:focus-visible .link__icon--youtube,
.link:active        .link__icon--youtube { background-color: var(--brand-youtube); }
.link:focus-visible .link__icon--steam,
.link:active        .link__icon--steam   { background-color: var(--brand-steam); }

@media (hover: hover) and (pointer: fine) {
  .link:hover .link__icon--discord { background-color: var(--brand-discord); }
  .link:hover .link__icon--github  { background-color: var(--brand-github); }
  .link:hover .link__icon--youtube { background-color: var(--brand-youtube); }
  .link:hover .link__icon--steam   { background-color: var(--brand-steam); }
}

/* --------------------------------------------------------------------------
   Copy confirmation
   -------------------------------------------------------------------------- */

.toast {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--toast);
  opacity: 0;
  transition: opacity 320ms ease;
}

.toast.is-visible { opacity: 1; }

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@keyframes drop-in {
  from { opacity: 0; transform: translateY(-38px) rotate(-10deg); }
  to   { opacity: 1; transform: none; }
}

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

@media (prefers-reduced-motion: reduce) {
  .wordmark__letter,
  .quote__text,
  .quote__author,
  .links {
    animation: none;
  }

  .glow { display: none; }

  .link,
  .link__icon,
  .wordmark__letter > span {
    transition-duration: 1ms;
  }

  /* :nth-child(n) matches the specificity of the tilt rules above, which would
     otherwise win and keep the transform. */
  .link:nth-child(n):hover,
  .link:nth-child(n):focus-visible,
  .link:nth-child(n):active {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Short viewports — phones in landscape, where the fluid vw-based padding is
   driven by the long edge and wastes most of the height.
   -------------------------------------------------------------------------- */

@media (max-height: 560px) and (orientation: landscape) {
  :root {
    --pad-y: 20px;
    --card-gap: 18px;
  }

  .wordmark { font-size: clamp(38px, 7vh, 54px); }
  .quote { gap: 6px; }
  .quote__text { font-size: 15px; line-height: 1.45; max-width: 46ch; }
}
