@font-face {
  font-family: "berkeley";
  src: url("../font/berkeley.woff2") format("woff2");
  font-display: swap;
}

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

:root {
  --accent: #00FF88;
  --bg: #0a0a0a;
  --surface: #111;
  --surface-2: #1a1a1a;
  --border: #222;
  --text: #e0e0e0;
  --text-dim: #666;
}

html { scroll-behavior: smooth; }

body {
  font-family: "berkeley", monospace;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#mesh {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

body > a {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10;

  & svg { mix-blend-mode: normal; }

  &:hover .octo-arm {
    animation: octocat-wave 560ms ease-in-out;
  }
}

@keyframes octocat-wave {
  0%, 100% { transform: rotate(0); }
  20%, 60% { transform: rotate(-25deg); }
  40%, 80% { transform: rotate(10deg); }
}

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 880px;
  height: 100dvh;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

main > div {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 85px;
  margin-bottom: 1.25rem;
  flex-shrink: 0;

  & > img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    cursor: pointer;
    filter: drop-shadow(0 0 50px rgba(0, 255, 136, 0.5));
    animation: logo-float 8s ease-in-out infinite;
  }

  &.exploding [data-i] { animation: none !important; }

  &.exploding > img {
    animation: logo-burst 1s ease-out, logo-glow 1s ease-out !important;
  }
}

[data-i] {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  text-decoration: none;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s;

  & svg { width: 17px; height: 17px; }

  &:hover {
    transform: scale(1.2) !important;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    background: var(--surface-2);
    z-index: 2;
  }

  & span {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    translate: -50% 6px;
    width: max-content;
    max-width: 180px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.6rem;
    line-height: 1.4;
    color: var(--text-dim);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    scale: 0.95;
    transition: opacity 0.2s, translate 0.2s, scale 0.2s;
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5);

    & strong {
      display: block;
      font-size: 0.65rem;
      font-weight: 600;
      color: var(--accent);
      margin-bottom: 2px;
    }
  }

  &:hover span {
    opacity: 1;
    translate: -50% 0;
    scale: 1;
  }
}

[data-i="0"] { translate: -105px -80px;  animation: drift0 5s ease-in-out infinite; }
[data-i="1"] { translate: 15px -110px;   animation: drift1 5.5s ease-in-out infinite; }
[data-i="2"] { translate: 110px -40px;   animation: drift2 4.8s ease-in-out infinite; }
[data-i="3"] { translate: 95px 75px;     animation: drift3 5.2s ease-in-out infinite; }
[data-i="4"] { translate: -20px 105px;   animation: drift4 4.5s ease-in-out infinite; }
[data-i="5"] { translate: -110px 30px;   animation: drift5 5.8s ease-in-out infinite; }

@keyframes drift0 { 0%,100% { translate: -105px -80px; rotate: 0deg; } 50% { translate: -110px -88px; rotate: -4deg; } }
@keyframes drift1 { 0%,100% { translate: 15px -110px; rotate: 0deg; } 50% { translate: 20px -118px; rotate: 3deg; } }
@keyframes drift2 { 0%,100% { translate: 110px -40px; rotate: 0deg; } 50% { translate: 118px -45px; rotate: -3deg; } }
@keyframes drift3 { 0%,100% { translate: 95px 75px; rotate: 0deg; } 50% { translate: 102px 82px; rotate: 4deg; } }
@keyframes drift4 { 0%,100% { translate: -20px 105px; rotate: 0deg; } 50% { translate: -25px 113px; rotate: -3deg; } }
@keyframes drift5 { 0%,100% { translate: -110px 30px; rotate: 0deg; } 50% { translate: -117px 25px; rotate: 3deg; } }

@keyframes logo-float {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  50% { translate: 0 -6px; rotate: -0.8deg; }
}

@keyframes logo-burst {
  0% { scale: 1; }
  15% { scale: 0.8; }
  35% { scale: 1.2; }
  60% { scale: 0.95; }
  100% { scale: 1; }
}

@keyframes logo-glow {
  0% { filter: drop-shadow(0 0 50px rgba(0, 255, 136, 0.5)); }
  25% { filter: drop-shadow(0 0 120px rgba(0, 255, 136, 1)) brightness(1.6); }
  50% { filter: drop-shadow(0 0 80px rgba(0, 255, 136, 0.7)) brightness(1.2); }
  100% { filter: drop-shadow(0 0 50px rgba(0, 255, 136, 0.5)); }
}

