:root {
    --bg: #060608;
    --fg: #f4f1ea;
    --muted: #8f8a81;
    --line: rgba(255, 255, 255, .085);
    --gold: #f2c879;
    --gold-dim: rgba(242, 200, 121, .5);
    --red: #ff4d5e;
    --green: #26d97f;
    --violet: #9a7bff;
    --teal: #2ee6c4;
  }

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

  html,
  body { height: 100%; }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100svh;
  }

  /* native cursor is hidden only once the custom one is live (JS adds the class) */
  html.is-custom-cursor,
  html.is-custom-cursor * { cursor: none !important; }

  ::selection {
    background: rgba(242, 200, 121, .28);
    color: #fff;
  }

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

  /* ---------- background shader ---------- */
  #shader {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 0;
    pointer-events: none;
  }

  .no-webgl #shader { display: none; }

  .no-webgl body {
    background:
      radial-gradient(70% 55% at 12% 18%, rgba(255, 60, 90, .18), transparent 65%),
      radial-gradient(65% 55% at 88% 22%, rgba(130, 90, 255, .20), transparent 65%),
      radial-gradient(60% 45% at 18% 88%, rgba(20, 210, 160, .14), transparent 65%),
      radial-gradient(60% 45% at 85% 85%, rgba(60, 110, 255, .14), transparent 65%),
      radial-gradient(60% 50% at 50% 40%, rgba(242, 200, 121, .10), transparent 70%),
      var(--bg);
  }

  .veil {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
      radial-gradient(46% 42% at 50% 42%, rgba(6, 6, 8, .50), transparent 75%),
      linear-gradient(180deg, rgba(6, 6, 8, .35), transparent 25%, transparent 75%, rgba(6, 6, 8, .45));
  }

  /* ---------- custom cursor ---------- */
  #cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s ease;
  }

  #cursor.is-visible { opacity: 1; }

  /* the circle: follows the pointer instantly, no smoothing */
  .cursor-dot {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    will-change: transform;
  }

  .cursor-dot i {
    position: absolute;
    left: -5px;
    top: -5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--cursor-accent, #ffe9b8);
    box-shadow:
      0 0 8px var(--cursor-accent, var(--gold)),
      0 0 26px color-mix(in srgb, var(--cursor-accent, var(--gold)) 45%, transparent);
    transition:
      transform .22s cubic-bezier(.2, .8, .2, 1),
      background-color .25s ease,
      box-shadow .25s ease;
  }

  /* the square: slightly trails the pointer */
  .frame-pos {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    will-change: transform;
  }

  .frame-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 52px;
    height: 52px;
    transform: translate(-50%, -50%);
    transform-origin: center;
    transition:
      width .4s cubic-bezier(.2, .8, .2, 1),
      height .4s cubic-bezier(.2, .8, .2, 1),
      transform .35s cubic-bezier(.2, .8, .2, 1);
    will-change: width, height, transform;
  }

  .frame-rot {
    position: absolute;
    inset: 0;
    will-change: transform;
  }

  .corner {
    position: absolute;
    width: 13px;
    height: 13px;
    border: 0 solid color-mix(in srgb, var(--cursor-accent, var(--gold)) 70%, transparent);
    transition:
      border-color .25s ease,
      width .3s cubic-bezier(.2, .8, .2, 1),
      height .3s cubic-bezier(.2, .8, .2, 1),
      border-width .25s ease;
  }

  .tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 2px; }
  .tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 2px; }
  .bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; border-bottom-left-radius: 2px; }
  .br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 2px; }

  #cursor.is-hover:not(.is-box) .frame-box { transform: translate(-50%, -50%) scale(1.42); }
  #cursor.is-hover .cursor-dot i { transform: scale(1.35); }
  #cursor.is-hover .corner { border-color: var(--cursor-accent, #fff1c9); }

  #cursor.is-box .corner {
    border-color: var(--cursor-accent, #fff1c9);
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--cursor-accent, var(--gold)) 55%, transparent));
  }

  #cursor.is-down:not(.is-box) .frame-box { transform: translate(-50%, -50%) scale(.78); }
  #cursor.is-down .cursor-dot i { transform: scale(.72); }

  /* text selection: the square comes alive */
  #cursor.is-selecting .corner {
    width: 22px;
    height: 22px;
    border-color: #fff3cf;
    animation: select-hue 2.6s linear infinite;
  }

  #cursor.is-selecting .tl { border-top-width: 2.5px; border-left-width: 2.5px; }
  #cursor.is-selecting .tr { border-top-width: 2.5px; border-right-width: 2.5px; }
  #cursor.is-selecting .bl { border-bottom-width: 2.5px; border-left-width: 2.5px; }
  #cursor.is-selecting .br { border-bottom-width: 2.5px; border-right-width: 2.5px; }

  #cursor.is-selecting:not(.is-box) .frame-box { transform: translate(-50%, -50%) scale(1.08); }

  @keyframes select-hue {
    from { filter: hue-rotate(0deg) drop-shadow(0 0 6px rgba(255, 245, 210, .5)); }
    to   { filter: hue-rotate(360deg) drop-shadow(0 0 6px rgba(255, 245, 210, .5)); }
  }

  /* copy success: green frame + corner pulse */
  .cursor-ping {
    position: absolute;
    left: -34px;
    top: -34px;
    width: 68px;
    height: 68px;
    border: 1.5px solid transparent;
    border-radius: 16px;
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
  }

  #cursor.is-copied .corner {
    border-color: #2ee6a0;
    filter: drop-shadow(0 0 6px rgba(46, 230, 160, .9));
    animation: copy-corner .85s cubic-bezier(.2, .8, .2, 1);
  }

  #cursor.is-copied .cursor-dot i {
    background: #2ee6a0;
    box-shadow:
      0 0 10px rgba(46, 230, 160, .95),
      0 0 30px rgba(46, 230, 160, .5);
    animation: copy-dot .85s cubic-bezier(.2, .8, .2, 1);
  }

  #cursor.is-copied .cursor-ping {
    animation: copy-ping .9s cubic-bezier(.15, .7, .3, 1);
  }

  @keyframes copy-corner {
    0% { transform: scale(1); }
    28% { transform: scale(1.32); }
    58% { transform: scale(.94); }
    100% { transform: scale(1); }
  }

  @keyframes copy-dot {
    0% { transform: scale(1); }
    35% { transform: scale(1.9); }
    100% { transform: scale(1); }
  }

  @keyframes copy-ping {
    0% { opacity: .85; transform: scale(.55); border-color: rgba(46, 230, 160, .9); }
    70% { opacity: .25; }
    100% { opacity: 0; transform: scale(1.9); border-color: rgba(46, 230, 160, 0); }
  }

  /* ---------- liquid glass top bar ---------- */
  .topbar {
    position: relative;
    z-index: 2;
    padding: clamp(.7rem, 1.6vw, 1.15rem) clamp(1rem, 3.2vw, 2.4rem);
    animation: fade-down .9s .1s cubic-bezier(.2, .8, .2, 1) both;
  }

  .bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .45rem .5rem .45rem .55rem;
    border-radius: 21px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, .05) 48%, rgba(255, 255, 255, .025)),
      rgba(17, 15, 21, .12);
    -webkit-backdrop-filter: blur(24px) saturate(200%) brightness(1.04);
    backdrop-filter: blur(24px) saturate(200%) brightness(1.04);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .28),
      inset 0 -1px 0 rgba(0, 0, 0, .35),
      inset 0 -10px 24px -18px rgba(0, 0, 0, .55),
      0 20px 45px -24px rgba(0, 0, 0, .9);
    isolation: isolate;
  }

  /* crisp specular rim */
  .bar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
      135deg,
      rgba(255, 255, 255, .55),
      rgba(255, 255, 255, .10) 26%,
      rgba(255, 255, 255, .035) 58%,
      rgba(255, 255, 255, .30)
    );
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    pointer-events: none;
  }

  /* slow-moving liquid sheen inside the glass */
  .bar::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background:
      radial-gradient(38% 120% at 28% 10%, rgba(255, 255, 255, .20), transparent 62%),
      radial-gradient(34% 110% at 74% 0%, rgba(190, 215, 255, .12), transparent 65%);
    mix-blend-mode: screen;
    opacity: .8;
    pointer-events: none;
    will-change: transform, opacity;
    animation: glass-drift 11s ease-in-out infinite alternate;
  }

  .brand,
  .nav { position: relative; z-index: 1; }

  @keyframes glass-drift {
    from { transform: translate3d(-2%, 0, 0); opacity: .65; }
    to   { transform: translate3d(2%, 1%, 0); opacity: 1; }
  }

  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .bar { background: rgba(17, 15, 21, .82); }
  }

  .brand {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    text-decoration: none;
  }

  .brand img {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    object-fit: cover;
    box-shadow: 0 0 0 1px var(--line), 0 8px 24px -12px rgba(242, 200, 121, .6);
    transition: transform .4s cubic-bezier(.2, .8, .2, 1), box-shadow .4s ease;
  }

  .brand:hover img {
    transform: scale(1.03);
    box-shadow: 0 0 0 1px rgba(242, 200, 121, .5), 0 12px 30px -12px rgba(242, 200, 121, .8);
  }

  .brand-name {
    font-size: .95rem;
    font-weight: 500;
    letter-spacing: .02em;
    background: linear-gradient(180deg, #fff8e4, #f2c879 65%, #c99b45);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .nav {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
  }

  .nav-btn {
    --accent: var(--gold);
    appearance: none;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .025);
    color: #cbc6bb;
    font: inherit;
    font-size: .82rem;
    font-weight: 500;
    letter-spacing: .06em;
    padding: .55rem 1.05rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
    transition:
      color .25s ease,
      border-color .25s ease,
      background-color .25s ease,
      box-shadow .25s ease,
      transform .25s cubic-bezier(.2, .8, .2, 1);
  }

  .nav-btn::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    opacity: .8;
    transition: opacity .25s ease, box-shadow .25s ease;
  }

  .nav-btn:hover::before,
  .nav-btn:focus-visible::before {
    opacity: 1;
    box-shadow: 0 0 9px var(--accent);
  }

  .nav-btn:hover,
  .nav-btn:focus-visible {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    background: color-mix(in srgb, var(--accent) 9%, transparent);
    box-shadow: 0 0 22px -6px color-mix(in srgb, var(--accent) 55%, transparent);
    outline: none;
  }

  .nav-btn:focus-visible {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  }

  .nav-btn.docs { --accent: var(--gold); }
  .nav-btn.stats { --accent: var(--teal); }

  .nav-btn.is-active {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 42%, transparent);
    background: color-mix(in srgb, var(--accent) 9%, transparent);
    box-shadow: 0 0 24px -8px color-mix(in srgb, var(--accent) 60%, transparent);
  }

  .nav-btn.is-active::before {
    opacity: 1;
    box-shadow: 0 0 9px var(--accent);
  }

  /* ---------- stage ---------- */
  .stage {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(1.1rem, 2.4vw, 1.8rem);
    padding: 2rem clamp(1.25rem, 5vw, 3rem) clamp(2.5rem, 7vh, 5rem);
    text-align: center;
  }

  /* centered crest */
  .crest {
    position: relative;
    width: clamp(170px, min(22vw, 26vh), 232px);
    aspect-ratio: 1;
    margin-bottom: -.9rem;
    isolation: isolate;
    animation: crest-in 1.1s .05s cubic-bezier(.2, .8, .2, 1) both;
  }

  .crest::before {
    content: "";
    position: absolute;
    inset: -22%;
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(242, 200, 121, .10), transparent 62%);
    filter: blur(14px);
    animation: halo 8s ease-in-out infinite;
    will-change: opacity;
  }

  .crest img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    will-change: transform;
    animation: float 8s ease-in-out infinite;
  }

  .tagline {
    margin: 0;
    font-size: .66rem;
    font-weight: 500;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--muted);
    animation: fade-up .9s .25s cubic-bezier(.2, .8, .2, 1) both;
  }

  .tagline b {
    font-weight: 500;
    color: color-mix(in srgb, var(--gold) 80%, white);
  }

  .tagline .sep {
    display: inline-block;
    margin: 0 .5em;
    color: rgba(255, 255, 255, .22);
  }

  /* links */
  .links {
    list-style: none;
    width: min(560px, 100%);
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
    animation: fade-up .9s .35s cubic-bezier(.2, .8, .2, 1) both;
  }

  .links li { border-bottom: 1px solid var(--line); }

  .link {
    --accent: var(--gold);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1.05rem .4rem;
    text-decoration: none;
    color: #dcd7cc;
    transition:
      color .3s ease,
      background-color .3s ease;
  }

  .link:hover,
  .link:focus-visible {
    color: #fff;
    background:
      linear-gradient(90deg,
        color-mix(in srgb, var(--accent) 13%, transparent),
        color-mix(in srgb, var(--accent) 3%, transparent) 55%,
        transparent 92%);
    outline: none;
  }

  .link:focus-visible {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
  }

  .link-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 11%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
    transition:
      transform .35s cubic-bezier(.2, .8, .2, 1),
      background-color .3s ease,
      box-shadow .3s ease,
      border-color .3s ease;
  }

  .link-icon svg { width: 20px; height: 20px; display: block; }
  .link-icon img { width: 20px; height: 20px; object-fit: contain; display: block; }

  .link:hover .link-icon,
  .link:focus-visible .link-icon {
    transform: scale(1.05);
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    box-shadow: 0 0 20px -4px color-mix(in srgb, var(--accent) 60%, transparent);
  }

  .link-name {
    font-size: clamp(1.15rem, 2.4vw, 1.4rem);
    font-weight: 400;
    letter-spacing: -.01em;
    text-align: left;
  }

  .link-arrow {
    color: transparent;
    transform: translateX(-8px);
    transition: color .3s ease, transform .35s cubic-bezier(.2, .8, .2, 1);
  }

  .link:hover .link-arrow,
  .link:focus-visible .link-arrow {
    color: var(--accent);
    transform: translateX(0);
  }

  .link-arrow svg { width: 16px; height: 16px; display: block; }

  /* ---------- footer ---------- */
  .page-foot {
    position: relative;
    z-index: 1;
    padding: 0 clamp(1.25rem, 4vw, 3rem) clamp(1.25rem, 3vw, 2rem);
    text-align: center;
    font-size: .72rem;
    letter-spacing: .08em;
    color: #63605a;
    animation: fade-up .9s .55s cubic-bezier(.2, .8, .2, 1) both;
  }

  .page-foot span { color: #8b867c; }

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

  @keyframes fade-down {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: none; }
  }

  @keyframes crest-in {
    from { opacity: 0; transform: scale(.9); }
    to { opacity: 1; transform: none; }
  }

  @keyframes float {
    0%, 100% { transform: translateY(-3px); }
    50% { transform: translateY(3px); }
  }

  @keyframes halo {
    0%, 100% { opacity: .7; }
    50% { opacity: 1; }
  }

  /* ---------- responsive ---------- */
  @media (max-width: 560px) {
    .topbar { padding: .55rem .7rem; }
    .bar {
      flex-wrap: wrap;
      justify-content: center;
      row-gap: .45rem;
      padding: .4rem .45rem;
      border-radius: 18px;
    }
    .nav { justify-content: center; }
    .nav-btn { padding: .5rem .85rem; font-size: .8rem; }
    .brand-name { font-size: .9rem; }
    .tagline { font-size: .58rem; letter-spacing: .18em; }
    .link { gap: .8rem; padding: .95rem .3rem; }
    .stage { gap: 1rem; }
  }

  @media (max-height: 700px) {
    .crest { width: clamp(132px, 20vh, 170px); }
    .stage { gap: .85rem; padding-top: 1rem; padding-bottom: 1.6rem; }
  }

  /* touch devices: native cursor, no custom ring */
  @media (hover: none), (pointer: coarse) {
    #cursor { display: none; }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: .001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .001ms !important;
    }
  }