:root {
  --myid-card-border: 1px solid var(--color-line);
  --myid-panel-radius: calc(var(--radius) + 4px);
}

#hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.78fr);
  gap: 42px;
  align-items: center;
  min-height: calc(100vh - 110px);
  padding: 82px 0 64px;

  & > .hero-overview {
    max-width: 780px;

    & > .hero-kicker {
      font-size: 1.28rem;
      font-weight: 800;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--color-text-high);
    }

    & > .hero-title {
      max-width: 11ch;
      margin-top: 12px;
      font-size: clamp(4rem, 6vw, 7.8rem);
      font-weight: 800;
      line-height: 1.28;
      letter-spacing: 0;
      color: var(--color-text-max);
    }

    & > .hero-desc {
      max-width: 620px;
      margin-top: 26px;
      font-size: 1.18rem;
      line-height: 1.82;
      color: var(--color-text-high);
    }

    & > .hero-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      margin-top: 32px;
    }
  }

  & > .cube-view {
    overflow: hidden;
    border: 1px solid var(--color-line);
    border-radius: calc(var(--radius) + 8px);
    color: rgb(247, 247, 247);
    background:
      linear-gradient(145deg, rgb(7, 7, 7) 0%, rgb(3, 3, 3) 100%), rgb(5, 5, 5);
    box-shadow:
      var(--shadow),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);

    & > .cube-frame {
      position: relative;
      display: grid;
      place-items: center;
      min-height: 560px;
      overflow: hidden;
      perspective: 980px;

      &::after {
        content: "";
        position: absolute;
        bottom: 54px;
        left: 50%;
        width: 390px;
        height: 96px;
        border-radius: 50%;
        background: radial-gradient(
          ellipse at center,
          rgba(255, 255, 255, 0.24) 0%,
          rgba(255, 255, 255, 0.13) 28%,
          rgba(255, 255, 255, 0.045) 54%,
          rgba(255, 255, 255, 0) 76%
        );
        filter: blur(24px);
        transform: translateX(-50%) rotateX(68deg);
        pointer-events: none;
      }

      &::before {
        content: "";
        position: absolute;
        top: -8%;
        left: 50%;
        width: min(230px, 52%);
        height: 99%;
        border-radius: 50% 50% 46% 46%;
        background:
          radial-gradient(
            ellipse at 50% 0%,
            rgba(255, 255, 255, 0.25) 0%,
            rgba(255, 255, 255, 0.115) 30%,
            rgba(255, 255, 255, 0.04) 58%,
            rgba(255, 255, 255, 0) 82%
          ),
          linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.105) 0%,
            rgba(255, 255, 255, 0.062) 42%,
            rgba(255, 255, 255, 0) 100%
          );
        opacity: 0.8;
        filter: blur(16px);
        transform: translateX(-50%);
        pointer-events: none;
      }

      & > .cube-grid-bg {
        position: absolute;
        inset: 0;
        background:
          linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.018) 1px,
            transparent 1px
          ),
          linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.018) 1px,
            transparent 1px
          ),
          radial-gradient(
            circle at 50% 50%,
            rgba(255, 255, 255, 0.035),
            transparent 21rem
          );
        background-size: 38px 38px;
        -webkit-mask-image: radial-gradient(
          circle at center,
          black 0%,
          transparent 72%
        );
        mask-image: radial-gradient(
          circle at center,
          black 0%,
          transparent 72%
        );
      }

      & > .cube-ring {
        position: absolute;
        width: 400px;
        height: 400px;
        border: 1px solid rgba(255, 255, 255, 0.025);
        border-radius: 50%;

        &.ring-a {
          transform: rotateX(68deg) rotateZ(24deg);
        }

        &.ring-b {
          width: 500px;
          height: 500px;
          opacity: 0.22;
          transform: rotateX(64deg) rotateZ(-34deg);
        }
      }

      & > .magic-cube-stage {
        position: relative;
        z-index: 1;
        width: 430px;
        height: 430px;
        filter: drop-shadow(0 34px 34px rgba(0, 0, 0, 0.46));
        transform-style: preserve-3d;

        & > .magic-cube {
          position: absolute;
          inset: 0;
          transform-origin: 50% 50%;
          transform-style: preserve-3d;
          will-change: transform;
          touch-action: none;
          cursor: grab;
          user-select: none;

          & > canvas {
            display: block;
            width: 100%;
            height: 100%;
            touch-action: none;
            cursor: grab;
            user-select: none;
          }

          &.is-dragging,
          &.is-dragging > canvas {
            cursor: grabbing;
          }
        }
      }
    }
  }

  @media (width < 800px) {
    grid-template-columns: 1fr;
    gap: 28px;
    min-height: auto;
    padding: 58px 0 42px;

    & > .hero-overview {
      & > .hero-desc {
        font-size: 1rem;
      }

      & > .hero-title {
        max-width: 9ch;
        font-size: 3.45rem;
      }
    }

    & > .cube-view > .cube-frame {
      min-height: 430px;

      & > .cube-ring {
        width: 300px;
        height: 300px;

        &.ring-b {
          width: 380px;
          height: 380px;
        }
      }

      & > .magic-cube-stage {
        width: min(350px, 94vw);
        height: min(350px, 94vw);
      }
    }
  }
}