main > section {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 255, 136, 0.04),
    0 20px 60px -10px rgba(0, 0, 0, 0.5),
    0 0 100px -20px rgba(0, 255, 136, 0.08);
  margin-bottom: 1rem;

  & article header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);

    & > span:nth-child(-n+3) {
      width: 10px;
      height: 10px;
      border-radius: 50%;
    }

    & > span:first-child { background: #ff5f57; }
    & > span:nth-child(2) { background: #febc2e; }
    & > span:nth-child(3) { background: #28c840; }

    & > div {
      display: flex;
      gap: 4px;
      margin-left: 12px;
    }

    & svg {
      width: 11px;
      height: 11px;
      color: var(--text-dim);
      margin-left: auto;
    }

    & > span:last-child {
      font-size: 0.65rem;
      color: var(--text-dim);
    }
  }

  & [data-tab] {
    background: none;
    border: none;
    cursor: pointer;
    font-family: "berkeley", monospace;
    font-size: 0.65rem;
    padding: 3px 10px;
    border-radius: 999px;
    color: var(--text-dim);
    transition: color 0.2s, background 0.2s;

    &.active {
      color: var(--accent);
      background: rgba(0, 255, 136, 0.08);
    }

    &:not(.active):hover { color: var(--text); }
  }

  & pre {
    display: flex;
    align-items: center;
    padding: 0 16px;
    min-height: 42px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;

    &:hover { background: rgba(0, 255, 136, 0.02); }

    &::before {
      content: "\276F";
      color: var(--accent);
      margin-right: 12px;
      font-size: 0.8rem;
      flex-shrink: 0;
    }

    & button {
      background: none;
      border: none;
      cursor: pointer;
      padding: 6px;
      border-radius: 6px;
      color: var(--text-dim);
      transition: color 0.2s, background 0.2s;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;

      &:hover {
        color: var(--accent);
        background: rgba(0, 255, 136, 0.08);
      }

      & svg { width: 13px; height: 13px; }
    }
  }

  & code {
    font-family: "berkeley", monospace;
    font-size: 0.8rem;
    color: var(--text);
    flex: 1;
    white-space: nowrap;
    overflow-x: auto;
    transition: opacity 0.2s;
  }

  & ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, 1fr);

    & li {
      padding: 0.9rem 1rem;
      display: flex;
      align-items: flex-start;
      gap: 0.6rem;
      border-right: 1px solid var(--border);
      transition: background 0.3s;

      &:last-child { border-right: none; }
      &:hover { background: var(--surface-2); }

      & > svg {
        width: 16px;
        height: 16px;
        color: var(--accent);
        flex-shrink: 0;
        margin-top: 1px;
      }
    }

    & h3 {
      font-size: 0.72rem;
      font-weight: 600;
      color: var(--accent);
      margin-bottom: 0.15rem;
    }

    & p {
      font-size: 0.65rem;
      line-height: 1.4;
      color: var(--text-dim);

      & a {
        color: var(--text-dim);
        transition: opacity 0.2s;

        &:hover { opacity: 0.7; }
      }
    }
  }
}

main > footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);

  & aside {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;

    & svg {
      width: 13px;
      height: 13px;
      color: #ffc832;
      flex-shrink: 0;
    }

    & p {
      font-size: 0.65rem;
      line-height: 1.4;
      color: #777;
    }
  }

  & > p {
    font-size: 0.65rem;
    color: var(--text-dim);
    flex-shrink: 0;

    & a {
      color: var(--accent);
      text-decoration: none;
      transition: opacity 0.2s;

      &:hover { opacity: 0.7; }
    }
  }
}

@media (max-width: 700px) {
  body { min-height: 100dvh; overflow: auto; }
  main { min-height: 100dvh; padding: 2rem 1rem 1.5rem; gap: 1.5rem; }

  main > div { padding: 60px; }
  main > div > img { width: 80px; height: 80px; }

  [data-i="0"] { translate: -75px -55px; }
  [data-i="1"] { translate: 10px -80px; }
  [data-i="2"] { translate: 80px -25px; }
  [data-i="3"] { translate: 65px 55px; }
  [data-i="4"] { translate: -15px 75px; }
  [data-i="5"] { translate: -80px 20px; }

  @keyframes drift0 { 0%,100% { translate: -75px -55px; } 50% { translate: -80px -60px; } }
  @keyframes drift1 { 0%,100% { translate: 10px -80px; } 50% { translate: 15px -85px; } }
  @keyframes drift2 { 0%,100% { translate: 80px -25px; } 50% { translate: 85px -30px; } }
  @keyframes drift3 { 0%,100% { translate: 65px 55px; } 50% { translate: 70px 60px; } }
  @keyframes drift4 { 0%,100% { translate: -15px 75px; } 50% { translate: -20px 80px; } }
  @keyframes drift5 { 0%,100% { translate: -80px 20px; } 50% { translate: -85px 15px; } }

  main > section ul { grid-template-columns: repeat(2, 1fr); }
  main > section ul li:nth-child(2) { border-right: none; }
  main > section ul li:nth-child(-n+2) { border-bottom: 1px solid var(--border); }

  main > footer { flex-direction: column; text-align: center; gap: 0.5rem; }
  main > footer aside { justify-content: center; }

  body > a svg { width: 60px; height: 60px; }
}
