/* =========================================================
   Inkast landing — global styles
   ========================================================= */

:root {
  --bg: #f4fd54;
  --fg: #000;
  --radius-qr: 32px;
  --font-display: "HelveticaNeue-CondensedBold", "Helvetica Neue", "Oswald", "Arial Narrow", "Noto Sans JP",
    "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-body: "HelveticaNeue-CondensedBold", "Helvetica Neue", "Oswald", "Arial Narrow", "Noto Sans JP",
    "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-variant-ligatures: common-ligatures;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  isolation: isolate;
}

/* =========================================================
   Animated background
   Adapted from https://codepen.io/wodniack/pen/VYwGEGg
   ========================================================= */

.black-hole-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  overflow: hidden;
  pointer-events: none;
  background: #141414;
  opacity: 0.34;
  mix-blend-mode: multiply;
}

.black-hole-bg::before {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: block;
  width: 150%;
  height: 140%;
  background: radial-gradient(ellipse at 50% 55%, transparent 10%, #000 50%);
  transform: translate3d(-50%, -50%, 0);
  content: "";
}

.black-hole-bg::after {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  display: block;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 75%, #a900ff 20%, transparent 75%);
  mix-blend-mode: overlay;
  transform: translate3d(-50%, -50%, 0);
  content: "";
}

.black-hole-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.black-hole-aura {
  position: absolute;
  top: -71.5%;
  left: 50%;
  z-index: 3;
  display: block;
  width: 30%;
  height: 140%;
  background:
    linear-gradient(
        20deg,
        #00f8f1,
        rgba(255, 189, 30, 0.13) 16.5%,
        #fe848f 33%,
        rgba(254, 132, 143, 0.13) 49.5%,
        #00f8f1 66%,
        rgba(0, 248, 241, 0.38) 85.5%,
        #ffbd1e 100%
      )
      0 100% / 100% 200%;
  border-radius: 0 0 100% 100%;
  filter: blur(50px);
  mix-blend-mode: plus-lighter;
  opacity: 0.75;
  transform: translate3d(-50%, 0, 0);
  animation: aura-glow 5s infinite linear;
}

.black-hole-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: block;
  background: repeating-linear-gradient(transparent, transparent 1px, #fff 1px, #fff 2px);
  mix-blend-mode: overlay;
  opacity: 0.45;
}

@keyframes aura-glow {
  0% {
    background-position: 0 100%;
  }
  100% {
    background-position: 0 300%;
  }
}

/* Bigger / heavier glyphs for CJK languages */
html[lang="ja"],
html[lang="zh"] {
  --font-display: "Noto Sans JP", "Noto Sans SC", "Oswald",
    "Helvetica Neue", system-ui, sans-serif;
  --font-body: "Noto Sans JP", "Noto Sans SC", "Oswald",
    "Helvetica Neue", system-ui, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

/* =========================================================
   Header / language switcher
   ========================================================= */

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  padding: 18px 24px;
}

.lang-switcher {
  position: relative;
}

.lang-button {
  background: transparent;
  border: 0;
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: #000;
  cursor: pointer;
  text-transform: uppercase;
  border-radius: 999px;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.lang-button:hover,
.lang-button[aria-expanded="true"] {
  background: #000;
  color: #fff;
}

.lang-button:focus-visible {
  outline: 2px solid #000;
  outline-offset: 4px;
}

.lang-caret {
  display: none;
  width: 10px;
  height: 7px;
  transition: transform 0.2s ease;
}

.lang-button[aria-expanded="true"] .lang-caret {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: rgba(8, 8, 8, 0.94);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 30px;
  min-width: 260px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(18px);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
}

.lang-menu[hidden] {
  display: none;
}

.lang-menu li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 14px 16px 14px 20px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.78);
  transition: background 0.14s ease, color 0.14s ease, transform 0.14s ease;
}

.lang-menu li span {
  display: inline-block;
  width: 38px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: inherit;
  font-family: var(--font-display);
  text-align: right;
  opacity: 0.72;
}

.lang-menu li:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.lang-menu li[aria-selected="true"] {
  background: #fff;
  color: #000;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.lang-menu li[aria-selected="true"] span {
  opacity: 1;
}

/* =========================================================
   Main layout
   ========================================================= */

.site-main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 24px 56px;
  gap: clamp(80px, 16vw, 200px);
  min-height: 100vh;
  min-height: 100dvh;
}