#snapshot {
  & > .snapshot-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 16px;

    & > .snapshot-metric {
      position: relative;
      display: flex;
      flex-direction: column;
      min-height: 192px;
      overflow: hidden;
      padding: 26px;
      border: 1px solid var(--color-line);
      border-radius: 24px;
      background: var(--color-card-prime);
      transition:
        opacity 0.72s cubic-bezier(0.22, 1, 0.36, 1),
        border-color var(--motion-fast),
        background var(--motion-fast),
        box-shadow var(--motion-fast);

      & > .snapshot-card-top {
        display: block;

        & > .snapshot-label {
          display: block;
          min-width: 0;
          overflow-wrap: anywhere;
          font-size: 0.9rem;
          font-weight: 800;
          line-height: 1.35;
          letter-spacing: 0;
          text-transform: uppercase;
          color: var(--color-text-high);
        }
      }

      & > strong {
        display: block;
        overflow-wrap: anywhere;
        margin-top: 26px;
        font-size: clamp(1.5rem, 2.2vw, 1.92rem);
        font-weight: 600;
        line-height: 1.3;
        color: var(--color-text-max);
      }

      & > p {
        margin-top: 14px;
        font-size: 0.95rem;
        line-height: 1.7;
        color: var(--color-text-high);
      }

      &::after,
      &::before {
        content: "";
        position: absolute;
        right: 18px;
        left: 18px;
        height: 1px;
        opacity: 0.62;
        pointer-events: none;
      }

      &::after {
        bottom: 0;
        opacity: 0.42;
      }

      &::before {
        top: 0;
      }
    }

    @media (width < 800px) {
      grid-template-columns: 1fr;
      margin-top: 16px;

      & > .snapshot-metric {
        min-height: 174px;
        padding: 22px;

        & > strong {
          margin-top: 22px;
          font-size: 1.48rem;
        }
      }
    }
  }
}

#title {
  & > .title {
    margin-top: 12px;
    font-size: clamp(2.4rem, 5vw, 4.4rem);
    font-weight: 800;
    line-height: 1.06;
    letter-spacing: 0;
    color: var(--color-text-max);
  }
}

#portals {
  & > section {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    padding: 0;
    border: var(--myid-card-border);
    border-radius: var(--myid-panel-radius);
    background: var(--color-card-prime);

    & > .portal-card {
      display: flex;
      flex-direction: column;
      min-height: 310px;
      padding: 24px;
      border-right: var(--myid-card-border);
      transition:
        opacity 0.72s cubic-bezier(0.22, 1, 0.36, 1),
        background 0.18s ease,
        transform 0.18s ease;

      & > .portal-index {
        font-size: 1.2rem;
        font-weight: 800;
        color: var(--color-text-high);
      }

      & > h3 {
        margin-top: 54px;
        font-size: 1.45rem;
        font-weight: 600;
        color: var(--color-text-max);
      }

      & > p {
        margin-top: 13px;
        font-size: 1rem;
        line-height: 1.78;
        color: var(--color-text-high);
      }

      & > span {
        display: inline-flex;
        gap: 7px;
        align-items: center;
        margin-top: auto;
        font-size: 0.96rem;
        font-weight: 800;
        color: var(--color-text-max);

        &::after {
          transition: transform 0.18s ease;
        }
      }

      &:hover {
        background: var(--color-card-mid);

        & > span::after {
          transform: translateX(3px);
        }
      }

      &:last-child {
        border-right: 0;
      }
    }

    @media (width < 800px) {
      grid-template-columns: 1fr;

      & > .portal-card {
        min-height: 0;
        padding: 20px 22px 22px;
        border-right: 0;
        border-bottom: var(--myid-card-border);

        & > h3 {
          margin-top: 22px;
          line-height: 1.2;
        }

        & > p {
          margin-top: 10px;
          line-height: 1.68;
        }

        & > span {
          margin-top: 18px;
        }

        &:last-child {
          border-bottom: 0;
        }
      }
    }
  }
}

#contact {
  & > .contact-section {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
    overflow: hidden;
    margin-top: 54px;
    padding: 0;
    border: 1px solid var(--color-line);
    border-radius: var(--myid-panel-radius);
    color: var(--color-text-max);
    background: var(--color-card-prime);

    & > .contact-copy {
      padding: 36px;
      border-right: 1px solid var(--color-line);

      & > .kicker {
        font-size: 1.28rem;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--color-text-high);
      }

      & > h2 {
        margin-top: 16px;
        font-size: clamp(2rem, 4vw, 3.6rem);
        font-weight: 800;
        line-height: 1.08;
      }

      & > p:not(.kicker) {
        margin-top: 16px;
        font-size: 1.06rem;
        line-height: 1.82;
        color: var(--color-text-high);
      }
    }

    & > .contact-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));

      & > .contact-link {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: 178px;
        padding: 32px;
        border-right: 1px solid var(--color-line);
        border-bottom: 1px solid var(--color-line);
        transition: background 0.18s ease;

        & > span {
          font-size: 1.08rem;
          font-weight: 800;
          color: var(--color-text-high);
        }

        & > strong {
          font-size: 1.16rem;
          font-weight: 600;
          line-height: 1.52;
          color: var(--color-text-max);
        }

        &:hover {
          background: var(--color-card-mid);
        }

        &:nth-child(2n) {
          border-right: 0;
        }

        &:nth-last-child(-n + 2) {
          border-bottom: 0;
        }
      }
    }

    @media (width < 800px) {
      grid-template-columns: 1fr;
      margin-top: 54px;

      & > .contact-copy {
        padding: 24px;
        border-right: 0;
        border-bottom: 1px solid var(--color-line);
      }

      & > .contact-grid {
        grid-template-columns: 1fr;

        & > .contact-link {
          padding: 24px;
          border-right: 0;
          border-bottom: var(--myid-card-border);

          &:last-child {
            border-bottom: 0;
          }

          &:nth-last-child(-n + 2) {
            border-bottom: var(--myid-card-border);
          }
        }
      }
    }
  }
}
