@import "@fontsource-variable/unbounded/wght.css";
@import "@fontsource-variable/instrument-sans/wght.css";

/* ------------------------------------------------------------------ *
 * Tokens
 * Palette: the Oceanic Shimmer tide (Foam, Sky, Cobalt, Navy) over a blue-black abyss.
 * ------------------------------------------------------------------ */
:root {
  --abyss: #050a14;
  --navy: #123a6b;
  --cobalt: #2e7cc0;
  --sky: #7fc6e6;
  --foam: #eaf7fb;
  --electric: #3ca6ff;

  --text: var(--foam);
  --text-2: rgb(234 247 251 / 0.68);
  --text-3: rgb(234 247 251 / 0.5);
  --line: rgb(127 198 230 / 0.13);
  --line-strong: rgb(127 198 230 / 0.26);
  --surface: rgb(16 36 66 / 0.5);
  --surface-hover: rgb(22 50 90 / 0.62);

  --font-display: "Unbounded Variable", "Unbounded", "Arial Black", system-ui, sans-serif;
  --font-text: "Instrument Sans Variable", "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-press: cubic-bezier(0.3, 0, 0.2, 1);

  --mark-size: clamp(250px, 72vw, 360px);
  --gutter: clamp(16px, 4vw, 32px);

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: clip;
  background: var(--abyss);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

svg {
  display: block;
}

::selection {
  background: rgb(46 124 192 / 0.6);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--electric);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--foam);
  color: var(--abyss);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.25s var(--ease-out);
}

.skip-link:focus-visible {
  transform: none;
}

.shell {
  width: min(100% - 2 * var(--gutter), 880px);
  margin-inline: auto;
}

/* ------------------------------------------------------------------ *
 * Hero
 * ------------------------------------------------------------------ */
.hero {
  position: relative;
  isolation: isolate;
  padding-top: clamp(8px, 4vh, 48px);
}

/* Dithered tide behind the hero; it fades out before the links. */
.tide {
  position: absolute;
  inset: 0 0 -180px;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.52;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 58%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 58%, transparent 100%);
}

.tide-canvas {
  --cell: 9px;
  display: block;
  image-rendering: pixelated;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 calc(var(--cell) * 0.22), transparent calc(var(--cell) * 0.22 + 0.8px));
  mask-image: radial-gradient(circle at 50% 50%, #000 calc(var(--cell) * 0.22), transparent calc(var(--cell) * 0.22 + 0.8px));
  -webkit-mask-size: var(--cell) var(--cell);
  mask-size: var(--cell) var(--cell);
}

.hero-inner {
  width: min(100% - 2 * var(--gutter), 880px);
  margin-inline: auto;
  text-align: center;
}

/* The glass mark. The canvas paints the abyss colour, so its edge fades into the page. */
.mark {
  position: relative;
  display: block;
  width: var(--mark-size);
  height: var(--mark-size);
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.mark:disabled {
  cursor: default;
}

.mark:focus-visible {
  outline: none;
}

.mark:focus-visible::after {
  content: "";
  position: absolute;
  inset: 21%;
  border-radius: 30%;
  outline: 2px solid var(--electric);
  outline-offset: 6px;
}

.mark-stage {
  position: absolute;
  inset: 0;
  -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 72%, transparent 100%);
}

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