/* =========================================================
   Hero
   ========================================================= */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  max-width: 560px;
  width: 100%;
}

.hero-logo {
  width: 137.921px;
  height: 162px;
  display: block;
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(56px, 10vw, 96px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-align: center;
  text-transform: uppercase;
  color: #000;
  word-break: break-word;
}

/* CJK doesn't break the same way as Latin — soften letter spacing */
html[lang="ja"] .hero-title,
html[lang="zh"] .hero-title {
  letter-spacing: 0;
  font-size: clamp(40px, 8vw, 76px);
}

/* Russian "ЛЁГКО ЗАВОДИ ДРУЗЕЙ" is a wider phrase */
html[lang="ru"] .hero-title,
html[lang="de"] .hero-title {
  font-size: clamp(48px, 8.5vw, 84px);
}

/* =========================================================
   Community block
   ========================================================= */

.community {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  width: 100%;
  max-width: 265px;
}

.community-title {
  margin: 0 0 7px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 4.5vw, 36px);
  letter-spacing: -0.03em;
  text-align: center;
  text-transform: none;
}

.sketch-button {
  --squircle: 40px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-block;
  color: #000;
  background: none;
  border: 0;
  border-radius: calc(var(--squircle) * 0.45);
  cursor: pointer;
  appearance: none;
  outline: none;
  text-decoration: none;
  perspective: 700px;
  transform:
    translate3d(var(--sketch-x, 0), var(--sketch-y, 0), 0)
    rotateX(var(--sketch-rotate-x, 0deg))
    rotateY(var(--sketch-rotate-y, 0deg));
  transform-style: preserve-3d;
  transform-origin: center;
  will-change: transform;
}

.sketch-button > span {
  position: relative;
  z-index: 2;
  display: block;
  padding: 12px 24px;
  color: #000;
  line-height: 24px;
  background-image: linear-gradient(90deg, #fcecfe, #fbf6e7, #e6fcf5);
  border-radius: inherit;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.02),
    0 4px 16px rgba(0, 0, 0, 0.02),
    0 4px 24px rgba(0, 0, 0, 0.02);
  clip-path: inset(0 round calc(var(--squircle) * 0.45));
  clip-path: shape(
    from 0 var(--squircle),
    curve to var(--squircle) 0 with 0 0 / 0 0,
    hline to calc(100% - var(--squircle)),
    curve to 100% var(--squircle) with 100% 0 / 100% 0,
    vline to calc(100% - var(--squircle)),
    curve to calc(100% - var(--squircle)) 100% with 100% 100% / 100% 100%,
    hline to var(--squircle),
    curve to 0 calc(100% - var(--squircle)) with 0 100% / 0 100%,
    close
  );
  transform: translateZ(12px);
}

.sketch-button.start svg {
  animation: sketch-stroke 1s linear;
}

.sketch-button .lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: hard-light;
  transform: scaleX(0.92) scaleY(0.95) translateZ(0);
}

.sketch-button .lines > div {
  position: absolute;
  inset: 0;
}

.sketch-button .lines > div:last-child {
  transform: rotate(180deg);
}

.sketch-button .lines > div svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: #c9e9ff;
  stroke-width: 1;
  stroke-dasharray: 2 10;
  stroke-dashoffset: 14;
  opacity: 0;
}

.sketch-button .lines > div svg:nth-child(1) {
  stroke: #f8fcff;
}

.sketch-button .lines > div svg:nth-child(2) {
  stroke-width: 6px;
  filter: blur(20px);
}

.sketch-button .lines > div svg:nth-child(3) {
  stroke-width: 5px;
  filter: blur(6px);
}

.sketch-button .lines > div svg:nth-child(4) {
  stroke-width: 10px;
  filter: blur(56px);
}

.sketch-button:focus-visible {
  outline: 2px solid #000;
  outline-offset: 4px;
}

@keyframes sketch-stroke {
  30%,
  55% {
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 4;
    opacity: 0;
  }
}

.qr-magnet-zone {
  width: 256px;
  height: 256px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 900px;
}

.qr-card {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: var(--radius-qr);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transform:
    translate3d(var(--qr-x, 0), var(--qr-y, 0), 0)
    rotateX(var(--qr-rotate-x, 0deg))
    rotateY(var(--qr-rotate-y, 0deg));
  transform-style: preserve-3d;
  transform-origin: center;
  will-change: transform;
}

.qr-card::after {
  position: absolute;
  inset: -45%;
  z-index: 2;
  display: block;
  background:
    radial-gradient(
      circle at var(--qr-glare-x, 50%) var(--qr-glare-y, 50%),
      rgba(255, 255, 255, 0.72) 0%,
      rgba(255, 255, 255, 0.32) 12%,
      rgba(255, 255, 255, 0.1) 24%,
      transparent 42%
    ),
    linear-gradient(
      115deg,
      transparent 24%,
      rgba(255, 255, 255, 0.26) 37%,
      rgba(255, 255, 255, 0.04) 45%,
      transparent 58%
    );
  border-radius: inherit;
  mix-blend-mode: screen;
  opacity: var(--qr-glare-opacity, 0);
  pointer-events: none;
  transform: translateZ(18px);
  transition: opacity 0.45s ease;
}

.qr-card svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: var(--radius-qr);
  shape-rendering: crispEdges;
}

.qr-card img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: var(--radius-qr);
}

.brand-logo {
  width: auto;
  height: 162px;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin-top: 0;
}

.legal-links a {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: #000;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.legal-links a:hover {
  border-bottom-color: #000;
}

/* =========================================================
   Mobile — iPhone-first scale, capped to fit 100vh
   ========================================================= */

@media (max-width: 719px) {
  :root {
    --mobile-u: min(1vw, calc(100dvh / 205));
    --radius-qr: calc(8.205 * var(--mobile-u));
  }
  .black-hole-bg {
    top: 0;
    bottom: 0;
    left: 50%;
    right: auto;
    width: max(100vw, 164vh);
    width: max(100vw, 164dvh);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-50%);
  }
  .site-header {
    padding: calc(4.615 * var(--mobile-u)) calc(6.154 * var(--mobile-u));
  }
  .lang-button {
    padding: calc(1.538 * var(--mobile-u)) calc(2.051 * var(--mobile-u));
    font-size: calc(3.59 * var(--mobile-u));
  }
  .lang-menu {
    top: calc(100% + calc(3.077 * var(--mobile-u)));
    padding: calc(2.051 * var(--mobile-u));
    border-radius: calc(7.692 * var(--mobile-u));
    min-width: calc(66.667 * var(--mobile-u));
    font-size: calc(4.615 * var(--mobile-u));
  }
  .lang-menu li {
    gap: calc(7.179 * var(--mobile-u));
    padding: calc(3.59 * var(--mobile-u)) calc(4.103 * var(--mobile-u)) calc(3.59 * var(--mobile-u)) calc(5.128 * var(--mobile-u));
  }
  .lang-menu li span {
    width: calc(9.744 * var(--mobile-u));
    font-size: calc(3.59 * var(--mobile-u));
  }
  .site-main {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: calc(9.231 * var(--mobile-u)) calc(6.154 * var(--mobile-u)) calc(4.103 * var(--mobile-u));
    gap: calc(11.282 * var(--mobile-u));
    justify-content: flex-start;
  }
  .hero {
    gap: calc(2.051 * var(--mobile-u));
    max-width: calc(84.615 * var(--mobile-u));
  }
  .hero-logo {
    width: calc(26 * var(--mobile-u));
    height: calc(30.541 * var(--mobile-u));
  }
  .hero-title {
    font-size: calc(13.846 * var(--mobile-u));
  }
  html[lang="ja"] .hero-title,
  html[lang="zh"] .hero-title {
    font-size: calc(11.795 * var(--mobile-u));
  }
  html[lang="ru"] .hero-title,
  html[lang="de"] .hero-title {
    font-size: calc(12.308 * var(--mobile-u));
  }
  .community {
    gap: calc(2.051 * var(--mobile-u));
    max-width: calc(54.103 * var(--mobile-u));
  }
  .community-title {
    margin-bottom: calc(1.538 * var(--mobile-u));
    font-size: calc(6.923 * var(--mobile-u));
  }
  .sketch-button > span {
    padding: calc(3.077 * var(--mobile-u)) calc(6.154 * var(--mobile-u));
    line-height: calc(6.154 * var(--mobile-u));
  }
  .qr-magnet-zone {
    width: calc(54.103 * var(--mobile-u));
    height: calc(54.103 * var(--mobile-u));
  }
  .brand-logo {
    height: calc(31.026 * var(--mobile-u));
  }
  .legal-links {
    gap: calc(1.538 * var(--mobile-u)) calc(3.59 * var(--mobile-u));
  }
  .legal-links a {
    font-size: calc(3.846 * var(--mobile-u));
  }
}