/* Without JavaScript or WebGL2: the settled plate, drawn in CSS. */
.mark-plate {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 57%;
  height: 57%;
  margin: auto;
  border: 1px solid rgb(127 198 230 / 0.28);
  border-radius: 30%;
  background: linear-gradient(to bottom, #123a6b, #0c2142);
  box-shadow:
    0 0 48px -12px rgb(127 198 230 / 0.4),
    inset 0 1px 0 rgb(234 247 251 / 0.16);
}

.mark-flat {
  width: 58%;
  color: var(--foam);
}

.js .mark:not(.mark--flat) .mark-plate {
  display: none;
}

.title {
  margin-top: calc(var(--mark-size) * -0.15);
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 0.75rem + 6.6vw, 5.25rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.title-glyphs > span {
  display: inline-block;
}

.title-gap {
  width: 0.3em;
}

.lede {
  max-width: 34ch;
  margin: clamp(14px, 2.2vh, 22px) auto 0;
  color: var(--text-2);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.55;
  text-wrap: balance;
}

/* ------------------------------------------------------------------ *
 * Channels
 * ------------------------------------------------------------------ */
.channels {
  margin-top: clamp(32px, 6vh, 56px);
}

.links {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

/* Spotlight border + wash (21st.dev Spotlight Card, adapted): --mx/--my come from spotlight.js. */
[data-spotlight] {
  --hue: calc(192 + var(--xp, 0.5) * 34);
  position: relative;
  isolation: isolate;
}

[data-spotlight]::before,
[data-spotlight]::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  pointer-events: none;
}

[data-spotlight]::before {
  inset: -1px;
  z-index: 1;
  padding: 1px;
  background:
    radial-gradient(120px circle at var(--mx, -999px) var(--my, -999px), rgb(255 255 255 / 0.85), transparent 45%),
    radial-gradient(300px circle at var(--mx, -999px) var(--my, -999px), hsl(var(--hue) 95% 66% / 0.9), transparent 70%);
  -webkit-mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
  -webkit-mask-clip: content-box, border-box;
  -webkit-mask-composite: xor;
  mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
  mask-clip: content-box, border-box;
  mask-composite: exclude;
}

[data-spotlight]::after {
  inset: 0;
  z-index: -1;
  background: radial-gradient(360px circle at var(--mx, -999px) var(--my, -999px), hsl(var(--hue) 90% 62% / 0.09), transparent 70%);
}

.link-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 84px;
  padding: 16px 20px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgb(234 247 251 / 0.05);
  text-decoration: none;
  transition:
    transform 0.5s var(--ease-out),
    background-color 0.3s ease,
    border-color 0.3s ease;
  touch-action: manipulation;
}

.link-card:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  transform: translateY(-3px);
}

.link-card:active {
  transform: translateY(-1px) scale(0.985);
  transition-duration: 0.12s;
  transition-timing-function: var(--ease-press);
}

.link-card:focus-visible {
  outline-offset: 4px;
}

.press-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(127 198 230 / 0.3), transparent 60%);
  transform: scale(0);
  animation: ripple 0.75s var(--ease-out) forwards;
}

@keyframes ripple {
  to {
    transform: scale(1);
    opacity: 0;
  }
}

.link-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgb(127 198 230 / 0.07);
  color: var(--foam);
  transition: transform 0.5s var(--ease-out), border-color 0.3s ease;
}

/* Each platform's own colour arrives on hover, so the icon is recognisable at a glance. */
.link-icon::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: var(--brand);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.link-icon svg {
  position: relative;
  width: 22px;
  height: 22px;
  fill: currentColor;
  transition: filter 0.35s ease;
}

[data-platform="youtube"] {
  --brand: #ff0033;
}

[data-platform="tiktok"] {
  --brand: #010101;
}