/* =========================================================
   Tablet and up
   ========================================================= */

@media (min-width: 720px) {
  .site-main {
    padding-top: 80px;
  }
  .hero-logo {
    width: 137.921px;
    height: 162px;
  }
  .hero-title {
    font-size: 73px;
    letter-spacing: -0.04em;
  }
  .community-title {
    font-size: 32px;
  }
}

/* =========================================================
   Desktop — 1440px vw scale, capped to fit 100vh
   ========================================================= */

@media (min-width: 1100px) {
  :root {
    --desktop-u: min(1vw, calc(100dvh / 82));
    --radius-qr: calc(2.222 * var(--desktop-u));
  }
  .site-header {
    padding: calc(2.361 * var(--desktop-u)) calc(2.361 * var(--desktop-u));
  }
  .lang-button {
    padding: calc(0.417 * var(--desktop-u)) calc(0.556 * var(--desktop-u));
    font-size: calc(2.222 * var(--desktop-u));
  }
  .lang-button:focus-visible {
    outline-width: calc(0.139 * var(--desktop-u));
    outline-offset: calc(0.278 * var(--desktop-u));
  }
  .lang-menu {
    top: calc(100% + calc(0.833 * var(--desktop-u)));
    padding: calc(0.556 * var(--desktop-u));
    border-radius: calc(2.083 * var(--desktop-u));
    min-width: calc(18.056 * var(--desktop-u));
    box-shadow: 0 calc(1.528 * var(--desktop-u)) calc(3.333 * var(--desktop-u)) rgba(0, 0, 0, 0.26);
    font-size: calc(1.25 * var(--desktop-u));
  }
  .lang-menu li {
    gap: calc(1.944 * var(--desktop-u));
    padding: calc(0.972 * var(--desktop-u)) calc(1.111 * var(--desktop-u)) calc(0.972 * var(--desktop-u)) calc(1.389 * var(--desktop-u));
  }
  .lang-menu li span {
    width: calc(2.639 * var(--desktop-u));
    font-size: calc(0.972 * var(--desktop-u));
  }
  .site-main {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: calc(0.903 * var(--desktop-u)) calc(1.667 * var(--desktop-u)) calc(3.889 * var(--desktop-u));
    gap: calc(14.722 * var(--desktop-u));
    justify-content: flex-start;
  }
  .hero {
    gap: calc(1.042 * var(--desktop-u));
    max-width: calc(19.097 * var(--desktop-u));
  }
  .hero-logo {
    width: calc(9.578 * var(--desktop-u));
    height: calc(11.25 * var(--desktop-u));
  }
  .hero-title {
    font-size: calc(5.082 * var(--desktop-u));
    letter-spacing: -0.04em;
  }
  html[lang="ja"] .hero-title,
  html[lang="zh"] .hero-title {
    font-size: calc(4.444 * var(--desktop-u));
  }
  html[lang="ru"] .hero-title,
  html[lang="de"] .hero-title {
    font-size: calc(4.722 * var(--desktop-u));
  }
  .community {
    gap: calc(0.625 * var(--desktop-u));
    max-width: calc(18.402 * var(--desktop-u));
  }
  .community-title {
    margin-bottom: calc(0.486 * var(--desktop-u));
    font-size: calc(2.222 * var(--desktop-u));
  }
  .sketch-button > span {
    padding: calc(0.833 * var(--desktop-u)) calc(1.667 * var(--desktop-u));
    line-height: calc(1.667 * var(--desktop-u));
  }
  .qr-magnet-zone {
    width: calc(17.778 * var(--desktop-u));
    height: calc(17.778 * var(--desktop-u));
  }
  .legal-links {
    gap: calc(0.417 * var(--desktop-u)) calc(0.972 * var(--desktop-u));
  }
  .legal-links a {
    font-size: calc(1.111 * var(--desktop-u));
  }
  .hero {
    margin-top: 0;
  }
}

/* =========================================================
   Reduced motion / focus
   ========================================================= */

:focus-visible {
  outline-color: #000;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .black-hole-bg {
    opacity: 0.22;
  }
}