[data-platform="instagram"] {
  --brand: radial-gradient(circle at 28% 108%, #fdf497 0%, #fdf497 6%, #fd5949 42%, #d6249f 62%, #285aeb 92%);
}

[data-platform="discord"] {
  --brand: #5865f2;
}

.link-card:hover .link-icon,
.link-card:focus-visible .link-icon {
  transform: rotate(-6deg) scale(1.06);
  border-color: transparent;
}

.link-card:hover .link-icon::before,
.link-card:focus-visible .link-icon::before {
  opacity: 1;
}

[data-platform="tiktok"]:hover .link-icon svg,
[data-platform="tiktok"]:focus-visible .link-icon svg {
  filter: drop-shadow(-1.5px -1px 0 #25f4ee) drop-shadow(1.5px 1px 0 #fe2c55);
}

.link-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.link-name {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.link-handle {
  overflow: hidden;
  color: var(--text-2);
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Two arrows: on hover the first leaves through the corner and the second slides in behind it. */
.link-go {
  position: relative;
  width: 22px;
  height: 22px;
  overflow: hidden;
  color: var(--text-3);
  transition: color 0.3s ease;
}

.link-go svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.45s var(--ease-out);
}

.link-go svg:last-child {
  transform: translate(-130%, 130%);
}

.link-card:hover .link-go,
.link-card:focus-visible .link-go {
  color: var(--foam);
}

.link-card:hover .link-go svg:first-child,
.link-card:focus-visible .link-go svg:first-child {
  transform: translate(130%, -130%);
}

.link-card:hover .link-go svg:last-child,
.link-card:focus-visible .link-go svg:last-child {
  transform: none;
}

/* ------------------------------------------------------------------ *
 * Contact
 * ------------------------------------------------------------------ */
.contact {
  display: grid;
  gap: clamp(20px, 3vw, 28px);
  margin-top: 14px;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgb(46 124 192 / 0.16), transparent 55%),
    var(--surface);
  box-shadow: inset 0 1px 0 rgb(234 247 251 / 0.05);
}

.contact-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 1.05rem + 1vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.contact-text {
  max-width: 46ch;
  margin-top: 8px;
  color: var(--text-2);
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding-top: clamp(18px, 3vw, 24px);
  border-top: 1px solid var(--line);
}

.email {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 0.8rem + 1.5vw, 1.6rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 7px;
  transition: text-decoration-color 0.3s ease;
}

.email:hover {
  text-decoration-color: var(--sky);
}

.buttons {
  display: flex;
  gap: 10px;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.4s var(--ease-out),
    background-color 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.4s var(--ease-out);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: scale(0.96);
  transition-duration: 0.1s;
}

.btn[hidden] {
  display: none;
}

.btn .press-layer .ripple {
  background: radial-gradient(circle, rgb(46 124 192 / 0.3), transparent 60%);
}

.btn-primary {
  min-width: 152px;
  background: var(--foam);
  color: var(--abyss);
}

.btn-primary:hover {
  background: #fff;
  box-shadow: 0 10px 28px -10px rgb(127 198 230 / 0.65);
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--foam);
}

.btn-ghost:hover {
  background: rgb(127 198 230 / 0.08);
  border-color: rgb(127 198 230 / 0.4);
}

.btn-icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-done {
  display: none;
}

.btn[data-state="copied"] .icon-copy {
  display: none;
}

.btn[data-state="copied"] .icon-done {
  display: block;
  stroke-dasharray: 24;
  animation: draw 0.45s var(--ease-out) both;
}

.btn[data-state="copied"] .btn-label {
  animation: swap 0.35s var(--ease-out) both;
}

.btn[data-state="failed"] .btn-label {
  animation: swap 0.35s var(--ease-out) both;
}

@keyframes draw {
  from {
    stroke-dashoffset: 24;
  }
  to {
    stroke-dashoffset: 0;
  }
}

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

@media (max-width: 519px) {
  .buttons {
    width: 100%;
  }

  .buttons .btn {
    flex: 1;
    min-width: 0;
    padding-inline: 12px;
  }
}

.clipboard-proxy {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ------------------------------------------------------------------ *
 * Footer
 * ------------------------------------------------------------------ */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: clamp(48px, 9vh, 88px);
  padding: 22px 0 calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 0.875rem;
}

.footer-mark {
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ------------------------------------------------------------------ *
 * Load sequence: the glass lands, the name rises letter by letter, then the channels follow.
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .tide {
    animation: fade 1.8s ease both;
  }

  .title-glyphs > span {
    animation: rise 1s var(--ease-out) both;
  }

  .title-glyphs > span:nth-child(1) { animation-delay: 420ms; }
  .title-glyphs > span:nth-child(2) { animation-delay: 460ms; }
  .title-glyphs > span:nth-child(3) { animation-delay: 500ms; }
  .title-glyphs > span:nth-child(5) { animation-delay: 560ms; }
  .title-glyphs > span:nth-child(6) { animation-delay: 600ms; }
  .title-glyphs > span:nth-child(7) { animation-delay: 640ms; }
  .title-glyphs > span:nth-child(8) { animation-delay: 680ms; }
  .title-glyphs > span:nth-child(9) { animation-delay: 720ms; }

  .lede {
    animation: enter 0.9s var(--ease-out) 820ms both;
  }

  .links > li {
    animation: enter 0.9s var(--ease-out) both;
  }

  .links > li:nth-child(1) { animation-delay: 980ms; }
  .links > li:nth-child(2) { animation-delay: 1070ms; }
  .links > li:nth-child(3) { animation-delay: 1160ms; }
  .links > li:nth-child(4) { animation-delay: 1250ms; }

  .contact {
    animation: enter 0.9s var(--ease-out) 1380ms both;
  }

  .footer {
    animation: fade 1s ease 1550ms both;
  }
}

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.5em);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(16px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}
